Feat: Shipping functionalities redesign, elta courier integration, commenting out acs since no integration can happen, flow updates
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Modules\Core\Shipping\DTOs;
|
||||
|
||||
use Modules\Core\Shipping\Enums\ExtraService;
|
||||
|
||||
/**
|
||||
* Carrier-agnostic input for CarrierFulfillmentInterface::createShipment().
|
||||
* Every field is optional — a carrier reads only what it needs and ignores
|
||||
@@ -19,6 +21,11 @@ class ShipmentRequest
|
||||
* an order that doesn't fit one compartment. Empty for every other
|
||||
* carrier, which ships as a single package described by $weight
|
||||
* instead.
|
||||
* @param array<int, ExtraService> $services staff-picked extra
|
||||
* services; a carrier only receives ones it declares via
|
||||
* SupportsExtraServices.
|
||||
* @param ?float $insuranceAmount when ExtraService::Insurance is picked.
|
||||
* @param ?string $deliveryUntil "HH:MM", when ExtraService::TimedDelivery is picked.
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly ?float $weight = null,
|
||||
@@ -27,5 +34,22 @@ class ShipmentRequest
|
||||
public readonly ?string $paymentMode = null,
|
||||
public readonly ?float $amountToCollect = null,
|
||||
public readonly array $boxes = [],
|
||||
public readonly array $services = [],
|
||||
public readonly ?float $insuranceAmount = null,
|
||||
public readonly ?string $deliveryUntil = null,
|
||||
public readonly ?string $trackingReference = null,
|
||||
) {}
|
||||
|
||||
public function has(ExtraService $service): bool
|
||||
{
|
||||
return in_array($service, $this->services, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function serviceValues(): array
|
||||
{
|
||||
return array_map(fn (ExtraService $service) => $service->value, $this->services);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user