From 581f23515142b6423625788b85ec0eb77d66752e Mon Sep 17 00:00:00 2001 From: Roman Havrylko Date: Fri, 24 Nov 2023 12:16:32 +0100 Subject: [PATCH 1/5] CC-31112: adjusted the checkout glue api ig with skip recalculation configuration. --- .../install-the-checkout-glue-api.md | 946 ++++++++++++++++++ .../checkout-feature-overview.md | 46 + 2 files changed, 992 insertions(+) create mode 100644 _includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md create mode 100644 docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md diff --git a/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md new file mode 100644 index 00000000000..e2e85a8c44b --- /dev/null +++ b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md @@ -0,0 +1,946 @@ + + + +This document describes how to install the [Checkout](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.html) feature API. + +## Install feature core + +Follow the steps below to install Checkout feature API. + +### Prerequisites + +Install the required features: + +| FEATURE | VERSION | INSTALLATION GUIDE | +|-----------------------------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Glue API: Spryker Core | {{page.version}} | [Install the Spryker Core Glue API](/docs/pbc/all/miscellaneous/{{page.version}}/install-and-upgrade/install-glue-api/install-the-spryker-core-glue-api.html) | +| Glue API: Cart | {{page.version}} | [Install the Cart Glue API](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/install-glue-api/install-the-cart-glue-api.html) | +| Glue API: Customer Account Management | {{page.version}} | [Install the Customer Account Management Glue API](/docs/pbc/all/identity-access-management/{{page.version}}/install-and-upgrade/install-the-customer-account-management-glue-api.html) | +| Glue API: Payments | {{page.version}} | [Glue API: Payments feature integration](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | +| Glue API: Shipment | {{page.version}} | [Integrate the Shipment Glue API](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/install-and-upgrade/install-the-shipment-glue-api.html) | + +### 1) Install the required modules using Composer + +Install the required modules: + +```bash +composer require spryker/checkout-rest-api:"3.8.0" spryker/order-payments-rest-api:"^1.0.0" spryker/sales-order-thresholds-rest-api:"^1.0.0" --update-with-dependencies +``` + +{% info_block warningBox "Verification" %} + +Make sure that the following modules have been installed: + +| MODULE | EXPECTED DIRECTORY | +|-----------------------------|------------------------------------------------| +| CheckoutRestApi | vendor/spryker/checkout-rest-api | +| OrderPaymentsRestApi | vendor/spryker/order-payments-rest-api | +| SalesOrderThresholdsRestApi | vendor/spryker/sales-order-thresholds-rest-api | + +{% endinfo_block %} + +### 2) Set up configuration + +1. Add the following configuration to your project: + +| CONFIGURATION | SPECIFICATION | NAMESPACE | +|-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------------| +| CheckoutRestApiConfig::shouldExecuteQuotePostRecalculationPlugins() | Defines if a stack of `QuotePostRecalculatePluginStrategyInterface` plugins should be executed after quote recalculation. | Pyz\Zed\CheckoutRestApi | +| CheckoutRestApiConfig::isRecalculationEnabledForQuoteMapperPlugins() | Defines if quote recalculation in a stack of `QuoteMapperPluginInterface` plugins will be enabled. | Pyz\Zed\CheckoutRestApi | +| CheckoutRestApiConfig::getRequiredCustomerRequestDataForGuestCheckout() | Returns the customer data fields required for checkout as a guest user. | Pyz\Glue\CheckoutRestApi | + +**src/Pyz/Zed/CheckoutRestApi/CheckoutRestApiConfig.php** + +```php + + */ + public function getRequiredCustomerRequestDataForGuestCheckout(): array + { + return array_merge(parent::getRequiredCustomerRequestDataForGuestCheckout(), [ + RestCustomerTransfer::FIRST_NAME, + RestCustomerTransfer::LAST_NAME, + ]); + } +} +``` + + + +2. Add all the payment methods available in the shop to `CheckoutRestApiConfig`—for example: + +
+src/Pyz/Glue/CheckoutRestApi/CheckoutRestApiConfig.php + +```php + ['dummyPaymentInvoice.dateOfBirth'], + 'dummyPaymentCreditCard' => [ + 'dummyPaymentCreditCard.cardType', + 'dummyPaymentCreditCard.cardNumber', + 'dummyPaymentCreditCard.nameOnCard', + 'dummyPaymentCreditCard.cardExpiresMonth', + 'dummyPaymentCreditCard.cardExpiresYear', + 'dummyPaymentCreditCard.cardSecurityCode', + ], + ]; + + /** + * @uses \Spryker\Shared\DummyPayment\DummyPaymentConfig::PROVIDER_NAME + */ + protected const DUMMY_PAYMENT_PROVIDER_NAME = 'DummyPayment'; + + /** + * @uses \Spryker\Shared\DummyPayment\DummyPaymentConfig::PAYMENT_METHOD_NAME_INVOICE + */ + protected const DUMMY_PAYMENT_PAYMENT_METHOD_NAME_INVOICE = 'Invoice'; + + /** + * @uses \Spryker\Shared\DummyPayment\DummyPaymentConfig::PAYMENT_METHOD_NAME_CREDIT_CARD + */ + protected const DUMMY_PAYMENT_PAYMENT_METHOD_NAME_CREDIT_CARD = 'Credit Card'; + + /** + * @uses \Spryker\Shared\DummyPayment\DummyPaymentConfig::PAYMENT_METHOD_INVOICE + */ + protected const PAYMENT_METHOD_INVOICE = 'dummyPaymentInvoice'; + + /** + * @uses \Spryker\Shared\DummyPayment\DummyPaymentConfig::PAYMENT_METHOD_CREDIT_CARD + */ + protected const PAYMENT_METHOD_CREDIT_CARD = 'dummyPaymentCreditCard'; + + protected const IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED = false; + + /** + * @return array + */ + public function getPaymentProviderMethodToStateMachineMapping(): array + { + return [ + static::DUMMY_PAYMENT_PROVIDER_NAME => [ + static::DUMMY_PAYMENT_PAYMENT_METHOD_NAME_CREDIT_CARD => static::PAYMENT_METHOD_CREDIT_CARD, + static::DUMMY_PAYMENT_PAYMENT_METHOD_NAME_INVOICE => static::PAYMENT_METHOD_INVOICE, + ], + ]; + } + + /** + * @return bool + */ + public function isShipmentMethodsMappedToAttributes(): bool + { + return false; + } + + /** + * @return bool + */ + public function isPaymentProvidersMappedToAttributes(): bool + { + return false; + } + + /** + * @return bool + */ + public function isAddressesMappedToAttributes(): bool + { + return false; + } +} +``` +
+ +{% info_block infoBox "Info" %} + +If `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` is true, make sure that the payment methods and providers of your shop are configured in `CheckoutRestApiConfig::getPaymentProviderMethodToStateMachineMapping()`. + +Setting `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` to false ignores the Glue API level configuration. Subsequently, the `checkout-data` endpoint returns all the payment methods. + +{% endinfo_block %} + +{% info_block warningBox “Verification” %} + +For the `checkout-data` endpoint to keep returning shipment methods, keep `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` set to true. + +If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` is true, make sure the shipping method attributes are returned in the `shipmentMethods` after sending the `POST https://glue.mysprykershop.com/checkout-data` request: + +
+Response sample + +```json +{ + "data": { + "type": "checkout-data", + "id": null, + "attributes": { + "addresses": [], + "shipmentMethods": [ + { + "id": 4, + "name": "Air Sonic", + "carrierName": "Spryker Drone Shipment", + "price": 1000, + "taxRate": null, + "deliveryTime": null, + "currencyIsoCode": "EUR" + }, + { + "id": 5, + "name": "Air Light", + "carrierName": "Spryker Drone Shipment", + "price": 1500, + "taxRate": null, + "deliveryTime": null, + "currencyIsoCode": "EUR" + }, + { + "id": 2, + "name": "Express", + "carrierName": "Spryker Dummy Shipment", + "price": 590, + "taxRate": null, + "deliveryTime": null, + "currencyIsoCode": "EUR" + }, + { + "id": 3, + "name": "Air Standard", + "carrierName": "Spryker Drone Shipment", + "price": 500, + "taxRate": null, + "deliveryTime": null, + "currencyIsoCode": "EUR" + }, + { + "id": 1, + "name": "Standard", + "carrierName": "Spryker Dummy Shipment", + "price": 490, + "taxRate": null, + "deliveryTime": null, + "currencyIsoCode": "EUR" + } + ], + ... +} +``` +
+ +{% endinfo_block %} + +{% info_block infoBox "Info" %} + +For the `checkout-data` endpoint to keep returning payment methods, keep `CheckoutRestApiConfig::isPaymentProvidersMappedToAttributes()` set to true. + +{% endinfo_block %} + +{% info_block warningBox "Verification" %} + +If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isPaymentProvidersMappedToAttributes()` is true, make sure the payment methods attributes are returned in the `paymentProviders `attribute after sending the `POST https://glue.mysprykershop.com/checkout-data` request: + +
+Response sample + +```json +{ + "data": { + "type": "checkout-data", + "id": null, + "attributes": { + "addresses": [], + "paymentProviders": [ + { + "paymentProviderName": "DummyPayment", + "paymentMethods": [ + { + "paymentMethodName": "Invoice", + "paymentProviderName": null, + "requiredRequestData": [ + "paymentMethod", + "paymentProvider", + "dummyPaymentInvoice.dateOfBirth" + ] + }, + { + "paymentMethodName": "Credit Card", + "paymentProviderName": null, + "requiredRequestData": [ + "paymentMethod", + "paymentProvider", + "dummyPaymentCreditCard.cardType", + "dummyPaymentCreditCard.cardNumber", + "dummyPaymentCreditCard.nameOnCard", + "dummyPaymentCreditCard.cardExpiresMonth", + "dummyPaymentCreditCard.cardExpiresYear", + "dummyPaymentCreditCard.cardSecurityCode" + ] + } + ] + } + ], + ... +} +``` +
+ +{% endinfo_block %} + +### 3) Set up transfer objects + +Generate transfer changes: + +```bash +console transfer:generate +``` + +{% info_block warningBox "Verification" %} + +Make sure that the following changes have been applied in transfer objects: + +| TRANSFER | TYPE | EVENT | PATH | +|------------------------------------------------------|----------|-------------|------------------------------------------------------------------------------| +| RestCheckoutDataTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutDataTransfer.php | +| RestCheckoutErrorTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutErrorTransfer.php | +| RestCheckoutDataResponseTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutDataResponseTransfer.php | +| RestCheckoutRequestAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutRequestAttributesTransfer.php | +| RestCustomerTransfer | class | created | src/Generated/Shared/Transfer/RestCustomerTransfer.php | +| RestAddressTransfer | class | created | src/Generated/Shared/Transfer/RestAddressTransfer.php | +| RestShipmentTransfer | class | created | src/Generated/Shared/Transfer/RestShipmentTransfer.php | +| RestPaymentTransfer | class | created | src/Generated/Shared/Transfer/RestPaymentTransfer.php | +| RestCheckoutDataResponseAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutDataResponseAttributesTransfer.php | +| RestPaymentProviderTransfer | class | created | src/Generated/Shared/Transfer/RestPaymentProviderTransfer.php | +| RestPaymentMethodTransfer | class | created | src/Generated/Shared/Transfer/RestPaymentMethodTransfer.php | +| RestShipmentMethodTransfer | class | created | src/Generated/Shared/Transfer/RestShipmentMethodTransfer.php | +| RestCheckoutResponseAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutResponseAttributesTransfer.php | +| CheckoutResponseTransfer | class | created | src/Generated/Shared/Transfer/CheckoutResponseTransfer.php | +| SaveOrderTransfer | class | created | src/Generated/Shared/Transfer/SaveOrderTransfer.php | +| CheckoutErrorTransfer | class | created | src/Generated/Shared/Transfer/CheckoutErrorTransfer.php | +| AddressesTransfer | class | created | src/Generated/Shared/Transfer/AddressesTransfer.php | +| AddressTransfer | class | created | src/Generated/Shared/Transfer/AddressTransfer.php | +| ShipmentMethodTransfer | class | created | src/Generated/Shared/Transfer/ShipmentMethodTransfer.php | +| ShipmentMethodsCollectionTransfer | class | created | src/Generated/Shared/Transfer/ShipmentMethodsCollectionTransfer.php | +| PaymentProviderCollectionTransfer | class | created | src/Generated/Shared/Transfer/PaymentProviderCollectionTransfer.php | +| PaymentProviderTransfer | class | created | src/Generated/Shared/Transfer/PaymentProviderTransfer.php | +| PaymentMethodsTransfer | class | created | src/Generated/Shared/Transfer/PaymentMethodsTransfer.php | +| PaymentMethodTransfer | class | created | src/Generated/Shared/Transfer/PaymentMethodTransfer.php | +| QuoteTransfer | class | created | src/Generated/Shared/Transfer/QuoteTransfer.php | +| StoreTransfer | class | created | src/Generated/Shared/Transfer/StoreTransfer.php | +| MoneyValueTransfer | class | created | src/Generated/Shared/Transfer/MoneyValueTransfer.php | +| CurrencyTransfer | class | created | src/Generated/Shared/Transfer/CurrencyTransfer.php | +| QuoteResponseTransfer | class | created | src/Generated/Shared/Transfer/QuoteResponseTransfer.php | +| QuoteErrorTransfer | class | created | src/Generated/Shared/Transfer/QuoteErrorTransfer.php | +| ShipmentTransfer | class | created | src/Generated/Shared/Transfer/ShipmentTransfer.php | +| RestErrorCollectionTransfer | class | created | src/Generated/Shared/Transfer/RestErrorCollectionTransfer.php | +| CheckoutDataTransfer | class | created | src/Generated/Shared/Transfer/CheckoutDataTransfer.php | +| ItemTransfer | class | created | src/Generated/Shared/Transfer/ItemTransfer.php | +| RestCheckoutResponseTransfer | class | created | src/Generated/Shared/Transfer/RestCheckoutResponseTransfer.php | +| RestErrorMessageTransfer | class | created | src/Generated/Shared/Transfer/RestErrorMessageTransfer.php | +| RestCheckoutDataTransfer.quote | property | added | src/Generated/Shared/Transfer/RestCheckoutDataTransfer.php | +| RestCheckoutResponseTransfer.checkoutData | property | added | src/Generated/Shared/Transfer/RestCheckoutResponseTransfer.php | +| CheckoutDataTransfer.quote | property | added | src/Generated/Shared/Transfer/CheckoutDataTransfer.php | +| RestCheckoutDataResponseAttributesTransfer.addresses | property | deprecated | src/Generated/Shared/Transfer/RestCheckoutDataResponseAttributesTransfer.php | +| QuoteTransfer.salesOrderThresholdValues | property | added | src/Generated/Shared/Transfer/QuoteTransfer.php | +| RestCartsAttributesTransfer | class | created | src/Generated/Shared/Transfer/RestCartsAttributesTransfer.php | +| SalesOrderThresholdTypeTransfer | class | created | src/Generated/Shared/Transfer/SalesOrderThresholdTypeTransfer.php | +| SalesOrderThresholdValueTransfer | class | created | src/Generated/Shared/Transfer/SalesOrderThresholdValueTransfer.php | +| RestCartsThresholdsTransfer | class | created | src/Generated/Shared/Transfer/RestCartsThresholdsTransfer.php | + +{% endinfo_block %} + +### 4) Set up behavior + +Set up the following behaviors. + +#### Enable resources and relationships + +Activate the following plugins: + +| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | +|-------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|---------------|-----------------------------------------------------| +| CheckoutDataResourcePlugin | Registers the `checkout-data` resource. | None | Spryker\Glue\CheckoutRestApi\Plugin\GlueApplication | +| CheckoutResourcePlugin | Registers the `checkout` resource. | None | Spryker\Glue\CheckoutRestApi\Plugin\GlueApplication | +| OrderRelationshipByOrderReferencePlugin | Adds a relationship to the `order` entity by order reference. | None | Spryker\Glue\OrdersRestApi\Plugin | +| OrderPaymentsResourceRoutePlugin | Registers the `order-payments` resource. | None | Spryker\Glue\OrderPaymentsRestApi\Plugin | +| CartByRestCheckoutDataResourceRelationshipPlugin | Adds `carts` resource as a relationship by `RestCheckoutDataTransfer.quote`. Applies only to registered customers. | None | Spryker\Glue\CartsRestApi\Plugin\GlueApplication | +| GuestCartByRestCheckoutDataResourceRelationshipPlugin | Adds `guest-carts` resource as the relationship by `RestCheckoutDataTransfer.quote`. Applies only to guest customers. | None | Spryker\Glue\CartsRestApi\Plugin\GlueApplication | + +
+src/Pyz/Glue/GlueApplication/GlueApplicationDependencyProvider.php + +```php +addRelationship( + CheckoutRestApiConfig::RESOURCE_CHECKOUT, + new OrderRelationshipByOrderReferencePlugin() + ); + $resourceRelationshipCollection->addRelationship( + CheckoutRestApiConfig::RESOURCE_CHECKOUT_DATA, + new CartByRestCheckoutDataResourceRelationshipPlugin(), + ); + $resourceRelationshipCollection->addRelationship( + CheckoutRestApiConfig::RESOURCE_CHECKOUT_DATA, + new GuestCartByRestCheckoutDataResourceRelationshipPlugin(), + ); + + return $resourceRelationshipCollection; + } +} +``` +
+ +{% info_block warningBox "Verification" %} + +Make sure that the following plugins are activated: + +| PLUGIN | TEST | +|-------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| CheckoutDataResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout-data` request. | +| CheckoutResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout` request. | +| OrderRelationshipByOrderReferencePlugin | Check if you get order information from the `orders` resource by sending the `POST https://glue.mysprykershop.com/checkout?include=orders` request. | +| CartByRestCheckoutDataResourceRelationshipPlugin | Check if you get cart data as a relationship from the `checkout-data` resource by sending the `POST https://glue.mysprykershop.com/checkout-data?include=carts` request. | +| GuestCartByRestCheckoutDataResourceRelationshipPlugin | Check if you get guest cart data as a relationship from the `checkout-data` resource by sending the `POST https://glue.mysprykershop.com/checkout?include=guest-carts` request. | + +To make sure that `OrderPaymentsResourceRoutePlugin` is activated, check if you get a valid response by sending the following request: + +**https://glue.mysprykershop.com/order-payments** + +```json +{ + "data": { + "type": "order-payments", + "attributes": { + "paymentIdentifier": {% raw %}{{{% endraw %}paymentIdentifier{% raw %}}}{% endraw %}, + "dataPayload": {% raw %}{{{% endraw %}dataPayload{% raw %}}}{% endraw %} + } + } +} +``` + +To ensure that `CartByRestCheckoutDataResourceRelationshipPlugin` is set up correctly, do the following: + +1. Send a request with an authorization token to a `checkout-data` endpoint with `carts` relation—for example, send the `POST https://glue.mysprykershop.com/checkout-data?include=carts` request with the request body: + +```json +{"data": + {"type": "checkout-data", + "attributes": + { + "idCart": "_cart_id", + "shipment": { + "idShipmentMethod": 1 + } + } + } +} +``` + +2. Check that the cart data is returned as a relationship and contains `shipmentTotal` in cart totals: + +```json +{ + "data": { + "type": "checkout-data", + ... + }, + ... + "relationships": { + "carts": { + "data": [ + { + "type": "carts", + "id": "_cart_id" + } + ] + } + } + }, + "included": [ + { + "type": "carts", + "id": "_cart_id", + "attributes": { + ... + "totals": { + ... + "shipmentTotal": ... + } + } + } + ] +} +``` + +Ensure that `GuestCartByRestCheckoutDataResourceRelationshipPlugin` is set up correctly: + +1. Send a request with an anonymous customer ID to a `checkout-data` endpoint with `guest-carts` relation—for example, send the `POST https://glue.mysprykershop.com/checkout-data?include=guest-carts` request with the request body: + +```json +{"data": + {"type": "checkout-data", + "attributes": + { + "idCart": "_cart_id", + "shipment": { + "idShipmentMethod": 1 + } + } + } +} +``` + +2. Check that the guest cart data is returned as a relationship and contains `shipmentTotal` in cart totals: + +```json +{ + "data": { + "type": "checkout-data", + ... + }, + ... + "relationships": { + "guest-carts": { + "data": [ + { + "type": "guest-carts", + "id": "_cart_id" + } + ] + } + } + }, + "included": [ + { + "type": "guest-carts", + "id": "_cart_id", + "attributes": { + ... + "totals": { + ... + "shipmentTotal": ... + } + } + } + ] +} +``` + +{% endinfo_block %} + +For more details, see [Implementing Checkout Steps for Glue API](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/interact-with-third-party-payment-providers-using-glue-api.html). + +#### Configure mapping + +Mappers must be configured on a project level to map the data from the request into `QuoteTransfer`: + + +| PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | +|---------------------------|--------------------------------------------------------------------------------------|---------------|-------------------------------------------------------------------| +| CustomerQuoteMapperPlugin | Adds a mapper that maps customer information to `QuoteTransfer`. | None | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | +| AddressQuoteMapperPlugin | Adds a mapper that maps billing and shipping address information to `QuoteTransfer`. | None | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | + + +**src/Pyz/Zed/CheckoutRestApi/CheckoutRestApiDependencyProvider.php** + +```php + + */ + protected function getRestCartAttributesMapperPlugins(): array + { + return [ + new SalesOrderThresholdRestCartAttributesMapperPlugin(), + ]; + } +} +``` + +**src/Pyz/Zed/Cart/CartDependencyProvider.php** + +```php + + */ + protected function getTerminationPlugins(Container $container): array + { + return [ + new SalesOrderThresholdCartTerminationPlugin(), + ]; + } +} +``` + +**src/Pyz/Zed/CartsRestApi/CartsRestApiDependencyProvider.php** + +```php + + */ + protected function getQuoteExpanderPlugins(): array + { + return [ + new SalesOrderThresholdQuoteExpanderPlugin(), + ]; + } +} +``` + +**src/Pyz/Zed/CheckoutRestApi/CheckoutRestApiDependencyProvider.php** + +```php + + */ + protected function getReadCheckoutDataValidatorPlugins(): array + { + return [ + new SalesOrderThresholdReadCheckoutDataValidatorPlugin(), + ]; + } +} +``` + + +{% info_block warningBox "Verification" %} + +Ensure that the plugins work correctly: + +1. [Set up the Minimum Hard Threshold](/docs/scos/user/back-office-user-guides/{{page.version}}/administration/thresholds/managing-global-thresholds.html). +2. Add a product to the cart with a price less minimum threshold value. +3. Check that the following error is returned by sending the `GET https://glue.mysprykershop.com/carts/{cart-uuid}` request. + +```json +{ + "data": { + "type": "carts", + "id": "1ce91011-8d60-59ef-9fe0-4493ef3628b2", + "attributes": { + "priceMode": "GROSS_MODE", + "currency": "EUR", + "store": "DE", + "name": "My Cart", + "isDefault": true, + "totals": { + "expenseTotal": 0, + "discountTotal": 0, + "taxTotal": 4151, + "subtotal": 26000, + "grandTotal": 26000, + "priceToPay": 26000 + }, + "discounts": [], + "thresholds": [ + { + "type": "hard-minimum-threshold", + "threshold": 200000, + "fee": null, + "deltaWithSubtotal": 174000, + "message": "You need to add items for €2,000.00 to pass a recommended threshold, but if you want can proceed to checkout." + } + ] + }, + "links": { + "self": "http://glue.de.spryker.local/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" + } + } +} +``` + +4. Check that the following error is returned by sending the `POST https://glue.mysprykershop.com/checkout-data` request. + +```json +{ + "errors": [ + { + "code": "1101", + "status": 422, + "detail": "You need to add items for €2,000.00 to pass a recommended threshold, but if you want can proceed to checkout." + } + ] +} +``` + +5. Add more products to cart to satisfy the minimum threshold value. +6. Check the result by sending the `GET https://glue.mysprykershop.com/carts/{cart-uuid}` request. + +```json +{ + "data": { + "type": "carts", + "id": "1ce91011-8d60-59ef-9fe0-4493ef3628b2", + "attributes": { + "priceMode": "GROSS_MODE", + "currency": "EUR", + "store": "DE", + "name": "My Cart", + "isDefault": true, + "totals": { + "expenseTotal": 0, + "discountTotal": 0, + "taxTotal": 45664, + "subtotal": 286000, + "grandTotal": 286000, + "priceToPay": 286000 + }, + "discounts": [], + "thresholds": [] + }, + "links": { + "self": "http://glue.de.spryker.local/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" + } + } +} +``` + +7. Check the result by sending the `POST https://glue.mysprykershop.com/checkout-data` request. + +```json +{ + "data": { + "type": "checkout-data", + "id": null, + "attributes": { + "addresses": [], + "paymentProviders": [], + "shipmentMethods": [], + "selectedShipmentMethods": [], + "selectedPaymentMethods": [] + }, + "links": { + "self": "http://glue.de.spryker.local/checkout-data" + } + } +} +``` + +{% endinfo_block %} + +## Install related features + +Integrate the following related features. + +| FEATURE | REQUIRED FOR THE CURRENT FEATURE | INSTALLATION GUIDE | +|--------------------|----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Glue API: Shipment | ✓ | [Install the Shipment Glue API](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/install-and-upgrade/install-the-shipment-glue-api.html) | +| Glue API: Payments | ✓ | [Glue API: Payments feature integration](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | diff --git a/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md new file mode 100644 index 00000000000..074af972f77 --- /dev/null +++ b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md @@ -0,0 +1,46 @@ +--- +title: Checkout feature overview +description: The checkout workflow is a multi-step process that can be fullly customized to fit your needs. +last_updated: Nov 24, 2023 +template: concept-topic-template +originalLink: https://documentation.spryker.com/2021080/docs/checkout +originalArticleId: 7dcc5635-2a15-410c-9a0b-bc62a13dd3a1 +redirect_from: + - /docs/scos/user/features/202311.0/checkout-feature-overview/checkout-feature-overview.html + - /docs/scos/dev/feature-walkthroughs/202311.0/checkout-feature-walkthrough.html + - /docs/pbc/all/cart-and-checkout/202311.0/checkout-feature-overview/checkout-feature-overview.html + - /docs/pbc/all/cart-and-checkout/202311.0/base-shop/checkout-feature-overview/checkout-feature-overview.html +--- + +Offer customers a smooth shopping experience by customizing the checkout workflow. Add, delete, and configure any checkout step, like customer account login, shipment and payment methods, or checkout overview. + +The *Checkout* feature lets customers select single or multiple products and add wishlist items to their cart, as well as integrate different carriers and delivery methods. + +Control the values of the orders that your customers place by defining order thresholds. + +Fulfilling small orders is not always worthwhile for the business because operating costs, time, and effort spent on processing them often overweight the profit gained. In such cases, implementing a minimum threshold might be the solution to prevent orders that are too small from being made. The *[Order Thresholds](/docs/scos/user/features/{{site.version}}/checkout-feature-overview/order-thresholds-overview.html)* feature provides you with multiple options for defining thresholds. You can define a minimum threshold and disallow placing orders with smaller values or request customers to pay a fee. + +Per your business requirements, you can also set up a maximum threshold to disallow placing orders above a defined threshold. + +In a B2B scenario, you can define any type of threshold for each [merchant relation](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/merchant-b2b-contracts-feature-overview.html) separately. + +With order thresholds, you can do the following: + +* Ensure buyers place bigger orders, which can increase your sales. +* Prevent the waste of resources on small orders. +* Ensure that the cost of items sold is not too high for each transaction, which, in the long run, can make your business more profitable. +* Support promotional campaigns, by offering free shipping for orders above a threshold and other perks. + +## Related Business User documents + +| OVERVIEWS | BACK OFFICE USER GUIDES | +|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| +| [Multi-step Checkout](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/feature-overviews/checkout-feature-overview/multi-step-checkout-overview.html) | [Define global thresholds](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/manage-in-the-back-office/define-global-thresholds.html) | +| [Order Thresholds](/docs/scos/user/features/{{site.version}}/checkout-feature-overview/order-thresholds-overview.html) | [Manage threshold settings](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/manage-in-the-back-office/manage-threshold-settings.html) | + +## Related Developer documents + +| INSTALLATION GUIDES | UPGRADE GUIDES | DATA IMPORT | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Install the Checkout feature](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/install-features/install-the-checkout-feature.html) | [Upgrade the Checkout module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkout-module.html) | [File details: sales_order_threshold.csv](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/import-and-export-data/import-file-details-sales-order-threshold.csv.html) | +| [Merchant feature integration](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/install-and-upgrade/install-the-merchant-feature.html) | [Upgrade the CheckoutPage module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkoutpage-module.html) | | From b41a0ea6eb269abb811825fbeb51c6e5c661fbfc Mon Sep 17 00:00:00 2001 From: Roman Havrylko Date: Fri, 24 Nov 2023 14:38:03 +0100 Subject: [PATCH 2/5] CC-31112: updated packages versions. --- .../202403.0/install-glue-api/install-the-checkout-glue-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md index e2e85a8c44b..f2612080e92 100644 --- a/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md +++ b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md @@ -24,7 +24,7 @@ Install the required features: Install the required modules: ```bash -composer require spryker/checkout-rest-api:"3.8.0" spryker/order-payments-rest-api:"^1.0.0" spryker/sales-order-thresholds-rest-api:"^1.0.0" --update-with-dependencies +composer require spryker/checkout-rest-api:"3.10.0" spryker/order-payments-rest-api:"^1.0.1" spryker/sales-order-thresholds-rest-api:"^1.0.0" --update-with-dependencies ``` {% info_block warningBox "Verification" %} From 28a97f4ba14f8b2eaefda30555df52b9e62f591e Mon Sep 17 00:00:00 2001 From: Andrii Tserkovnyi Date: Wed, 27 Dec 2023 15:21:51 +0200 Subject: [PATCH 3/5] Update install-the-checkout-glue-api.md --- .../install-the-checkout-glue-api.md | 155 ++++++++++-------- 1 file changed, 85 insertions(+), 70 deletions(-) diff --git a/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md index f2612080e92..5f75d608c01 100644 --- a/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md +++ b/_includes/pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md @@ -1,13 +1,6 @@ +This document describes how to install the [Checkout](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.html) Glue API. - - -This document describes how to install the [Checkout](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.html) feature API. - -## Install feature core - -Follow the steps below to install Checkout feature API. - -### Prerequisites +## Prerequisites Install the required features: @@ -16,12 +9,12 @@ Install the required features: | Glue API: Spryker Core | {{page.version}} | [Install the Spryker Core Glue API](/docs/pbc/all/miscellaneous/{{page.version}}/install-and-upgrade/install-glue-api/install-the-spryker-core-glue-api.html) | | Glue API: Cart | {{page.version}} | [Install the Cart Glue API](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/install-glue-api/install-the-cart-glue-api.html) | | Glue API: Customer Account Management | {{page.version}} | [Install the Customer Account Management Glue API](/docs/pbc/all/identity-access-management/{{page.version}}/install-and-upgrade/install-the-customer-account-management-glue-api.html) | -| Glue API: Payments | {{page.version}} | [Glue API: Payments feature integration](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | -| Glue API: Shipment | {{page.version}} | [Integrate the Shipment Glue API](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/install-and-upgrade/install-the-shipment-glue-api.html) | +| Glue API: Payments | {{page.version}} | [Install the Payments Glue API](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | +| Glue API: Shipment | {{page.version}} | [Install the Shipment Glue API](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/install-and-upgrade/install-the-shipment-glue-api.html) | -### 1) Install the required modules using Composer +## 1) Install the required modules -Install the required modules: +Install the required modules using Composer: ```bash composer require spryker/checkout-rest-api:"3.10.0" spryker/order-payments-rest-api:"^1.0.1" spryker/sales-order-thresholds-rest-api:"^1.0.0" --update-with-dependencies @@ -39,14 +32,14 @@ Make sure that the following modules have been installed: {% endinfo_block %} -### 2) Set up configuration +## 2) Set up configuration -1. Add the following configuration to your project: +1. Add the following configuration: | CONFIGURATION | SPECIFICATION | NAMESPACE | |-------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------------| | CheckoutRestApiConfig::shouldExecuteQuotePostRecalculationPlugins() | Defines if a stack of `QuotePostRecalculatePluginStrategyInterface` plugins should be executed after quote recalculation. | Pyz\Zed\CheckoutRestApi | -| CheckoutRestApiConfig::isRecalculationEnabledForQuoteMapperPlugins() | Defines if quote recalculation in a stack of `QuoteMapperPluginInterface` plugins will be enabled. | Pyz\Zed\CheckoutRestApi | +| CheckoutRestApiConfig::isRecalculationEnabledForQuoteMapperPlugins() | Defines if quote recalculation in a stack of `QuoteMapperPluginInterface` plugins is to be enabled. | Pyz\Zed\CheckoutRestApi | | CheckoutRestApiConfig::getRequiredCustomerRequestDataForGuestCheckout() | Returns the customer data fields required for checkout as a guest user. | Pyz\Glue\CheckoutRestApi | **src/Pyz/Zed/CheckoutRestApi/CheckoutRestApiConfig.php** @@ -67,7 +60,7 @@ class CheckoutRestApiConfig extends SprykerCheckoutRestApiConfig { return false; } - + /** * @return bool */ @@ -198,19 +191,20 @@ class CheckoutRestApiConfig extends SprykerCheckoutRestApiConfig ``` -{% info_block infoBox "Info" %} +{% info_block infoBox "" %} + +* If `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` is true, make sure that the payment methods and providers of your shop are configured in `CheckoutRestApiConfig::getPaymentProviderMethodToStateMachineMapping()`. -If `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` is true, make sure that the payment methods and providers of your shop are configured in `CheckoutRestApiConfig::getPaymentProviderMethodToStateMachineMapping()`. +* Setting `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` to false ignores the Glue API level configuration. Subsequently, the `checkout-data` endpoint returns all the payment methods. + +* For the `checkout-data` endpoint to keep returning shipment methods, keep `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` set to true. -Setting `CheckoutRestApiConfig::IS_PAYMENT_PROVIDER_METHOD_TO_STATE_MACHINE_MAPPING_ENABLED` to false ignores the Glue API level configuration. Subsequently, the `checkout-data` endpoint returns all the payment methods. {% endinfo_block %} {% info_block warningBox “Verification” %} -For the `checkout-data` endpoint to keep returning shipment methods, keep `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` set to true. - -If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` is true, make sure the shipping method attributes are returned in the `shipmentMethods` after sending the `POST https://glue.mysprykershop.com/checkout-data` request: +If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAttributes()` is true, make sure the `checkout-data` endpoint returns shipping methods in the `shipmentMethods` attribute.
Response sample @@ -276,7 +270,7 @@ If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isShipmentMethodsMappedToAtt {% endinfo_block %} -{% info_block infoBox "Info" %} +{% info_block infoBox "" %} For the `checkout-data` endpoint to keep returning payment methods, keep `CheckoutRestApiConfig::isPaymentProvidersMappedToAttributes()` set to true. @@ -284,7 +278,7 @@ For the `checkout-data` endpoint to keep returning payment methods, keep `Checko {% info_block warningBox "Verification" %} -If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isPaymentProvidersMappedToAttributes()` is true, make sure the payment methods attributes are returned in the `paymentProviders `attribute after sending the `POST https://glue.mysprykershop.com/checkout-data` request: +If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isPaymentProvidersMappedToAttributes()` is true, make sure the `checkout-data` endpoint returns payment methods in the `paymentProviders` attribute.
Response sample @@ -333,7 +327,7 @@ If `Pyz\Glue\CheckoutRestApi\CheckoutRestApiConfig::isPaymentProvidersMappedToAt {% endinfo_block %} -### 3) Set up transfer objects +## 3) Set up transfer objects Generate transfer changes: @@ -395,11 +389,11 @@ Make sure that the following changes have been applied in transfer objects: {% endinfo_block %} -### 4) Set up behavior +## 4) Set up behavior Set up the following behaviors. -#### Enable resources and relationships +### Enable resources and relationships Activate the following plugins: @@ -473,20 +467,23 @@ class GlueApplicationDependencyProvider extends SprykerGlueApplicationDependency {% info_block warningBox "Verification" %} -Make sure that the following plugins are activated: +Make sure that the following plugins have been activated: | PLUGIN | TEST | |-------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| CheckoutDataResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout-data` request. | -| CheckoutResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout` request. | -| OrderRelationshipByOrderReferencePlugin | Check if you get order information from the `orders` resource by sending the `POST https://glue.mysprykershop.com/checkout?include=orders` request. | +| CheckoutDataResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout-data` request. +| CheckoutResourcePlugin | Check if you get a valid response by sending the `POST https://glue.mysprykershop.com/checkout` request. | +| OrderRelationshipByOrderReferencePlugin | Check if you get order information from the `orders` resource by sending the `POST https://glue.mysprykershop.com/checkout?include=orders` request. | | CartByRestCheckoutDataResourceRelationshipPlugin | Check if you get cart data as a relationship from the `checkout-data` resource by sending the `POST https://glue.mysprykershop.com/checkout-data?include=carts` request. | | GuestCartByRestCheckoutDataResourceRelationshipPlugin | Check if you get guest cart data as a relationship from the `checkout-data` resource by sending the `POST https://glue.mysprykershop.com/checkout?include=guest-carts` request. | -To make sure that `OrderPaymentsResourceRoutePlugin` is activated, check if you get a valid response by sending the following request: +{% endinfo_block %} + +{% info_block warningBox "Verification" %} -**https://glue.mysprykershop.com/order-payments** +To make sure that `OrderPaymentsResourceRoutePlugin` has been activated, check if you get a valid response by sending the following request: +`POST https://glue.mysprykershop.com/order-payments` ```json { "data": { @@ -499,15 +496,20 @@ To make sure that `OrderPaymentsResourceRoutePlugin` is activated, check if you } ``` -To ensure that `CartByRestCheckoutDataResourceRelationshipPlugin` is set up correctly, do the following: +{% endinfo_block %} + +{% info_block warningBox "Verification" %} + +Make sure `CartByRestCheckoutDataResourceRelationshipPlugin` has been activated: -1. Send a request with an authorization token to a `checkout-data` endpoint with `carts` relation—for example, send the `POST https://glue.mysprykershop.com/checkout-data?include=carts` request with the request body: +1. Send the request: +`POST https://glue.mysprykershop.com/checkout-data?include=carts` ```json -{"data": - {"type": "checkout-data", - "attributes": - { +{ + "data": { + "type": "checkout-data", + "attributes": { "idCart": "_cart_id", "shipment": { "idShipmentMethod": 1 @@ -553,9 +555,15 @@ To ensure that `CartByRestCheckoutDataResourceRelationshipPlugin` is set up corr } ``` -Ensure that `GuestCartByRestCheckoutDataResourceRelationshipPlugin` is set up correctly: +{% endinfo_block %} -1. Send a request with an anonymous customer ID to a `checkout-data` endpoint with `guest-carts` relation—for example, send the `POST https://glue.mysprykershop.com/checkout-data?include=guest-carts` request with the request body: +{% info_block warningBox "Verification" %} + +Make sure `GuestCartByRestCheckoutDataResourceRelationshipPlugin` has been activated: + +1. Send the following request with an anonymous customer ID: + +`POST https://glue.mysprykershop.com/checkout-data?include=guest-carts` ```json {"data": @@ -609,17 +617,17 @@ Ensure that `GuestCartByRestCheckoutDataResourceRelationshipPlugin` is set up co {% endinfo_block %} -For more details, see [Implementing Checkout Steps for Glue API](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/interact-with-third-party-payment-providers-using-glue-api.html). +For more details, see [Interact with third party payment providers using Glue API](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/interact-with-third-party-payment-providers-using-glue-api.html). -#### Configure mapping +### Configure mapping -Mappers must be configured on a project level to map the data from the request into `QuoteTransfer`: +On the project level, configure the following mappers to map the data from the request to `QuoteTransfer`: | PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | |---------------------------|--------------------------------------------------------------------------------------|---------------|-------------------------------------------------------------------| -| CustomerQuoteMapperPlugin | Adds a mapper that maps customer information to `QuoteTransfer`. | None | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | -| AddressQuoteMapperPlugin | Adds a mapper that maps billing and shipping address information to `QuoteTransfer`. | None | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | +| CustomerQuoteMapperPlugin | Adds a mapper that maps customer information to `QuoteTransfer`. | | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | +| AddressQuoteMapperPlugin | Adds a mapper that maps billing and shipping address information to `QuoteTransfer`. | | Spryker\Zed\CustomersRestApi\Communication\Plugin\CheckoutRestApi | **src/Pyz/Zed/CheckoutRestApi/CheckoutRestApiDependencyProvider.php** @@ -650,19 +658,19 @@ class CheckoutRestApiDependencyProvider extends SprykerCheckoutRestApiDependency {% info_block warningBox "Verification" %} -To make sure that `CustomerQuoteMapperPlugin` is activated, send the `POST https://glue.mysprykershop.com/checkout` request and check that the returned order information contains the customer information you have provided in the request. +* To make sure `CustomerQuoteMapperPlugin` has been activated, send the `POST https://glue.mysprykershop.com/checkout` request and check that the returned order information contains the customer information you have provided in the request. -To make sure that `AddressQuoteMapperPlugin` is activated, send a `POST https://glue.mysprykershop.com/checkout` request and check that the returned order information contains the billing and shipping address information you have provided in the request. +* To make sure `AddressQuoteMapperPlugin` has been activated, send the `POST https://glue.mysprykershop.com/checkout` request and check that the returned order information contains the billing and shipping address information you have provided in the request. {% endinfo_block %} -#### Configure the single payment method validator plugin +### Configure the single payment method validator plugin Activate the following plugins: | PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | |-------------------------------------------------------|------------------------------------------------------------------------|---------------|-------------------------------------| -| SinglePaymentCheckoutRequestAttributesValidatorPlugin | Validates that checkout request data contains only one payment method. | None | Spryker\Glue\CheckoutRestApi\Plugin | +| SinglePaymentCheckoutRequestAttributesValidatorPlugin | Validates if checkout request data contains only one payment method. | | Spryker\Glue\CheckoutRestApi\Plugin | **src/Pyz/Glue/CheckoutRestApi/CheckoutRestApiDependencyProvider.php** @@ -694,7 +702,7 @@ class CheckoutRestApiDependencyProvider extends SprykerCheckoutRestApiDependency {% info_block warningBox "Verification" %} -To make sure that `SinglePaymentCheckoutRequestAttributesValidatorPlugin` is activated, check that the following error is returned by sending the `POST https://glue.mysprykershop.com/checkout` request. +To make sure that `SinglePaymentCheckoutRequestAttributesValidatorPlugin` has been activated, send the `POST https://glue.mysprykershop.com/checkout` request and check that the following error is returned: ```json { @@ -710,16 +718,16 @@ To make sure that `SinglePaymentCheckoutRequestAttributesValidatorPlugin` is act {% endinfo_block %} -#### Configure minimum order value plugins +### Configure minimum order value plugins Activate the following plugins: | PLUGIN | SPECIFICATION | PREREQUISITES | NAMESPACE | |----------------------------------------------------|----------------------------------------------------------------------------------------------|---------------|------------------------------------------------------------------------------| -| SalesOrderThresholdRestCartAttributesMapperPlugin | Maps `QuoteTransfer.salesOrderThresholdValues` to `RestCartsAttributesTransfer.thresholds`. | None | Spryker\Glue\SalesOrderThresholdsRestApi\Plugin\CartsRestApi | -| SalesOrderThresholdCartTerminationPlugin | Finds applicable thresholds and expands quote with sales order thresholds data. | None | Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Cart | -| SalesOrderThresholdQuoteExpanderPlugin | Finds applicable thresholds and expands quote with sales order thresholds data. | None | Spryker\Zed\SalesOrderThresholdsRestApi\Communication\Plugin\CartsRestApi | -| SalesOrderThresholdReadCheckoutDataValidatorPlugin | Finds applicable thresholds and adds error messages if threshold conditions are not matched. | None | Spryker\Zed\SalesOrderThresholdsRestApi\Communication\Plugin\CheckoutRestApi | +| SalesOrderThresholdRestCartAttributesMapperPlugin | Maps `QuoteTransfer.salesOrderThresholdValues` to `RestCartsAttributesTransfer.thresholds`. | | Spryker\Glue\SalesOrderThresholdsRestApi\Plugin\CartsRestApi | +| SalesOrderThresholdCartTerminationPlugin | Finds applicable thresholds and expands quote with sales order thresholds data. | | Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Cart | +| SalesOrderThresholdQuoteExpanderPlugin | Finds applicable thresholds and expands quote with sales order thresholds data. | | Spryker\Zed\SalesOrderThresholdsRestApi\Communication\Plugin\CartsRestApi | +| SalesOrderThresholdReadCheckoutDataValidatorPlugin | Finds applicable thresholds and adds error messages if threshold conditions are not met. | | Spryker\Zed\SalesOrderThresholdsRestApi\Communication\Plugin\CheckoutRestApi | **src/Pyz/Glue/CartsRestApi/CartsRestApiDependencyProvider.php** @@ -826,9 +834,12 @@ class CheckoutRestApiDependencyProvider extends SprykerCheckoutRestApiDependency Ensure that the plugins work correctly: -1. [Set up the Minimum Hard Threshold](/docs/scos/user/back-office-user-guides/{{page.version}}/administration/thresholds/managing-global-thresholds.html). -2. Add a product to the cart with a price less minimum threshold value. -3. Check that the following error is returned by sending the `GET https://glue.mysprykershop.com/carts/{cart-uuid}` request. +1. [Set up a minimum hard threshold](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/manage-in-the-back-office/define-global-thresholds.html#define-a-minimum-hard-threshold.html). +2. Add a product to cart with a price lower than the threshold you've set. +3. Send the request: `GET https://glue.mysprykershop.com/carts/{cart-uuid}` + Make sure the message about threshold conditions not being met is returned. Example: +
+ Response sample with threshold conditions not met ```json { @@ -861,13 +872,15 @@ Ensure that the plugins work correctly: ] }, "links": { - "self": "http://glue.de.spryker.local/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" + "self": "https://glue.mysprykershop.com/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" } } } ``` -4. Check that the following error is returned by sending the `POST https://glue.mysprykershop.com/checkout-data` request. +
+ +4. Send the `POST https://glue.mysprykershop.com/checkout-data` request and check that the following error is returned. ```json { @@ -881,9 +894,12 @@ Ensure that the plugins work correctly: } ``` -5. Add more products to cart to satisfy the minimum threshold value. -6. Check the result by sending the `GET https://glue.mysprykershop.com/carts/{cart-uuid}` request. +5. Add more products to cart to satisfy the minimum threshold you've set. +6. To check that the cart meets the threshold conditions, send the following request: `GET https://glue.mysprykershop.com/carts/{cart-uuid}`. + The threshold message shouldn't be displayed in the response: +
+ Response sample with threshold conditions met ```json { "data": { @@ -907,13 +923,14 @@ Ensure that the plugins work correctly: "thresholds": [] }, "links": { - "self": "http://glue.de.spryker.local/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" + "self": "https://glue.mysprykershop.com/carts/1ce91011-8d60-59ef-9fe0-4493ef3628b2" } } } ``` -7. Check the result by sending the `POST https://glue.mysprykershop.com/checkout-data` request. +7. To check that the cart meets threshold conditions, send the following request: `POST https://glue.mysprykershop.com/checkout-data`. + You should get a regular response without any errors: ```json { @@ -928,7 +945,7 @@ Ensure that the plugins work correctly: "selectedPaymentMethods": [] }, "links": { - "self": "http://glue.de.spryker.local/checkout-data" + "self": "https://glue.mysprykershop.com/checkout-data" } } } @@ -938,9 +955,7 @@ Ensure that the plugins work correctly: ## Install related features -Integrate the following related features. - | FEATURE | REQUIRED FOR THE CURRENT FEATURE | INSTALLATION GUIDE | |--------------------|----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Glue API: Shipment | ✓ | [Install the Shipment Glue API](/docs/pbc/all/carrier-management/{{page.version}}/base-shop/install-and-upgrade/install-the-shipment-glue-api.html) | -| Glue API: Payments | ✓ | [Glue API: Payments feature integration](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | +| Glue API: Payments | ✓ | [Install the Payments Glue API](/docs/pbc/all/payment-service-provider/{{page.version}}/base-shop/install-and-upgrade/install-the-payments-glue-api.html) | From c031ba1761ddc7e37dae271ebd8bd2a0253997ce Mon Sep 17 00:00:00 2001 From: Andrii Tserkovnyi Date: Wed, 27 Dec 2023 15:32:50 +0200 Subject: [PATCH 4/5] review --- .../checkout-feature-overview.md | 2 +- .../checkout-feature-overview.md | 17 +++++++++-------- .../install-the-checkout-glue-api.md | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 docs/pbc/all/cart-and-checkout/202403.0/base-shop/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.md diff --git a/docs/pbc/all/cart-and-checkout/202311.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md b/docs/pbc/all/cart-and-checkout/202311.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md index 313a215b1de..9f273aff848 100644 --- a/docs/pbc/all/cart-and-checkout/202311.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md +++ b/docs/pbc/all/cart-and-checkout/202311.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md @@ -43,4 +43,4 @@ With order thresholds, you can do the following: | INSTALLATION GUIDES | UPGRADE GUIDES| DATA IMPORT | |---------|---------|---------| | [Install the Checkout feature](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/install-features/install-the-checkout-feature.html) | [Upgrade the Checkout module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkout-module.html) | [File details: sales_order_threshold.csv](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/import-and-export-data/import-file-details-sales-order-threshold.csv.html) | -| [Merchant feature integration](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/install-and-upgrade/install-the-merchant-feature.html) | [Upgrade the CheckoutPage module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkoutpage-module.html) | | +| [Install the Merchant feature](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/install-and-upgrade/install-the-merchant-feature.html) | [Upgrade the CheckoutPage module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkoutpage-module.html) | | diff --git a/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md index 074af972f77..eab90f7e96b 100644 --- a/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md +++ b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/feature-overviews/checkout-feature-overview/checkout-feature-overview.md @@ -18,11 +18,11 @@ The *Checkout* feature lets customers select single or multiple products and add Control the values of the orders that your customers place by defining order thresholds. -Fulfilling small orders is not always worthwhile for the business because operating costs, time, and effort spent on processing them often overweight the profit gained. In such cases, implementing a minimum threshold might be the solution to prevent orders that are too small from being made. The *[Order Thresholds](/docs/scos/user/features/{{site.version}}/checkout-feature-overview/order-thresholds-overview.html)* feature provides you with multiple options for defining thresholds. You can define a minimum threshold and disallow placing orders with smaller values or request customers to pay a fee. +Fulfilling small orders is not always worthwhile for the business because operating costs, time, and effort spent on processing them often overweight the profit gained. In such cases, implementing a minimum threshold might be the solution to prevent orders that are too small from being made. The *[Order Thresholds](/docs/scos/user/features/{{page.version}}/checkout-feature-overview/order-thresholds-overview.html)* feature provides you with multiple options for defining thresholds. You can define a minimum threshold and disallow placing orders with smaller values or request customers to pay a fee. Per your business requirements, you can also set up a maximum threshold to disallow placing orders above a defined threshold. -In a B2B scenario, you can define any type of threshold for each [merchant relation](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/merchant-b2b-contracts-feature-overview.html) separately. +In a B2B scenario, you can define any type of threshold for each [merchant relation](/docs/pbc/all/merchant-management/{{page.version}}/base-shop/merchant-b2b-contracts-feature-overview.html) separately. With order thresholds, you can do the following: @@ -35,12 +35,13 @@ With order thresholds, you can do the following: | OVERVIEWS | BACK OFFICE USER GUIDES | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| -| [Multi-step Checkout](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/feature-overviews/checkout-feature-overview/multi-step-checkout-overview.html) | [Define global thresholds](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/manage-in-the-back-office/define-global-thresholds.html) | -| [Order Thresholds](/docs/scos/user/features/{{site.version}}/checkout-feature-overview/order-thresholds-overview.html) | [Manage threshold settings](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/manage-in-the-back-office/manage-threshold-settings.html) | +| [Multi-step Checkout](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/feature-overviews/checkout-feature-overview/multi-step-checkout-overview.html) | [Define global thresholds](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/manage-in-the-back-office/define-global-thresholds.html) | +| [Order Thresholds](/docs/scos/user/features/{{page.version}}/checkout-feature-overview/order-thresholds-overview.html) | [Manage threshold settings](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/manage-in-the-back-office/manage-threshold-settings.html) | ## Related Developer documents -| INSTALLATION GUIDES | UPGRADE GUIDES | DATA IMPORT | -|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Install the Checkout feature](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/install-features/install-the-checkout-feature.html) | [Upgrade the Checkout module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkout-module.html) | [File details: sales_order_threshold.csv](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/import-and-export-data/import-file-details-sales-order-threshold.csv.html) | -| [Merchant feature integration](/docs/pbc/all/merchant-management/{{site.version}}/base-shop/install-and-upgrade/install-the-merchant-feature.html) | [Upgrade the CheckoutPage module](/docs/pbc/all/cart-and-checkout/{{site.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkoutpage-module.html) | | +| INSTALLATION GUIDES | UPGRADE GUIDES | DATA IMPORT | +|--------------------|---------------------------|--------------------------------------------------| +| [Install the Checkout feature](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/install-features/install-the-checkout-feature.html) | [Upgrade the Checkout module](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkout-module.html) | [File details: sales_order_threshold.csv](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/import-and-export-data/import-file-details-sales-order-threshold.csv.html) | +| [Install the Checkout Glue API](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.html) | [Upgrade the CheckoutPage module](/docs/pbc/all/cart-and-checkout/{{page.version}}/base-shop/install-and-upgrade/upgrade-modules/upgrade-the-checkoutpage-module.html) | | +| [Install the Merchant feature](/docs/pbc/all/merchant-management/{{page.version}}/base-shop/install-and-upgrade/install-the-merchant-feature.html) | | | diff --git a/docs/pbc/all/cart-and-checkout/202403.0/base-shop/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.md b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.md new file mode 100644 index 00000000000..2f7e94b5926 --- /dev/null +++ b/docs/pbc/all/cart-and-checkout/202403.0/base-shop/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.md @@ -0,0 +1,18 @@ +--- +title: Install the Checkout Glue API +template: feature-integration-guide-template +originalLink: https://documentation.spryker.com/2021080/docs/glue-api-checkout-feature-integration +originalArticleId: f44bd963-7af3-4ce8-8b7a-3c1477880728 + - /docs/pbc/all/cart-and-checkout/202311.0/install-and-upgrade/install-glue-api/install-the-checkout-glue-api.html +related: + - title: Checkout feature integration + link: docs/scos/dev/feature-integration-guides/page.version/checkout-feature-integration.html + - title: Check out purchases + link: docs/scos/dev/glue-api-guides/page.version/checking-out/checking-out-purchases.html + - title: Update payment data + link: docs/pbc/all/cart-and-checkout/page.version/base-shop/manage-using-glue-api/check-out/glue-api-update-payment-data.html + - title: Submit checkout data + link: docs/scos/dev/glue-api-guides/page.version/checking-out/submitting-checkout-data.html +--- + +{% include pbc/all/install-features/202403.0/install-glue-api/install-the-checkout-glue-api.md %} From 949c6022d944f0d6866a771a344747db77d682d2 Mon Sep 17 00:00:00 2001 From: Andrii Tserkovnyi Date: Wed, 3 Jan 2024 10:45:41 +0200 Subject: [PATCH 5/5] Update Rakefile --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 2cd16757ecf..159f99e813d 100644 --- a/Rakefile +++ b/Rakefile @@ -178,6 +178,7 @@ task :check_pbc do /docs\/pbc\/\w+\/[\w-]+\/202204\.0\/.+/, /docs\/pbc\/\w+\/[\w-]+\/202212\.0\/.+/, /docs\/pbc\/\w+\/[\w-]+\/202307\.0\/.+/, + /docs\/pbc\/\w+\/[\w-]+\/202403\.0\/.+/, /docs\/pbc\/\w+\/[\w-]+\/202400\.0\/.+/ ] HTMLProofer.check_directory("./_site", options).run