Skip to content

Commit

Permalink
customer now can apply "free transport and payment" promo code
Browse files Browse the repository at this point in the history
- application simulates behavior of reaching "free transport and payment" limit
- added bool Order::$freeTransportAndPaymentApplied which is used to get payment prices when a customer wants to change the payment after an order is created
  • Loading branch information
vitek-rostislav committed Dec 17, 2024
1 parent 79d3a7f commit 2410d05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Model/Cart/TransportAndPaymentWatcherFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,13 @@ public function checkTransportAndPayment(

$productsPrice = $orderData->getProductsTotalPriceAfterAppliedDiscounts();

if ($this->freeTransportAndPaymentFacade->isActive($domainId)) {
$isFreeTransportAndPaymentPromoCodeApplied = $orderInput->isFreeTransportAndPaymentPromoCodeApplied();

if ($this->freeTransportAndPaymentFacade->isActive($domainId, $isFreeTransportAndPaymentPromoCodeApplied)) {
$amountWithVatForFreeTransport = $this->freeTransportAndPaymentFacade->getRemainingPriceWithVat(
$productsPrice->getPriceWithVat(),
$domainId,
$isFreeTransportAndPaymentPromoCodeApplied,
);

$this->cartWithModificationsResult->setRemainingAmountWithVatForFreeTransport($amountWithVatForFreeTransport);
Expand Down
1 change: 1 addition & 0 deletions src/Model/Resolver/Price/PriceQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function priceByPaymentQuery(
$order->getCurrency(),
$order->getTotalProductsPrice(),
$order->getDomainId(),
$order->isFreeTransportAndPaymentApplied(),
);
}

Expand Down

0 comments on commit 2410d05

Please sign in to comment.