From df7f9531e82ca8fcc3750318716cbd4d7f816cf1 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Thu, 7 Mar 2024 11:38:03 +0800 Subject: [PATCH 1/5] fix payment history display transfer status --- .../elements/PaymentHistoryComponent.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 877ec248..90270fee 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -8,8 +8,17 @@
Status
-
- {{ item.status === 7 ? 'Refunded' : (item.status === 1 ? 'Processing Payment' : 'Transferred')}} +
+ {{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} +
+
+ {{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} +
+
+
+
Status
+
+ {{ item.status === 7 ? 'Refunded' : (item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Payment Approved')}}
{{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} @@ -18,7 +27,7 @@
Payment Amount
- {{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} + {{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
@@ -61,7 +70,7 @@
Status
-
+
{{ item.transaction_bill.status === 1 ? 'Processing Payment' : 'Transferred'}}
From 32224f6803cc36185e53387794063098b12bde8e Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Thu, 7 Mar 2024 11:43:19 +0800 Subject: [PATCH 2/5] fix payment history display transfer status --- .../bookings/elements/PaymentHistoryComponent.vue | 9 --------- 1 file changed, 9 deletions(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 90270fee..1db22609 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -6,15 +6,6 @@
-
-
Status
-
- {{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} -
-
- {{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}} -
-
Status
From 70300412467eeeb9b0877c6afb34877c8def563b Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Thu, 7 Mar 2024 11:46:46 +0800 Subject: [PATCH 3/5] fix payment history display transfer status --- .../components/bookings/elements/PaymentHistoryComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 1db22609..a6556cd2 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -61,7 +61,7 @@
Status
-
+
{{ item.transaction_bill.status === 1 ? 'Processing Payment' : 'Transferred'}}
From b0e3467fbe40bf1590a041509511eb5e7fc60412 Mon Sep 17 00:00:00 2001 From: JiaSheng Date: Thu, 7 Mar 2024 15:41:21 +0800 Subject: [PATCH 4/5] export pending order should not export order with refund in progress --- routes/web.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index a6590c17..9016724c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -386,7 +386,11 @@ Route::get('/segments', function (Request $request) { })->name('segments'); Route::get('/pending_orders', function(){ - $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED])->get(); + $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED]) + ->whereDoesntHave('transactions', function ($query) { + return $query->where('type', TransactionType::REFUND)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION]); + }) + ->get(); echo ''; $i = 0; From 626bec90d2381ca7ea1b3f61bd5f739c2434a331 Mon Sep 17 00:00:00 2001 From: JiaSheng Date: Mon, 11 Mar 2024 01:14:40 +0800 Subject: [PATCH 5/5] update export pending order so that partial refund booking show correct amount --- routes/web.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index 9016724c..ef5538ab 100644 --- a/routes/web.php +++ b/routes/web.php @@ -25,6 +25,7 @@ use Spatie\Activitylog\Models\Activity; use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger; use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject; use App\Classes\Modules\Bookings\Processors\CreatePurchaseOrderFor1688OrderProcessor; +use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount; use App\Classes\Modules\Documents\Services\DeletesDocument; use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionWithInvoiceNoProcessor; use App\Classes\Modules\Transactions\Services\DeletesTransaction; @@ -396,6 +397,8 @@ Route::get('/pending_orders', function(){ $i = 0; foreach ($payments as $payment){ $booking = $payment->owner; + $original_refunds = floatval((App()->make(CalculatesBookingRefundAmount::class))->calculateRefundAmount($payment, $booking->fix_currency_id)); + $refunds = $original_refunds / $payment->currency_rate; if(!$booking instanceof Booking){ dd($payment); } @@ -411,11 +414,11 @@ Route::get('/pending_orders', function(){ echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo '';
'.$booking->marking.''.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].''.$payment->currency->short_code.''.$payment->amount.''.number_format(bcsub($payment->amount, $refunds, 7), 5, '.', '').''.$booking->company->reference.''.$payment->original_currency->short_code.''.$payment->original_amount.''.number_format(bcsub($payment->original_amount, $original_refunds, 7), 5, '.', '').''.$booking->service->name.''.$payment->updated_at->diffForHumans().'