Feat: Shipping functionalities redesign, elta courier integration, commenting out acs since no integration can happen, flow updates

This commit is contained in:
2026-09-30 17:28:47 +03:00
parent f411dec1da
commit 49ec4333af
63 changed files with 3143 additions and 347 deletions
@@ -0,0 +1,14 @@
<?php
namespace Modules\Core\Shipping\Contracts;
/**
* A carrier whose shipments are created as pending records and only get a
* voucher number when the label is printed (ELTA). Until then the shipment
* has no tracking_reference and can still be cancelled; printLabel()
* issues the voucher. Its shipments get a tab on the Pending Vouchers
* screen, like carriers with a manifest step.
*/
interface IssuesVoucherOnPrint
{
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Core\Shipping\Contracts;
use Illuminate\Support\Collection;
use Modules\Core\Shipping\Models\Shipment;
/**
* A carrier that can print several shipments' labels as one PDF — behind
* the Pending Vouchers screen's "Print selected". Same side effects as
* printLabel() per shipment (issuing pending vouchers, setting
* label_printed_at).
*/
interface SupportsBatchLabels
{
/**
* @param Collection<int, Shipment> $shipments
*/
public function printLabels(Collection $shipments): string;
}
@@ -2,6 +2,8 @@
namespace Modules\Core\Shipping\Contracts;
use Lunar\Shipping\Models\ShippingMethod;
/**
* A shipping rate driver implements this to say a person is physically
* present at handoff to collect cash — true for a courier like
@@ -14,6 +16,10 @@ namespace Modules\Core\Shipping\Contracts;
* Contracts\DeclaresFulfillmentType, which only distinguishes carrier vs.
* store_pickup and can't tell ACS and Box Now apart (both 'carrier').
*
* Receives the shipping method, since for some drivers it's a per-method
* setting — a manual carrier's "Courier collects cash on delivery" toggle
* (Modules\Core\Shipping\Carriers\Manual\ManualRateDriver).
*
* Not implemented at all means "no" — a driver with no opinion here
* (any of table-rate-shipping's own generic drivers, if one were ever
* re-added) is treated as not supporting cash collection, the safer
@@ -21,5 +27,5 @@ namespace Modules\Core\Shipping\Contracts;
*/
interface SupportsCashCollection
{
public function collectsCash(): bool;
public function collectsCash(ShippingMethod $method): bool;
}
@@ -0,0 +1,21 @@
<?php
namespace Modules\Core\Shipping\Contracts;
use Modules\Core\Shipping\Enums\ExtraService;
/**
* A carrier that offers extra services (Saturday delivery, insurance, …).
* Only the carrier knows its own codes — the rest of the app deals in the
* normalized ExtraService cases.
*/
interface SupportsExtraServices
{
/**
* The services this carrier offers, keyed by ExtraService value, each
* mapped to the carrier's own code.
*
* @return array<string, string>
*/
public function extraServices(): array;
}
@@ -0,0 +1,19 @@
<?php
namespace Modules\Core\Shipping\Contracts;
use Carbon\CarbonInterface;
use Modules\Core\Shipping\DTOs\CarrierVoucher;
/**
* A carrier that can list the vouchers on our account for a date range —
* feeds the Carrier Vouchers screen (returns, and vouchers not linked to
* any order yet).
*/
interface SupportsVoucherListing
{
/**
* @return iterable<CarrierVoucher>
*/
public function listVouchers(CarbonInterface $from, CarbonInterface $to): iterable;
}
@@ -0,0 +1,14 @@
<?php
namespace Modules\Core\Shipping\Contracts;
use Modules\Core\Shipping\DTOs\CarrierVoucher;
/**
* A carrier that can look up a single voucher by number — so a voucher can
* be found and linked to an order before the next list sync.
*/
interface SupportsVoucherLookup
{
public function lookupVoucher(string $voucherNumber): ?CarrierVoucher;
}