Create a fake item to send to PayPal for shipping, so it can be covered by shop credit. Fixes bug #12158.

This commit is contained in:
Colin Kuskie 2011-06-13 11:03:29 -07:00
parent 9dd8658ceb
commit 328826e3f7
2 changed files with 14 additions and 6 deletions

View file

@ -11,6 +11,7 @@
- fixed #12152: PayPal Standard ignores shop-credit
- fixed #12119: Locale setting for paypal
- fixed #12156: Asset Manager performance
- fixed #12158: Shop credit cannot be used to pay for Shipping on PayPal
7.10.17
- fixed: Forced to use a PayDriver even with a balance of 0 in the cart.

View file

@ -265,7 +265,7 @@ sub paymentVariables {
cancel_return => $cancel->as_string,
lc => $i18n->getLanguage->{locale},
handling_cart => $cart->calculateShipping, ##According to https://www.x.com/message/180018#180018
#handling_cart => $cart->calculateShipping, ##According to https://www.x.com/message/180018#180018
tax_cart => $cart->calculateTaxes,
discount_amount_cart => abs($cart->calculateShopCreditDeduction),
@ -276,11 +276,18 @@ sub paymentVariables {
my $counter = 0;
foreach my $item (@{ $cart->getItems}) {
my $n = ++$counter;
$params{"amount_$n"} = $item->getSku->getPrice;
$params{"quantity_$n"} = $item->get('quantity');
$params{"item_name_$n"} = $item->get('configuredTitle');
$params{"item_number_$n"} = $item->get('itemId');
++$counter;
$params{"amount_$counter"} = $item->getSku->getPrice;
$params{"quantity_$counter"} = $item->get('quantity');
$params{"item_name_$counter"} = $item->get('configuredTitle');
$params{"item_number_$counter"} = $item->get('itemId');
}
if ($cart->requiresShipping) {
++$counter;
$params{"amount_$counter"} = $cart->calculateShipping;
$params{"quantity_$counter"} = 1;
$params{"item_name_$counter"} = $i18n->get('shipping', 'Shop');
$params{"item_number_$counter"} = 'Shipping';
}
return \%params;