edofre/yii2-omnikassa Yii2 component for Rabobank omnikassa payments

omnikassarabobank

Yii2 omnikassa component

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require edofre/yii2-omnikassa "V1.0.5"

or add

"edofre/yii2-omnikassa": "V1.0.5"

to the require section of your composer.json file.

Usage

Add the components to the configuration, the following configuration is the test environment for omnikassa

return [
    ...
    'components'          => [
        'omniKassa'    => [
            'class'                => '\edofre\omnikassa\OmniKassa',
            'automaticResponse'    => false,
            'currencyCode'         => '978',
            'interfaceVersion'     => 'HP_1.0',
            'keyVersion'           => '1',
            'merchantId'           => '002020000000001',
            'paymentMeanBrandList' => 'IDEAL,VISA,MASTERCARD,MAESTRO',
            'secretKey'            => '002020000000001_KEY1',
            'testMode'             => true,
            'url'                  => 'https://payment-webinit.simu.omnikassa.rabobank.nl/paymentServlet',
        ],
        ...
    ],
    ...
];

Create the PaymentRequest object and create a form

$paymentRequest = new \edofre\omnikassa\PaymentRequest([
    'amount'               => 12354, // Amount in cents, 12345 = 123,45
    'orderId'              => 'your-order-id',
    'normalReturnUrl'      => \yii\helpers\Url::to(['site/return'], true),
    'transactionReference' => "your-transaction-reference",
]);
Yii::$app->omniKassa->prepareRequest($paymentRequest);
<form method="post" action="<?= Yii::$app->omniKassa->url ?>">
    <input type="hidden" name="Data" value="<?= Yii::$app->omniKassa->dataField ?>">
    <input type="hidden" name="InterfaceVersion" value="<?= Yii::$app->omniKassa->interfaceVersion ?>">
    <input type="hidden" name="Seal" value="<?= Yii::$app->omniKassa->seal ?>">
    <?= \yii\helpers\Html::submitButton('Click here to make your payment', ['class' => 'btn btn-success']) ?>
</form>

Create the controller action you specified in the PaymentRequest and process the request

public function actionReturn()
{
    $response = Yii::$app->omniKassa->processRequest();

    var_dump($response->attributes);
    var_dump('Pending', $response->isPending);
    var_dump('Successful', $response->isSuccessful);
    var_dump('Failure', $response->isFailure);
}

Don't forgot to disable CSRF protection for this action as it is an external action

public function beforeAction($action)
{
    if ($action->id == 'return') {
        $this->enableCsrfValidation = false;
    }

    return parent::beforeAction($action);
}

Changelog

Change Log: yii2-omnikassa

Version 1.0.5

Date: 24-Dec-2016

  • Formatting update
  • Moved files to src dir

Version 1.0.4

Date: 11-Jun-2016

  • Formatting fixes
  • Spelling mistakes

Version 1.0.3

Date: 15-Mar-2016

  • New license agreement

Version 1.0.2

Date: 06-Mar-2016

  • Updated README.md

Version 1.0.1

Date: 28-Feb-2016

  • Removed language from README.md example
  • Testing GitHub packagist webhook

Version 1.0.0

Date: 28-Feb-2016

  • Initial release

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



V1.0.5 is the latest of 2 releases



MIT license
Stats
1 github stars & 0 github forks
0 downloads in the last day
0 downloads in the last 30 days
31 total downloads