2017 © Pedro PelĂĄez
 

cakephp-plugin cakephp-stuzza-eps-banktransfer-plugin

CakePhp Plugin for EPS bank transfer payments

image

hakito/cakephp-stuzza-eps-banktransfer-plugin

CakePhp Plugin for EPS bank transfer payments

  • Saturday, September 26, 2015
  • by hakito
  • Repository
  • 1 Watchers
  • 0 Stars
  • 99 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

CakePHP-EpsBankTransfer-Plugin

CakePHP 4.x plugin, (*2)

Installation

Using composer

If you are using composer simply add the plugin using the command, (*3)

composer require hakito/cakephp-stuzza-eps-banktransfer-plugin

Without composer

Download the plugin to app/Plugin/EpsBankTransfer. Also download https://github.com/hakito/PHP-Stuzza-EPS-BankTransfer Add a PSR-4 compatible autoloader to your bootstrap., (*4)

Load the plugin

Load the plugin in your bootstrap:, (*5)

public function bootstrap()
{
    // Call parent to load bootstrap from files.
    parent::bootstrap();

    $this->addPlugin(\EpsBankTransfer\Plugin::class, ['routes' => true]);
}

Confguration

In your app.local.php add an entry for EpsBankTransfer, (*6)

[
    'EpsBankTransfer',
    [
        // required parameters
        'userid' => 'AKLJS231534',           // Eps "HĂ€ndler" id
        'secret' => 'topSecret',             // Secret for authentication
        'iban' => 'AT611904300234573201',    // IBAN code of bank account where money will be sent to
        'bic' => 'GAWIATW1XXX',              // BIC code of bank account where money will be sent to
        'account_owner' => 'John Q. Public', // Name of the account owner where money will be sent to

        // Encryption key for sending encrypted remittance identifier as encrypted string
        'encryptionKey' => 'A_SECRET_KEY_MUST_BE_32_BYTES_LONG',

        //// optional parameters
        //'ObscuritySuffixLength' => 8,             // Number of hash chars appended to remittance identifier
        //'ObscuritySeed'  => 'SOME RANDOM STRING', // Seed for the random remittance identifier suffix. REQUIRED when ObscuritySuffixLength > 0 provided
        //'TestMode' => true                        // Use EPS test mode URL endpoint
    ]
];

Logs

If you want to collect the log stream add this entry to your log configuration in app_local.php, (*7)

    'Log' =>
    [
        'eps' =>
        [
            'className' => FileLog::class,
            'path' => LOGS,
            'file' => 'eps',
            'scopes' => ['EpsBankTransfer'],
            'levels' => ['warning', 'error', 'critical', 'alert', 'emergency', 'info', 'debug'],
        ],
    ]

Usage

In your payment handling controller:, (*8)

    // Load the component
    public function initialize(): void
    {
        parent::initialize();
        $this->loadComponent('EpsBankTransfer.Eps');
    }

    // Sample checkout
    private function _checkoutEPS($orderId)
    {
        // Add all articles
        $this->Eps->AddArticle('Magic dragon', $quantity, $priceInCents);

        // You might also want to add shipping agio as article
        $this->Eps->AddArticle('Shipping agio', 1, $shippingAgioInCents);

        // remittanceIdentifier could be your shopping card id
        // okUrl is the return url if payment is successful
        // nOkUrl is the return url if payment failed / canceled
        // BIC of the bank from GetBanksArray
        $this->Eps->PaymentRedirect($remittanceIdentifier, $okUrl, $nOkUrl, $bic);
    }

Event handlers

You must implement at least the following eventhandlers:, (*9)

EpsBankTransfer.VitalityCheck

\Cake\Event\EventManager::instance()->on('EpsBankTransfer.VitalityCheck',
function ($event, $args)
{
  // $args =
  // [
  //   'raw' => {string},                  // Raw XML content
  //   'vitalityCheckDetails' => {object}, // Instance of at\externet\eps_bank_transfer\VitalityCheckDetails
  // ]

  return ['handled' => true]; // You have to set this otherwise the EPS call is not successful
});

EpsBankTransfer.Confirmation', $this

\Cake\Event\EventManager::instance()->on('EpsBankTransfer.Confirmation',
function ($event, $args)
{
  // $args =
  // [
  //   'raw' => {string},                     // Raw XML content
  //   'bankConfirmationDetails' => {object}, // Instance of at\externet\eps_bank_transfer\BankConfirmationDetails
  // ]

  return ['handled' => true]; // You have to set this otherwise the EPS call is not successful
});

The Versions

26/09 2015

dev-master

9999999-dev https://github.com/hakito/CakePHP-EpsBankTransfer-Plugin

CakePhp Plugin for EPS bank transfer payments

  Sources   Download

GPL-2.0

The Requires

 

cakephp payments eps bank transfer stuzza