Ratenkauf by Easycredit - Installation and Configuration

Installation

To install Easycredit, run the following command in the console:

composer require spryker-eco/easycredit

In order to use front-end functionality (JavaScript and CSS) with old Demoshop, the shop-ui-compatibility module is required:

composer require spryker-eco/shop-ui-compatibility

After installing shop-ui-compatibility use procedures described in this migration guide - Setting up ShopUICompatibility Module in the Legacy Demoshop.

Configuration

Perform the initial configuration of Easycredit:

<?php
...
use SprykerEco\Shared\Easycredit\EasycreditConstants;
...
...
$config[EasycreditConstants::SHOP_IDENTIFIER] = 'Your shop identifier';
$config[EasycreditConstants::SHOP_TOKEN] = 'Your shop token';
$config[EasycreditConstants::API_URL] = 'https://ratenkauf.easycredit.de/ratenkauf-ws/rest/v2';
$config[EasycreditConstants::SUCCESS_URL] = $config[ApplicationConstants::BASE_URL_YVES] . '/easycredit/payment/success';
$config[EasycreditConstants::CANCELLED_URL] = $config[ApplicationConstants::BASE_URL_YVES] . '/checkout/payment';
$config[EasycreditConstants::DENIED_URL] = $config[ApplicationConstants::BASE_URL_YVES] . '/checkout/payment';

Integration

  1. First of all, update CheckoutPageDependencyProvider by adding a new payment subform and a payment method handler.

    To show the Easycredit payment method on the payment step, you should define SubFormPlugin and StepHandlerPlugin.

  2. The next dependency provider you should update is OmsDependencyProvider.

    To use commands and conditions for events in OMS, define them.

  3. And one more dependency provider to be updated is CheckoutDependencyProvider.

    To send requests to Easycredit, you need the technical order identifier value. After adding this plugin, the order identifier will be saved to the database in table spy_payment_easycredit_order_identifier.

To use Easycredit requests during the checkout process, you have to create your own checkout steps. To implement the checkout steps, follow the guidelines below:

  1. Extend StepFactory.
  2. Implement StepFactory as shown in this example:
  3. Now you can extend the basic steps on the project level and can create your Easycredit step that will be called when a user takes Easycredit as PaymentMethod.

    Examples of steps implementations:

  4. To run the step process for the new Easycredit step, you should extend the default CheckoutController with a new action for handling the Easycredit step.
  5. After creating a new action in the checkout controller, define a new route in CheckoutPageControllerProvider.
  6. Also, the Easycredit bundle has its own YvesController for handling a success response from Easycredit, so you have to define a controller in YvesBootstrap.

Frontend part

Еo show the Easycredit info on the PDP page, and Summary and Payment steps, you have to extend some views on the project level .

You can find some examples below in payment.twig, summary.twig and pdp.twig.

You might want to configure the product detail page to add some validation and show the Easycredit badge in src/Pyz/Yves/ProductDetailPage/Theme/default/components/molecules/product-configurator/product-configurator.twig