mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 20:44:19 +00:00
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Addresses\Processors;
|
|
|
|
use App\Classes\Modules\Addresses\Services\CreatesOrderAddress;
|
|
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
|
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Models\Order;
|
|
|
|
class CreateOrderAddressProcessor
|
|
{
|
|
|
|
/** @var CanCreateAddress */
|
|
private $canCreateAddress;
|
|
|
|
/** @var CreatesAddress */
|
|
private $createsOrderAddress;
|
|
|
|
private $fetchesAddress;
|
|
|
|
/**
|
|
* CreateAddressProcessor constructor.
|
|
* @param CanCreateAddress $canCreateAddress
|
|
* @param CreatesOrderAddress $createsOrderAddress
|
|
* @param FetchesAddress $fetchesAddress
|
|
*/
|
|
public function __construct(CanCreateAddress $canCreateAddress, CreatesOrderAddress $createsOrderAddress, FetchesAddress $fetchesAddress)
|
|
{
|
|
$this->fetchesAddress = $fetchesAddress;
|
|
$this->canCreateAddress = $canCreateAddress;
|
|
$this->createsOrderAddress = $createsOrderAddress;
|
|
}
|
|
|
|
/**
|
|
* @param EmploymentObject $object
|
|
* @return Model
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function execute(int $address, Order $order): Model {
|
|
|
|
$address = $this->fetchesAddress->execute(['id' => $address_id]);
|
|
|
|
|
|
// $this->canCreateAddress->passes($object);
|
|
|
|
//Fetches Address & duplicate
|
|
|
|
return $this->createsOrderAddress->execute($address, $order);
|
|
}
|
|
|
|
}
|