Ratenkauf by Easycredit - Installation and Configuration

Installation

To install Easycredit, run the command in the console:

composer require spryker-eco/easycredit

After installation, you have to run the propel:install command or you can check the following migration:


CREATE SEQUENCE "spy_payment_easycredit_api_log_pk_seq";
 
CREATE TABLE "spy_payment_easycredit_api_log"
(
	"id_payment_easycredit_api_log" INTEGER NOT NULL,
	"type" VARCHAR NOT NULL,
	"request" TEXT NOT NULL,
	"response" TEXT NOT NULL,
	"status_code" INT2,
	"error_code" VARCHAR,
	"error_message" VARCHAR,
	"error_type" VARCHAR,
	"created_at" TIMESTAMP,
	"updated_at" TIMESTAMP,
	PRIMARY KEY ("id_payment_easycredit_api_log")
);
 
CREATE SEQUENCE "spy_payment_easycredit_order_identifier_pk_seq";
 
CREATE TABLE "spy_payment_easycredit_order_identifier"
(
	"id_payment_easycredit_order_identifier" INTEGER NOT NULL,
	"fk_sales_order" INTEGER NOT NULL,
	"identifier" VARCHAR NOT NULL,
	"confirmed" BOOLEAN NOT NULL,
	PRIMARY KEY ("id_payment_easycredit_order_identifier")
);

To use front-end functionality (JavaScript and CSS) with old demoshop, the shop-ui-compatibility module is necessary:

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

Set up the Easycredit initial configuration.

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 another 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 the spy_payment_easycredit_order_identifier table.

To use Easycredit requests during the checkout process, you have to create your own checkout steps. To implement the checkout steps, follow the steps 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

You should extend some views on the project level for showing Easycredit info on the PDP page, and Summary, and Payment steps.

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

Payment step - src/Pyz/Yves/CheckoutPage/Theme/default/views/payment/payment.twig

Summary step - src/Pyz/Yves/CheckoutPage/Theme/default/views/summary/summary.twig

PDP page - src/Pyz/Yves/ProductDetailPage/Theme/default/views/pdp/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.

Make sure to replace <Your shop identifier> with value used in config_default.