From dfedb99c133418321efe86a6bf00852c3da2db14 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 26 Jun 2024 23:43:40 +0800 Subject: [PATCH] fix bug: customer pay full amount but payment cant go through due to rounding up issue --- .../Processors/CreatePaymentTransactionProcessor.php | 2 +- routes/web.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Classes/Modules/Transactions/Processors/CreatePaymentTransactionProcessor.php b/app/Classes/Modules/Transactions/Processors/CreatePaymentTransactionProcessor.php index ad5e79ab..8ceb0100 100644 --- a/app/Classes/Modules/Transactions/Processors/CreatePaymentTransactionProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CreatePaymentTransactionProcessor.php @@ -114,7 +114,7 @@ class CreatePaymentTransactionProcessor /** @var Wallet $wallet */ $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.'); } diff --git a/routes/web.php b/routes/web.php index 7e7c14f1..aa9a39a9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1272,6 +1272,7 @@ Route::get('/payment-and-billing-2', function () { Route::get('/show-all-extra-payments', function () { ini_set('memory_limit', '-1'); + ini_set('max_execution_time', 0); $invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE) ->where('status', ApprovalStatus::COMPLETED)