fix bug: customer pay full amount but payment cant go through due to rounding up issue

This commit is contained in:
edmondlang
2024-06-26 23:43:40 +08:00
parent 669cac9bd4
commit dfedb99c13
2 changed files with 2 additions and 1 deletions
@@ -114,7 +114,7 @@ class CreatePaymentTransactionProcessor
/** @var Wallet $wallet */ /** @var Wallet $wallet */
$wallet = $company_module->wallets()->first(); $wallet = $company_module->wallets()->first();
if((float) number_format(($wallet->amount - $amount),2) < 0){ if((float) number_format(($wallet->amount - $amount),2) < -0.01){
throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.'); throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.');
} }
+1
View File
@@ -1272,6 +1272,7 @@ Route::get('/payment-and-billing-2', function () {
Route::get('/show-all-extra-payments', function () { Route::get('/show-all-extra-payments', function () {
ini_set('memory_limit', '-1'); ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE) $invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
->where('status', ApprovalStatus::COMPLETED) ->where('status', ApprovalStatus::COMPLETED)