Skip to content

Commit

Permalink
Ensure Express Checkout totals are correct (#2230)
Browse files Browse the repository at this point in the history
Also make sure the values are right when a coupon is used.
  • Loading branch information
mihaijoldis authored and JustinSainton committed Feb 4, 2017
1 parent f8c577f commit 34ad289
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -27,14 +27,18 @@ protected function add_payment( $action ) {
$request['PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD'] = 'InstantPaymentOnly';
}

foreach ( array( 'subtotal', 'shipping', 'handling', 'tax', 'amount' ) as $key ) {
foreach ( array( 'subtotal', 'shipping', 'handling', 'tax', 'amount', 'discount' ) as $key ) {
if ( isset( $this->options[$key] ) ) {
$this->options[$key] = $this->format( $this->options[$key] );
}
}

if ( isset( $this->options[ 'discount' ] ) ) {
$this->options['subtotal'] = $this->format( $this->options['subtotal'] - $this->options['discount'] );
}

$request += phpme_map( $this->options, array(
'PAYMENTREQUEST_0_ITEMAMT' => 'amount',
'PAYMENTREQUEST_0_ITEMAMT' => 'subtotal',
'PAYMENTREQUEST_0_SHIPPINGAMT' => 'shipping',
'PAYMENTREQUEST_0_HANDLINGAMT' => 'handling',
'PAYMENTREQUEST_0_TAXAMT' => 'tax',
Expand Down

0 comments on commit 34ad289

Please sign in to comment.