Updated credit max

This commit is contained in:
Prashant Singh 2019-06-29 16:02:03 +05:30
parent 15690a1f0d
commit 4e8b5d875c
1 changed files with 3 additions and 3 deletions

View File

@ -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.');
}
}