From c6ffc89773e4e13d1112dda1795ad44df98535fa Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 19 Jul 2023 13:32:09 +0800 Subject: [PATCH] update accounting mapping --- .../ControllersLogic/UpdateBankStatementDetailLogic.php | 6 +++--- .../Modules/Accounting/Processors/ChecksBillNumber.php | 6 +----- .../Modules/Exports/Services/ExportsInvoiceTransactions.php | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php index 8e49720f..d9eab3db 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateBankStatementDetailLogic.php @@ -93,9 +93,9 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic if (in_array($systemReference, ['exchange', 'izyim'])) { $transaction = $this->checksBillNumber->execute($transactionReference, $systemReference); - if (!count($transaction)) { + if (is_array($transaction) && empty($transaction)) { throw new MalformedRequestException('Transaction Not Found.'); - } + } if($systemReference === 'exchange') { $owner_type = Transaction::class; @@ -116,7 +116,7 @@ class UpdateBankStatementDetailLogic extends AbstractControllerLogic $transactionType = $transaction['type']; if (($payFor === 'sales' && !in_array($transactionType, [ShippingTransactionType::PAYMENT, ShippingTransactionType::GROUP_PAYMENT])) - || ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP]))) { + || ($payFor === 'top_up' && !in_array($transactionType, [ShippingTransactionType::TOP_UP, ShippingTransactionType::GROUP_PAYMENT]))) { throw new MalformedRequestException('Transaction Type does not match.'); } diff --git a/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php b/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php index 0ac72cd2..adc5c7b1 100644 --- a/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php +++ b/app/Classes/Modules/Accounting/Processors/ChecksBillNumber.php @@ -20,11 +20,7 @@ class ChecksBillNumber $payload = $data['payload']; return $payload['data']; } catch (\Exception $exception) { - dd($exception->getMessage()); -// preg_match('/\{.*\}/s', $exception->getMessage(), $matches); -// $jsonError = json_decode($matches[0]); - // Retrieved Transactions failed -// throw new MalformedRequestException($jsonError->title); + throw new MalformedRequestException($exception->getMessage()); } } diff --git a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php index 975e800b..a4f37bf4 100644 --- a/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php +++ b/app/Classes/Modules/Exports/Services/ExportsInvoiceTransactions.php @@ -127,7 +127,7 @@ class ExportsInvoiceTransactions implements FromQuery, WithHeadings, WithHeading return [ '<>', - $row['updated_at'], + Carbon::parse($row['updated_at'])->format('m/d/Y H:m'), $row['debtor_code'], $row['type'] === ShippingTransactionType::PAYMENT ? $row['order_reference'] : $row['marking'], '',