Files
core/src/Checkout/Events/ShippingOptionSelected.php
T

25 lines
860 B
PHP

<?php
namespace Modules\Core\Checkout\Events;
use Lunar\DataTypes\ShippingOption;
use Lunar\Models\Cart;
/**
* Dispatched by CheckoutService::selectShippingOption() — carries the fully
* resolved ShippingOption (name, price, carrier identifier), not just the
* string identifier the caller passed in. Deliberate divergence from
* CartService's events, which carry a plain Cart/CartLine model reference —
* a live-priced carrier quote (see docs/checkout.md's note on
* ShippingManifest::getOptions() already being backed by the merged
* Shipping-Carriers ACS/Box Now live-rate drivers) is meaningfully more
* expensive for a listener to re-derive later than a CartLine reference is.
*/
class ShippingOptionSelected
{
public function __construct(
public readonly Cart $cart,
public readonly ShippingOption $option,
) {}
}