mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 16:04:05 +00:00
Add new seeder, add new public const variable for 1668, update code in CreateBookingLogic for 1688 booking flow
This commit is contained in:
@@ -13,6 +13,8 @@ use App\Classes\Modules\Bookings\Services\CreatesBooking;
|
||||
use App\Classes\Modules\Bookings\Services\GeneratesBookingMarking;
|
||||
|
||||
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Http\Resources\BookingResource;
|
||||
|
||||
use ErrorException;
|
||||
@@ -44,19 +46,24 @@ class CreateBookingLogic extends AbstractControllerLogic
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/**
|
||||
* CreateBookingLogic constructor.
|
||||
* @param CanCreateBooking $canCreateBooking
|
||||
* @param CreatesBooking $createsBooking
|
||||
* @param GeneratesBookingMarking $generatesBookingMarking
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
*/
|
||||
public function __construct(CanCreateBooking $canCreateBooking, CreatesBooking $createsBooking, GeneratesBookingMarking $generatesBookingMarking, FetchesCompany $fetchesCompany)
|
||||
public function __construct(CanCreateBooking $canCreateBooking, CreatesBooking $createsBooking, GeneratesBookingMarking $generatesBookingMarking, FetchesCompany $fetchesCompany, CreateCompanyProcessor $createCompanyProcessor)
|
||||
{
|
||||
$this->canCreateBooking = $canCreateBooking;
|
||||
$this->createsBooking = $createsBooking;
|
||||
$this->generatesBookingMarking = $generatesBookingMarking;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,10 +76,17 @@ class CreateBookingLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
|
||||
|
||||
$object = new BookingObject($request->input('service_id'), $request->input('transferable_bank_id'), $this->generatesBookingMarking->execute(), number_format( floatval(str_replace(',', '', $request->input('fix_amount'))), 5, '.', ''), $request->input('type') === 1 ? $request->input('convertible_currency_id') : 1, $request->input('convertible_currency_id'), 1);
|
||||
|
||||
if($object->getServiceId() == '5')
|
||||
{
|
||||
$company = $this->createCompanyProcessor->execute($request, BusinessType::ONESIXSIXEIGHT);
|
||||
}
|
||||
else {
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
|
||||
}
|
||||
|
||||
$this->canCreateBooking->passes($object);
|
||||
|
||||
$booking = $this->createsBooking->execute($company, $object);
|
||||
|
||||
Reference in New Issue
Block a user