From 2100c4a14ae98972898c4d7df7b705f7d18cc046 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Fri, 19 May 2023 20:45:03 +0800 Subject: [PATCH 1/4] update fix_failed_callback_from_billplz log --- .../Commands/FixBillplzFailedCallbackPayment.php | 11 +++++++++-- app/Console/Kernel.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/FixBillplzFailedCallbackPayment.php b/app/Console/Commands/FixBillplzFailedCallbackPayment.php index a3f2ebb4..d04919e3 100644 --- a/app/Console/Commands/FixBillplzFailedCallbackPayment.php +++ b/app/Console/Commands/FixBillplzFailedCallbackPayment.php @@ -77,7 +77,6 @@ class FixBillplzFailedCallbackPayment extends Command { ini_set('memory_limit', '-1'); - $this->info(Carbon::now() . ' : Fix failled callback from billplz cron started.'); $this->outputArray = []; $start = new Carbon(); @@ -85,6 +84,11 @@ class FixBillplzFailedCallbackPayment extends Command $transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get(); $totalTransactions = count($transactions); + + if ($totalTransactions) { + $this->info(Carbon::now() . ' : Fix failled callback from billplz cron started.'); + } + $counter = 1; $totalAmount = 0; foreach ($transactions as $transaction){ @@ -180,6 +184,9 @@ class FixBillplzFailedCallbackPayment extends Command $end = new Carbon(); $elapsedTime = $start->diff($end)->format('%H:%I:%S'); - $this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount); + if ($totalTransactions) { + $this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount); + } + } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 259d5692..31424fd0 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -51,7 +51,7 @@ class Kernel extends ConsoleKernel $schedule->command('billplz-failed-callback:fix') ->dailyAt('00:00') ->withoutOverlapping() - ->appendOutputTo (storage_path().'/logs/dix_failed_callback_from_billplz.log'); + ->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log'); } /** From a3cad7816cc8d4ec59a15c081f92d5ad9c9c0a97 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Fri, 19 May 2023 21:22:16 +0800 Subject: [PATCH 2/4] deletes group payment --- .../ControllersLogic/DeleteGroupLogic.php | 29 ++++------------ .../Transactions/Services/DeletesGroup.php | 19 +++++++++++ .../Transactions/Services/FetchesGroup.php | 33 +++++++++++++++++++ .../GroupPaymentsBillingComponents.vue | 22 +++++++++++-- 4 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 app/Classes/Modules/Transactions/Services/DeletesGroup.php create mode 100644 app/Classes/Modules/Transactions/Services/FetchesGroup.php diff --git a/app/Classes/Modules/Transactions/ControllersLogic/DeleteGroupLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/DeleteGroupLogic.php index 601a1530..5366ed7d 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/DeleteGroupLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/DeleteGroupLogic.php @@ -5,9 +5,8 @@ namespace App\Classes\Modules\Transactions\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Transactions\Services\FetchesGroup; use App\Classes\Modules\Transactions\Services\DeletesTransaction; +use App\Classes\Modules\Transactions\Services\DeletesGroup; use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus; -use App\Classes\ValueObjects\Constants\ApprovalStatus; -use App\Http\Resources\GroupResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -24,14 +23,11 @@ class DeleteGroupLogic extends AbstractControllerLogic ]; } - /** @var UpdatesTransactionStatus */ - private $updatesTransactionStatus; - /** @var FetchesGroup */ private $fetchesGroup; - /** @var DeletesTransaction */ - private $deletesTransaction; + /** @var DeletesGroup */ + private $deletesGroup; /** * DeleteGroupLogic constructor. @@ -39,11 +35,10 @@ class DeleteGroupLogic extends AbstractControllerLogic * @param FetchesGroup $fetchesGroup * @param DeletesTransaction $deletesTransaction */ - public function __construct(updatesTransactionStatus $updatesTransactionStatus, FetchesGroup $fetchesGroup, DeletesTransaction $deletesTransaction) + public function __construct(FetchesGroup $fetchesGroup, DeletesGroup $deletesGroup) { - $this->updatesTransactionStatus = $updatesTransactionStatus; $this->fetchesGroup = $fetchesGroup; - $this->deletesTransaction = $deletesTransaction; + $this->deletesGroup = $deletesGroup; } /** @@ -55,19 +50,9 @@ class DeleteGroupLogic extends AbstractControllerLogic { $group = $this->fetchesGroup->execute(['id' => $request->route('id')]); - $items = $group->transactions()->get(); + $this->deletesGroup->execute($group); - foreach($items as $item) { - $bill = $item; - $payment = $bill->owner; - $group->transactions()->detach($bill->id); - $this->updatesTransactionStatus->execute($payment, ApprovalStatus::APPROVED); - $this->deletesTransaction->execute($bill); - } - - $group->delete(); - - return $this->resourceResponse(new GroupResource($group)); + return $this->response([]); } } \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/Services/DeletesGroup.php b/app/Classes/Modules/Transactions/Services/DeletesGroup.php new file mode 100644 index 00000000..27b45183 --- /dev/null +++ b/app/Classes/Modules/Transactions/Services/DeletesGroup.php @@ -0,0 +1,19 @@ +handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/Services/FetchesGroup.php b/app/Classes/Modules/Transactions/Services/FetchesGroup.php new file mode 100644 index 00000000..a3034bbc --- /dev/null +++ b/app/Classes/Modules/Transactions/Services/FetchesGroup.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue index 0a8a11c9..91df229d 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue @@ -25,7 +25,25 @@ -
+
+
+ +
+
+ + + + + +
From 525e7a5dd1da3d93f2e89e6ab5294312db05629f Mon Sep 17 00:00:00 2001 From: edmondlang Date: Fri, 19 May 2023 21:27:26 +0800 Subject: [PATCH 3/4] deletes group payment --- .../elements/GroupPaymentsBillingComponents.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue index 91df229d..9d748b40 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue @@ -25,12 +25,12 @@
-
+
- + Date: Sun, 21 May 2023 19:20:26 +0800 Subject: [PATCH 4/4] add BillNo Filter --- .../General/Eloquent/Filters/BillNo.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/Classes/General/Eloquent/Filters/BillNo.php diff --git a/app/Classes/General/Eloquent/Filters/BillNo.php b/app/Classes/General/Eloquent/Filters/BillNo.php new file mode 100644 index 00000000..167dcd51 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/BillNo.php @@ -0,0 +1,20 @@ +where('bill_no', $value); + } + +} \ No newline at end of file