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 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/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'); } /** diff --git a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue index 0a8a11c9..9d748b40 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/GroupPaymentsBillingComponents.vue @@ -25,7 +25,25 @@ -
+
+
+ +
+
+ + + + + +