Skip to content

Commit

Permalink
Add method for shipping discount (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
sofwar authored and srmklive committed Jun 19, 2018
1 parent f889a96 commit 4a0b034
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Services/ExpressCheckout.php
Expand Up @@ -125,6 +125,20 @@ protected function setShippingAmount($data)
]);
}
}

/**
* Set shipping discount if available.
*
* @param array $data
*/
protected function setShippingDiscount($data)
{
if (isset($data['shipping_discount'])) {
$this->post = $this->post->merge([
'PAYMENTREQUEST_0_SHIPDISCAMT' => $data['shipping_discount'] * -1,
]);
}
}

/**
* Perform a SetExpressCheckout API call on PayPal.
Expand Down Expand Up @@ -154,6 +168,8 @@ public function setExpressCheckout($data, $subscription = false)
]);

$this->setShippingAmount($data);

$this->setShippingDiscount($data);

$this->setExpressCheckoutRecurringPaymentConfig($data, $subscription);

Expand Down

0 comments on commit 4a0b034

Please sign in to comment.