omnipay-braintree icon indicating copy to clipboard operation
omnipay-braintree copied to clipboard

`$item->getPrice()` being used as a total amount when it is a unit amount

Open mambose opened this issue 3 years ago • 2 comments

$item->getPrice() returns the item's unit price and not the line item's total amount. This is creating inaccurate line item data when viewing transactions in Braintree.

https://github.com/thephpleague/omnipay-braintree/blob/fef291e3018515bdd6dcc447d6de5e24dda990e1/src/Message/AbstractRequest.php#L455-L456

The code should look something like this:

'totalAmount' => abs(round($item->getQuantity() * $item->getPrice(), $this->getCurrencyDecimalPlaces())),
'unitAmount' => abs(round($item->getPrice(), $this->getCurrencyDecimalPlaces())),

mambose avatar Nov 24 '21 05:11 mambose

@barryvdh, any chance we can get this fix rolled out (see pull request)?

It's a fairly critical fix for the line item code.

timeverts avatar Dec 08 '21 06:12 timeverts

@barryvdh, any movement on this bug fix?

timeverts avatar Feb 16 '22 13:02 timeverts