diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php index 0ec53d9b..843ecb88 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php @@ -75,6 +75,8 @@ class CreateBookingRefundLogic extends AbstractControllerLogic $booking = Booking::find($request->route('id')); $transaction = $this->fetchesTransaction->execute(['id' => $request->route('payment_id')]); + + $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::REFUNDED); $paymentAttemptLimit = $this->fetchesCompanyPaymentAttemptLimit->execute($booking->company); @@ -87,8 +89,6 @@ class CreateBookingRefundLogic extends AbstractControllerLogic $transaction->tax, $transaction->service_charge, Carbon::now()->addMinutes($paymentAttemptLimit), ApprovalStatus::PENDING_VERIFICATION); $transaction = $this->createsTransaction->execute($booking, $object); - - $this->updatesTransactionStatus->execute($transaction, ApprovalStatus::REFUNDED); return $this->resourceResponse(new TransactionResource($transaction)); } diff --git a/app/Http/Controllers/Bookings/CreateBookingRefundController.php b/app/Http/Controllers/Bookings/CreateBookingRefundController.php index e15b8ff8..40d4ddda 100644 --- a/app/Http/Controllers/Bookings/CreateBookingRefundController.php +++ b/app/Http/Controllers/Bookings/CreateBookingRefundController.php @@ -10,7 +10,7 @@ class CreateBookingRefundController { /** * @param Request $request - * @param CreateBookingPaymentLogic $logic + * @param CreateBookingRefundLogic $logic * @return JsonResponse */ public function create(Request $request, CreateBookingRefundLogic $logic): JsonResponse { diff --git a/routes/booking.php b/routes/booking.php index e7f3d7d4..c2805443 100644 --- a/routes/booking.php +++ b/routes/booking.php @@ -20,6 +20,7 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking Route::group(['prefix' => '{id}/refund', 'as' => 'refund.'], function () { Route::post('{payment_id}/create', 'CreateBookingRefundController@create')->name('create'); + Route::post('{payment_id}/credit_note/create', 'CreateBookingRefundCreditNoteController@create')->name('credit_note.create'); }); Route::post('{id}/purchase_order/verification', 'ApprovePurchaseOrderController@approve')->name('po.approval');