Skip to content

Commit

Permalink
[FIX] PayPal needs rebatt amount as a money value and has to be added…
Browse files Browse the repository at this point in the history
… twice in typoscript.
  • Loading branch information
krausandre committed Dec 10, 2023
1 parent cfd8eb7 commit a70f185
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/EventListener/Order/Payment/ProviderRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Extcode\Cart\Domain\Model\Cart;
use Extcode\Cart\Domain\Model\Cart\Cart as CartCart;
use Extcode\Cart\Domain\Model\Cart\CartCoupon;
use Extcode\Cart\Domain\Model\Cart\CartCouponPercentage;
use Extcode\Cart\Domain\Model\Order\Item as OrderItem;
use Extcode\Cart\Domain\Repository\CartRepository;
use Extcode\Cart\Event\Order\PaymentEvent;
Expand Down Expand Up @@ -229,7 +230,12 @@ protected function addEachCouponFromCartToQuery(): void
*/
foreach ($this->cart->getCoupons() as $cartCoupon) {
if ($cartCoupon->getIsUseable()) {
$discount += $cartCoupon->getDiscount();
// A.K.: Differentiate between percentage and fixed discount
if ($cartCoupon instanceof CartCouponPercentage) {
$discount += (float)($this->orderItem->getGross() * $cartCoupon->getDiscount());
} else {
$discount += $cartCoupon->getDiscount();
}
}
}

Expand Down

0 comments on commit a70f185

Please sign in to comment.