Skip to content

Commit

Permalink
discount added to UpdateOrderApi and Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
LaskeJu committed Jan 7, 2021
1 parent f94082d commit 0471728
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/Api/UpdateOrderApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function it_updates_pay_pal_order_with_given_new_total(
$order->getTotal()->willReturn(1122);
$order->getCurrencyCode()->willReturn('USD');
$order->getShippingTotal()->willReturn(22);
$order->getOrderPromotionTotal()->willReturn(0);

$shippingAddress->getFullName()->willReturn('John Doe');
$shippingAddress->getStreet()->willReturn('Main St. 123');
Expand Down Expand Up @@ -115,6 +116,7 @@ function it_updates_digital_order(
$order->getTotal()->willReturn(1122);
$order->getCurrencyCode()->willReturn('USD');
$order->getShippingTotal()->willReturn(0);
$order->getOrderPromotionTotal()->willReturn(0);

$order->isShippingRequired()->willReturn(false);

Expand Down
4 changes: 4 additions & 0 deletions src/Api/UpdateOrderApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public function update(
'currency_code' => $order->getCurrencyCode(),
'value' => $payPalItemData['total_tax'],
],
'discount' => [
'currency_code' => $order->getCurrencyCode(),
'value' => abs($order->getOrderPromotionTotal()) / 100,
],
],
],
'payee' => [
Expand Down

0 comments on commit 0471728

Please sign in to comment.