|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function isCreditAutoPayment(Order $order, bool $debitCreditOnFunctioningOptional = false) |
|
|
public function isCreditAutoPayment(Order $order, bool $debitCreditOnFunctioningOptional = false) |
|
|
{ |
|
|
{ |
|
|
if($order->subscription) { |
|
|
|
|
|
if($order->subscription->auto_payment == Subscription::AUTO_PAYMENT_YES) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$pointSale = $order->pointSale; |
|
|
|
|
|
if($pointSale) { |
|
|
|
|
|
if($order->subscription && $pointSale->payment_method_credit) { |
|
|
|
|
|
if($order->subscription->auto_payment == Subscription::AUTO_PAYMENT_YES) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if($order->subscription->auto_payment == Subscription::AUTO_PAYMENT_NO) { |
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
if($order->subscription->auto_payment == Subscription::AUTO_PAYMENT_NO) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$pointSale = $order->pointSale; |
|
|
|
|
|
if($pointSale) { |
|
|
|
|
|
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale); |
|
|
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale); |
|
|
|
|
|
|
|
|
if ($order->id_user && $this->producerSolver->getConfig('credit') && $pointSale->payment_method_credit) { |
|
|
if ($order->id_user && $this->producerSolver->getConfig('credit') && $pointSale->payment_method_credit) { |
|
|
if($order->mean_payment == MeanPayment::CREDIT || $creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) { |
|
|
if($order->mean_payment == MeanPayment::CREDIT || $creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) { |
|
|
return true; |
|
|
return true; |