Nov
24
1 week ago
pull request

mambose pull request thephpleague/omnipay-braintree

mambose
mambose

Fix bug where `$item->getPrice()` was being used as the total amount …

…rather than the unit amount

see https://github.com/thephpleague/omnipay-braintree/issues/69

Activity icon
issue

mambose issue thephpleague/omnipay-braintree

mambose
mambose

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

$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())),
Activity icon
fork

mambose forked thephpleague/omnipay-braintree

⚡ Braintree Driver for Omnipay Gateway
mambose MIT License Updated
fork time in 1 week ago
Sep
22
2 months ago
Activity icon
fork

sozojoe forked thephpleague/omnipay-braintree

⚡ Braintree Driver for Omnipay Gateway
sozojoe MIT License Updated
fork time in 2 months ago