Skip to content

Commit

Permalink
bug #10938 [Payum][Paypal] Use full price instead of discounted one (…
Browse files Browse the repository at this point in the history
…Prometee)

This PR was merged into the 1.5 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.4 to master
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | unknown
| License         | MIT

I was having trouble with many PayPal errors during the black friday and the error was :
`"The totals of the cart item amounts do not match order amounts."`

The bug was caused by the fact that PayPal make a validation of the total price with the sum of each item lines we build. This bug appear because all discounted prices are regrouped into an item line named "Discount" so all other lines shouldn't be filled with something related with discounts.

Commits
-------

f118b0a Use full price instead of discounted one
  • Loading branch information
lchrusciel authored Jan 13, 2020
2 parents 3a0d62a + f118b0a commit f36502c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function execute($request): void
$m = 0;
foreach ($order->getItems() as $item) {
$details['L_PAYMENTREQUEST_0_NAME' . $m] = $item->getVariant()->getProduct()->getName();
$details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($item->getDiscountedUnitPrice());
$details['L_PAYMENTREQUEST_0_AMT' . $m] = $this->formatPrice($item->getUnitPrice());
$details['L_PAYMENTREQUEST_0_QTY' . $m] = $item->getQuantity();

++$m;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function it_executes_request(
$order->getShippingTotal()->willReturn(8000);

$orderItem->getVariant()->willReturn($productVariant);
$orderItem->getDiscountedUnitPrice()->willReturn(80000);
$orderItem->getUnitPrice()->willReturn(80000);
$orderItem->getQuantity()->willReturn(1);

$productVariant->getProduct()->willReturn($product);
Expand Down

0 comments on commit f36502c

Please sign in to comment.