Feat: Adding Translations to Payment and Shipping Methods, removing unecessary shipping method fulfillment type
This commit is contained in:
@@ -27,6 +27,7 @@ use Modules\Core\Shipping\Contracts\CarrierFulfillmentInterface;
|
||||
use Modules\Core\Shipping\Filament\Pages\ManageShippingRates;
|
||||
use Modules\Core\Shipping\Jobs\PollShipmentTrackingJob;
|
||||
use Modules\Core\Shipping\Listeners\InvalidateShippingOptions;
|
||||
use Modules\Core\Shipping\Support\FulfillmentType;
|
||||
use Modules\Core\Shipping\Models\Shipment;
|
||||
|
||||
class ShippingServiceProvider extends ServiceProvider
|
||||
@@ -80,8 +81,10 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
// resolveCarrier() for the same lookup pattern already used to
|
||||
// resolve a carrier driver from it).
|
||||
//
|
||||
// Reads ShippingMethod.data['fulfillment_type'] directly rather
|
||||
// than through a ShippingMethod::macro('isStorePickup', ...) —
|
||||
// Resolves via Modules\Core\Shipping\Support\FulfillmentType (driver-
|
||||
// declared for acs/box-now, merchant-configured data['fulfillment_type']
|
||||
// fallback for table-rate-shipping's generic drivers) rather than
|
||||
// through a ShippingMethod::macro('isStorePickup', ...) —
|
||||
// Lunar\Base\Traits\HasModelExtending::__callStatic() (used by
|
||||
// Lunar\Shipping\Models\ShippingMethod via Lunar\Base\BaseModel)
|
||||
// intercepts EVERY unmatched static call, including macro()
|
||||
@@ -91,8 +94,7 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
// false. (Lunar\Models\Order is unaffected because it declares
|
||||
// its own macro() method directly, bypassing __callStatic
|
||||
// entirely — that's why Order::macro('isStorePickupOrder', ...)
|
||||
// below still works.) Defaults to 'carrier' (false) for any row
|
||||
// saved before this field existed.
|
||||
// below still works.)
|
||||
Order::macro('isStorePickupOrder', function () {
|
||||
/** @var Order $this */
|
||||
$code = $this->shippingAddress?->shipping_option;
|
||||
@@ -108,7 +110,7 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
// attribute avoids that entirely.
|
||||
$method = ShippingMethod::where('code', $code)->first();
|
||||
|
||||
return ($method?->data['fulfillment_type'] ?? 'carrier') === 'store_pickup';
|
||||
return $method && FulfillmentType::isStorePickup($method);
|
||||
});
|
||||
|
||||
foreach ([CartLineAdded::class, CartLineUpdated::class, CartLineRemoved::class, CartCleared::class, ShippingAddressSet::class] as $event) {
|
||||
|
||||
Reference in New Issue
Block a user