Skip to content

Commit

Permalink
Added cart and order items to the morphmap as well
Browse files Browse the repository at this point in the history
Changed the built-in adjuster aliases' keys
  • Loading branch information
fulopattila122 committed Mar 5, 2024
1 parent 3c2285a commit ff389ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- Added the `CalculateTaxes` listener to cart update and shipping address change events
- Added the `AdjusterAliases` class that for decoupling FQCNs from the database
- Added automatic mapping of adjuster FQCN <-> aliases when saving an adjustment into the DB and when calling the `getAdjuster()` method
- BC: Added cart and order item models to the Relation morph map: the `adjustable_type` field in the `adjustments` table needs to be converted!
- BC: Added the `?CheckoutSubject` return type to the `getCart()` method of the `Checkout` interface
- BC: Changed `Checkout::getShippingAddress()` return type to be nullable
- BC: Added the void return type to `Checkout::setShippingAddress()`
Expand Down
8 changes: 4 additions & 4 deletions src/Adjustments/Adjusters/AdjusterAliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
final class AdjusterAliases
{
private static array $map = [
'discount' => SimpleDiscount::class,
'fee' => SimpleFee::class,
'shipping_fee' => SimpleShippingFee::class,
'tax' => SimpleTax::class,
'simple_discount' => SimpleDiscount::class,
'simple_fee' => SimpleFee::class,
'simple_shipping_fee' => SimpleShippingFee::class,
'simple_tax' => SimpleTax::class,
];

public static function add(string $alias, string $fqcn): void
Expand Down
4 changes: 4 additions & 0 deletions src/Foundation/Providers/ModuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Vanilo\Adjustments\Adjusters\AdjusterAliases;
use Vanilo\Cart\Contracts\Cart as CartContract;
use Vanilo\Cart\Contracts\CartItem as CartItemContract;
use Vanilo\Cart\Models\CartItemProxy;
use Vanilo\Cart\Models\CartProxy;
use Vanilo\Category\Contracts\Taxon as TaxonContract;
use Vanilo\Category\Contracts\Taxonomy as TaxonomyContract;
Expand Down Expand Up @@ -56,6 +57,7 @@
use Vanilo\Order\Contracts\Order as OrderContract;
use Vanilo\Order\Contracts\OrderFactory as OrderFactoryContract;
use Vanilo\Order\Contracts\OrderItem as OrderItemContract;
use Vanilo\Order\Models\OrderItemProxy;
use Vanilo\Order\Models\OrderProxy;
use Vanilo\Payment\Contracts\PaymentMethod as PaymentMethodContract;
use Vanilo\Payment\Models\PaymentMethodProxy;
Expand Down Expand Up @@ -106,7 +108,9 @@ public function boot()
'taxonomy' => TaxonomyProxy::modelClass(),
'taxon' => TaxonProxy::modelClass(),
'order' => OrderProxy::modelClass(),
'order_item' => OrderItemProxy::modelClass(),
'cart' => CartProxy::modelClass(),
'cart_item' => CartItemProxy::modelClass(),
'shipment' => ShipmentProxy::modelClass(),
'shipping_method' => ShippingMethodProxy::modelClass(),
'payment_method' => PaymentMethodProxy::modelClass(),
Expand Down
1 change: 1 addition & 0 deletions src/Foundation/Shipping/PaymentDependentShippingFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PaymentDependentShippingFee implements Adjuster
use HasWriteableTitleAndDescription;
use IsLockable;
use IsNotIncluded;

public const ALIAS = 'payment_dependent_shipping_fee';

public function __construct(
Expand Down

0 comments on commit ff389ed

Please sign in to comment.