Heidelpay - Direct Debit

Setup

The following configuration should be made after Heidelpay has been installed and integrated.

Configuration

$config[HeidelpayConstants::CONFIG_HEIDELPAY_TRANSACTION_CHANNEL_DIRECT_DEBIT] = ''; //You can use public test account for testing with channel `31HA07BC8142C5A171749A60D979B6E4` but replace it with real one when you go live. Config should be taken from Heidelpay.
$config[HeidelpayConstants::DIRECT_DEBIT_REGISTRATION_ASYNC_RESPONSE_URL] = $config[HeidelpayConstants::CONFIG_YVES_URL] . '/heidelpay/dd-register-response'; // This setting is store sensitive and should be set in store related config (config_default_DE.php for example).
 
$config[OmsConstants::PROCESS_LOCATION] = [
	...
	APPLICATION_ROOT_DIR . '/vendor/spryker-eco/heidelpay/config/Zed/Oms',
];
 
$config[OmsConstants::ACTIVE_PROCESSES] = [
	...
	'HeidelpayDirectDebit01',
];
$config[SalesConstants::PAYMENT_METHOD_STATEMACHINE_MAPPING] = [
	...
HeidelpayConfig::PAYMENT_METHOD_DIRECT_DEBIT => 'HeidelpayDirectDebit01',
];

The Process of Registration of a Direct Debit Account

Payment flow with direct debit is divided into two workflows - based on the new "Registration," and without/with the existing "Registration." Existing "Registration" means that customer's bank account data (IBAN, Account Holder and so on) will be persisted in the database to use it again next time if customer uses the same shipping address. Otherwise, use the new "Registration" option.

When you go to the checkout payment page and choose the DirectDebit payment method, there are two payment options - to use the already existing registration (if available) or to create a new registration (always available) with the two fields IBAN and Account Holder. Existing registration is available only for registered customer after he placed an order with DirectDebit payment method, and he uses the same shipping address.

Integration into Project

All general integration parts of Heidelpay module should be done before the following steps.

  1. Adjust CheckoutPageDependencyProvider on project level to add Direct Debit subform and payment method handler. Also, add HeidelpayClient into dependencies. It's used in specific DirectDebitRegistration checkout step.
  2. Extend StepFactory on project level to add specific DirectDebitRegistration checkout step. This step should be included right before the Payment step.
  3. Extend Yves Factory to create StepFactory from project level instead of Spryker Core.
  4. Extend CheckoutController on the project level to add an action for direct debit registration step.
  5. Extend CheckoutPageControllerProvider to register controller action described above.
  6. Adjust define data section in the template of Checkout Payment step to include DirectDebit payment method template.
  7. Adjust OmsDependencyProvider to add debit on registration and refund OMS commands and conditions related to it.

    OMS State Machine

    You can find an example of DirectDebit state machine in vendor/spryker-eco/heidelpay/config/Zed/Oms/HeidelpayDirectDebit01.xml

    The state machine includes two main processes: Debit on Registration and Refund. After the order is placed successfully, the debit process starts. In this process, we use the identification of direct debit registration. In case of return order refund process is used.

 

Last review date: Aug 28, 2019