|
|
@@ -73,13 +73,18 @@ trait OrderUtilsReductionTrait |
|
|
|
|
|
|
|
$orderShop->addOrderReductionCart($orderReductionCart) ; |
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop)) { |
|
|
|
if($this->isOrderShopPositiveAmount($orderShop) |
|
|
|
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
|
|
|
|
$this->em->persist($orderReductionCart); |
|
|
|
$this->em->flush(); |
|
|
|
|
|
|
|
return $orderReductionCart ; |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
else { |
|
|
|
$orderShop->removeOrderReductionCart($orderReductionCart) ; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function isReductionCreditAllowAddToOrder($orderShop, $reductionCredit) |
|
|
@@ -148,13 +153,19 @@ trait OrderUtilsReductionTrait |
|
|
|
|
|
|
|
$orderShop->addOrderReductionCredit($orderReductionCredit) ; |
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop)) { |
|
|
|
if($this->isOrderShopPositiveAmount($orderShop) |
|
|
|
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
|
|
|
|
$this->em->persist($orderReductionCredit); |
|
|
|
$this->em->flush(); |
|
|
|
|
|
|
|
return $orderReductionCredit; |
|
|
|
} |
|
|
|
else { |
|
|
|
$orderShop->removeOrderReductionCredit($orderReductionCredit) ; |
|
|
|
|
|
|
|
return false ; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|