From e7942731adc2a475df5da72cc19919fc6d633fd3 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 13 Mar 2023 00:10:26 +0800 Subject: [PATCH 01/15] revert call back bill plz logic --- .../Billplzs/ControllersLogic/CallbackBillplzLogic.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index e9daa5f1..0f64795b 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -105,14 +105,9 @@ 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 && !$transaction->owner instanceof Wallet) { + if(($invoice->amount - $transaction->amount) < 0.01) { $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); $packingList->status = ApprovalStatus::APPROVED; @@ -124,7 +119,7 @@ class CallbackBillplzLogic } } - $company_module_marking = $transaction->owner->owner->connections->first()->invitee_reference; + $company_module_marking = $transaction->owner->owner->connections? $transaction->owner->owner->connections->first()->invitee_reference: null; return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $order->reference ?? null, 'company_module_marking' => $company_module_marking ?? null, 'transaction' => $transaction, 'status' => $status]); } From 8277b9d0fdc3ab03445ea83999c5272f046bfd60 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 13 Mar 2023 00:32:59 +0800 Subject: [PATCH 02/15] fix bug unsuccessfull payment can went through --- .../Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index 85c9fe77..7c4dc824 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -101,7 +101,7 @@ class CallbackBillplzLogic $token = Auth::fromUser(User::find(1)); $request->headers->set('Authorization', 'Bearer '.$token); - $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED); + $this->updatesTransactionStatus->execute($transaction, $status); if(($invoice->amount - $transaction->amount) < 0.01) { $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); From 715384f4a42e35b94ec1acc2f12b77d989ac3899 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 13 Mar 2023 00:42:44 +0800 Subject: [PATCH 03/15] audit billplz --- routes/web.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/routes/web.php b/routes/web.php index a4619efc..c510eb1d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -955,3 +955,26 @@ Route::get('/packing-lists/delete-duplicated', function(Request $request){ } } }); + +Route::get('/billplz/audit', function (Request $request) { + $transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get(); + $i = 0; + $totalAmount = 0; + foreach ($transactions as $transaction){ + $response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference); + + if($response->successful()){ + $data = $response->json(); + if($data['paid']){ + + } else { + $totalAmount += $transaction->amount; + echo $transaction->id." => Fraud." . $transaction->amount . "
"; + } + }else{ + echo "billplz error
"; + } + } + + echo 'Total: ' . $totalAmount; +}); \ No newline at end of file From 432ce2d14a9689181201e381850d4f2327483b1c Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Mon, 13 Mar 2023 01:42:14 +0800 Subject: [PATCH 04/15] billplz audit --- routes/web.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/web.php b/routes/web.php index c510eb1d..ab6c32b4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -868,7 +868,7 @@ Route::get('/invoices/delete-duplicated', function(Request $request){ dump($order->reference . ' -no'); } - // if have unverified payment + // if have unverified payment // $paymentHistory = $packingList->transactions()->whereHas('transactions', function($query){ // return $query->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION ,ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED]); // })->get(); @@ -969,7 +969,7 @@ Route::get('/billplz/audit', function (Request $request) { } else { $totalAmount += $transaction->amount; - echo $transaction->id." => Fraud." . $transaction->amount . "
"; + echo 'Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . "

"; } }else{ echo "billplz error
"; @@ -977,4 +977,4 @@ Route::get('/billplz/audit', function (Request $request) { } echo 'Total: ' . $totalAmount; -}); \ No newline at end of file +}); From a2f70f266d875e1fd74f960e7cd6accb8364717e Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 13 Mar 2023 06:57:19 +0800 Subject: [PATCH 05/15] billplz audit --- app/Console/Commands/AuditBillplz.php | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app/Console/Commands/AuditBillplz.php diff --git a/app/Console/Commands/AuditBillplz.php b/app/Console/Commands/AuditBillplz.php new file mode 100644 index 00000000..77540087 --- /dev/null +++ b/app/Console/Commands/AuditBillplz.php @@ -0,0 +1,77 @@ +info(Carbon::now() . ' : Audit Billplz cron started.'); + $start = new Carbon(); + + $transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get(); + $totalTransactions = count($transactions); + $counter = 1; + $totalAmount = 0; + foreach ($transactions as $transaction){ + $response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference); + + if($response->successful()){ + $data = $response->json(); + if($data['paid']){ + + } else { + $totalAmount += $transaction->amount; + $this->info($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount); + } + }else{ + $this->info("billplz error
"); + } + $counter++; + } + + $end = new Carbon(); + $elapsedTime = $start->diff($end)->format('%H:%I:%S'); + + $this->info(Carbon::now() . ' : Done Audit Billplz. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount); + } +} From c76c50466de9993b61377972d326f3f4d449ef24 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 13 Mar 2023 13:43:28 +0800 Subject: [PATCH 06/15] multi payment final ui --- .../Filters/DoesNotHavePaymentStatusIn.php | 22 ++++++++++++++++ .../Filters/HavePaymentStatusNotIn.php | 22 ++++++++++++++++ .../ControllersLogic/CallbackBillplzLogic.php | 7 +++++- ...CustomerPaymentBillingSectionComponent.vue | 25 +++++++++++++++++-- .../elements/PaymentsBillingComponents.vue | 4 +++ 5 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/DoesNotHavePaymentStatusIn.php create mode 100644 app/Classes/General/Eloquent/Filters/HavePaymentStatusNotIn.php diff --git a/app/Classes/General/Eloquent/Filters/DoesNotHavePaymentStatusIn.php b/app/Classes/General/Eloquent/Filters/DoesNotHavePaymentStatusIn.php new file mode 100644 index 00000000..f8e9f214 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/DoesNotHavePaymentStatusIn.php @@ -0,0 +1,22 @@ +whereDoesntHave('transactions', function (Builder $query) use($value) { + $query->where('type', TransactionType::PAYMENT)->whereIn('status', $value); + }); + } +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/HavePaymentStatusNotIn.php b/app/Classes/General/Eloquent/Filters/HavePaymentStatusNotIn.php new file mode 100644 index 00000000..0b989f73 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/HavePaymentStatusNotIn.php @@ -0,0 +1,22 @@ +whereHas('transactions', function (Builder $query) use($value) { + $query->where('type', TransactionType::PAYMENT)->whereNotIn('status', $value); + }); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index 1cca14f6..f674e67f 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -105,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, $status); - 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/resources/assets/vue/components/companies/sections/CustomerPaymentBillingSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerPaymentBillingSectionComponent.vue index 4ebdffaa..b594b3a5 100644 --- a/resources/assets/vue/components/companies/sections/CustomerPaymentBillingSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/CustomerPaymentBillingSectionComponent.vue @@ -27,6 +27,22 @@ +
+
+
+ + +
+
+
+
+
Payment In Progress
+
+
+
@@ -52,12 +68,17 @@
- + +
+
+
+
+
- +
diff --git a/resources/assets/vue/components/paymentsBilling/elements/PaymentsBillingComponents.vue b/resources/assets/vue/components/paymentsBilling/elements/PaymentsBillingComponents.vue index b3c896b7..f00e8be4 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/PaymentsBillingComponents.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/PaymentsBillingComponents.vue @@ -23,6 +23,10 @@

Amount

MYR {{ item.amount.toFixed(2) }}
+
+

Payment Date

+
{{ item.payment_history[item.payment_history.length-1].created_at }}
+
From 0fd3584af25b921942895b3f9b676fd96a4f2302 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Mon, 13 Mar 2023 16:03:05 +0800 Subject: [PATCH 07/15] billplz audit --- routes/web.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/routes/web.php b/routes/web.php index ab6c32b4..18efb102 100644 --- a/routes/web.php +++ b/routes/web.php @@ -968,6 +968,9 @@ Route::get('/billplz/audit', function (Request $request) { if($data['paid']){ } else { + $transaction->status = ApprovalStatus::REJECTED; + $transaction->save(); + $totalAmount += $transaction->amount; echo 'Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . "

"; } From daeb376aa5c755bc13635b171099ffdd9152c7d6 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Mon, 13 Mar 2023 16:05:41 +0800 Subject: [PATCH 08/15] billplz audit --- routes/web.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routes/web.php b/routes/web.php index 18efb102..11bbf1db 100644 --- a/routes/web.php +++ b/routes/web.php @@ -968,9 +968,13 @@ Route::get('/billplz/audit', function (Request $request) { if($data['paid']){ } else { + $transaction->status = ApprovalStatus::REJECTED; $transaction->save(); + $invoice = $transaction->owner; + $invoice->status = ApprovalStatus::APPROVED; + $totalAmount += $transaction->amount; echo 'Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . "

"; } From 92b6e6dc3a32efaa2bfd9822028d8add3c386d51 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 15 Mar 2023 19:48:48 +0800 Subject: [PATCH 09/15] debug billplz payment --- .../Commands/debugBillplzFailedPayment.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 app/Console/Commands/debugBillplzFailedPayment.php diff --git a/app/Console/Commands/debugBillplzFailedPayment.php b/app/Console/Commands/debugBillplzFailedPayment.php new file mode 100644 index 00000000..ee1cf4b0 --- /dev/null +++ b/app/Console/Commands/debugBillplzFailedPayment.php @@ -0,0 +1,75 @@ +where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get(); + + $i = 0; + $totalAmount = 0; + foreach ($transactions as $transaction){ + $response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference); + + // dd($response); + + if($response->successful()){ + $data = $response->json(); + if($data['paid']){ + if (!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) { + $this->returnLog('Paid transaction', $transaction); + } + } + // else { + // $totalAmount += $transaction->amount; + // $this->returnLog('Unpaid Transaction', $transaction); + // } + }else{ + $this->returnLog('billplz error', $transaction); + } + } + } + + public function returnLog($text, $transaction) { + $approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID; + $this->info($text . ' - id: '. $transaction->id . '. Booking Marking: '. $transaction->owner->marking . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]); + } +} From ef3c738fb13104e35d0cd625f2fe01430f19e375 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 15 Mar 2023 19:58:05 +0800 Subject: [PATCH 10/15] debug billplz payment --- app/Console/Commands/debugBillplzFailedPayment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/debugBillplzFailedPayment.php b/app/Console/Commands/debugBillplzFailedPayment.php index ee1cf4b0..729ecfee 100644 --- a/app/Console/Commands/debugBillplzFailedPayment.php +++ b/app/Console/Commands/debugBillplzFailedPayment.php @@ -50,6 +50,8 @@ class debugBillplzFailedPayment extends Command $response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference); // dd($response); + + // dd($transaction->owner->owner->owner->reference); if($response->successful()){ $data = $response->json(); @@ -70,6 +72,6 @@ class debugBillplzFailedPayment extends Command public function returnLog($text, $transaction) { $approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID; - $this->info($text . ' - id: '. $transaction->id . '. Booking Marking: '. $transaction->owner->marking . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]); + $this->info($text . ' - id: '. $transaction->id . '. Order Marking: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]); } } From 64ec76eed6c5796aa3445c756d5f88935e5c7ced Mon Sep 17 00:00:00 2001 From: Dillon Date: Fri, 17 Mar 2023 17:28:18 +0800 Subject: [PATCH 11/15] Insert logs for debugging --- app/Classes/Jobs/UpdatePerfexCRMInvoice.php | 8 +++ .../CreatePerfexCRMInvoiceProcessor.php | 7 +++ .../PackingListToPerfexCRMProcessor.php | 59 +++++++++++-------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/app/Classes/Jobs/UpdatePerfexCRMInvoice.php b/app/Classes/Jobs/UpdatePerfexCRMInvoice.php index e7902958..0db33536 100644 --- a/app/Classes/Jobs/UpdatePerfexCRMInvoice.php +++ b/app/Classes/Jobs/UpdatePerfexCRMInvoice.php @@ -18,6 +18,8 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Carbon\Carbon; +use Illuminate\Support\Facades\Log; + class UpdatePerfexCRMInvoice implements ShouldQueue { @@ -58,6 +60,7 @@ class UpdatePerfexCRMInvoice implements ShouldQueue if($invoiceStatus != PerfexCRMInvoiceStatus::PAID){ //get project $projectId = ""; + $projectName = ""; if($transaction->owner instanceof Transaction){ $orderReference = $transaction->owner->owner->owner()->first()->reference; $packingListReference = $transaction->owner->owner->reference; @@ -68,6 +71,11 @@ class UpdatePerfexCRMInvoice implements ShouldQueue } } + if($projectId == ""){ + Log::error(json_encode('UpdatePerfexCRMInvoice debug: '.$projectName)); + Log::error(json_encode($transaction->owner)); + } + //update invoice (App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $projectId); } diff --git a/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php b/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php index 806bb5dd..ba0c1033 100644 --- a/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php +++ b/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php @@ -14,6 +14,7 @@ use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerProject; use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus; use App\Models\PackingList; use Carbon\Carbon; +use Illuminate\Support\Facades\Log; class CreatePerfexCRMInvoiceProcessor { @@ -99,6 +100,7 @@ class CreatePerfexCRMInvoiceProcessor //get project $projectId = ""; //Project only exist in CRM if the customer already made payment + $projectName = ""; if($isPaid){ if($transaction->owner instanceof PackingList){ $orderReference = $transaction->owner->owner->reference; @@ -115,6 +117,11 @@ class CreatePerfexCRMInvoiceProcessor } } } + + if($projectId == ""){ + Log::error(json_encode('CreatePerfexCRMInvoiceProcessor debug: '.$projectName)); + Log::error(json_encode($transaction->owner)); + } } //newitems diff --git a/app/Classes/Modules/PerfexCRM/Processors/PackingListToPerfexCRMProcessor.php b/app/Classes/Modules/PerfexCRM/Processors/PackingListToPerfexCRMProcessor.php index 775407ed..55d2e150 100644 --- a/app/Classes/Modules/PerfexCRM/Processors/PackingListToPerfexCRMProcessor.php +++ b/app/Classes/Modules/PerfexCRM/Processors/PackingListToPerfexCRMProcessor.php @@ -7,6 +7,7 @@ use App\Classes\ValueObjects\Constants\PerfexCRMTasks; use App\Classes\Jobs\UpdatePerfexCRM; use App\Models\PackingList; use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus; +use Illuminate\Support\Facades\Log; class PackingListToPerfexCRMProcessor { @@ -17,35 +18,41 @@ class PackingListToPerfexCRMProcessor */ public function execute(PackingList $packingList) { - $order = $packingList->owner; - $companyModule = $order->companyModule()->first(); - $connection = $companyModule->inviters()->withPivot('invitee_reference')->first(); - $companyName = $companyModule->name; - $companyReference = $connection ? $connection->pivot->invitee_reference:''; - $employee = $companyModule->employees()->first(); - $contactEmail = $employee->email; - $contactName = $employee->name; + try { + $order = $packingList->owner; + $companyModule = $order->companyModule()->first(); + $connection = $companyModule->inviters()->withPivot('invitee_reference')->first(); + $companyName = $companyModule->name; + $companyReference = $connection ? $connection->pivot->invitee_reference:''; + $employee = $companyModule->employees()->first(); + $contactEmail = $employee->email; + $contactName = $employee->name; - $orderReference = $packingList->owner->reference; - $packingListReference = $packingList->reference; - $projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference; + $orderReference = $packingList->owner->reference; + $packingListReference = $packingList->reference; + $projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference; - $updatePerfexCRMObject = new UpdatePerfexCRMObject( - $companyName, - $companyReference, - $contactName, - $contactEmail, - "", - $projectName, - PerfexCRMProjectStatus::NOT_STARTED, - [], - [ - PerfexCRMTasks::TASK_LOADED_CONTAINER_1, - PerfexCRMTasks::TASK_LOADED_CONTAINER_2, - ] - ); - UpdatePerfexCRM::dispatch($updatePerfexCRMObject); + $updatePerfexCRMObject = new UpdatePerfexCRMObject( + $companyName, + $companyReference, + $contactName, + $contactEmail, + "", + $projectName, + PerfexCRMProjectStatus::NOT_STARTED, + [], + [ + PerfexCRMTasks::TASK_LOADED_CONTAINER_1, + PerfexCRMTasks::TASK_LOADED_CONTAINER_2, + ] + ); + UpdatePerfexCRM::dispatch($updatePerfexCRMObject); + } catch (\Exception $exception){ + Log::error(json_encode('PackingListToPerfexCRMProcessor debug:')); + Log::error(json_encode($packingList)); + Log::error($exception); + } return true; } } From f2a02230c70cf8d699ec1df36b894396feae2d73 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 18 Mar 2023 23:16:08 +0800 Subject: [PATCH 12/15] update payment redirect --- resources/views/pages/payments_redirect.blade.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/views/pages/payments_redirect.blade.php b/resources/views/pages/payments_redirect.blade.php index 19a85bde..f72404bc 100644 --- a/resources/views/pages/payments_redirect.blade.php +++ b/resources/views/pages/payments_redirect.blade.php @@ -40,7 +40,7 @@ @endif @if($company_module_marking) -
Back to Payment and Billing
+
Back to Payment and Billing
@endif
@@ -66,6 +66,11 @@
Back to Order
@endif + @if($company_module_marking) + +
Back to Payment and Billing
+
+ @endif
@@ -83,7 +88,12 @@
@if($marking) -
Back to Order
+
Back to Order
+
+ @endif + @if($company_module_marking) + +
Back to Payment and Billing
@endif From f30a0cf7eedf60cdb388d76354921ee4e0856567 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 18 Mar 2023 23:34:38 +0800 Subject: [PATCH 13/15] wallet top up logic --- .../ControllersLogic/CallbackBillplzLogic.php | 2 +- .../elements/WalletTopUpHistoryComponent.vue | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php index f674e67f..18986b1d 100644 --- a/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php +++ b/app/Classes/Modules/Billplzs/ControllersLogic/CallbackBillplzLogic.php @@ -106,7 +106,7 @@ class CallbackBillplzLogic $request->headers->set('Authorization', 'Bearer '.$token); // check if is wallet top up - if($transaction->owner instanceof Wallet && $transaction->status !== ApprovalStatus::APPROVED) { + if($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED) { $this->updatesWalletBalance->execute($transaction->owner, $transaction->amount); } diff --git a/resources/assets/vue/components/wallets/elements/WalletTopUpHistoryComponent.vue b/resources/assets/vue/components/wallets/elements/WalletTopUpHistoryComponent.vue index f827134d..29219ff1 100644 --- a/resources/assets/vue/components/wallets/elements/WalletTopUpHistoryComponent.vue +++ b/resources/assets/vue/components/wallets/elements/WalletTopUpHistoryComponent.vue @@ -95,7 +95,7 @@
Status
- Rejected + {{ item.payment_method === 5 ? 'Failed' : 'Rejected' }}
@@ -107,11 +107,21 @@
-
Rejected On: {{ item.updated_at }}
+ +
{{ item.payment_method === 5 ? 'Failed' : 'Rejected' }} On: {{ item.updated_at }}
-
+ +
From 3dcf3cff106cfa8de2da50b7bc5ce1004ae26158 Mon Sep 17 00:00:00 2001 From: Dillon Date: Sun, 19 Mar 2023 04:29:50 +0800 Subject: [PATCH 14/15] Update CRM invoice due date --- .../PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php b/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php index ba0c1033..e3a3a4a5 100644 --- a/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php +++ b/app/Classes/Modules/PerfexCRM/Processors/CreatePerfexCRMInvoiceProcessor.php @@ -68,7 +68,7 @@ class CreatePerfexCRMInvoiceProcessor } $date = Carbon::parse($transaction->created_at)->format('Y-m-d'); - $dueDate = Carbon::parse($transaction->created_at)->format('Y-m-d'); + $dueDate = Carbon::parse($transaction->created_at)->addDays(6)->startOfDay()->format('Y-m-d'); $currency = 1; //cief TODO: To look into Malaysia and Chinese currency $subTotal = 0.00; $total = 0.00; From 76a9af2dc8f19fcd8dbfc3f7286c073d7d4076d0 Mon Sep 17 00:00:00 2001 From: Dillon Date: Sun, 19 Mar 2023 04:50:12 +0800 Subject: [PATCH 15/15] Fix a problem of a mismatch in data update for invoice --- .../Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php index b7ab4b2a..b75b5cae 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php @@ -38,7 +38,7 @@ class UpdatesPerfexCRMInvoice $data = [ 'number' => $invoice->number, 'date' => $invoice->date, - 'duedate' => $invoice->date, + 'duedate' => $invoice->duedate, 'currency' => $invoice->currency, 'subtotal' => $invoice->subtotal, 'total' => $invoice->total,