diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php index 75ad76a1..062db191 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php @@ -73,6 +73,10 @@ class CreateBookingRefundLogic extends AbstractControllerLogic public function logic(Request $request) : JsonResponse { + if(auth()->user()->type === 3) { + throw new MalformedRequestException('You do not have the permission to refund the order.'); + } + $transaction = $this->fetchesTransaction->execute(['id' => $request->route('payment_id')]); $booking = $transaction->owner; diff --git a/app/Classes/Modules/Bookings/Services/CalculatesBookingRefundAmount.php b/app/Classes/Modules/Bookings/Services/CalculatesBookingRefundAmount.php index 239545af..8792aaa6 100644 --- a/app/Classes/Modules/Bookings/Services/CalculatesBookingRefundAmount.php +++ b/app/Classes/Modules/Bookings/Services/CalculatesBookingRefundAmount.php @@ -9,7 +9,7 @@ class CalculatesBookingRefundAmount { public function execute(Booking $booking, int $type, ?string $payment_reference = null): float { - $refundAmounts = $booking->transactions()->payments()->get()->map(function ($payment) use ($type) { + $refundAmounts = $booking->transactions()->payments()->complete()->get()->map(function ($payment) use ($type) { return $this->calculateRefundAmount($payment, $type); }); diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue index 8df6cfe3..3e0c9ca6 100644 --- a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue @@ -117,7 +117,7 @@
| '; echo ' | Refunded Original Amount | '; echo ''; + echo ' | Remark | '; echo 'Service | '; echo 'Last Updated At | '; echo 'Bank Type | '; echo 'Bank Holder Name | '; echo '|
| '.($index + 1).'. | '; echo ''.$payment->updated_at->format('d-M-y').' | '; @@ -483,6 +507,7 @@ Route::get('/approve_refunds', function(){ echo ''.$payment->original_currency->short_code.' | '; echo ''.number_format($original_refunds, 5, '.', '').' | '; echo ''; + echo ' | '.$remark.' | '; echo ''.$booking->service->name.' | '; echo ''.$payment->updated_at->diffForHumans().' | '; echo ''.$bankType.' | ';