diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index ae8ae28f..e9daa5f1 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -44,6 +44,9 @@ class CallbackBillplzLogic /** @var UpdateDoFromYDPortalProcessor */ private $updateDoFromYDPortalProcessor ; + /** @var UpdatesWalletBalance */ + private $updatesWalletBalance; + /** * CallbackBillplzLogic constructor. * @param GetBillplzBill $getBillplzBill @@ -52,13 +55,14 @@ class CallbackBillplzLogic * @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor * @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor */ - public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor) + public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance) { $this->getBillplzBill = $getBillplzBill; $this->fetchesTransaction = $fetchesTransaction; $this->updatesTransactionStatus = $updatesTransactionStatus; $this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor; $this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor; + $this->updatesWalletBalance = $updatesWalletBalance; } @@ -101,9 +105,14 @@ class CallbackBillplzLogic $token = Auth::fromUser(User::find(1)); $request->headers->set('Authorization', 'Bearer '.$token); + // check if is wallet top up + if($transaction->owner instanceof Wallet && $transaction->status !== ApprovalStatus::APPROVED) { + $this->updatesWalletBalance->execute($transaction->owner, $transaction->amount); + } + $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED); - if(($invoice->amount - $transaction->amount) < 0.01) { + if(($invoice->amount - $transaction->amount) < 0.01 && !$transaction->owner instanceof Wallet) { $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); $packingList->status = ApprovalStatus::APPROVED; diff --git a/app/Classes/Modules/Wallets/ControllersLogic/FetchWalletByCompanyModuleControllerLogic.php b/app/Classes/Modules/Wallets/ControllersLogic/FetchWalletByCompanyModuleControllerLogic.php index 8a97929c..6a7c9515 100644 --- a/app/Classes/Modules/Wallets/ControllersLogic/FetchWalletByCompanyModuleControllerLogic.php +++ b/app/Classes/Modules/Wallets/ControllersLogic/FetchWalletByCompanyModuleControllerLogic.php @@ -24,7 +24,7 @@ class FetchWalletByCompanyModuleControllerLogic extends AbstractControllerLogic protected function notification():array { return [ 'title' => 'Retrieved Wallet', - 'message' => 'You have successfully created a wallet' + 'message' => 'You have successfully retrieved a wallet' ]; } @@ -78,7 +78,11 @@ class FetchWalletByCompanyModuleControllerLogic extends AbstractControllerLogic return $this->resourceResponse(new WalletResource($wallet)); } - $query = $this->fetchesWallet->execute(['owner_id' => $request->route('company_module_id')]); + $filters = $this->fetchesWallet->deserializeFilters($request->input('filters')); + + $filters['owner_id'] = $request->route('company_module_id'); + + $query = $this->fetchesWallet->execute($filters); return $this->resourceResponse(new WalletResource($query)); } diff --git a/resources/assets/vue/components/companies/elements/CustomerPaymentBillingInnerComponent.vue b/resources/assets/vue/components/companies/elements/CustomerPaymentBillingInnerComponent.vue index 1bbf3d5d..8ec98df2 100644 --- a/resources/assets/vue/components/companies/elements/CustomerPaymentBillingInnerComponent.vue +++ b/resources/assets/vue/components/companies/elements/CustomerPaymentBillingInnerComponent.vue @@ -6,7 +6,7 @@

