|
|
|
|
|
|
|
|
|
|
|
|
|
|
$orderShop->addOrderReductionCart($orderReductionCart) ; |
|
|
$orderShop->addOrderReductionCart($orderReductionCart) ; |
|
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop)) { |
|
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop) |
|
|
|
|
|
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
|
|
|
|
|
$this->em->persist($orderReductionCart); |
|
|
$this->em->persist($orderReductionCart); |
|
|
$this->em->flush(); |
|
|
$this->em->flush(); |
|
|
|
|
|
|
|
|
return $orderReductionCart ; |
|
|
return $orderReductionCart ; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
else { |
|
|
|
|
|
$orderShop->removeOrderReductionCart($orderReductionCart) ; |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function isReductionCreditAllowAddToOrder($orderShop, $reductionCredit) |
|
|
public function isReductionCreditAllowAddToOrder($orderShop, $reductionCredit) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$orderShop->addOrderReductionCredit($orderReductionCredit) ; |
|
|
$orderShop->addOrderReductionCredit($orderReductionCredit) ; |
|
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop)) { |
|
|
|
|
|
|
|
|
if($this->isOrderShopPositiveAmount($orderShop) |
|
|
|
|
|
&& $this->isOrderShopPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
|
|
|
|
|
$this->em->persist($orderReductionCredit); |
|
|
$this->em->persist($orderReductionCredit); |
|
|
$this->em->flush(); |
|
|
$this->em->flush(); |
|
|
|
|
|
|
|
|
return $orderReductionCredit; |
|
|
return $orderReductionCredit; |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$orderShop->removeOrderReductionCredit($orderReductionCredit) ; |
|
|
|
|
|
|
|
|
return false ; |
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|