diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php
index 6a7510c2..62409cd0 100644
--- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php
+++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php
@@ -108,7 +108,12 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
// $transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
// $transactionRefundCalculationObject->init();
- $refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7);
+ if ((float)$request->input('amount') === (float)$transaction->original_amount) {
+ $refundAmount = $transaction->original_amount / $transaction->currency_rate;
+ $service_charges_to_refund = $transaction->service_charge;
+ } else {
+ $refundAmount = bcdiv($request->input('amount'), $transaction->currency_rate, 7);
+ }
$bookingAmountBeforeCurrentRefund = $booking->fix_amount - $refundInPending;
diff --git a/app/Http/Resources/ListTransactionJobResource.php b/app/Http/Resources/ListTransactionJobResource.php
index b8908ee6..1547c09e 100644
--- a/app/Http/Resources/ListTransactionJobResource.php
+++ b/app/Http/Resources/ListTransactionJobResource.php
@@ -18,6 +18,7 @@ class ListTransactionJobResource extends JsonResource
{
$booking = null; //cief todo: 66
$bank = null;
+ //Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -26,6 +27,7 @@ class ListTransactionJobResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
+ //Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [
diff --git a/app/Http/Resources/PaymentTransactionResource.php b/app/Http/Resources/PaymentTransactionResource.php
index d7c0ae27..291c274b 100644
--- a/app/Http/Resources/PaymentTransactionResource.php
+++ b/app/Http/Resources/PaymentTransactionResource.php
@@ -24,6 +24,7 @@ class PaymentTransactionResource extends JsonResource
$booking = null; //cief todo: 66
$bank = null;
+ //Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -32,6 +33,7 @@ class PaymentTransactionResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
+ //Check if Transaction of type PAYMENT has an override for recipient bank - ends
$booking_marking = '';
diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php
index 595ce443..e14c32c0 100644
--- a/app/Http/Resources/TransactionResource.php
+++ b/app/Http/Resources/TransactionResource.php
@@ -21,6 +21,7 @@ class TransactionResource extends JsonResource
{
$booking = null; //cief todo: 66
$bank = null;
+ //Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND, TransactionType::SUPPLIER_REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
@@ -29,6 +30,7 @@ class TransactionResource extends JsonResource
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
}
+ //Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [
diff --git a/routes/web.php b/routes/web.php
index e2317150..74e9ecbb 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -408,24 +408,7 @@ Route::get('/pending_orders', function(){
->orderBy('updated_at', 'desc')
->get();
- echo '
';
- // echo '';
- // echo '';
- // echo '| Client Booking Date | ';
- // echo 'Payment Type | ';
- // echo 'Marking | ';
- // echo 'Customer Payment Currency | ';
- // echo 'Customer Payment Amount | ';
- // echo 'Reference No. | ';
- // echo 'Booking Amount Currency | ';
- // echo 'CNY | ';
- // echo 'Service | ';
- // echo 'Days | ';
- // echo 'Cust Supplier Acc Type | ';
- // echo 'Cust Supplier Acc Name | ';
- // echo '
';
- // echo '';
- // echo '';
+ echo '';
$i = 0;
foreach ($payments as $payment){
$booking = $payment->owner;
@@ -445,17 +428,19 @@ Route::get('/pending_orders', function(){
echo '';
echo '| '.$payment->updated_at->format('d-M-y').' | ';
- echo ''.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].' | ';
echo ''.$booking->marking.' | ';
+ echo ''.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].' | ';
echo ''.$payment->currency->short_code.' | ';
echo ''.number_format(bcsub($payment->amount, $refunds, 7), 5, '.', '').' | ';
echo ''.$booking->company->reference.' | ';
+ echo ' | ';
echo ''.$payment->original_currency->short_code.' | ';
echo ''.number_format(bcsub($payment->original_amount, $original_refunds, 7), 5, '.', '').' | ';
+ echo ' | ';
echo ''.$booking->service->name.' | ';
echo ''.$payment->updated_at->diffForHumans().' | ';
echo ''.$bankType.' | ';
- echo ''.$bank->holder_name.' | ';
+ echo ''.$booking->bank->holder_name.' | ';
echo '
';
}
echo '
';