Skip to content
This repository was archived by the owner on Nov 5, 2021. It is now read-only.

APPS-138: Update documentation #307

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions 202001.0/de30702d-5a59-46d8-ada4-54cd2a9a55f4.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,68 @@ return $quoteTransfer;
}
```

13. Add checkout plugins of Payone in `Pyz\Zed\Checkout\CheckoutDependencyProvider`:

```php
<?php

/**
* 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(),
//...
];
}
//...
}
```

Now, go to checkout and try placing an order with Paypal express checkout.
75 changes: 64 additions & 11 deletions 202009.0/051546bb-7fec-4f0d-bd66-15d4f0d07fb6.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
$container->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)
Expand Down Expand Up @@ -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.

<div class="hubspot-form js-hubspot-form" data-portal-id="2770802" data-form-id="163e11fb-e833-4638-86ae-a2ca4b929a41" id="hubspot-1"></div>
<div class="hubspot-form js-hubspot-form" data-portal-id="2770802" data-form-id="163e11fb-e833-4638-86ae-a2ca4b929a41" id="hubspot-1"></div>
38 changes: 2 additions & 36 deletions 202009.0/11393c45-b1f7-43b4-ba21-4e8334b88bab.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
namespace Spryker\Zed\PaymentProvider\Dependency\Injector;
class PaymentDependencyInjector extends AbstractDependencyInjector
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Kernel\Container
*/
public function injectBusinessLayerDependencies(Container $container)
{
$container = $this->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.

Expand Down
64 changes: 64 additions & 0 deletions 202009.0/37595603-a37d-4550-a107-b58a0949e0b9.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,4 +405,68 @@ return $quoteTransfer;
}
```

13. Add checkout plugins of Payone in `Pyz\Zed\Checkout\CheckoutDependencyProvider`:

```php
<?php

/**
* 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(),
//...
];
}
//...
}
```

Now, go to checkout and try placing an order with Paypal express checkout.
9 changes: 6 additions & 3 deletions 202009.0/6b89b387-1125-443f-aa35-3668b5570610.md
Original file line number Diff line number Diff line change
@@ -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. |
Expand Down Expand Up @@ -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). |
| `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. |
3 changes: 2 additions & 1 deletion 202009.0/8cbde214-f788-47a6-a8ed-1058949b5294.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +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 spy_sales_payment table.

#### Pre Save Condition Plugin

Expand Down
Loading