mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
e3e4b490b0
# Conflicts: # resources/views/partials/header.blade.php # routes/web.php
71 lines
2.3 KiB
PHP
71 lines
2.3 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\Modules\Bookings\Standards\Rules\CanFetchBooking;
|
|
use App\Classes\Modules\Transactions\Processors\CreateProformaInvoiceTransactionProcessor;
|
|
use App\Http\Resources\BookingResource;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CreateProformaInvoiceTransactionLogic extends AbstractControllerLogic
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Create Proforma Invoice Transaction',
|
|
'message' => 'You have successfully create proforma invoice transaction'
|
|
];
|
|
}
|
|
|
|
/** @var CanFetchBooking */
|
|
private $canFetchBooking;
|
|
|
|
/** @var FetchesBooking */
|
|
private $fetchesBooking;
|
|
|
|
/** @var CreateProformaInvoiceTransactionProcessor */
|
|
private $CreateProformaInvoiceTransactionProcessor;
|
|
|
|
/**
|
|
* FetchBookingLogic constructor.
|
|
* @param CanFetchBooking $canFetchBooking
|
|
* @param FetchesBooking $fetchesBooking
|
|
* @param CreateProformaInvoiceTransactionProcessor $CreateProformaInvoiceTransactionProcessor
|
|
*/
|
|
public function __construct(
|
|
CanFetchBooking $canFetchBooking,
|
|
FetchesBooking $fetchesBooking,
|
|
CreateProformaInvoiceTransactionProcessor $CreateProformaInvoiceTransactionProcessor
|
|
)
|
|
{
|
|
$this->canFetchBooking = $canFetchBooking;
|
|
$this->fetchesBooking = $fetchesBooking;
|
|
$this->CreateProformaInvoiceTransactionProcessor = $CreateProformaInvoiceTransactionProcessor;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$this->canFetchBooking->passes();
|
|
|
|
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
|
|
|
$this->CreateProformaInvoiceTransactionProcessor->execute($booking);
|
|
|
|
return $this->resourceResponse(new BookingResource($booking));
|
|
}
|
|
|
|
} |