'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([]); } }