From f273b05135c2ab0a8b764d714d1c52d08bd6bf78 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi <79862859+olehnovatskyi-spryker@users.noreply.github.com>
Date: Wed, 16 Jun 2021 12:57:57 +0300
Subject: [PATCH 01/13] Update: BS Payone
---
.../051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md | 75 ++++++++++++++++---
1 file changed, 64 insertions(+), 11 deletions(-)
diff --git a/202009.0/051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md b/202009.0/051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md
index 64af974a4..fc3e2ab97 100644
--- a/202009.0/051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md
+++ b/202009.0/051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md
@@ -104,20 +104,73 @@ $container[static::PAYMENT_METHOD_HANDLER] = function () {
};
```
-## Integration with Payment module (PaymentDependencyProvider):
+Project (demoshop) level `\Pyz\Zed\Checkout\CheckoutDependencyProvider` method `provideBusinessLayerDependencies` container has to be extended with the checkout plugins of Payone. It can be done by adding plugins into related plugins stacks in these methods in \Pyz\Zed\Checkout\CheckoutDependencyProvider:
+* `getCheckoutPreConditions`;
+* `getCheckoutOrderSavers`;
+* `getCheckoutPostHooks`.
-Project (demoshop) level `\Pyz\Zed\Payment\PaymentDependencyProvider` method `provideBusinessLayerDependencies` container has to be extended with the `static::CHECKOUT_PLUGINS` key which has to contain information about PSP payment pre-, post-, and -save Order plugins.
-
-Add the key to `\Pyz\Zed\Payment\PaymentDependencyProvider`:
+Add the plugins into `\Pyz\Zed\Checkout\CheckoutDependencyProvider`:
```php
extend(static::CHECKOUT_PLUGINS, function (CheckoutPluginCollection $pluginCollection) {
- $pluginCollection->add(new PayonePreCheckPlugin(), PayoneConfig::PROVIDER_NAME, static::CHECKOUT_PRE_CHECK_PLUGINS);
- $pluginCollection->add(new PayoneSaveOrderPlugin(), PayoneConfig::PROVIDER_NAME, static::CHECKOUT_ORDER_SAVER_PLUGINS);
- $pluginCollection->add(new PayonePostSaveHookPlugin(), PayoneConfig::PROVIDER_NAME, static::CHECKOUT_POST_SAVE_PLUGINS);
- return $pluginCollection;
- });
+/**
+ * This file is part of the Spryker Suite.
+ * For full license information, please view the LICENSE file that was distributed with this source code.
+ */
+
+namespace Pyz\Zed\Checkout;
+
+//...
+use SprykerEco\Zed\Payone\Communication\Plugin\Checkout\PayoneCheckoutDoSaveOrderPlugin;
+use SprykerEco\Zed\Payone\Communication\Plugin\Checkout\PayoneCheckoutPostSavePlugin;
+use SprykerEco\Zed\Payone\Communication\Plugin\Checkout\PayoneCheckoutPreConditionPlugin;
+
+class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
+{
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface[]
+ */
+ protected function getCheckoutPreConditions(Container $container)
+ {
+ return [
+ //...
+ new PayoneCheckoutPreConditionPlugin(),
+ //...
+ ];
+ }
+
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[]|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface[]
+ */
+ protected function getCheckoutOrderSavers(Container $container)
+ {
+ return [
+ //...
+ new PayoneCheckoutDoSaveOrderPlugin(),
+ //...
+ ];
+ }
+
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface[]
+ */
+ protected function getCheckoutPostHooks(Container $container)
+ {
+ return [
+ //...
+ new PayoneCheckoutPostSavePlugin(),
+ //...
+ ];
+ }
+
+ //...
+}
```
## Integration with OMS module (OmsDependencyProvider)
@@ -358,4 +411,4 @@ See [Disclaimer](https://github.com/spryker/spryker-documentation).
---
For further information on this partner and integration into Spryker, please contact us.
-
\ No newline at end of file
+
From 8d9a8131ae80cbf35c2cd0551bcc57cf1a0d4dae Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 13:44:09 +0300
Subject: [PATCH 02/13] Update: PayOne - Integration into the Legacy Demoshop
Project
---
.../de30702d-5a59-46d8-ada4-54cd2a9a55f4.md | 64 +++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/202001.0/de30702d-5a59-46d8-ada4-54cd2a9a55f4.md b/202001.0/de30702d-5a59-46d8-ada4-54cd2a9a55f4.md
index 1c5aa0773..bc64f72f3 100644
--- a/202001.0/de30702d-5a59-46d8-ada4-54cd2a9a55f4.md
+++ b/202001.0/de30702d-5a59-46d8-ada4-54cd2a9a55f4.md
@@ -290,4 +290,68 @@ return $quoteTransfer;
}
```
+13. Add checkout plugins of Payone in `Pyz\Zed\Checkout\CheckoutDependencyProvider`:
+
+```php
+
Date: Wed, 16 Jun 2021 13:55:50 +0300
Subject: [PATCH 03/13] Update: PayOne - Facade
---
202009.0/6b89b387-1125-443f-aa35-3668b5570610.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/202009.0/6b89b387-1125-443f-aa35-3668b5570610.md b/202009.0/6b89b387-1125-443f-aa35-3668b5570610.md
index c79514ef2..7802373d7 100644
--- a/202009.0/6b89b387-1125-443f-aa35-3668b5570610.md
+++ b/202009.0/6b89b387-1125-443f-aa35-3668b5570610.md
@@ -1,6 +1,7 @@
|Facade Method |Param |Return |Description |
| --- | --- | --- | --- |
-| `saveOrder` | `QuoteTransfer`, `CheckoutResponseTransfer` | void | Saves Payone payment method data according to quote and checkout response transfer data. |
+| `saveOrder` (deprecated) | `QuoteTransfer`, `CheckoutResponseTransfer` | void | Saves Payone payment method data according to quote and checkout response transfer data. |
+| `saveOrderPayment` | `QuoteTransfer`, `SaveOrderTransfer` | void | Saves order payment method data according to quote and order data. |
| `authorizePayment` | `OrderTransfer` | `AuthorizationResponseContainer` | Performs payment authorization request to Payone API. |
| `preAuthorizePayment` | Order Id | `AuthorizationResponseContainer` | Performs payment pre-authorization request to Payone API. |
| `capturePayment` | `PayoneCaptureTransfer` | `CaptureResponseContainer` | Performs payment capture request to Payone API. |
@@ -32,10 +33,12 @@
| `isPaymentAppointed` | Order Id, Order Item Id | bool | Checks if there is an unprocessed transaction status update from Payone with "Appointed" status for a certain order. |
| `isPaymentOther` | Order Id, Order Item Id | bool | Checks if there is an unprocessed transaction status update from Payone with status different from "Paid", "Underpaid" or "Appointed" for a certain order. |
| `isPaymentCapture` | Order Id, Order Item Id | bool | Checks if there is an unprocessed transaction status update from Payone with "Capture" status for a certain order. |
-| `postSaveHook` | `QuoteTransfer`, `CheckoutResponseTransfer` | `CheckoutResponseTransfer` | Handles redirects and errors after order placement. |
+| `postSaveHook` (deprecated) | `QuoteTransfer`, `CheckoutResponseTransfer` | `CheckoutResponseTransfer` | Handles redirects and errors after order placement. |
+| `orderPostSave` | `QuoteTransfer`, `CheckoutResponseTransfer` | `CheckoutResponseTransfer` | Handles redirects and errors after order placement. Executes `authorization` or `pre-authorization` API call depends on payment method. Updates `CheckoutResponseTransfer` with errors or/and redirect url accordingly to API response. |
| `getPaymentLogs` | `ObjectCollection` | array of `PayonePaymentLogTransfer` | Gets payment logs (both api and transaction status) for specific orders in chronological order. |
| `getPaymentDetail` | Order Id | `PaymentDetailTransfer` | Gets payment details for a specific order. |
| `updatePaymentDetail` | `PaymentDetailTransfer`, Order Id | void | Updates payment details for a specific order. |
| install | `MessengerInterface` | void | Installs module translations to project glossary. |
| `startPaypalExpressCheckout` | `PayoneStartPaypalExpressCheckoutRequestTransfer` | `PayonePaypalExpressCheckoutGenericPaymentResponseTransfer` | Sends request to payone in order to start express checkout and get the workorderid which is used for further operations. |
-| `getPaypalExpressCheckoutDetails` | `QuoteTransfer` | `PayonePaypalExpressCheckoutGenericPaymentResponseTransfer` | Returns customer specific information retrieved from paypal through payone (e.g. email and shipping info). |
\ No newline at end of file
+| `getPaypalExpressCheckoutDetails` | `QuoteTransfer` | `PayonePaypalExpressCheckoutGenericPaymentResponseTransfer` | Returns customer specific information retrieved from paypal through payone (e.g. email and shipping info). |
+| `executeCheckoutPostSaveHook` (deprecated) | `QuoteTransfer` `CheckoutResponseTransfer` | `CheckoutResponseTransfer` | Executes `authorization` or `pre-authorization` API call depends on payment method. Updates `CheckoutResponseTransfer` with errors or/and redirect url accordingly to API response. |
From 68ab28ed1d76910bcd11bf773a8e2c3653d56f01 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 14:07:41 +0300
Subject: [PATCH 04/13] Update: PayOne - Integration into the SCOS Project
---
.../37595603-a37d-4550-a107-b58a0949e0b9.md | 64 +++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/202009.0/37595603-a37d-4550-a107-b58a0949e0b9.md b/202009.0/37595603-a37d-4550-a107-b58a0949e0b9.md
index 00113d792..79bacb776 100644
--- a/202009.0/37595603-a37d-4550-a107-b58a0949e0b9.md
+++ b/202009.0/37595603-a37d-4550-a107-b58a0949e0b9.md
@@ -405,4 +405,68 @@ return $quoteTransfer;
}
```
+13. Add checkout plugins of Payone in `Pyz\Zed\Checkout\CheckoutDependencyProvider`:
+
+```php
+
Date: Wed, 16 Jun 2021 15:42:39 +0300
Subject: [PATCH 05/13] Update: Gift cards feature integration
---
.../f27f2d37-c023-47be-8b1c-f3f42c09c4cf.md | 97 ++++++-------------
1 file changed, 32 insertions(+), 65 deletions(-)
diff --git a/202009.0/f27f2d37-c023-47be-8b1c-f3f42c09c4cf.md b/202009.0/f27f2d37-c023-47be-8b1c-f3f42c09c4cf.md
index eb49727d4..fe9a1e5d9 100644
--- a/202009.0/f27f2d37-c023-47be-8b1c-f3f42c09c4cf.md
+++ b/202009.0/f27f2d37-c023-47be-8b1c-f3f42c09c4cf.md
@@ -71,10 +71,6 @@ use Spryker\Zed\GiftCard\GiftCardConfig;
// ---------- Dependency injector
$config[KernelConstants::DEPENDENCY_INJECTOR_ZED] = [
- 'Payment' => [
- GiftCardConfig::PROVIDER_NAME,
- NopaymentConfig::PAYMENT_PROVIDER_NAME,
- ],
'Oms' => [
GiftCardConfig::PROVIDER_NAME,
],
@@ -544,7 +540,9 @@ Add the following plugins to your project:
| --- | --- | --- | --- |
|`GiftCardCalculatorPlugin` | During quote recalculation, distinguishes applicable and non-applicable gift cards and creates payment methods for applicable gift cards. | - | `Spryker\Zed\GiftCard\Communication\Plugin` |
| `GiftCardMetadataExpanderPlugin` | Extends gift card items with gift card configuration metadata to change cart items. | - | `Spryker\Zed\GiftCard\Communication\Plugin` |
-| `GiftCardOrderItemSaverPlugin` | Saves gift card order data to the database. |- | `Spryker\Zed\GiftCard\Communication\Plugin` |
+| `GiftCardCheckoutDoSaveOrderPlugin` | Saves gift cards items from the quote. Saves gift card payments from the quote. |- | `Spryker\Zed\GiftCard\Communication\Plugin\Checkout` |
+| `GiftCardCheckoutPreConditionPlugin` | Returns true if QuoteTransfer.payments don't have GiftCard payments. Returns true if gift card was in use before and amount is valid. Returns false otherwise. |- | `\Spryker\Zed\GiftCard\Communication\Plugin\Checkout` |
+| `NopaymentCheckoutPreConditionPlugin` | Returns true if there is no Nopayment payment provider in QuoteTransfer.payments otherwise does additional checks/logic. Returns true if QuoteTransfer.totals.priceToPay greater than 0 otherwise adds an error into CheckoutResponseTransfer and returns false. |- | `\Spryker\Zed\Nopayment\Communication\Plugin\Checkout` |
| `GiftCardDiscountableItemFilterPlugin` | Filters gift card items from discountable items.|- | `Spryker\Zed\GiftCard\Communication\Plugin` |
| `GiftCardDeliveryMailTypePlugin` | Provides a mail type for sending e-mails about successful gift card orders. |- | `Spryker\Zed\GiftCardMailConnector\Communication\Plugin\Mail` |
| `Command\ShipGiftCardByEmailCommandPlugin` | Registers `GiftCardMailConnector/ShipGiftCard` OMS command that is used to deliver a gift card by e-mail. | Use `GiftCardDeliveryMailTypePlugin` above to register the necessary mail type. | `Spryker\Zed\GiftCardMailConnector\Communication\Plugin\Oms` |
@@ -613,23 +611,46 @@ class CartDependencyProvider extends SprykerCartDependencyProvider
namespace Pyz\Zed\Checkout;
+...
use Spryker\Zed\Checkout\CheckoutDependencyProvider as SprykerCheckoutDependencyProvider;
-use Spryker\Zed\GiftCard\Communication\Plugin\GiftCardOrderItemSaverPlugin;
+use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutDoSaveOrderPlugin;
+use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutPreConditionPlugin;
+use Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin;
use Spryker\Zed\Kernel\Container;
+...
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
- * @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[]
+ * @return \Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface[]
+ */
+ protected function getCheckoutPreConditions(Container $container)
+ {
+ return [
+ ...
+ new GiftCardCheckoutPreConditionPlugin(),
+ new NopaymentCheckoutPreConditionPlugin(),
+ ...
+ ];
+ }
+
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[]|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface[]
*/
protected function getCheckoutOrderSavers(Container $container)
{
return [
- new GiftCardOrderItemSaverPlugin(),
+ ...
+ new GiftCardCheckoutDoSaveOrderPlugin(),
+ ...
];
}
+
+ ...
}
```
@@ -803,9 +824,6 @@ Add the following plugins to your project:
|`GiftCardUsageMailTypePlugin` | Provides a mail type for sending gift card usage information emails. | - | `Spryker\Zed\GiftCardMailConnector\Communication\Plugin\Mail`|
|`PriceToPayPaymentMethodFilterPlugin` | Filters available payment methods based on the price-to-pay value of the quote. | - |`Spryker\Zed\Nopayment\Communication\Plugin\Payment` |
| `GiftCardPaymentMethodFilterPlugin` | Filters blacklisted payment methods in case the quote contains a gift card to be purchased. |- | `Spryker\Zed\GiftCard\Communication\Plugin` |
-| `GiftCardPreCheckPlugin` | Checks if a gift card payment method value is not bigger than the rest of the gift card value to be used to pay. | - | `Spryker\Zed\GiftCard\Communication\Plugin`|
-| `GiftCardOrderSaverPlugin`| Saves a gift card payment to the database when an order is placed. | - | `Spryker\Zed\GiftCard\Communication\Plugin`|
-|`NopaymentPreCheckPlugin`| Checks if a "Nopayment" payment method is allowed to be used. | - | `Spryker\Zed\Nopayment\Communication\Plugin\Checkout`|
**src/Pyz/Client/CartCode/CartCodeDependencyProvider.php**
@@ -844,6 +862,8 @@ use Spryker\Zed\Kernel\Container;
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
+ ...
+
/**
* @param \Spryker\Zed\Kernel\Container $container
*
@@ -852,6 +872,7 @@ class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
protected function getCheckoutPostHooks(Container $container)
{
return [
+ ...
new SendEmailToGiftCardUser(),
];
}
@@ -942,32 +963,13 @@ class MailDependencyProvider extends SprykerMailDependencyProvider
namespace Pyz\Zed\Payment;
-use Spryker\Shared\Nopayment\NopaymentConfig as SprykerNopaymentConfig;
-use Spryker\Zed\GiftCard\Communication\Plugin\GiftCardOrderSaverPlugin;
use Spryker\Zed\GiftCard\Communication\Plugin\GiftCardPaymentMethodFilterPlugin;
-use Spryker\Zed\GiftCard\Communication\Plugin\GiftCardPreCheckPlugin;
-use Spryker\Zed\GiftCard\GiftCardConfig as SprykerGiftCardConfig;
use Spryker\Zed\Kernel\Container;
-use Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentPreCheckPlugin;
use Spryker\Zed\Nopayment\Communication\Plugin\Payment\PriceToPayPaymentMethodFilterPlugin;
-use Spryker\Zed\Payment\Dependency\Plugin\Checkout\CheckoutPluginCollectionInterface;
use Spryker\Zed\Payment\PaymentDependencyProvider as SprykerPaymentDependencyProvider;
class PaymentDependencyProvider extends SprykerPaymentDependencyProvider
{
- /**
- * @param \Spryker\Zed\Kernel\Container $container
- *
- * @return \Spryker\Zed\Kernel\Container
- */
- public function provideBusinessLayerDependencies(Container $container)
- {
- $container = parent::provideBusinessLayerDependencies($container);
- $container = $this->extendPaymentPlugins($container);
-
- return $container;
- }
-
/**
* @return \Spryker\Zed\Payment\Dependency\Plugin\Payment\PaymentMethodFilterPluginInterface[]
*/
@@ -978,41 +980,6 @@ class PaymentDependencyProvider extends SprykerPaymentDependencyProvider
new GiftCardPaymentMethodFilterPlugin(),
];
}
-
- /**
- * @param \Spryker\Zed\Kernel\Container $container
- *
- * @return \Spryker\Zed\Kernel\Container
- */
- protected function extendPaymentPlugins(Container $container): Container
- {
- $container->extend(
- PaymentDependencyProvider::CHECKOUT_PLUGINS,
- function (CheckoutPluginCollectionInterface $pluginCollection) {
- $pluginCollection->add(
- new GiftCardPreCheckPlugin(),
- SprykerGiftCardConfig::PROVIDER_NAME,
- PaymentDependencyProvider::CHECKOUT_PRE_CHECK_PLUGINS
- );
-
- $pluginCollection->add(
- new GiftCardOrderSaverPlugin(),
- SprykerGiftCardConfig::PROVIDER_NAME,
- PaymentDependencyProvider::CHECKOUT_ORDER_SAVER_PLUGINS
- );
-
- $pluginCollection->add(
- new NopaymentPreCheckPlugin(),
- SprykerNopaymentConfig::PAYMENT_PROVIDER_NAME,
- PaymentDependencyProvider::CHECKOUT_ORDER_SAVER_PLUGINS
- );
-
- return $pluginCollection;
- }
- );
-
- return $container;
- }
}
```
From f0d9492b7a8b73ee2f061745fd18a117d06c1f0d Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 16:53:57 +0300
Subject: [PATCH 06/13] Update: Enabling gift cards
---
202009.0/ec995017-b790-46e4-ba14-2a072d8fc20d.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/202009.0/ec995017-b790-46e4-ba14-2a072d8fc20d.md b/202009.0/ec995017-b790-46e4-ba14-2a072d8fc20d.md
index 76c5a9f95..eb45a4901 100644
--- a/202009.0/ec995017-b790-46e4-ba14-2a072d8fc20d.md
+++ b/202009.0/ec995017-b790-46e4-ba14-2a072d8fc20d.md
@@ -30,10 +30,9 @@ spryker/product-management:"^0.12.0"
| `GiftCardDiscountableItemFilterPlugin` |Restricts using a Gift Card for another Gift Cards in a cart. The plugin filters out Gift Cards from discountable items. |`DiscountDependencyProvider::getDiscountableItemFilterPlugins` | - |
| `GiftCardIsUsedDecisionRulePlugin` | As a part of the replacement strategy, this plugin does not allow using a Gift Card twice. |`GiftCardDependencyProvider::getDecisionRulePlugins` | Replacement |
| `GiftCardMetadataExpanderPlugin` | Populates Gift Card information when it is in the cart. | `CartDependencyProvider::getExpanderPlugins` | - |
-| `GiftCardOrderItemSaverPlugin` | Saves a Gift Card with populated data when an order is placed. | `CheckoutDependencyProvider::getCheckoutOrderSavers` | - |
-| `GiftCardOrderSaverPlugin` | Keeps Gift Card as an order payment method. | `PaymentDependencyProvider::extendPaymentPlugin` with a key `PaymentDependencyProvider::CHECKOUT_ORDER_SAVER_PLUGINS`| - |
+| `GiftCardCheckoutDoSaveOrderPlugin` | Saves a Gift Card with populated data when an order is placed. Keeps Gift Card as an order payment method. | `CheckoutDependencyProvider::getCheckoutOrderSavers` | - |
| `GiftCardPaymentMethodFilterPlugin` | Now, every payment method is compatible with a Gift Card in the cart. The plugin filters out all incompatible payment methods from available ones during checkout payment methods step. | `PaymentDependencyProvider::getPaymentMethodFilterPlugins` | - |
-| `GiftCardPreCheckPlugin` | Confirms that a Gift Card is not used at the moment and that payment method amount assigned to the Gift Card is no more than the Gift Card amount itself. | `PaymentDependencyProvider::extendPaymentPlugin` with a key `PaymentDependencyProvider::CHECKOUT_PRE_CHECK_PLUGINS` | - |
+| `GiftCardCheckoutPreConditionPlugin` | Confirms that a Gift Card is not used at the moment and that payment method amount assigned to the Gift Card is no more than the Gift Card amount itself.. | `CheckoutDependencyProvider::getCheckoutPreConditions` | - |
| `GiftCardRecreateValueProviderPlugin` |For replacement: defines a Gift Card leftover. It’s simply a Gift Card amount for this strategy. | `GiftCardDependencyProvider::getValueProviderPlugin` | Replacement |
| `CreateGiftCardCommandPlugin` | It is an order management system command to create a Gift Card based on a paid order item (a Gift Card item). | `OmsDependencyProvider::extendCommandPlugins` | - |
| `ReplaceGiftCardsCommandPlugin` | For placement strategy: creates a new Gift Card based on leftover from the previous one. | `OmsDependencyProvider::extendCommandPlugins` | Replacement |
@@ -46,7 +45,7 @@ spryker/product-management:"^0.12.0"
| `GiftCardUsageMailTypePlugin` | Sends an e-mail on Gift Card usage to its user. | `MailDependencyProvider::MAIL_TYPE_COLLECTION` | - |
| `ShipGiftCardByEmailCommandPlugin` | An order management system command which triggers Gift Card electronic shipment. |`OmsDependencyProvider::extendCommandPlugins` | - |
| `NopaymentHandlerPlugin` | A payment method placeholder that is used when an order is paid by only a Gift Card without a real payment method. | `CheckoutDependencyProvider::extendPaymentMethodHandler` | - |
-| `NopaymentPreCheckPlugin` | Doesn’t allow placing an order with a price to pay more than 0 with a NoPayment payment method. | `PaymentDependencyProvider::extendPaymentPlugins` with a key `PaymentDependencyProvider::CHECKOUT_ORDER_SAVER_PLUGINS` | - |
+| `NopaymentCheckoutPreConditionPlugin` | Doesn’t allow placing an order with a price to pay more than 0 with a NoPayment payment method. | `CheckoutDependencyProvider::getCheckoutPreConditions` | - |
| `PriceToPayPaymentMethodFilterPlugin` | Filters payment methods based on cart totals. | `PaymentDependencyProvider::getPaymentMethodFilterPlugins` | - |
| `PaymentFormFilterPlugin` | Each payment method provides its subforms. The plugin filters them out based on an available payment method list. | `CheckoutDependencyProvider::getPaymentFormFilterPlugins` | - |
| `PaymentCalculatorPlugin` | Distributes total prices to payment methods. Calculates price to pay to quote totals. | `CalculationDependencyProvider::getQuoteCalculatorPluginStack` | - |
From 13903c88c2efe0d7a77fa56b3ef2414e56c2ed36 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 17:12:10 +0300
Subject: [PATCH 07/13] Update: Migration Guide - Checkout
---
202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
index dd0306b1b..a742925f6 100644
--- a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
+++ b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
@@ -1,3 +1,8 @@
+## Upgrading from Version 6.* to Version 6.3.0
+
+### Migrate to the New Saved Plugins:
+Replace `\Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentOrderSaverPlugin` with `\Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin` and `\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface`
+
## Upgrading from Version 4.* to Version 6.0.0
@(Info)()(In order to dismantle the Horizontal Barrier and enable partial module updates on projects, a Technical Release took place. Public API of source and target major versions are equal. No migration efforts are required. Please [contact us](https://support.spryker.com/hc/en-us) if you have any questions.)
From 88a42dcaca44c15da60abcfc8bc20c02042c1114 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 17:26:54 +0300
Subject: [PATCH 08/13] Update: Migration Guide - Checkout
---
202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
index a742925f6..db91a6bb5 100644
--- a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
+++ b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
@@ -1,7 +1,12 @@
## Upgrading from Version 6.* to Version 6.3.0
### Migrate to the New Saved Plugins:
-Replace `\Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentOrderSaverPlugin` with `\Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin` and `\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface`
+Replace `\Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentOrderSaverPlugin` with `\Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin`
+Add `\Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutDoSaveOrderPlugin`
+
+### Migrate to the New Pre Condition Plugins:
+Add `\Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutPreConditionPlugin`
+Add `\Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin`
## Upgrading from Version 4.* to Version 6.0.0
From 12bd468ed634aede01fb6001170adfe2f77bd829 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 22:28:40 +0300
Subject: [PATCH 09/13] reverted changes
---
202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
index db91a6bb5..dd0306b1b 100644
--- a/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
+++ b/202009.0/0ca5f92d-8ed9-4eca-ba19-e4e68dd050ce.md
@@ -1,13 +1,3 @@
-## Upgrading from Version 6.* to Version 6.3.0
-
-### Migrate to the New Saved Plugins:
-Replace `\Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentOrderSaverPlugin` with `\Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin`
-Add `\Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutDoSaveOrderPlugin`
-
-### Migrate to the New Pre Condition Plugins:
-Add `\Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutPreConditionPlugin`
-Add `\Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin`
-
## Upgrading from Version 4.* to Version 6.0.0
@(Info)()(In order to dismantle the Horizontal Barrier and enable partial module updates on projects, a Technical Release took place. Public API of source and target major versions are equal. No migration efforts are required. Please [contact us](https://support.spryker.com/hc/en-us) if you have any questions.)
From 744446fb4fa127db5a875be4b1dbd7774ed2efd7 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 23:11:37 +0300
Subject: [PATCH 10/13] Update: Checkout Process Review and Implementation
---
202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md b/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
index 86d26002d..48e3d691f 100644
--- a/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
+++ b/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
@@ -122,6 +122,7 @@ There are already some plugins implemented with each of those types:
* ProductOptionOrderSaverPlugin — saves product options to sales_product_item table.
* DiscountOrderSavePlugin — save order discounts to the sales_discounts table.
* OrderShipmentSavePlugin — saves order shipment information to sales_expense table.
+* SalesPaymentCheckoutDoSaveOrderPlugin — Saves order payments to the database spy_sales_payment.
#### Pre Save Condition Plugin
From 30e70e6ad5d86c5f825e31866fa468118b1c363f Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Wed, 16 Jun 2021 23:12:45 +0300
Subject: [PATCH 11/13] Fixed typos
---
202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md b/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
index 48e3d691f..85c76fa55 100644
--- a/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
+++ b/202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
@@ -120,9 +120,9 @@ There are already some plugins implemented with each of those types:
* OrderCustomerSavePlugin — save/create a customer in the database if the customer is new or the ID is not set (guest customer is ignored).
* SalesOrderSaverPlugin — saves order information, creates sales_order and sales_order_item table.
* ProductOptionOrderSaverPlugin — saves product options to sales_product_item table.
-* DiscountOrderSavePlugin — save order discounts to the sales_discounts table.
+* DiscountOrderSavePlugin — saves order discounts to the sales_discounts table.
* OrderShipmentSavePlugin — saves order shipment information to sales_expense table.
-* SalesPaymentCheckoutDoSaveOrderPlugin — Saves order payments to the database spy_sales_payment.
+* SalesPaymentCheckoutDoSaveOrderPlugin — saves order payments to the spy_sales_payment table.
#### Pre Save Condition Plugin
From 18840359a43f102313cb2c73e2bb8b26a3cec207 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Thu, 17 Jun 2021 10:03:38 +0300
Subject: [PATCH 12/13] Update: HowTo - Hydrate Payment Methods for an Order
---
.../11393c45-b1f7-43b4-ba21-4e8334b88bab.md | 38 +------------------
1 file changed, 2 insertions(+), 36 deletions(-)
diff --git a/202009.0/11393c45-b1f7-43b4-ba21-4e8334b88bab.md b/202009.0/11393c45-b1f7-43b4-ba21-4e8334b88bab.md
index 4943b3f65..abd7c8ee2 100644
--- a/202009.0/11393c45-b1f7-43b4-ba21-4e8334b88bab.md
+++ b/202009.0/11393c45-b1f7-43b4-ba21-4e8334b88bab.md
@@ -6,43 +6,9 @@ Each payment method must provide payment amount it shares from order grand total
## Payment Hydration for Order
The [Sales](https://documentation.spryker.com/v4/docs/sales) module provides plugins to hydrate OrderTransfer which is called when `SalesFacade::getOrderByIdSalesOrder` invoked.
-One of those plugins are `\Spryker\Zed\Payment\Communication\Plugin\Sales\PaymentOrderHydratePlugin` which must be added to `\Pyz\Zed\Sales\SalesDependencyProvider::getOrderHydrationPlugins` plugin stack.
+One of those plugins is `\Spryker\Zed\SalesPayment\Communication\Plugin\Sales\SalesPaymentOrderExpanderPlugin` which must be added to `\Pyz\Zed\Sales\SalesDependencyProvider::getOrderHydrationPlugins` plugin stack.
-This plugin invokes the payment hydration plugin stack which must be injected to ` \Spryker\Zed\Payment\PaymentDependencyProvider::PAYMENT_HYDRATION_PLUGINS`, for example:
-
-```php
-injectPaymentPlugin($container);
- return $container;
- }
- /**
- * @param \Spryker\Zed\Kernel\Container $container
- *
- * @return \Spryker\Zed\Kernel\Container
- */
- protected function injectPaymentPlugin(Container $container)
- {
- $container->extend(PaymentDependencyProvider::PAYMENT_HYDRATION_PLUGINS, function (PaymentHydratorPluginCollectionInterface $pluginCollection) {
- $pluginCollection->add(‘PaymentProvider’, new PaymentProviderSalesOrderPaymentHydrationPlugin()) // this plugin must implement \Spryker\Zed\Payment\Dependency\Plugin\Sales\PaymentHydratorPluginInterface
- return $pluginCollection;
- });
- return $container;
- }
-}
-?>
-```
-
-The plugin will receive `OrderTransfer` and `PaymentTransfer` which is the payment you need to hydrate with additional data.
+The plugin will receive `OrderTransfer` which is the payment you need to hydrate with additional data.
Plugins have to populate the `PaymentTransfer` object and return it back. After this step you should be able to get payment information when calling `SalesFacade::getOrderByIdSalesOrder`. We also included simple Zed UI twig block for payments so it can display a little more information about payment methods used on the Order Detail page.
From 9342dc8e962dd20926443886fd61d55b6c959bd2 Mon Sep 17 00:00:00 2001
From: Oleh Novatskyi
Date: Thu, 17 Jun 2021 11:14:01 +0300
Subject: [PATCH 13/13] Update: Implementation of Direct Debit in Zed
---
.../eb1f5a29-4549-489f-9c03-7f187666f768.md | 177 +++++++++---------
1 file changed, 85 insertions(+), 92 deletions(-)
diff --git a/202009.0/eb1f5a29-4549-489f-9c03-7f187666f768.md b/202009.0/eb1f5a29-4549-489f-9c03-7f187666f768.md
index 3f54e13d1..a080d73f0 100644
--- a/202009.0/eb1f5a29-4549-489f-9c03-7f187666f768.md
+++ b/202009.0/eb1f5a29-4549-489f-9c03-7f187666f768.md
@@ -386,15 +386,15 @@ Information will be available here: `/payment-methods/sales/list?id-sales-order=
To integrate the Direct Debit method into the checkout, you need to implement these 3 plugins:
-* `DirectDebitPostCheckPlugin`
-* `DirectDebitPreCheckPlugin`
-* `DirectDebitSaveOrderPlugin`
+* `PaymentMethodsDirectDebitCheckoutPreConditionPlugin`
+* `PaymentMethodsDirectDebitCheckoutDoSaveOrderPlugin`
+* `PaymentMethodsDirectDebitCheckoutPostSavePlugin`
To do this, perform the following steps:
1. In Zed, add the following 3 plugins to the `Communication/Plugin/Checkout/` folder of the new module you've created (`PaymentMethods`).
-**DirectDebitPreCheckPlugin**
+**PaymentMethodsDirectDebitCheckoutPreConditionPlugin**
```php
setIsSuccess(true);
-
- return true;
- }
-
+ /**
+ * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
+ * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer
+ *
+ * @return bool
+ */
+ public function checkCondition(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer)
+ {
+ $checkoutResponseTransfer->setIsSuccess(true);
+
+ return true;
+ }
}
```
-**DirectDebitSaveOrderPlugin**
+**PaymentMethodsDirectDebitCheckoutDoSaveOrderPlugin**
```php
getFacade()->saveOrderPayment($quoteTransfer, $checkoutResponseTransfer);
+ $this->getFacade()->saveOrderPayment($quoteTransfer, $saveOrderTransfer);
}
- }
-
+}
```
-**DirectDebitPostCheckPlugin**
+**PaymentMethodsDirectDebitCheckoutPostSavePlugin**
```php
getFacade()->orderPostSave($quoteTransfer, $checkoutResponseTransfer);
+ }
}
```
-2. Inject these 3 plugins in the `PaymentMethods` module by creating a `PaymentDependencyInjector` under the `Dependency/Injector/` folder:
+2. Inject these 3 plugins in the `Checkout` module in the `CheckoutDependencyProvider` in the related stacks:
**Code sample:**
```php
injectPaymentPlugins($container);
-
- return $container;
- }
-
- /**
- * @param \Spryker\Zed\Kernel\Container $container
- *
- * @return \Spryker\Zed\Kernel\Container
- */
- protected function injectPaymentPlugins(Container $container)
- {
- $container->extend(PaymentDependencyProvider::CHECKOUT_PLUGINS, function (CheckoutPluginCollection $pluginCollection) {
- $pluginCollection->add(new DirectDebitPreCheckPlugin(), PaymentMethodsConstants::PROVIDER, PaymentDependencyProvider::CHECKOUT_PRE_CHECK_PLUGINS);
- $pluginCollection->add(new DirectDebitSaveOrderPlugin(), PaymentMethodsConstants::PROVIDER, PaymentDependencyProvider::CHECKOUT_ORDER_SAVER_PLUGINS);
- $pluginCollection->add(new DirectDebitPostCheckPlugin(), PaymentMethodsConstants::PROVIDER, PaymentDependencyProvider::CHECKOUT_POST_SAVE_PLUGINS);
-
- return $pluginCollection;
- });
-
- return $container;
- }
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[]|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface[]
+ */
+ protected function getCheckoutOrderSavers(Container $container)
+ {
+ return [
+ ...
+ new PaymentMethodsDirectDebitCheckoutDoSaveOrderPlugin(),
+ ];
+ }
+ /**
+ * @param \Spryker\Zed\Kernel\Container $container
+ *
+ * @return \Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface[]
+ */
+ protected function getCheckoutPostHooks(Container $container)
+ {
+ return [
+ ...
+ new PaymentMethodsDirectDebitCheckoutPostSavePlugin(),
+ ];
+ }
}
```
@@ -550,9 +546,6 @@ $config[KernelConstants::DEPENDENCY_INJECTOR_YVES] = [
],
];
$config[KernelConstants::DEPENDENCY_INJECTOR_ZED] = [
- 'Payment' => [
- PaymentMethodsConstants::PROVIDER,
- ],
'Oms' => [
PaymentMethodsConstants::PROVIDER,
],