mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +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);
|
||||
|
||||
@@ -12,4 +12,6 @@ final class BusinessType {
|
||||
|
||||
public const TRANSFER_AGENT = 4;
|
||||
|
||||
public const ONESIXSIXEIGHT = 5;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AddServiceTypeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
\DB::table('service_types')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'name' => '1688',
|
||||
'status' => '2',
|
||||
'deleted_at' => NULL,
|
||||
'created_at' => '2021-03-09 07:52:56',
|
||||
'updated_at' => '2021-03-09 09:57:40',
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user