mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 20:43:56 +00:00
58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ExpireBookingPaymentControllerLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Expire Payment',
|
|
'message' => 'You have successfully expire the Payment'
|
|
];
|
|
}
|
|
|
|
/** @var FetchesBooking */
|
|
private $fetchesBooking;
|
|
|
|
/**
|
|
* DeletePurchaseOrderPdfLogic constructor.
|
|
* @param FetchesBooking $fetchesBooking
|
|
*/
|
|
public function __construct(fetchesBooking $fetchesBooking)
|
|
{
|
|
$this->fetchesBooking = $fetchesBooking;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
|
|
|
$payment = $booking->transactions()
|
|
->payments()->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
|
->first();
|
|
|
|
$payment->status = ApprovalStatus::EXPIRED;
|
|
$payment->save();
|
|
|
|
return $this->response([]);
|
|
}
|
|
|
|
}
|