Updated credit max
This commit is contained in:
parent
15690a1f0d
commit
4e8b5d875c
|
|
@ -56,7 +56,7 @@ class Cart
|
|||
|
||||
$baseGrandTotal = $this->orderRepository->scopeQuery(function ($query) {
|
||||
return $query
|
||||
->where('orders.customer_id', '=', $this->getCurrentCustomerGuard()->user()->id)
|
||||
->where('orders.customer_id', $this->getCurrentCustomerGuard()->user()->id)
|
||||
->where('orders.status', '<>', 'canceled');
|
||||
})->sum('base_grand_total');
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class Cart
|
|||
->where('orders.status', '<>', 'canceled');
|
||||
})->sum('base_grand_total_invoiced');
|
||||
|
||||
if ( ($baseGrandTotal - $baseGrandTotalInvoiced) >= (core()->getConfigData('customer.settings.credit_max.amount') - ($baseGrandTotal - $baseGrandTotalInvoiced)))
|
||||
throw new \Exception('You available credit limit has been exceeded. Please you pay your pending invoice.');
|
||||
if ( ($baseGrandTotal - $baseGrandTotalInvoiced) >= core()->getConfigData('customer.settings.credit_max.amount'))
|
||||
throw new \Exception('You available credit limit has been exceeded. Please pay your pending invoice.');
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue