Adaptations Paypal Checkout REST API plugin

  • Posts: 77
  • Thank you received: 4
  • Hikashop Business
9 months 4 weeks ago #352782

-- HikaShop version -- : 4.7.4
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4.2

Hi,

Often, the customer does not provide a shipping address. However, the Country for the shipping address is always set, even if the customer does not specify a shipping address. This leads to problems with paypal, because they get the country code and expect also a ZIP code and CITY then. Otherwise the payment fails.

Can you please adapt the paypal plugin to check all fields for the shipping address and add an else part with "NO_SHIPPING" ?.

in paypalcheckout.php:

Instead of:
             if(!empty($order->cart->shipping_address)) {

please change to:
             if(!empty($order->cart->shipping_address->address_firstname) && !empty($order->cart->shipping_address->address_lastname) && !empty($order->cart->shipping_address->address_street) && !empty($order->cart->shipping_address->address_city) && !empty($order->cart->shipping_address->address_post_code) && !empty($order->cart->shipping_address->address_country->zone_code_2)) {

If no shipping address is specified, it would also make sense to add the NO_SHIPPING parameter in the application_context.
Like this (if is same as above and then add else part):

if(!empty($order->cart->shipping_address->address_firstname) && !empty($order->cart->shipping_address->address_lastname) && !empty($order->cart->shipping_address->address_street) && !empty($order->cart->shipping_address->address_city) && !empty($order->cart->shipping_address->address_post_code) && !empty($order->cart->shipping_address->address_country->zone_code_2)) {
....
....
....
...
...

else {
   $orderData->application_context->shipping_preference = 'NO_SHIPPING';
}


Thank you and best regards

Last edit: 9 months 4 weeks ago by tgdkere2.
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
9 months 4 weeks ago #352786

Hi,

Thank you for your feedback. We'll add these changes for the next version of HikaShop.

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum