Payment Integration - Computop
Partner Information
ABOUT COMPUTOP | |
Computop is a leading international Payment Service Provider that enables merchants and white label customers to process global multichannel payments. Computop’s state of the art and wholly owned payment platform Computop Paygate offers seamless solutions for mobile, online and in store payment transactions. All transactions processed by Computop Paygate are secure as our platform is PCI certified. Computop offers a global payment management solution that is connected to over 350 payment methods and acquirer connections worldwide, customizable fraud prevention, tokenization and other value added services like currency conversion and debt management that result in secure transaction processing and higher conversion rates. Paygate is scalable and favoured by merchants in the travel, gaming, gambling, digital, hospitality, and the retail industry. Prebuilt payment and fraud management integration cartridges or modules are available for leading ERP and shop system solutions including demandware, hybris, intershop, Magento, and IBM Websphere. Founded in 1997, Computop is a global player for the 21st century. Headquartered in Bamberg, Germany, the company has sales operations in New York, London, and Shanghai. Computop is trusted by the largest global brands worldwide including Samsung, The Otto Group, C&A, Fossil, Metro Cash & Carry, and Swarovski. |
General Information
We integrate with a wide range of payment methods that can be configured according to your needs and convenience. Payment method flows are configured using state machines.
The SprykerEco.Computop spryker-eco/computop bundle provides integration Spryker e-commerce system with Computop industry partner. It requires the SprykerEco.ComputopApi spryker-eco/computop-api bundle that provides the REST Client for making API calls to the Computop Payment Provider.
The SprykerEco.Computop bundle includes integration with:
- Checkout process - payment forms with all necessary fields that are required to make payment request, save order information and so on.
- OMS (Order Management System) - state machines, all necessary commands for making modification requests and conditions for changing orders status accordingly.
The SprykerEco.Computop bundle provides the following payment methods:
Installation
To install the payment provider, run:
composer require spryker-eco/computop
Configuration
All the necessary configurations can be found in:
vendor/spryker-eco/computop/config/config.dist.php
Configuration Key | Type | Description |
$config[ComputopApiConstants::MERCHANT_ID] | string | Computop merchant identifier. |
$config[ComputopApiConstants::BLOWFISH_PASSWORD] | string | Password for blowfish hashing. |
$config[ComputopApiConstants::HMAC_PASSWORD] | string | Password for hmac hashing. |
$config[ComputopConstants::PAYDIREKT_SHOP_KEY] | string | Shop key for Paydirect payment method. |
$config[ComputopConstants::IDEAL_ISSUER_ID] | string | Issuer ID for Ideal payment method. |
$config[ComputopConstants::PAY_NOW_INIT_ACTION] | string | Init API call endpoint for PayNow payment method. |
$config[ComputopConstants::CREDIT_CARD_INIT_ACTION] | string | Init API call endpoint for Credit Card payment method. |
$config[ComputopConstants::PAYPAL_INIT_ACTION] | string | Init API call endpoint for PayPal payment method. |
$config[ComputopConstants::DIRECT_DEBIT_INIT_ACTION] | string | Init API call endpoint for Direct Debit payment method. |
$config[ComputopConstants::SOFORT_INIT_ACTION] | string | Init API call endpoint for Sofort payment method. |
$config[ComputopConstants::PAYDIREKT_INIT_ACTION] | string | Init API call endpoint for Paydirect payment method. |
$config[ComputopConstants::IDEAL_INIT_ACTION] | string | Init API call endpoint for Ideal payment method. |
$config[ComputopConstants::EASY_CREDIT_INIT_ACTION] | string | Init API call endpoint for Easy Credit payment method. |
$config[ComputopApiConstants::EASY_CREDIT_STATUS_ACTION] | string | Status API call endpoint for Easy Credit payment method. |
$config[ComputopApiConstants::EASY_CREDIT_AUTHORIZE_ACTION] | string | Authorize API call endpoint for Easy Credit payment method. |
$config[ComputopApiConstants::AUTHORIZE_ACTION] | string | Authorize API call endpoint. |
$config[ComputopApiConstants::CAPTURE_ACTION] | string | Capture API call endpoint. |
$config[ComputopApiConstants::REVERSE_ACTION] | string | Reserve API call endpoint. |
$config[ComputopApiConstants::INQUIRE_ACTION] | string | Inquire API call endpoint. |
$config[ComputopApiConstants::REFUND_ACTION] | string | Refund API call endpoint. |
$config[ComputopApiConstants::RESPONSE_MAC_REQUIRED] | array | MAC is required for methods (to check MAC on response). |
$config[ComputopConstants::CREDIT_CARD_TEMPLATE_ENABLED] | bool | Is custom template enabled for Credit Card payment method. |
$config[ComputopConstants::CREDIT_CARD_TX_TYPE] | string | TX TYPE for Credit Card payment method (empty string). |
$config[ComputopConstants::PAY_NOW_TX_TYPE] | string | TX TYPE for PayNow payment method (empty string). |
$config[ComputopConstants::PAY_PAL_TX_TYPE] | string | TX TYPE for PayPal payment method (Auth). |
$config[ComputopConstants::PAYMENT_METHODS_WITHOUT_ORDER_CALL] | array | Array of payment methods without order call. |
$config[ComputopApiConstants::PAYMENT_METHODS_CAPTURE_TYPES] | array | Array with mapping payment methods and their capture types (MANUAL or AUTO). |
$config[ComputopConstants::CRIF_ENABLED] | bool | Is CRIF risk check enabled. |
$config[ComputopApiConstants::CRIF_ACTION] | string | CRIF API call endpoint. |
$config[ComputopApiConstants::CRIF_PRODUCT_NAME] | string | QuickCheckConsumer or CreditCheckConsumer or QuickCheckBusiness or CreditCheckBusiness or IdentCheckConsume. |
$config[ComputopApiConstants::CRIF_LEGAL_FORM] | string | PERSON or COMPANY or UNKNOWN. |
$config[ComputopConstants::CRIF_GREEN_AVAILABLE_PAYMENT_METHODS] | array | List of payment methods available with green response code. |
$config[ComputopConstants::CRIF_YELLOW_AVAILABLE_PAYMENT_METHODS] | array | List of payment methods available with yellow response code. |
$config[ComputopConstants::CRIF_RED_AVAILABLE_PAYMENT_METHODS] | array | List of payment methods available with red response code. |
Also you have to add payment methods to State Machine (OMS) configuration in the config_default.php file:
$config[OmsConstants::PROCESS_LOCATION] = [
...
APPLICATION_ROOT_DIR . '/vendor/spryker-eco/cmoputop/config/Zed/Oms',
];
$config[OmsConstants::ACTIVE_PROCESSES] = [
...
'ComputopPayNow01',
'ComputopCreditCard01',
'ComputopDirectDebit01',
'ComputopPaydirekt01',
'ComputopPayPal01',
'ComputopSofort01',
'ComputopIdeal01',
'ComputopEasyCredit01',
];
$config[SalesConstants::PAYMENT_METHOD_STATEMACHINE_MAPPING] = [
...
ComputopConfig::PAYMENT_METHOD_PAY_NOW => 'ComputopPayNow01',
ComputopConfig::PAYMENT_METHOD_CREDIT_CARD => 'ComputopCreditCard01',
ComputopConfig::PAYMENT_METHOD_DIRECT_DEBIT => 'ComputopDirectDebit01',
ComputopConfig::PAYMENT_METHOD_PAYDIREKT => 'ComputopPaydirekt01',
ComputopConfig::PAYMENT_METHOD_PAY_PAL => 'ComputopPayPal01',
ComputopConfig::PAYMENT_METHOD_SOFORT => 'ComputopSofort01',
ComputopConfig::PAYMENT_METHOD_IDEAL => 'ComputopIdeal01',
ComputopConfig::PAYMENT_METHOD_EASY_CREDIT => 'ComputopEasyCredit01',
];
Integration into Project
Update CheckoutPageDependencyProvider to add payment subform plugins, payment method handlers, provide Computop client and UtilText service:
<?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\Yves\CheckoutPage;
...
use Spryker\Yves\StepEngine\Dependency\Plugin\Form\SubFormPluginCollection;
use SprykerEco\Shared\Computop\ComputopConfig;
use SprykerEco\Yves\Computop\Plugin\ComputopPaymentHandlerPlugin;
use SprykerEco\Yves\Computop\Plugin\CreditCardSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\DirectDebitSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\EasyCreditSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\IdealSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\PaydirektSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\PayNowSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\PayPalSubFormPlugin;
use SprykerEco\Yves\Computop\Plugin\SofortSubFormPlugin;
...
class CheckoutPageDependencyProvider extends SprykerShopCheckoutPageDependencyProvider
{
public const CLIENT_COMPUTOP = 'CLIENT_COMPUTOP';
public const SERVICE_UTIL_TEXT = 'SERVICE_UTIL_TEXT';
/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
public function provideDependencies(Container $container)
{
$container = parent::provideDependencies($container);
$container = $this->extendPaymentMethodHandler($container);
$container = $this->extendSubFormPluginCollection($container);
$container = $this->addComputopClient($container);
$container = $this->addUtilTextService($container);
return $container;
}
/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function extendPaymentMethodHandler(Container $container): Container
{
$container->extend(static::PAYMENT_METHOD_HANDLER, function (StepHandlerPluginCollection $paymentMethodHandler) {
...
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_SOFORT);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_PAYDIREKT);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_IDEAL);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_CREDIT_CARD);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_PAY_PAL);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_DIRECT_DEBIT);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_EASY_CREDIT);
$paymentMethodHandler->add(new ComputopPaymentHandlerPlugin(), ComputopConfig::PAYMENT_METHOD_PAY_NOW);
return $paymentMethodHandler;
});
return $container;
}
/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function extendSubFormPluginCollection(Container $container): Container
{
$container->extend(static::PAYMENT_SUB_FORMS, function (SubFormPluginCollection $subFormPluginCollection) {
...
$subFormPluginCollection->add(new CreditCardSubFormPlugin());
$subFormPluginCollection->add(new PayPalSubFormPlugin());
$subFormPluginCollection->add(new DirectDebitSubFormPlugin());
$subFormPluginCollection->add(new SofortSubFormPlugin());
$subFormPluginCollection->add(new PaydirektSubFormPlugin());
$subFormPluginCollection->add(new IdealSubFormPlugin());
$subFormPluginCollection->add(new EasyCreditSubFormPlugin());
$subFormPluginCollection->add(new PayNowSubFormPlugin());
return $subFormPluginCollection;
});
return $container;
}
/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function addComputopClient(Container $container): Container
{
$container[static::CLIENT_COMPUTOP] = function () use ($container) {
return $container->getLocator()->computop()->client();
};
return $container;
}
/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function addUtilTextService(Container $container): Container
{
$container[static::SERVICE_UTIL_TEXT] = function () use ($container) {
return $container->getLocator()->utilText()->service();
};
return $container;
}
}
Extend ShipmentStep if you want to use CRIF risk check payment methods filtering logic:
<?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\Yves\CheckoutPage\Process\Steps;
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
use Spryker\Yves\StepEngine\Dependency\Plugin\Handler\StepHandlerPluginCollection;
use SprykerEco\Client\Computop\ComputopClientInterface;
use SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCalculationClientInterface;
use SprykerShop\Yves\CheckoutPage\Process\Steps\ShipmentStep as SprykerShipmentStep;
use Symfony\Component\HttpFoundation\Request;
class ShipmentStep extends SprykerShipmentStep
{
/**
* @var \SprykerEco\Client\Computop\ComputopClientInterface
*/
protected $computopClient;
/**
* @param \SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCalculationClientInterface $calculationClient
* @param \Spryker\Yves\StepEngine\Dependency\Plugin\Handler\StepHandlerPluginCollection $shipmentPlugins
* @param string $stepRoute
* @param string $escapeRoute
* @param \SprykerEco\Client\Computop\ComputopClientInterface $computopClient
*/
public function __construct(
CheckoutPageToCalculationClientInterface $calculationClient,
StepHandlerPluginCollection $shipmentPlugins,
$stepRoute,
$escapeRoute,
ComputopClientInterface $computopClient
) {
parent::__construct(
$calculationClient,
$shipmentPlugins,
$stepRoute,
$escapeRoute
);
$this->computopClient = $computopClient;
}
/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return \Generated\Shared\Transfer\QuoteTransfer
*/
public function execute(Request $request, AbstractTransfer $quoteTransfer)
{
$quoteTransfer = parent::execute($request, $quoteTransfer);
return $this->computopClient->performCrifApiCall($quoteTransfer);
}
}
Add PayNow Checkout step if you want to use this payment method in your project:
<?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\Yves\CheckoutPage\Process\Steps;
use Spryker\Service\UtilText\UtilTextServiceInterface;
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
use SprykerEco\Shared\Computop\ComputopConfig;
use SprykerShop\Yves\CheckoutPage\Process\Steps\AbstractBaseStep;
class ComputopPayNowStep extends AbstractBaseStep
{
protected const FORM_TOKEN_LENGTH = 43;
/**
* @var \Spryker\Service\UtilText\UtilTextServiceInterface
*/
protected $utilTextService;
/**
* @param \Spryker\Service\UtilText\UtilTextServiceInterface $utilTextService
* @param string $stepRoute
* @param string $escapeRoute
*/
public function __construct(
UtilTextServiceInterface $utilTextService,
$stepRoute,
$escapeRoute
) {
parent::__construct($stepRoute, $escapeRoute);
$this->utilTextService = $utilTextService;
}
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
public function requireInput(AbstractTransfer $quoteTransfer)
{
if ($this->isMethodPayNow($quoteTransfer)) {
return true;
}
return false;
}
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
public function postCondition(AbstractTransfer $quoteTransfer)
{
return true;
}
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return array
*/
public function getTemplateVariables(AbstractTransfer $quoteTransfer): array
{
return [
'data' => $quoteTransfer->getPayment()->getComputopPayNow()->getData(),
'len' => $quoteTransfer->getPayment()->getComputopPayNow()->getLen(),
'merchant' => $quoteTransfer->getPayment()->getComputopPayNow()->getMerchantId(),
'action' => $quoteTransfer->getPayment()->getComputopPayNow()->getUrl(),
'brandOptions' => $this->getBrandOptions(),
'formToken' => $this->utilTextService->generateRandomString(static::FORM_TOKEN_LENGTH),
];
}
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
protected function isMethodPayNow(AbstractTransfer $quoteTransfer): bool
{
return $quoteTransfer->getPayment()->getPaymentSelection() === ComputopConfig::PAYMENT_METHOD_PAY_NOW;
}
/**
* @return string[]
*/
protected function getBrandOptions(): array
{
return [
'VISA' => [
'value' => 'VISA',
'label' => 'Visa',
],
'MasterCard' => [
'value' => 'MasterCard',
'label' => 'Master Card',
],
'AMEX' => [
'value' =>'AMEX',
'label' => 'American Express',
],
'DINERS' => [
'value' => 'DINERS',
'label' => 'Diners Club',
],
'JCB' => [
'value' => 'JCB',
'label' => 'JCB',
],
'CBN' => [
'value' => 'CBN',
'label' => 'CBN',
],
'SWITCH' => [
'value' => 'SWITCH',
'label' => 'Switch',
],
'SOLO' => [
'value' => 'SOLO',
'label' => 'Solo',
],
];
}
}
Extend PlaceOrder checkout step to add PayNow payment method data in QuoteTransfer (necessary only for PayNow payment method):
<?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\Yves\CheckoutPage\Process\Steps;
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
use Spryker\Yves\Messenger\FlashMessenger\FlashMessengerInterface;
use SprykerEco\Client\Computop\ComputopClientInterface;
use SprykerEco\Shared\Computop\ComputopConfig;
use SprykerShop\Yves\CheckoutPage\Process\Steps\PlaceOrderStep as SprykerPlaceOrderStep;
use SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCheckoutClientInterface;
use SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToGlossaryStorageClientInterface;
use Symfony\Component\HttpFoundation\Request;
class PlaceOrderStep extends SprykerPlaceOrderStep
{
/**
* @var \SprykerEco\Client\Computop\ComputopClientInterface
*/
protected $computopClient;
/**
* @param \SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToCheckoutClientInterface $checkoutClient
* @param \Spryker\Yves\Messenger\FlashMessenger\FlashMessengerInterface $flashMessenger
* @param string $currentLocale
* @param \SprykerShop\Yves\CheckoutPage\Dependency\Client\CheckoutPageToGlossaryStorageClientInterface $glossaryStorageClient
* @param \SprykerEco\Client\Computop\ComputopClientInterface $computopClient
* @param string $stepRoute
* @param string $escapeRoute
* @param array $errorCodeToRouteMatching
*/
public function __construct(
CheckoutPageToCheckoutClientInterface $checkoutClient,
FlashMessengerInterface $flashMessenger,
string $currentLocale,
CheckoutPageToGlossaryStorageClientInterface $glossaryStorageClient,
ComputopClientInterface $computopClient,
$stepRoute,
$escapeRoute,
$errorCodeToRouteMatching = []
) {
parent::__construct(
$checkoutClient,
$flashMessenger,
$currentLocale,
$glossaryStorageClient,
$stepRoute,
$escapeRoute,
$errorCodeToRouteMatching
);
$this->computopClient = $computopClient;
}
/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return \Spryker\Shared\Kernel\Transfer\AbstractTransfer
*/
public function execute(Request $request, AbstractTransfer $quoteTransfer)
{
if ($this->isPaymentPayNow($quoteTransfer) && $this->isComputopPaymentExist($quoteTransfer)) {
return $quoteTransfer;
}
$quoteTransfer = parent::execute($request, $quoteTransfer);
if ($this->isPaymentPayNow($quoteTransfer)) {
$this->setComputopInitData($quoteTransfer);
}
return $quoteTransfer;
}
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
protected function isPaymentPayNow(AbstractTransfer $quoteTransfer): bool
{
return $quoteTransfer->getPayment()->getPaymentSelection() === ComputopConfig::PAYMENT_METHOD_PAY_NOW;
}
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
protected function isComputopPaymentExist(AbstractTransfer $quoteTransfer): bool
{
$quoteTransfer = $this->computopClient->isComputopPaymentExist($quoteTransfer);
return (bool)$quoteTransfer->getPayment()->getIsComputopPaymentExist();
}
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return \Generated\Shared\Transfer\QuoteTransfer
*/
protected function setComputopInitData(AbstractTransfer $quoteTransfer)
{
$paymentSelection = $quoteTransfer->getPayment()->getPaymentSelection();
$paymentMethod = ucfirst($paymentSelection);
$methodGet = 'get' . $paymentMethod;
$methodSet = 'set' . $paymentMethod;
$computopPaymentTransfer = $quoteTransfer->getPayment()->$methodGet();
$computopPaymentTransfer
->setData($this->checkoutResponseTransfer->getComputopInitPayment()->getData())
->setLen($this->checkoutResponseTransfer->getComputopInitPayment()->getLen());
$quoteTransfer->getPayment()->$methodSet($computopPaymentTransfer);
return $quoteTransfer;
}
}
Add Easy Credit Checkout step if you want to use this payment method in your project:
<?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\Yves\CheckoutPage\Process\Steps;
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
use Spryker\Yves\StepEngine\Dependency\Step\StepWithExternalRedirectInterface;
use SprykerEco\Shared\Computop\ComputopConfig;
use SprykerShop\Yves\CheckoutPage\Process\Steps\AbstractBaseStep;
use Symfony\Component\HttpFoundation\Request;
class ComputopEasyCreditStep extends AbstractBaseStep implements StepWithExternalRedirectInterface
{
/**
* @var string
*/
protected $redirectUrl = '';
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
public function requireInput(AbstractTransfer $quoteTransfer)
{
return false;
}
/**
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return \Spryker\Shared\Kernel\Transfer\AbstractTransfer
*/
public function execute(Request $request, AbstractTransfer $quoteTransfer)
{
if ($quoteTransfer->getPayment()->getPaymentSelection() !== ComputopConfig::PAYMENT_METHOD_EASY_CREDIT) {
return $quoteTransfer;
}
$this->redirectUrl = $quoteTransfer->getPayment()->getComputopEasyCredit()->getUrl();
return $quoteTransfer;
}
/**
* @param \Spryker\Shared\Kernel\Transfer\AbstractTransfer|\Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return bool
*/
public function postCondition(AbstractTransfer $quoteTransfer)
{
return true;
}
/**
* Return external redirect url, when redirect occurs not within same application. Used after execute.
*
* @return string
*/
public function getExternalRedirectUrl()
{
return $this->redirectUrl;
}
}
Extend SummaryOrder Checkout step to add Easy Credit fees information on summary page (necessary only for Easy Credit payment method):
<?php
/**
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/
namespace Pyz\Yves\CheckoutPage\Process\Steps;
use Generated\Shared\Transfer\PaymentTransfer;
use Generated\Shared\Transfer\QuoteTransfer;
use Spryker\Shared\Kernel\Transfer\AbstractTransfer;
use SprykerShop\Yves\CheckoutPage\Process\Steps\SummaryStep as SprykerSummaryStep;
class SummaryStep extends SprykerSummaryStep
{
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return array
*/
public function getTemplateVariables(AbstractTransfer $quoteTransfer)
{
return [
'quoteTransfer' => $quoteTransfer,
'cartItems' => $this->productBundleClient->getGroupedBundleItems(
$quoteTransfer->getItems(),
$quoteTransfer->getBundleItems()
),
'additionalData' => $this->getAdditionalData($quoteTransfer),
];
}
/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return array
*/
protected function getAdditionalData(QuoteTransfer $quoteTransfer): array
{
if ($quoteTransfer->getPayment()->getPaymentSelection() !== PaymentTransfer::COMPUTOP_EASY_CREDIT) {
return [];
}
$easyCreditStatusResponse = $quoteTransfer
->getPayment()
->getComputopEasyCredit()
->getEasyCreditStatusResponse();
$financing = $easyCreditStatusResponse->getFinancingData();
$process = $easyCreditStatusResponse->getProcessData();
return [
'installmentPlanMoney' => [
'Kaufbetrag' => (int)round($financing['finanzierung']['bestellwert'] * 100),
'+ Zinsen' => (int)round($financing['ratenplan']['zinsen']['anfallendeZinsen'] * 100),
'= Gesamtbetrag' => (int)round($financing['ratenplan']['gesamtsumme'] * 100),
'Ihre monatliche Rate' => (int)round($financing['ratenplan']['zahlungsplan']['betragRate'] * 100),
'letzte Rate' => (int)round($financing['ratenplan']['zahlungsplan']['betragLetzteRate'] * 100),
],
'installmentPlanTax' => [
'Sollzinssatz p.a. fest für die gesamte Laufzeit' => $financing['ratenplan']['zinsen']['nominalzins'],
'effektiver Jahreszins' => $financing['ratenplan']['zinsen']['effektivzins'],
],
'installmentText' => $financing['tilgungsplanText'],
'installmentLink' => $process['allgemeineVorgangsdaten']['urlVorvertraglicheInformationen'],
];
}
}
Extend StepFactory to add/update necessary checkout steps:
<?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\Yves\CheckoutPage\Process;
use Pyz\Yves\CheckoutPage\Process\Steps\ComputopEasyCreditStep;
use Pyz\Yves\CheckoutPage\Process\Steps\ComputopPayNowStep;
use Pyz\Yves\CheckoutPage\CheckoutPageDependencyProvider;
use Pyz\Yves\CheckoutPage\Plugin\Provider\CheckoutPageControllerProvider;
use Pyz\Yves\CheckoutPage\Process\Steps\ShipmentStep;
use Pyz\Yves\CheckoutPage\Process\Steps\PlaceOrderStep;
use Pyz\Yves\CheckoutPage\Process\Steps\SummaryStep;
use Spryker\Service\UtilText\UtilTextServiceInterface;
use Spryker\Yves\StepEngine\Process\StepCollection;
use SprykerEco\Client\Computop\ComputopClientInterface;
use SprykerShop\Yves\CheckoutPage\Process\StepFactory as SprykerStepFactory;
use SprykerShop\Yves\HomePage\Plugin\Provider\HomePageControllerProvider;
/**
* @method \SprykerShop\Yves\CheckoutPage\CheckoutPageConfig getConfig()
*/
class StepFactory extends SprykerStepFactory
{
/**
* @return \Spryker\Yves\StepEngine\Process\StepCollectionInterface
*/
public function createStepCollection()
{
$stepCollection = new StepCollection(
$this->getUrlGenerator(),
CheckoutPageControllerProvider::CHECKOUT_ERROR
);
$stepCollection
->addStep($this->createEntryStep())
->addStep($this->createCustomerStep())
->addStep($this->createAddressStep())
->addStep($this->createShipmentStep())
->addStep($this->createPaymentStep())
->addStep($this->createComputopEasyCreditStep())
->addStep($this->createSummaryStep())
->addStep($this->createPlaceOrderStep())
->addStep($this->createPayNowStep())
->addStep($this->createSuccessStep());
return $stepCollection;
}
/**
* @return \SprykerShop\Yves\CheckoutPage\Process\Steps\ShipmentStep
*/
public function createShipmentStep()
{
return new ShipmentStep(
$this->getCalculationClient(),
$this->getShipmentPlugins(),
CheckoutPageControllerProvider::CHECKOUT_SHIPMENT,
HomePageControllerProvider::ROUTE_HOME,
$this->getComputopClient()
);
}
/**
* @return \SprykerShop\Yves\CheckoutPage\Process\Steps\PlaceOrderStep
*/
public function createPlaceOrderStep()
{
return new PlaceOrderStep(
$this->getCheckoutClient(),
$this->getFlashMessenger(),
$this->getStore()->getCurrentLocale(),
$this->getGlossaryStorageClient(),
$this->getComputopClient(),
CheckoutPageControllerProvider::CHECKOUT_PLACE_ORDER,
HomePageControllerProvider::ROUTE_HOME,
[
static::ERROR_CODE_GENERAL_FAILURE => self::ROUTE_CART,
'payment failed' => CheckoutPageControllerProvider::CHECKOUT_PAYMENT,
'shipment failed' => CheckoutPageControllerProvider::CHECKOUT_SHIPMENT,
]
);
}
/**
* @return \Pyz\Yves\CheckoutPage\Process\Steps\ComputopEasyCreditStep
*/
protected function createComputopEasyCreditStep()
{
return new ComputopEasyCreditStep(
CheckoutPageControllerProvider::CHECKOUT_COMPUTOP_EASYCREDIT,
HomePageControllerProvider::ROUTE_HOME
);
}
/**
* @return \Pyz\Yves\CheckoutPage\Process\Steps\SummaryStep
*/
public function createSummaryStep()
{
return new SummaryStep(
$this->getProductBundleClient(),
CheckoutPageControllerProvider::CHECKOUT_SUMMARY,
HomePageControllerProvider::ROUTE_HOME
);
}
/**
* @return \Pyz\Yves\CheckoutPage\Process\Steps\ComputopPayNowStep
*/
protected function createPayNowStep()
{
return new ComputopPayNowStep(
$this->getUtilTextService(),
CheckoutPageControllerProvider::CHECKOUT_COMPUTOP_PAYNOW,
HomePageControllerProvider::ROUTE_HOME
);
}
/**
* @return \SprykerEco\Client\Computop\ComputopClientInterface
*/
public function getComputopClient(): ComputopClientInterface
{
return $this->getProvidedDependency(CheckoutPageDependencyProvider::CLIENT_COMPUTOP);
}
/**
* @return \Spryker\Service\UtilText\UtilTextServiceInterface
*/
public function getUtilTextService(): UtilTextServiceInterface
{
return $this->getProvidedDependency(CheckoutPageDependencyProvider::SERVICE_UTIL_TEXT);
}
}
Extend CheckoutPageFactory for project level StepFactory usage:
<?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\Yves\CheckoutPage;
use Pyz\Yves\CheckoutPage\Process\StepFactory;
use SprykerShop\Yves\CheckoutPage\CheckoutPageFactory as SprykerShopCheckoutPageFactory;
class CheckoutPageFactory extends SprykerShopCheckoutPageFactory
{
/**
* @return \SprykerShop\Yves\CheckoutPage\Process\StepFactory
*/
public function createStepFactory()
{
return new StepFactory();
}
}
Extend CheckoutPage CheckoutController to add PayNow and EasyCredit step actions (if you use these payment methods):
<?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\Yves\CheckoutPage\Controller;
use SprykerShop\Yves\CheckoutPage\Controller\CheckoutController as SprykerShopCheckoutController;
use Symfony\Component\HttpFoundation\Request;
/**
* @method \SprykerShop\Yves\CheckoutPage\CheckoutPageFactory getFactory()
*/
class CheckoutController extends SprykerShopCheckoutController
{
/**
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return array|\Symfony\Component\HttpFoundation\RedirectResponse
*/
public function easyCreditAction(Request $request)
{
return $this->createStepProcess()->process($request);
}
/**
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return array|\Spryker\Yves\Kernel\View\View|\Symfony\Component\HttpFoundation\RedirectResponse
*/
public function paynowAction(Request $request)
{
$quoteValidationResponseTransfer = $this->canProceedCheckout();
if (!$quoteValidationResponseTransfer->getIsSuccessful()) {
$this->processErrorMessages($quoteValidationResponseTransfer->getMessages());
return $this->redirectResponseInternal(static::ROUTE_CART);
}
$response = $this->createStepProcess()->process($request);
if (!is_array($response)) {
return $response;
}
return $this->view(
$response,
$this->getFactory()->getCustomerPageWidgetPlugins(),
'@CheckoutPage/views/paynow/paynow.twig'
);
}
}
Extend CheckoutPageControllerProvider to define PayNow and EasyCredit step actions (if you use these payment methods):
<?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\Yves\CheckoutPage\Plugin\Provider;
use Silex\Application;
use SprykerShop\Yves\CheckoutPage\Plugin\Provider\CheckoutPageControllerProvider as SprykerShopCheckoutPageControllerProvider;
class CheckoutPageControllerProvider extends SprykerShopCheckoutPageControllerProvider
{
public const CHECKOUT_COMPUTOP_EASYCREDIT = 'checkout-computop-easycredit';
public const CHECKOUT_COMPUTOP_PAYNOW = 'checkout-computop-paynow';
/**
* @param \Silex\Application $app
*
* @return void
*/
protected function defineControllers(Application $app)
{
$this->addCheckoutIndexRoute()
->addCustomerStepRoute()
->addAddressStepRoute()
->addShipmentStepRoute()
->addPaymentStepRoute()
->addCheckoutSummaryStepRoute()
->addPlaceOrderStepRoute()
->addCheckoutErrorRoute()
->addCheckoutSuccessRoute()
->addComputopPayNowRoute()
->addComputopEasyCreditRoute();
}
/**
* @return $this
*/
protected function addComputopPayNowRoute()
{
$this->createController('/{checkout}/computop/paynow', static::CHECKOUT_COMPUTOP_PAYNOW, 'CheckoutPage', 'Checkout', 'paynow')
->assert('checkout', $this->getAllowedLocalesPattern() . 'checkout|checkout')
->value('checkout', 'checkout')
->method('GET|POST');
return $this;
}
/**
* @return $this
*/
protected function addComputopEasyCreditRoute()
{
$this->createController('/{checkout}/computop/easycredit', static::CHECKOUT_COMPUTOP_EASYCREDIT, 'CheckoutPage', 'Checkout', 'easyCredit')
->assert('checkout', $this->getAllowedLocalesPattern() . 'checkout|checkout')
->value('checkout', 'checkout')
->method('GET|POST');
return $this;
}
}
Change CheckoutPageControllerProvider from core to project level in YvesBootstrap (if you use PayNow or Easy Credit payment methods):
- use SprykerShop\Yves\CheckoutPage\Plugin\Provider\CheckoutPageControllerProvider;
+ use Pyz\Yves\CheckoutPage\Plugin\Provider\CheckoutPageControllerProvider;
Extend payment twig to add Computop payment methods:
...
{% define data = {
backUrl: _view.previousStepUrl,
forms: {
payment: _view.paymentForm
},
title: 'checkout.step.payment.title' | trans,
customForms: {
'Computop/credit-card': ['credit-card', 'computop'],
'Computop/direct-debit': ['direct-debit', 'computop'],
'Computop/easy-credit': ['easy-credit', 'computop'],
'Computop/ideal': ['ideal', 'computop'],
'Computop/paydirekt': ['paydirekt', 'computop'],
'Computop/paynow': ['paynow', 'computop'],
'Computop/paypal': ['paypal', 'computop'],
'Computop/sofort': ['sofort', 'computop'],
}
} %}
...
Add paynow checkout step template if you want to use this payment method:
{% extends template('page-layout-checkout', 'CheckoutPage') %}
{% define data = {
paynowAction: _view.action,
paynowBrandOptions: _view.brandOptions,
paynowMerchant: _view.merchant,
paynowData: _view.data,
paynowLen: _view.len,
paynowFormToken: _view.formToken,
title: 'checkout.step.paynow.title' | trans,
} %}
{% block breadcrumb %}{% endblock %}
{% block content %}
<div class="form box">
<form name="paynowStepForm" method="post" action="{{ data.paynowAction }}">
<div id="paynowStepForm" class="grid">
<div class="form__fields col col--sm-12 col--lg-6">
<div class="form__field">
<label for="paynowStepForm_CCBrand" class="label label--required">{{ 'checkout.step.paynow.credit_card_brand'| trans }}</label>
{% include atom('select') with {
modifiers: ['expand'],
data: {
options: data.paynowBrandOptions
}
} only %}
</div>
<div class="form__field">
<label for="paynowStepForm_CCNr" class="label label--required">{{ 'checkout.step.paynow.credit_card_number'| trans }}</label>
<input class="input input--expand" type="text" id="paynowStepForm_CCNr" name="CCNr" required="required">
</div>
<div class="form__field">
<label for="paynowStepForm_CCExpiry" class="label label--required">{{ 'checkout.step.paynow.credit_card_expiry'| trans }}</label>
<input class="input input--expand" type="text" id="paynowStepForm_CCExpiry" name="CCExpiry" required="required">
</div>
<div class="form__field">
<label for="paynowStepForm_CCCVC" class="label label--required">{{ 'checkout.step.paynow.cvv'| trans }}</label>
<input class="input input--expand" type="text" id="paynowStepForm_CCCVC" name="CCCVC" required="required">
</div>
<input type="hidden" id="paynowStepForm_MerchantID" name="MerchantID" value="{{ data.paynowMerchant }}">
<input type="hidden" id="paynowStepForm_Data" name="Data" value="{{ data.paynowData }}">
<input type="hidden" id="paynowStepForm_Len" name="Len" value="{{ data.paynowLen }}">
<input type="hidden" id="paynowStepForm__token" name="paynowStepForm[_token]" value="{{ data.paynowFormToken }}">
<div class="form__field">
<button type="submit" class="button button--success button--expand">{{ 'checkout.step.paynow.pay_button_text'| trans }}</button>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
Add easy-credit-summary molecule is you want to use Easy Credit payment method:
{% extends model('component') %}
{% define config = {
name: 'easy-credit-summary'
} %}
{% define data = {
additionalData: null
} %}
{% block body %}
<div class="box">
<h6>{{ 'computop.easycredit.intallment_plan' | trans }}</h6>
<hr />
{% for key, value in data.additionalData.installmentPlanMoney %}
<div class="grid">
<span class="col col--sm-8">{{ key }}</span>
<span class="col col--sm-4 text-right">{{ value | money }}</span>
</div>
{% endfor %}
{% for key, value in data.additionalData.installmentPlanTax %}
<div class="grid">
<span class="col col--sm-8">{{ key }}</span>
<span class="col col--sm-4 text-right">{{ value }}%</span>
</div>
{% endfor %}
<p>{{ data.additionalData.installmentText }}</p>
<a href="{{ data.additionalData.installmentLink }}">{{ 'computop.easycredit.installment_link_text' | trans }}</a>
</div>
{% endblock %}
Extend summary twig to add Easy Credit fees information (necessary for Easy Credit payment method):
{% extends template('page-layout-checkout', 'CheckoutPage') %}
{% define data = {
cart: _view.quoteTransfer,
backUrl: _view.previousStepUrl,
transfer: _view.quoteTransfer,
cartItems: _view.cartItems,
shippingAddress: _view.quoteTransfer.shippingAddress,
billingAddress: _view.quoteTransfer.billingAddress,
shipmentMethod: _view.quoteTransfer.shipment.method.name,
paymentMethod: _view.quoteTransfer.payment.paymentMethod,
additionalData: _view.additionalData,
forms: {
summary: _view.summaryForm
},
overview: {
shipmentMethod: _view.quoteTransfer.shipment.method.name,
payments: _view.quoteTransfer.payments,
expenses: _view.quoteTransfer.expenses,
voucherDiscounts: _view.quoteTransfer.voucherDiscounts,
cartRuleDiscounts: _view.quoteTransfer.cartRuleDiscounts,
prices: {
subTotal: _view.quoteTransfer.totals.subtotal,
storeCurrency: _view.quoteTransfer.shipment.method.storeCurrencyPrice,
grandTotal: _view.quoteTransfer.totals.grandtotal,
priceToPay: _view.quoteTransfer.totals.priceToPay,
tax: _view.quoteTransfer.totals.taxtotal.amount,
discountTotal: _view.quoteTransfer.totals.discounttotal | default
}
},
title: 'checkout.step.summary.title' | trans
} %}
{% block content %}
<div class="grid">
<div class="col col--sm-12 col--lg-4">
<div class="box">
<span class="float-right">{{ 'checkout.step.summary.with_method' | trans }} <strong>{{data.paymentMethod}}</strong></span>
<h6>{{ 'checkout.step.summary.payment' | trans }}</h6>
<hr/>
{% include molecule('display-address') with {
class: 'text-small',
data: {
address: data.billingAddress
}
} only %}
</div>
<div class="box">
<span class="float-right">{{ 'checkout.step.summary.with_method' | trans }} <strong>{{ data.shipmentMethod }}</strong></span>
<h6>{{ 'checkout.step.summary.shipping' | trans }}</h6>
<hr/>
{% include molecule('display-address') with {
class: 'text-small',
data: {
address: data.shippingAddress
}
} only %}
</div>
{% if data.additionalData is defined and data.additionalData is not empty %}
{% include molecule('easy-credit-summary', 'CheckoutPage') with {
data: {
additionalData: data.additionalData
}
} only %}
{% endif %}
</div>
<div class="col col--sm-12 col--lg-8">
<div class="box">
{% for item in data.cartItems %}
{% set item = item.bundleProduct is defined ? item.bundleProduct : item %}
{% embed molecule('summary-item', 'CheckoutPage') with {
data: {
name: item.name,
quantity: item.quantity,
price: item.sumPrice | money,
options: item.productOptions | default({}),
bundleItems: item.bundleItems | default([]),
quantitySalesUnit: item.quantitySalesUnit,
amountSalesUnit: item.amountSalesUnit,
amount: item.amount
},
embed: {
isLast: not loop.last,
item: item
}
} only %}
{% block body %}
{{parent()}}
{% if widgetExists('CartNoteQuoteItemNoteWidgetPlugin') %}
{% if embed.item.cartNote is not empty %}
{{ widget('CartNoteQuoteItemNoteWidgetPlugin', embed.item) }} {# @deprecated Use molecule('note-list', 'CartNoteWidget') instead. #}
{% endif %}
{% elseif embed.item.cartNote is not empty %}
{% include molecule('note-list', 'CartNoteWidget') ignore missing with {
data: {
label: 'cart_note.checkout_page.item_note',
note: embed.item.cartNote
}
} only %}
{% endif %}
{% if embed.isLast %}<hr/>{% endif %}
{% endblock %}
{% endembed %}
{% endfor %}
</div>
{% if data.transfer.cartNote is not empty %}
{% if widgetExists('CartNoteQuoteNoteWidgetPlugin') %}
<div class="box">
{{ widget('CartNoteQuoteNoteWidgetPlugin', data.transfer) }} {#@deprecated Use molecule('note-list', 'CartNoteWidget') instead.#}
</div>
{% else %}
<div class="box">
{% include molecule('note-list', 'CartNoteWidget') ignore missing with {
data: {
label: 'cart_note.checkout_page.quote_note',
note: data.transfer.cartNote
}
} only %}
</div>
{% endif %}
{% endif %}
<div class="box">
{% widget 'CartCodeFormWidget' args [data.transfer] only %}
{% elsewidget 'CheckoutVoucherFormWidget' args [data.transfer] only %} {# @deprecated Use CartCodeFormWidget instead. #}
{% elsewidget 'CheckoutVoucherFormWidgetPlugin' args [data.transfer] only %} {# @deprecated Use CheckoutVoucherFormWidget instead. #}
{% endwidget %}
</div>
{% embed molecule('form') with {
class: 'box',
data: {
form: data.forms.summary,
submit: {
enable: can('SeeOrderPlaceSubmitPermissionPlugin'),
text: 'checkout.step.place.order' | trans
},
cancel: {
enable: true,
url: data.backUrl,
text: 'general.back.button' | trans
}
},
embed: {
overview: data.overview,
cart: data.cart
}
} only %}
{% block body %}
{% include molecule('summary-overview', 'CheckoutPage') with {
data: embed.overview
} only %}
{% include molecule('gift-card-payment-summary', 'GiftCardWidget') ignore missing with {
data: {
cart: embed.cart
}
} only %}
<hr />
{{parent()}}
{% endblock %}
{% endembed %}
</div>
</div>
{% endblock %}
Add controller provider:
<?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\Yves\ShopApplication;
...
use SprykerEco\Yves\Computop\Plugin\Provider\ComputopControllerProvider;
...
class YvesBootstrap extends SprykerYvesBootstrap
{
...
/**
* @param bool|null $isSsl
*
* @return \SprykerShop\Yves\ShopApplication\Plugin\Provider\AbstractYvesControllerProvider[]
*/
protected function getControllerProviderStack($isSsl)
{
return [
...
new ComputopControllerProvider($isSsl),
];
}
}
Add checkout plugins:
<?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\Computop\Communication\Plugin\Checkout\ComputopDoSaveOrderPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Checkout\ComputopPostSaveHookPlugin;
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
{
...
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[]
*/
protected function getCheckoutOrderSavers(Container $container)
{
/** @var \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface[] $plugins */
$plugins = [
...
new ComputopDoSaveOrderPlugin(),
];
return $plugins;
}
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPostSaveHookInterface[]
*/
protected function getCheckoutPostHooks(Container $container)
{
return [
...
new ComputopPostSaveHookPlugin(),
];
}
}
Add OMS commands and conditions:
public function provideBusinessLayerDependencies(Container $container): Container
{
$container = parent::provideBusinessLayerDependencies($container);
$container = $this->extendCommandPlugins($container);
$container = $this->extendConditionPlugins($container);
return $container;
}
<?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\Oms;
...
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Command\AuthorizePlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Command\CancelPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Command\CapturePlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Command\EasyCreditAuthorizePlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Command\RefundPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Condition\IsAuthorizedPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Condition\IsCancelledPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Condition\IsCapturedPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Condition\IsInitializedPlugin;
use SprykerEco\Zed\Computop\Communication\Plugin\Oms\Condition\IsRefundedPlugin;
class OmsDependencyProvider extends SprykerOmsDependencyProvider
{
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Kernel\Container
*/
public function provideBusinessLayerDependencies(Container $container)
{
$container = parent::provideBusinessLayerDependencies($container);
$container = $this->extendCommandPlugins($container);
$container = $this->extendConditionPlugins($container);
return $container;
}
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Kernel\Container
*/
protected function extendCommandPlugins(Container $container): Container
{
$container->extend(self::COMMAND_PLUGINS, function (CommandCollectionInterface $commandCollection) {
...
$commandCollection->add(new AuthorizePlugin(), 'Computop/Authorize');
$commandCollection->add(new CancelPlugin(), 'Computop/Cancel');
$commandCollection->add(new CapturePlugin(), 'Computop/Capture');
$commandCollection->add(new EasyCreditAuthorizePlugin(), 'Computop/EasyCreditAuthorize');
$commandCollection->add(new RefundPlugin(), 'Computop/Refund');
return $commandCollection;
});
return $container;
}
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Spryker\Zed\Kernel\Container
*/
protected function extendConditionPlugins(Container $container): Container
{
$container->extend(OmsDependencyProvider::CONDITION_PLUGINS, function (ConditionCollectionInterface $conditionCollection) {
...
$conditionCollection->add(new IsAuthorizedPlugin(), 'Computop/IsAuthorized');
$conditionCollection->add(new IsCancelledPlugin(), 'Computop/IsCancelled');
$conditionCollection->add(new IsCapturedPlugin(), 'Computop/IsCaptured');
$conditionCollection->add(new IsInitializedPlugin(), 'Computop/IsInitialized');
$conditionCollection->add(new IsRefundedPlugin(), 'Computop/IsRefunded');
return $conditionCollection;
});
return $container;
}
}
Extend PaymentDependencyProvider to add payment method filter plugin (if you want to use CRIF risk check):
<?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\Payment;
...
use SprykerEco\Zed\Computop\Communication\Plugin\ComputopPaymentMethodFilterPlugin;
class PaymentDependencyProvider extends SprykerPaymentDependencyProvider
{
/**
* @return \Spryker\Zed\Payment\Dependency\Plugin\Payment\PaymentMethodFilterPluginInterface[]
*/
protected function getPaymentMethodFilterPlugins()
{
return [
...
new ComputopPaymentMethodFilterPlugin(),
];
}
}
Copyright and Disclaimer
See Disclaimer.
See also:
- Learn about Computop API
- Get acquainted with Computop OMS functioning
- Configure Credit Card payment method for Computop
- Configure Direct Debit payment method for Computop
- Configure Easy Credit payment method for Computop
- Configure iDeal payment method for Computop
- Configure Paydirekt payment method for Computop
- Configure PayNow payment method for Computop
- Configure PayPal payment method for Computop
- Configure Sofort payment method for Computop
- Computop CRIF
- Computop announces plugin for international payment methods in Spryker applications
- Computop Press Release