├── CONTRIBUTING.md ├── Changelog.md ├── LICENSE.md ├── README.md ├── composer.json ├── phpunit.xml.dist └── src ├── Adjustments ├── Adjusters │ ├── AdjusterAliases.php │ ├── PercentDiscount.php │ ├── SimpleDiscount.php │ ├── SimpleFee.php │ ├── SimpleShippingFee.php │ ├── SimpleTax.php │ └── SimpleTaxDeduction.php ├── Contracts │ ├── Adjustable.php │ ├── Adjuster.php │ ├── Adjustment.php │ ├── AdjustmentCollection.php │ └── AdjustmentType.php ├── Models │ ├── Adjustment.php │ ├── AdjustmentProxy.php │ ├── AdjustmentType.php │ └── AdjustmentTypeProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── Support │ ├── ArrayAdjustmentCollection.php │ ├── HasAdjustmentsViaRelation.php │ ├── HasEmptyData.php │ ├── HasNoOrigin.php │ ├── HasWriteableAdjustable.php │ ├── HasWriteableTitleAndDescription.php │ ├── IsACharge.php │ ├── IsAShippingAdjusment.php │ ├── IsIncluded.php │ ├── IsLockable.php │ ├── IsNotIncluded.php │ ├── RecalculatesAdjustments.php │ └── RelationAdjustmentCollection.php ├── phpunit.xml.dist └── resources │ ├── database │ └── migrations │ │ └── 2021_05_27_113135_create_adjustments_table.php │ └── manifest.php ├── Cart ├── CartManager.php ├── Contracts │ ├── Cart.php │ ├── CartEvent.php │ ├── CartItem.php │ ├── CartManager.php │ └── CartState.php ├── Events │ ├── BaseCartEvent.php │ ├── CartCreated.php │ ├── CartDeleted.php │ ├── CartDeleting.php │ └── CartUpdated.php ├── Exceptions │ └── InvalidCartConfigurationException.php ├── Facades │ └── Cart.php ├── Listeners │ ├── AssignUserToCart.php │ ├── DissociateUserFromCart.php │ └── RestoreCurrentUsersLastActiveCart.php ├── Models │ ├── Cart.php │ ├── CartItem.php │ ├── CartItemProxy.php │ ├── CartProxy.php │ ├── CartState.php │ └── CartStateProxy.php ├── Providers │ ├── EventServiceProvider.php │ └── ModuleServiceProvider.php └── resources │ ├── config │ └── module.php │ ├── database │ └── migrations │ │ ├── 2017_10_28_111947_create_carts_table.php │ │ ├── 2017_10_29_224033_create_cart_items_table.php │ │ ├── 2018_10_15_224808_add_cart_state.php │ │ └── 2023_01_12_123641_add_cart_item_configuration.php │ └── manifest.php ├── Category ├── Contracts │ ├── Taxon.php │ └── Taxonomy.php ├── Models │ ├── Taxon.php │ ├── TaxonProxy.php │ ├── Taxonomy.php │ └── TaxonomyProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── Traits │ └── HasTaxons.php └── resources │ ├── database │ └── migrations │ │ ├── 2018_08_24_160805_create_taxonomies_table.php │ │ ├── 2018_08_24_165408_create_taxons_table.php │ │ ├── 2018_11_04_211505_create_model_taxons_table.php │ │ └── 2024_06_07_083226_add_content_fields_to_taxons_table.php │ └── manifest.php ├── Channel ├── Contracts │ └── Channel.php ├── Models │ ├── Channel.php │ └── ChannelProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── Traits │ └── Channelable.php └── resources │ ├── database │ └── migrations │ │ ├── 2019_07_30_040905_create_channels_table.php │ │ ├── 2023_07_10_145614_add_currency_to_the_channels_table.php │ │ ├── 2023_08_31_182424_add_channelables_table.php │ │ ├── 2024_01_26_103355_extend_channels_table.php │ │ └── 2024_04_04_123653_convert_channel_billing_and_shipping_countries_to_zones.php │ └── manifest.php ├── Checkout ├── CheckoutManager.php ├── Contracts │ ├── Checkout.php │ ├── CheckoutDataFactory.php │ ├── CheckoutEvent.php │ ├── CheckoutRequest.php │ ├── CheckoutState.php │ ├── CheckoutStore.php │ └── CouponEvent.php ├── Drivers │ ├── BaseCheckoutStore.php │ ├── ImplicitCheckoutRequest.php │ ├── RequestStore.php │ └── SessionStore.php ├── Events │ ├── BaseCheckoutEvent.php │ ├── BaseCouponEvent.php │ ├── BillpayerChanged.php │ ├── CouponAdded.php │ ├── CouponRemoved.php │ ├── CouponUtilized.php │ ├── PaymentMethodSelected.php │ ├── ShippingAddressChanged.php │ └── ShippingMethodSelected.php ├── Facades │ └── Checkout.php ├── Models │ ├── CheckoutState.php │ └── CheckoutStateProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── Traits │ ├── EmulatesFillAttributes.php │ └── HasCheckoutState.php └── resources │ ├── config │ └── module.php │ └── manifest.php ├── Contracts ├── Address.php ├── Billpayer.php ├── Buyable.php ├── CheckoutSubject.php ├── CheckoutSubjectItem.php ├── Configurable.php ├── Contactable.php ├── Customer.php ├── DetailedAmount.php ├── Dimension.php ├── Feature.php ├── HasImages.php ├── Merchant.php ├── Organization.php ├── Payable.php ├── Person.php ├── Schematized.php ├── Shippable.php └── Stockable.php ├── Foundation ├── Factories │ ├── CheckoutDataFactory.php │ └── OrderFactory.php ├── Listeners │ ├── CalculatePromotions.php │ ├── CalculateShippingFees.php │ ├── CalculateTaxes.php │ ├── DeleteCartAdjustments.php │ ├── HasCartAndCheckout.php │ ├── UpdateCouponUsage.php │ └── UpdateSalesFigures.php ├── Models │ ├── Address.php │ ├── Cart.php │ ├── CartItem.php │ ├── Channel.php │ ├── Customer.php │ ├── MasterProduct.php │ ├── MasterProductVariant.php │ ├── Order.php │ ├── OrderItem.php │ ├── PaymentMethod.php │ ├── Product.php │ ├── Shipment.php │ ├── ShippingMethod.php │ ├── Taxon.php │ └── Taxonomy.php ├── Providers │ ├── EventServiceProvider.php │ └── ModuleServiceProvider.php ├── Search │ ├── ProductFinder.php │ └── ProductSearch.php ├── Shipping │ ├── DiscountableShippingFee.php │ ├── DiscountableShippingFeeCalculator.php │ ├── FlatFeeCalculator.php │ ├── PaymentDependentShippingFee.php │ └── PaymentDependentShippingFeeCalculator.php ├── Support │ └── helpers.php ├── Traits │ ├── CanBeShipped.php │ └── LoadsMediaConversionsFromConfig.php └── resources │ ├── config │ └── box.php │ ├── database │ └── migrations │ │ ├── 2018_05_12_100622_create_media_table.php │ │ ├── 2018_11_10_204207_add_sales_attributes_to_products.php │ │ ├── 2020_10_02_230537_upgrade_media_table_to_v8.php │ │ ├── 2020_12_08_150233_upgrade_media_table_to_v9.php │ │ ├── 2022_07_05_154855_add_channel_id_to_orders_table.php │ │ ├── 2023_02_22_191444_add_shipping_method_and_customer_to_the_orders_table.php │ │ ├── 2023_03_06_203615_add_payable_remote_id_to_the_orders_table.php │ │ ├── 2023_03_25_201501_add_tax_category_id_to_products.php │ │ ├── 2023_10_04_230611_add_payment_method_to_orders_table.php │ │ └── 2024_04_10_200341_add_zone_to_payment_methods_table.php │ └── manifest.php ├── Links ├── Contracts │ ├── LinkGroup.php │ ├── LinkGroupItem.php │ └── LinkType.php ├── Models │ ├── LinkGroup.php │ ├── LinkGroupItem.php │ ├── LinkGroupItemProxy.php │ ├── LinkGroupProxy.php │ ├── LinkType.php │ └── LinkTypeProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── Query │ ├── CachesMorphTypes.php │ ├── Eliminate.php │ ├── EliminateLinkGroup.php │ ├── EliminateLinks.php │ ├── Establish.php │ ├── FindsDesiredLinkGroups.php │ ├── Get.php │ ├── HasBaseModel.php │ ├── HasPrivateLinkTypeBasedConstructor.php │ ├── HasPropertyFilter.php │ └── WantsLinksOrGroups.php ├── Support │ └── helpers.php ├── Traits │ ├── Linkable.php │ └── NormalizesLinkType.php └── resources │ ├── database │ └── migrations │ │ ├── 2022_02_11_181838_create_link_types_table.php │ │ ├── 2022_02_16_092027_create_link_group_tables.php │ │ └── 2024_05_31_074502_add_root_item_to_link_group_items_table.php │ └── manifest.php ├── MasterProduct ├── Contracts │ ├── MasterProduct.php │ └── MasterProductVariant.php ├── Models │ ├── MasterProduct.php │ ├── MasterProductProxy.php │ ├── MasterProductVariant.php │ └── MasterProductVariantProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── phpunit.xml.dist └── resources │ ├── database │ └── migrations │ │ ├── 2022_06_13_090450_create_master_products_table.php │ │ ├── 2022_06_13_090835_create_master_product_variants_table.php │ │ ├── 2023_01_25_114755_add_description_to_variants_table.php │ │ └── 2023_11_23_152437_add_backorder_to_master_product_variants_table.php │ └── manifest.php ├── Order ├── Contracts │ ├── Billpayer.php │ ├── FulfillmentStatus.php │ ├── Order.php │ ├── OrderAwareEvent.php │ ├── OrderFactory.php │ ├── OrderItem.php │ ├── OrderItemAwareEvent.php │ ├── OrderNumberGenerator.php │ └── OrderStatus.php ├── Events │ ├── BaseOrderEvent.php │ ├── BaseOrderItemEvent.php │ ├── HasOrder.php │ ├── OrderBillpayerUpdated.php │ ├── OrderItemHasBeenPutOnHold.php │ ├── OrderItemPickedUp.php │ ├── OrderItemShipped.php │ ├── OrderItemsIsReadyForDelivery.php │ ├── OrderItemsIsReadyForPickup.php │ ├── OrderProcessingStarted.php │ ├── OrderShippingAddressUpdated.php │ ├── OrderWasCancelled.php │ ├── OrderWasCompleted.php │ └── OrderWasCreated.php ├── Exceptions │ └── CreateOrderException.php ├── Factories │ └── OrderFactory.php ├── Generators │ ├── NanoIdGenerator.php │ ├── SequentialNumberGenerator.php │ └── TimeHashGenerator.php ├── Models │ ├── Billpayer.php │ ├── BillpayerProxy.php │ ├── FulfillmentStatus.php │ ├── FulfillmentStatusProxy.php │ ├── Order.php │ ├── OrderItem.php │ ├── OrderItemProxy.php │ ├── OrderProxy.php │ ├── OrderStatus.php │ └── OrderStatusProxy.php ├── Providers │ └── ModuleServiceProvider.php └── resources │ ├── config │ └── module.php │ ├── database │ └── migrations │ │ ├── 2017_11_27_131854_create_billpayers_table.php │ │ ├── 2017_11_27_131855_create_orders_table.php │ │ ├── 2017_11_27_145105_create_order_items_table.php │ │ ├── 2020_12_29_124643_add_unique_index_to_order_numbers.php │ │ ├── 2023_01_19_121154_add_order_item_configuration.php │ │ ├── 2023_02_20_145123_add_fulfillment_status_to_orders.php │ │ ├── 2023_02_20_153027_add_fulfillment_status_to_order_items.php │ │ ├── 2023_02_22_180720_add_language_and_ordered_at_fields_to_the_orders_table.php │ │ ├── 2023_07_10_115351_add_currency_field_to_the_orders_table.php │ │ └── 2024_08_27_082142_add_domain_to_the_orders_table.php │ └── manifest.php ├── Payment ├── Contracts │ ├── Payment.php │ ├── PaymentAware.php │ ├── PaymentEvent.php │ ├── PaymentEventMap.php │ ├── PaymentGateway.php │ ├── PaymentHistory.php │ ├── PaymentMethod.php │ ├── PaymentRequest.php │ ├── PaymentResponse.php │ ├── PaymentStatus.php │ ├── Transaction.php │ ├── TransactionHandler.php │ └── TransactionNotCreated.php ├── Events │ ├── BasePaymentEvent.php │ ├── HasPayment.php │ ├── PaymentCompleted.php │ ├── PaymentCreated.php │ ├── PaymentDeclined.php │ ├── PaymentPartiallyReceived.php │ └── PaymentTimedOut.php ├── Exceptions │ └── InexistentPaymentGatewayException.php ├── Factories │ └── PaymentFactory.php ├── Gateways │ └── NullGateway.php ├── Models │ ├── Payment.php │ ├── PaymentHistory.php │ ├── PaymentHistoryProxy.php │ ├── PaymentMethod.php │ ├── PaymentMethodProxy.php │ ├── PaymentProxy.php │ ├── PaymentStatus.php │ └── PaymentStatusProxy.php ├── PaymentGateways.php ├── Processing │ ├── DefaultEventMappingRules.php │ └── PaymentResponseHandler.php ├── Providers │ └── ModuleServiceProvider.php ├── Requests │ └── NullRequest.php ├── Responses │ ├── NoTransaction.php │ ├── NullResponse.php │ └── NullStatus.php ├── Support │ └── ReplacesPaymentUrlParameters.php └── resources │ ├── database │ └── migrations │ │ ├── 2019_12_17_093757_create_payment_methods_table.php │ │ ├── 2019_12_17_094730_create_payments_table.php │ │ ├── 2021_02_28_161404_add_status_message_to_payments_table.php │ │ ├── 2021_03_21_102944_create_payment_history_table.php │ │ ├── 2021_05_20_174749_add_remote_id_to_payments_table.php │ │ └── 2023_03_06_205137_add_subtype_to_payments_table.php │ └── manifest.php ├── Product ├── Contracts │ ├── Product.php │ └── ProductState.php ├── Models │ ├── Product.php │ ├── ProductProxy.php │ ├── ProductState.php │ └── ProductStateProxy.php ├── Providers │ └── ModuleServiceProvider.php └── resources │ ├── database │ └── migrations │ │ ├── 2017_10_07_133259_create_products_table.php │ │ ├── 2019_04_08_000000_add_stock_field_to_products_table.php │ │ ├── 2022_02_28_160230_add_original_price_field_to_products_table.php │ │ ├── 2022_02_28_163548_add_dimensions_to_products_table.php │ │ └── 2023_11_23_091238_add_backorder_to_products_table.php │ └── manifest.php ├── Promotion ├── Actions │ ├── CartFixedDiscount.php │ └── CartPercentageDiscount.php ├── Contracts │ ├── Coupon.php │ ├── Promotion.php │ ├── PromotionAction.php │ ├── PromotionActionType.php │ ├── PromotionRule.php │ └── PromotionRuleType.php ├── Exceptions │ ├── InexistentPromotionActionException.php │ └── InexistentPromotionRuleException.php ├── Models │ ├── Coupon.php │ ├── CouponProxy.php │ ├── Promotion.php │ ├── PromotionAction.php │ ├── PromotionActionProxy.php │ ├── PromotionProxy.php │ ├── PromotionRule.php │ ├── PromotionRuleProxy.php │ └── PromotionStatus.php ├── PromotionActionTypes.php ├── PromotionRuleTypes.php ├── Providers │ └── ModuleServiceProvider.php ├── Rules │ ├── CartMinimumValue.php │ └── CartQuantity.php └── resources │ ├── database │ └── migrations │ │ ├── 2024_06_08_131453_create_promotions_table.php │ │ ├── 2024_06_08_164653_create_coupons_table.php │ │ ├── 2024_06_09_095853_create_promotion_rules_table.php │ │ └── 2024_06_10_175853_create_promotion_actions_table.php │ └── manifest.php ├── Properties ├── Contracts │ ├── Property.php │ ├── PropertyType.php │ └── PropertyValue.php ├── Exceptions │ ├── UnknownPropertyException.php │ └── UnknownPropertyTypeException.php ├── Models │ ├── Property.php │ ├── PropertyProxy.php │ ├── PropertyValue.php │ └── PropertyValueProxy.php ├── PropertyTypes.php ├── Providers │ └── ModuleServiceProvider.php ├── Traits │ └── HasPropertyValues.php ├── Types │ ├── Boolean.php │ ├── Integer.php │ ├── Number.php │ └── Text.php └── resources │ ├── database │ └── migrations │ │ ├── 2018_12_08_111450_create_properties_table.php │ │ ├── 2018_12_08_112321_create_property_values_table.php │ │ ├── 2018_12_08_124157_create_model_property_values_table.php │ │ └── 2023_08_23_155708_add_hidden_field_to_properties.php │ └── manifest.php ├── Shipment ├── Calculators │ └── NullShippingFeeCalculator.php ├── Contracts │ ├── Carrier.php │ ├── Shipment.php │ ├── ShipmentStatus.php │ ├── ShippingFeeCalculator.php │ └── ShippingMethod.php ├── Exceptions │ ├── InexistentShippingFeeCalculatorException.php │ └── InvalidShippingConfigurationException.php ├── Models │ ├── Carrier.php │ ├── CarrierProxy.php │ ├── Shipment.php │ ├── ShipmentProxy.php │ ├── ShipmentStatus.php │ ├── ShipmentStatusProxy.php │ ├── ShippingFee.php │ ├── ShippingMethod.php │ └── ShippingMethodProxy.php ├── Providers │ └── ModuleServiceProvider.php ├── ShippingFeeCalculators.php ├── Traits │ └── BelongsToCarrier.php └── resources │ ├── database │ └── migrations │ │ ├── 2019_02_16_082635_create_shipments_table.php │ │ ├── 2022_02_28_220149_create_carriers_table.php │ │ ├── 2022_02_28_221239_add_carrier_id_to_shipments_table.php │ │ ├── 2022_03_26_144125_create_shipping_methods_table.php │ │ ├── 2022_11_09_141850_add_active_flag_to_shipping_methods_table.php │ │ ├── 2023_02_20_094957_add_reference_number_to_shipments_table.php │ │ ├── 2023_02_20_104644_create_shippables_table.php │ │ ├── 2023_02_27_183045_add_zone_to_shipping_methods_table.php │ │ ├── 2023_03_12_093217_add_zones_foreign_key_to_shipping_methods_table.php │ │ └── 2023_03_28_195634_add_extend_the_shipments_table.php │ └── manifest.php ├── Support ├── Dto │ ├── Address.php │ ├── DetailedAmount.php │ ├── Dimension.php │ ├── Merchant.php │ └── SchemaDefinition.php ├── Features.php ├── Features │ ├── Inventory.php │ ├── MultiChannel.php │ ├── Pricing.php │ └── SearchEngine.php ├── Generators │ └── NanoIdGenerator.php ├── Traits │ ├── AddressModel.php │ ├── BuyableModel.php │ ├── BuyableNoImage.php │ ├── ConfigurableModel.php │ ├── ConfigurationHasNoSchema.php │ └── HasImagesFromMediaLibrary.php └── Utils │ ├── AddressComparisonResult.php │ └── Addresses.php └── Taxes ├── Calculators ├── DeductiveTaxCalculator.php ├── DefaultTaxCalculator.php └── NullTaxCalculator.php ├── Contracts ├── TaxCalculator.php ├── TaxCategory.php ├── TaxCategoryType.php ├── TaxEngineDriver.php ├── TaxRate.php └── Taxable.php ├── Drivers ├── NullTaxEngineDriver.php ├── SimpleTaxEngineDriver.php └── TaxEngineManager.php ├── Exceptions ├── InexistentTaxCalculatorException.php └── InvalidTaxConfigurationException.php ├── Facades └── TaxEngine.php ├── Models ├── TaxCategory.php ├── TaxCategoryProxy.php ├── TaxCategoryType.php ├── TaxCategoryTypeProxy.php ├── TaxRate.php └── TaxRateProxy.php ├── Providers └── ModuleServiceProvider.php ├── TaxCalculators.php ├── Traits └── BelongsToTaxCategory.php └── resources ├── config └── module.php ├── database └── migrations │ ├── 2023_03_17_150427_create_tax_categories_table.php │ ├── 2023_03_26_085056_create_tax_rates_table.php │ └── 2024_02_09_144402_add_type_to_tax_categories_table.php └── manifest.php /src/Adjustments/Contracts/Adjustable.php: -------------------------------------------------------------------------------- 1 | adjustable; 26 | } 27 | 28 | public function setAdjustable(Adjustable $adjustable): void 29 | { 30 | $this->adjustable = $adjustable; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Adjustments/Support/HasWriteableTitleAndDescription.php: -------------------------------------------------------------------------------- 1 | title; 26 | } 27 | 28 | public function setTitle(string $title): void 29 | { 30 | $this->title = $title; 31 | } 32 | 33 | public function getDescription(): ?string 34 | { 35 | return $this->description; 36 | } 37 | 38 | public function setDescription(?string $description): void 39 | { 40 | $this->description = $description; 41 | } 42 | 43 | public function removeDescription(): void 44 | { 45 | $this->description = null; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Adjustments/Support/IsACharge.php: -------------------------------------------------------------------------------- 1 | type) { 27 | $this->type = AdjustmentTypeProxy::SHIPPING(); 28 | } 29 | 30 | return $this->type; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Adjustments/Support/IsIncluded.php: -------------------------------------------------------------------------------- 1 | isLocked; 24 | } 25 | 26 | public function lock(): void 27 | { 28 | $this->isLocked = true; 29 | } 30 | 31 | public function unlock(): void 32 | { 33 | $this->isLocked = false; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Adjustments/Support/IsNotIncluded.php: -------------------------------------------------------------------------------- 1 | adjustments() as $adjustment) { 28 | $adjustment->getAdjuster()->recalculate($adjustment, $this); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Adjustments/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | ./Tests 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Adjustments/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Adjustments Module', 7 | 'version' => '4.2.0', 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Cart/Contracts/CartEvent.php: -------------------------------------------------------------------------------- 1 | cart; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Cart/Events/CartCreated.php: -------------------------------------------------------------------------------- 1 | id == $event->user->id) { 30 | return; // Don't associate to the same user again 31 | } 32 | Cart::setUser($event->user); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Cart/Listeners/DissociateUserFromCart.php: -------------------------------------------------------------------------------- 1 | true, 7 | 'user' => [ 8 | 'model' => null, // Leave null to use config('auth.providers.users.model'): default of v0.1 - v2.0 9 | ], 10 | 'session_key' => 'vanilo_cart', // The session key where the cart id gets saved 11 | 'auto_destroy' => false, // Whether to immediately delete carts with 0 items 12 | 'auto_assign_user' => true, // Whether to automatically set the user_id on new carts (based on Auth::user()) 13 | 'preserve_for_user' => false, // Whether to keep and restore user carts across logins and devices 14 | 'merge_duplicates' => false, // Whether to merge carts if `preserve_for_user` is enabled, user logs in and the session contains another cart 15 | 'items' => [ 16 | 'extra_product_attributes_to_merge' => [] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /src/Cart/resources/database/migrations/2017_10_28_111947_create_carts_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->integer('user_id')->unsigned()->nullable(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('carts'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Cart/resources/database/migrations/2017_10_29_224033_create_cart_items_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->integer('cart_id')->unsigned(); 20 | $table->string('product_type'); 21 | $table->integer('product_id')->unsigned(); 22 | $table->integer('quantity')->unsigned(); 23 | $table->decimal('price', 15, 4); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('cart_items'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Cart/resources/database/migrations/2018_10_15_224808_add_cart_state.php: -------------------------------------------------------------------------------- 1 | string('state')->default(CartStateProxy::defaultValue()); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::table('carts', function (Blueprint $table) { 31 | $table->dropColumn('state'); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Cart/resources/database/migrations/2023_01_12_123641_add_cart_item_configuration.php: -------------------------------------------------------------------------------- 1 | json('configuration')->nullable()->after('price'); 13 | }); 14 | } 15 | 16 | public function down() 17 | { 18 | Schema::table('cart_items', function (Blueprint $table) { 19 | $table->dropColumn('configuration'); 20 | }); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/Cart/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Cart Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Category/Contracts/Taxonomy.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | $table->string('name'); 15 | $table->string('slug')->nullable(); 16 | $table->timestamps(); 17 | 18 | $table->unique('slug'); 19 | }); 20 | } 21 | 22 | public function down() 23 | { 24 | Schema::drop('taxonomies'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Category/resources/database/migrations/2018_11_04_211505_create_model_taxons_table.php: -------------------------------------------------------------------------------- 1 | integer('taxon_id')->unsigned(); 14 | $table->morphs('model'); 15 | $table->timestamps(); 16 | 17 | $table->foreign('taxon_id') 18 | ->references('id') 19 | ->on('taxons') 20 | ->onDelete('cascade'); 21 | 22 | $table->primary(['taxon_id', 'model_id', 'model_type']); 23 | }); 24 | } 25 | 26 | public function down() 27 | { 28 | Schema::drop('model_taxons'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Category/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Category Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Channel/Contracts/Channel.php: -------------------------------------------------------------------------------- 1 | increments('id'); 15 | $table->string('name'); 16 | $table->string('slug')->nullable(); 17 | $table->json('configuration')->nullable(); 18 | $table->softDeletes(); 19 | $table->timestamps(); 20 | 21 | $table->unique('slug'); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::drop('channels'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Channel/resources/database/migrations/2023_07_10_145614_add_currency_to_the_channels_table.php: -------------------------------------------------------------------------------- 1 | char('currency', 3)->nullable()->after('slug'); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('channels', function (Blueprint $table) { 20 | $table->dropColumn('currency'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Channel/resources/database/migrations/2023_08_31_182424_add_channelables_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedInteger('channel_id'); 15 | $table->string('channelable_type'); 16 | $table->unsignedBigInteger('channelable_id'); 17 | $table->timestamps(); 18 | 19 | $table->foreign('channel_id') 20 | ->references('id') 21 | ->on('channels'); 22 | }); 23 | } 24 | 25 | public function down(): void 26 | { 27 | Schema::drop('channelables'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /src/Channel/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Channel Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Checkout/Contracts/CheckoutDataFactory.php: -------------------------------------------------------------------------------- 1 | checkout; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Checkout/Events/BaseCouponEvent.php: -------------------------------------------------------------------------------- 1 | couponCode = $couponCode; 28 | } 29 | 30 | public function getCouponCode(): string 31 | { 32 | return $this->couponCode; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Checkout/Events/BillpayerChanged.php: -------------------------------------------------------------------------------- 1 | checkout->getBillpayer(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Checkout/Events/CouponAdded.php: -------------------------------------------------------------------------------- 1 | oldPaymentMethodId = $oldPaymentMethodId; 29 | $this->newPaymentMethodId = $checkout->getPaymentMethodId(); 30 | } 31 | 32 | public function selectedPaymentMethodId(): null|int|string 33 | { 34 | return $this->newPaymentMethodId; 35 | } 36 | 37 | public function oldPaymentMethodId(): null|int|string 38 | { 39 | return $this->oldPaymentMethodId; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Checkout/Events/ShippingAddressChanged.php: -------------------------------------------------------------------------------- 1 | checkout->getShippingAddress(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Checkout/Models/CheckoutStateProxy.php: -------------------------------------------------------------------------------- 1 | state instanceof CheckoutState ? $this->state : CheckoutStateProxy::create($this->state); 25 | } 26 | 27 | public function setState($state) 28 | { 29 | $this->state = $state instanceof CheckoutState ? $state : CheckoutStateProxy::create($state); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Checkout/resources/config/module.php: -------------------------------------------------------------------------------- 1 | [ 7 | 'driver' => 'request' 8 | ], 9 | 'default' => [ 10 | 'weight_unit' => 'kg', 11 | ], 12 | ]; 13 | -------------------------------------------------------------------------------- /src/Checkout/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Checkout Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Contracts/Billpayer.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | public function getItems(): Collection; 29 | 30 | public function itemsTotal(): float; 31 | 32 | /** 33 | * Returns the final total of the CheckoutSubject (typically a cart) 34 | */ 35 | public function total(): float; 36 | } 37 | -------------------------------------------------------------------------------- /src/Contracts/CheckoutSubjectItem.php: -------------------------------------------------------------------------------- 1 | getCart(); 26 | if (!($cart instanceof Adjustable)) { 27 | return; 28 | } 29 | 30 | $cart->invalidateAdjustments(); 31 | $cart->fresh()->adjustments()->clear(); 32 | $cart->getItems()->each(fn (CartItem $item) => $item instanceof Adjustable ? $item->adjustments()->clear() : null); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Foundation/Listeners/UpdateCouponUsage.php: -------------------------------------------------------------------------------- 1 | getCouponCode())) { 16 | DB::transaction(function () use ($coupon) { 17 | $coupon->usage_count += 1; 18 | $promotion = $coupon->getPromotion(); 19 | $promotion->usage_count += 1; 20 | $coupon->save(); 21 | $promotion->save(); 22 | }); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Foundation/Listeners/UpdateSalesFigures.php: -------------------------------------------------------------------------------- 1 | getOrder(); 26 | 27 | foreach ($order->getItems() as $item) { 28 | /** @var OrderItem $item */ 29 | if ($item->product instanceof Buyable) { 30 | if ($item->quantity >= 0) { 31 | $item->product->addSale($order->ordered_at ?? $order->created_at, $item->quantity); 32 | } else { 33 | $item->product->removeSale(-1 * $item->quantity); 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Foundation/Models/Address.php: -------------------------------------------------------------------------------- 1 | price * $this->quantity; 32 | } 33 | 34 | public function total(): float 35 | { 36 | return $this->preAdjustmentTotal() + $this->adjustments()->total(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Foundation/Models/PaymentMethod.php: -------------------------------------------------------------------------------- 1 | loadConversionsFromVaniloConfig(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Foundation/Support/helpers.php: -------------------------------------------------------------------------------- 1 | morphToMany(ShipmentProxy::modelClass(), 'shippable')->withTimestamps(); 26 | } 27 | 28 | public function addShipment(ShipmentContract $shipment): static 29 | { 30 | $this->shipments()->save($shipment); 31 | 32 | return $this; 33 | } 34 | 35 | public function addShipments(ShipmentContract ...$shipments) 36 | { 37 | $this->shipments()->saveMany($shipments); 38 | 39 | return $this; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Foundation/resources/database/migrations/2018_11_10_204207_add_sales_attributes_to_products.php: -------------------------------------------------------------------------------- 1 | integer('units_sold')->unsigned()->default(0); 15 | $table->dateTime('last_sale_at')->nullable(); 16 | }); 17 | } 18 | 19 | public function down() 20 | { 21 | Schema::table('products', function (Blueprint $table) { 22 | $table->dropColumn(['units_sold', 'last_sale_at']); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Foundation/resources/database/migrations/2022_07_05_154855_add_channel_id_to_orders_table.php: -------------------------------------------------------------------------------- 1 | intOrBigIntBasedOnRelated('channel_id', Schema::connection(null), 'channels.id') 14 | ->after('shipping_address_id') 15 | ->unsigned() 16 | ->nullable(); 17 | }); 18 | } 19 | 20 | public function down() 21 | { 22 | Schema::table('orders', function (Blueprint $table) { 23 | $table->dropColumn('channel_id'); 24 | }); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/Foundation/resources/database/migrations/2023_03_06_203615_add_payable_remote_id_to_the_orders_table.php: -------------------------------------------------------------------------------- 1 | string('payable_remote_id') 14 | ->nullable() 15 | ->after('channel_id') 16 | ->comment('The remote id used by the payment subsystem') 17 | ; 18 | }); 19 | } 20 | 21 | public function down() 22 | { 23 | Schema::table('orders', function (Blueprint $table) { 24 | $table->dropColumn('payable_remote_id'); 25 | }); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /src/Foundation/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Foundation', 7 | 'version' => '4.2.1' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Links/Contracts/LinkGroup.php: -------------------------------------------------------------------------------- 1 | type); 31 | } 32 | 33 | public function group(): EliminateLinkGroup 34 | { 35 | return new EliminateLinkGroup($this->type); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Links/Query/EliminateLinkGroup.php: -------------------------------------------------------------------------------- 1 | linkGroupsOfModel($model)->map->id); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Links/Query/FindsDesiredLinkGroups.php: -------------------------------------------------------------------------------- 1 | morphMany(LinkGroupItemProxy::modelClass(), 'linkable') 29 | ->get() 30 | ->transform(fn ($item) => $item->group) 31 | ->filter(fn ($group) => $group?->type->id === $this->type->id); 32 | 33 | if ($this->hasPropertyFilter()) { 34 | $groups = $groups->filter(fn ($group) => $group->property_id == $this->propertyId()); 35 | } 36 | 37 | return $groups; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Links/Query/HasBaseModel.php: -------------------------------------------------------------------------------- 1 | baseModel = $model; 26 | 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Links/Query/HasPrivateLinkTypeBasedConstructor.php: -------------------------------------------------------------------------------- 1 | type = $this->normalizeLinkTypeModel($type); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Links/Query/WantsLinksOrGroups.php: -------------------------------------------------------------------------------- 1 | wants = 'links'; 24 | 25 | return $this; 26 | } 27 | 28 | public function groups(): self 29 | { 30 | $this->wants = 'groups'; 31 | 32 | return $this; 33 | } 34 | 35 | public function linkItems(): self 36 | { 37 | $this->wants = 'linkItems'; 38 | 39 | return $this; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Links/Traits/NormalizesLinkType.php: -------------------------------------------------------------------------------- 1 | slug; 28 | 29 | if (!isset($this->linkTypeCache[$slug])) { 30 | $this->linkTypeCache[$slug] = is_string($type) ? LinkTypeProxy::findBySlug($type) : $type; 31 | } 32 | 33 | if (null === $this->linkTypeCache[$slug]) { 34 | throw new InvalidArgumentException("There is no link type with `$slug` slug"); 35 | } 36 | 37 | return $this->linkTypeCache[$slug]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Links/resources/database/migrations/2022_02_11_181838_create_link_types_table.php: -------------------------------------------------------------------------------- 1 | id(); 15 | $table->string('name')->unique(); 16 | $table->string('slug')->unique(); 17 | $table->boolean('is_active')->default(true); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | public function down() 23 | { 24 | Schema::drop('link_types'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Links/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Links Module', 7 | 'version' => '4.2.1' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/MasterProduct/Contracts/MasterProduct.php: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | 12 | ./Tests 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/MasterProduct/resources/database/migrations/2023_01_25_114755_add_description_to_variants_table.php: -------------------------------------------------------------------------------- 1 | text('description')->nullable(); 14 | $table->string('state')->nullable(); 15 | }); 16 | } 17 | 18 | public function down() 19 | { 20 | Schema::table('master_product_variants', function (Blueprint $table) { 21 | $table->dropColumn('description'); 22 | }); 23 | 24 | Schema::table('master_product_variants', function (Blueprint $table) { 25 | $table->dropColumn('state'); 26 | }); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/MasterProduct/resources/database/migrations/2023_11_23_152437_add_backorder_to_master_product_variants_table.php: -------------------------------------------------------------------------------- 1 | decimal('backorder', 15, 4, true)->nullable(); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('master_product_variants', function (Blueprint $table) { 20 | $table->dropColumn('backorder'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/MasterProduct/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Master Product Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Order/Contracts/Billpayer.php: -------------------------------------------------------------------------------- 1 | order = $order; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Order/Events/BaseOrderItemEvent.php: -------------------------------------------------------------------------------- 1 | orderItem = $orderItem; 29 | $this->order = $orderItem->order; 30 | } 31 | 32 | public function getOrderItem(): OrderItem 33 | { 34 | return $this->orderItem; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Order/Events/HasOrder.php: -------------------------------------------------------------------------------- 1 | order; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Order/Events/OrderBillpayerUpdated.php: -------------------------------------------------------------------------------- 1 | [ 7 | 'generator' => 'time_hash', //possible values: time_hash, sequential_number, nano_id 8 | 'sequential_number' => [ 9 | 'start_sequence_from' => 1, 10 | 'prefix' => '', 11 | 'pad_length' => 1, 12 | 'pad_string' => '0' 13 | ], 14 | 'time_hash' => [ 15 | 'high_variance' => false, 16 | 'start_base_date' => '2000-01-01', 17 | 'uppercase' => false 18 | ], 19 | 'nano_id' => [ 20 | 'size' => 12, 21 | 'alphabet' => '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' 22 | ], 23 | ] 24 | ]; 25 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2017_11_27_145105_create_order_items_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | $table->integer('order_id')->unsigned(); 15 | $table->string('product_type'); 16 | $table->integer('product_id')->unsigned(); 17 | $table->string('name')->nullable()->comment('The product name at the moment of buying'); 18 | $table->integer('quantity'); 19 | $table->decimal('price', 15, 4); 20 | $table->timestamps(); 21 | 22 | $table->foreign('order_id') 23 | ->references('id') 24 | ->on('orders') 25 | ->onDelete('cascade'); 26 | }); 27 | } 28 | 29 | public function down() 30 | { 31 | Schema::drop('order_items'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2020_12_29_124643_add_unique_index_to_order_numbers.php: -------------------------------------------------------------------------------- 1 | unique('number', 'order_number_unique'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('orders', function (Blueprint $table) { 20 | $table->dropUnique('order_number_unique'); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2023_01_19_121154_add_order_item_configuration.php: -------------------------------------------------------------------------------- 1 | json('configuration')->nullable()->after('price'); 13 | }); 14 | } 15 | 16 | public function down() 17 | { 18 | Schema::table('order_items', function (Blueprint $table) { 19 | $table->dropColumn('configuration'); 20 | }); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2023_02_20_145123_add_fulfillment_status_to_orders.php: -------------------------------------------------------------------------------- 1 | string('fulfillment_status')->default('unfulfilled')->after('status'); 13 | }); 14 | } 15 | 16 | public function down() 17 | { 18 | Schema::table('orders', function (Blueprint $table) { 19 | $table->dropColumn('fulfillment_status'); 20 | }); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2023_02_20_153027_add_fulfillment_status_to_order_items.php: -------------------------------------------------------------------------------- 1 | string('fulfillment_status')->default('unfulfilled')->after('name'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('order_items', function (Blueprint $table) { 20 | $table->dropColumn('fulfillment_status'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2023_07_10_115351_add_currency_field_to_the_orders_table.php: -------------------------------------------------------------------------------- 1 | char('currency', 3)->nullable()->after('language'); 15 | }); 16 | 17 | // Set default value for `currency` on existing records 18 | $currencyInConfig = config('vanilo.foundation.currency.code'); 19 | if (is_string($currencyInConfig) && 3 === strlen($currencyInConfig)) { 20 | DB::update('UPDATE orders set currency = ?', [$currencyInConfig]); 21 | } 22 | } 23 | 24 | public function down() 25 | { 26 | Schema::table('orders', function (Blueprint $table) { 27 | $table->dropColumn('currency'); 28 | }); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /src/Order/resources/database/migrations/2024_08_27_082142_add_domain_to_the_orders_table.php: -------------------------------------------------------------------------------- 1 | string('domain')->nullable()->after('currency'); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('orders', function (Blueprint $table) { 20 | $table->dropColumn('domain'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Order/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Order Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Payment/Contracts/Payment.php: -------------------------------------------------------------------------------- 1 | methods */ 23 | public function supportsRefunds(): bool; 24 | 25 | public function supportsRetry(): bool; 26 | 27 | public function allowsRefund(Payment $payment): bool; 28 | 29 | public function issueRefund(Payment $payment, float $amount, array $options = []): Transaction|TransactionNotCreated; 30 | 31 | public function canBeRetried(Payment $payment): bool; 32 | 33 | public function getRetryRequest(Payment $payment, array $options = []): PaymentRequest|TransactionNotCreated; 34 | } 35 | -------------------------------------------------------------------------------- /src/Payment/Contracts/TransactionNotCreated.php: -------------------------------------------------------------------------------- 1 | payment = $payment; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Payment/Events/HasPayment.php: -------------------------------------------------------------------------------- 1 | payment; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Payment/Events/PaymentCompleted.php: -------------------------------------------------------------------------------- 1 | amountPaid = $amountPaid; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Payment/Events/PaymentTimedOut.php: -------------------------------------------------------------------------------- 1 | payment = $payment; 27 | } 28 | 29 | public function getHtmlSnippet(array $options = []): ?string 30 | { 31 | return ''; 32 | } 33 | 34 | public function willRedirect(): bool 35 | { 36 | return false; 37 | } 38 | 39 | public function getRemoteId(): ?string 40 | { 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Payment/Responses/NullStatus.php: -------------------------------------------------------------------------------- 1 | $payment->getPaymentId(), 27 | 'payableId' => $payment->getPayable()->getPayableId(), 28 | ]; 29 | 30 | $result = $url; 31 | foreach ($substitutions as $param => $replacement) { 32 | $result = str_replace('{' . $param . '}', $replacement, $result); 33 | } 34 | 35 | if (!Str::startsWith($result, 'http')) { 36 | $result = URL::to($result); 37 | } 38 | 39 | return $result; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Payment/resources/database/migrations/2019_12_17_093757_create_payment_methods_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 15 | $table->string('name'); 16 | $table->text('description')->nullable(); 17 | $table->string('gateway'); 18 | $table->json('configuration'); 19 | $table->boolean('is_enabled')->default(true); 20 | $table->bigInteger('transaction_count')->default(0); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | public function down() 27 | { 28 | Schema::drop('payment_methods'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Payment/resources/database/migrations/2021_02_28_161404_add_status_message_to_payments_table.php: -------------------------------------------------------------------------------- 1 | string('status_message')->nullable()->after('status'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('payments', function (Blueprint $table) { 20 | $table->dropColumn('status_message'); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Payment/resources/database/migrations/2021_03_21_102944_create_payment_history_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 15 | $table->bigInteger('payment_id'); 16 | $table->string('old_status', 35)->nullable(); 17 | $table->string('new_status', 35); 18 | $table->string('message')->nullable(); 19 | $table->string('native_status')->nullable(); 20 | $table->string('transaction_number')->nullable(); 21 | $table->decimal('transaction_amount', 15, 4)->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | public function down() 27 | { 28 | Schema::drop('payment_history'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Payment/resources/database/migrations/2023_03_06_205137_add_subtype_to_payments_table.php: -------------------------------------------------------------------------------- 1 | string('subtype')->nullable()->after('payment_method_id'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('payments', function (Blueprint $table) { 20 | $table->dropColumn('subtype'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Payment/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Payment Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Product/Contracts/Product.php: -------------------------------------------------------------------------------- 1 | decimal('stock', 15, 4)->default(0); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('products', function (Blueprint $table) { 30 | $table->dropColumn('stock'); 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Product/resources/database/migrations/2022_02_28_160230_add_original_price_field_to_products_table.php: -------------------------------------------------------------------------------- 1 | decimal('original_price', 15, 4)->nullable()->after('price'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('products', function (Blueprint $table) { 20 | $table->dropColumn('original_price'); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Product/resources/database/migrations/2023_11_23_091238_add_backorder_to_products_table.php: -------------------------------------------------------------------------------- 1 | decimal('backorder', 15, 4, true)->nullable(); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('products', function (Blueprint $table) { 20 | $table->dropColumn('backorder'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Product/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Product Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Promotion/Contracts/Coupon.php: -------------------------------------------------------------------------------- 1 | __('Inactive'), 18 | self::Active => __('Active'), 19 | self::Expired => __('Expired'), 20 | self::Depleted => __('Depleted'), 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Promotion/PromotionActionTypes.php: -------------------------------------------------------------------------------- 1 | make($class, $parameters); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Promotion/PromotionRuleTypes.php: -------------------------------------------------------------------------------- 1 | make($class, $parameters); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Promotion/resources/database/migrations/2024_06_08_164653_create_coupons_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->foreignId('promotion_id'); 15 | $table->foreign('promotion_id')->references('id')->on('promotions'); 16 | 17 | $table->string('code')->unique(); 18 | $table->unsignedInteger('usage_limit')->nullable(); 19 | $table->unsignedInteger('per_customer_usage_limit')->nullable(); 20 | $table->unsignedInteger('usage_count')->default(0); 21 | $table->dateTime('expires_at')->nullable(); 22 | 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | public function down(): void 28 | { 29 | Schema::drop('coupons'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /src/Promotion/resources/database/migrations/2024_06_09_095853_create_promotion_rules_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->foreignId('promotion_id'); 15 | $table->string('type'); 16 | $table->json('configuration')->nullable(); 17 | $table->timestamps(); 18 | $table->foreign('promotion_id')->references('id')->on('promotions'); 19 | }); 20 | } 21 | 22 | public function down(): void 23 | { 24 | Schema::drop('promotion_rules'); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/Promotion/resources/database/migrations/2024_06_10_175853_create_promotion_actions_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->foreignId('promotion_id'); 15 | $table->string('type'); 16 | $table->json('configuration')->nullable(); 17 | $table->timestamps(); 18 | $table->foreign('promotion_id')->references('id')->on('promotions'); 19 | }); 20 | } 21 | 22 | public function down(): void 23 | { 24 | Schema::drop('promotion_actions'); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /src/Promotion/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Promotion Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Properties/Contracts/Property.php: -------------------------------------------------------------------------------- 1 | 'blue', 'shape' => 'heart'] 30 | * @param array $conditions The keys of the entries = the property slug, the values = the scalar property value 31 | */ 32 | public static function getByScalarPropertiesAndValues(array $conditions): Collection; 33 | } 34 | -------------------------------------------------------------------------------- /src/Properties/Exceptions/UnknownPropertyException.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | $table->string('name'); 15 | $table->string('type'); 16 | $table->string('slug')->nullable(); 17 | $table->json('configuration')->nullable(); 18 | $table->softDeletes(); 19 | $table->timestamps(); 20 | 21 | $table->unique('slug'); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::drop('properties'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Properties/resources/database/migrations/2018_12_08_112321_create_property_values_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | $table->integer('property_id')->unsigned(); 15 | $table->string('value'); 16 | $table->string('title'); 17 | $table->integer('priority')->nullable(); 18 | $table->json('settings')->nullable(); 19 | $table->softDeletes(); 20 | $table->timestamps(); 21 | 22 | $table->foreign('property_id') 23 | ->references('id') 24 | ->on('properties') 25 | ->onDelete('cascade'); 26 | 27 | $table->index('priority'); 28 | }); 29 | } 30 | 31 | public function down() 32 | { 33 | Schema::drop('property_values'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Properties/resources/database/migrations/2018_12_08_124157_create_model_property_values_table.php: -------------------------------------------------------------------------------- 1 | integer('property_value_id')->unsigned(); 14 | $table->morphs('model'); 15 | $table->timestamps(); 16 | 17 | $table->foreign('property_value_id') 18 | ->references('id') 19 | ->on('property_values') 20 | ->onDelete('cascade'); 21 | 22 | $table->primary(['property_value_id', 'model_id', 'model_type'], 'pk_model_property_values'); 23 | }); 24 | } 25 | 26 | public function down() 27 | { 28 | Schema::drop('model_property_values'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Properties/resources/database/migrations/2023_08_23_155708_add_hidden_field_to_properties.php: -------------------------------------------------------------------------------- 1 | boolean('is_hidden')->default(false)->after('configuration'); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('properties', function (Blueprint $table) { 20 | $table->dropColumn('is_hidden'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Properties/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Properties Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Shipment/Contracts/Carrier.php: -------------------------------------------------------------------------------- 1 | isEstimate = $isEstimate; 28 | $this->detailedAmount = $amount instanceof DetailedAmount ? $amount : new \Vanilo\Support\Dto\DetailedAmount($amount); 29 | } 30 | 31 | public function amount(): DetailedAmount 32 | { 33 | return $this->detailedAmount; 34 | } 35 | 36 | public function isEstimate(): bool 37 | { 38 | return $this->isEstimate; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Shipment/Models/ShippingMethodProxy.php: -------------------------------------------------------------------------------- 1 | carrier; 29 | } 30 | 31 | public function carrier(): BelongsTo 32 | { 33 | return $this->belongsTo(CarrierProxy::modelClass(), 'carrier_id', 'id'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2022_02_28_220149_create_carriers_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('name'); 15 | $table->boolean('is_active')->default(true); 16 | $table->json('configuration')->nullable(); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | public function down() 22 | { 23 | Schema::drop('carriers'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2022_02_28_221239_add_carrier_id_to_shipments_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('carrier_id')->nullable()->after('address_id'); 14 | }); 15 | } 16 | 17 | public function down() 18 | { 19 | Schema::table('shipments', function (Blueprint $table) { 20 | $table->dropColumn('carrier_id'); 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2022_03_26_144125_create_shipping_methods_table.php: -------------------------------------------------------------------------------- 1 | id(); 13 | $table->string('name')->nullable(); 14 | $table->bigInteger('carrier_id')->unsigned()->nullable(); 15 | $table->json('configuration')->nullable(); 16 | $table->timestamps(); 17 | 18 | $table->foreign('carrier_id') 19 | ->references('id') 20 | ->on('carriers'); 21 | }); 22 | } 23 | 24 | public function down() 25 | { 26 | Schema::drop('shipping_methods'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2022_11_09_141850_add_active_flag_to_shipping_methods_table.php: -------------------------------------------------------------------------------- 1 | boolean('is_active')->default(true)->after('configuration'); 13 | }); 14 | } 15 | 16 | public function down() 17 | { 18 | Schema::table('shipping_methods', function (Blueprint $table) { 19 | $table->dropColumn('is_active'); 20 | }); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2023_02_20_094957_add_reference_number_to_shipments_table.php: -------------------------------------------------------------------------------- 1 | string('reference_number')->nullable()->after('tracking_number'); 13 | }); 14 | } 15 | 16 | public function down() 17 | { 18 | Schema::table('shipments', function (Blueprint $table) { 19 | $table->dropColumn('reference_number'); 20 | }); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2023_02_20_104644_create_shippables_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedBigInteger('shipment_id'); 15 | $table->string('shippable_type'); 16 | $table->unsignedBigInteger('shippable_id'); 17 | $table->timestamps(); 18 | 19 | $table->foreign('shipment_id') 20 | ->references('id') 21 | ->on('shipments'); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::drop('shippables'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /src/Shipment/resources/database/migrations/2023_02_27_183045_add_zone_to_shipping_methods_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('zone_id')->nullable()->after('carrier_id'); 14 | $table->string('calculator')->nullable()->after('carrier_id'); 15 | }); 16 | } 17 | 18 | public function down() 19 | { 20 | Schema::table('shipping_methods', function (Blueprint $table) { 21 | $table->dropColumn('zone_id'); 22 | }); 23 | Schema::table('shipping_methods', function (Blueprint $table) { 24 | $table->dropColumn('calculator'); 25 | }); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /src/Shipment/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Shipment Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Support/Dto/Dimension.php: -------------------------------------------------------------------------------- 1 | width; 31 | } 32 | 33 | public function height(): float 34 | { 35 | return $this->height; 36 | } 37 | 38 | public function length(): float 39 | { 40 | return $this->length; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Support/Dto/SchemaDefinition.php: -------------------------------------------------------------------------------- 1 | getSchema(), $schematized->getSchemaSample()); 31 | } 32 | 33 | public function getSchema(): Schema 34 | { 35 | return $this->schema; 36 | } 37 | 38 | public function getSchemaSample(array $mergeWith = null): array 39 | { 40 | return $this->sample; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Support/Features/Inventory.php: -------------------------------------------------------------------------------- 1 | module('inventory'); 25 | } 26 | 27 | public function isDisabled(): bool 28 | { 29 | return !$this->isEnabled(); 30 | } 31 | 32 | public function configuration(): array 33 | { 34 | return config('vanilo.features.inventory', []); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Support/Features/MultiChannel.php: -------------------------------------------------------------------------------- 1 | isEnabled(); 29 | } 30 | 31 | public function configuration(): array 32 | { 33 | return config('vanilo.features.multi_channel', []); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Support/Features/Pricing.php: -------------------------------------------------------------------------------- 1 | module('vanilo.pricing'); 25 | } 26 | 27 | public function isDisabled(): bool 28 | { 29 | return !$this->isEnabled(); 30 | } 31 | 32 | public function configuration(): array 33 | { 34 | return config('vanilo.features.pricing', []); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Support/Features/SearchEngine.php: -------------------------------------------------------------------------------- 1 | module('search'); 25 | } 26 | 27 | public function isDisabled(): bool 28 | { 29 | return !$this->isEnabled(); 30 | } 31 | 32 | public function configuration(): array 33 | { 34 | return config('vanilo.features.search_engine', []); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Support/Traits/BuyableNoImage.php: -------------------------------------------------------------------------------- 1 | belongsTo(TaxCategoryProxy::modelClass()); 30 | } 31 | 32 | public function getTaxCategory(): ?TaxCategory 33 | { 34 | return $this->taxCategory; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Taxes/resources/config/module.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'driver' => TaxEngineManager::NULL_DRIVER, 10 | ], 11 | ]; 12 | -------------------------------------------------------------------------------- /src/Taxes/resources/database/migrations/2023_03_17_150427_create_tax_categories_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('name'); 15 | $table->boolean('is_active')->default(true); 16 | $table->timestamps(); 17 | }); 18 | } 19 | 20 | public function down() 21 | { 22 | Schema::drop('tax_categories'); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /src/Taxes/resources/database/migrations/2024_02_09_144402_add_type_to_tax_categories_table.php: -------------------------------------------------------------------------------- 1 | string('type', 64)->default('physical_goods'); 14 | }); 15 | } 16 | 17 | public function down(): void 18 | { 19 | Schema::table('tax_categories', function (Blueprint $table) { 20 | $table->dropColumn('type'); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /src/Taxes/resources/manifest.php: -------------------------------------------------------------------------------- 1 | 'Vanilo Taxes Module', 7 | 'version' => '4.2.0' 8 | ]; 9 | --------------------------------------------------------------------------------