- Posts: 82
- Thank you received: 5
Adaptations Paypal Checkout REST API plugin
3 years 4 months ago - 3 years 4 months ago #352782
by tgdkere2
Adaptations Paypal Checkout REST API plugin was created by tgdkere2
-- 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
-- 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: 3 years 4 months ago by tgdkere2.
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
3 years 4 months ago #352786
by nicolas
Replied by nicolas on topic Adaptations Paypal Checkout REST API plugin
Hi,
Thank you for your feedback. We'll add these changes for the next version of HikaShop.
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.052 seconds