kholmatov / yii2-lacaixa
Yii2 lacaixa module to integrate the payment gateway (TPV Virtual) Redsys to be integrated into virtual web shops that have been developed under Yii2.
Installs: 78
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-12-25 20:18:24 UTC
README
Yii2 lacaixa module to integrate the payment gateway (TPV Virtual) Redsys to be integrated into virtual web shops that have been developed under Yii2.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist kholmatov/yii2-lacaixa "*"
or add
"kholmatov/yii2-lacaixa": "*"
to the require section of your composer.json
file.
Usage
Setting configuration file kholmatov/yii2-lacaixa/config.php
Once the extension is installed, simply use it in your code by :
<?= \kholmatov\lacaixa\RedsysWDG::getFormData($DS_MERCHANT_ORDER,$DS_MERCHANT_AMOUNT,$languageCode,$ProductDescription); ?>
or get result on Json format:
<?= \kholmatov\lacaixa\RedsysWDG::getFormDataJson($DS_MERCHANT_ORDER,$DS_MERCHANT_AMOUNT,$languageCode,$ProductDescription); ?>
Put this example code in any controller script for testing success url in action (URLOK):
... public function actionOk(){ $get = Yii::$app->request->get(); if(isset($get) && isset($get['Ds_SignatureVersion']) && isset($get['Ds_MerchantParameters']) && isset($get['Ds_Signature'])): $rs = \kholmatov\lacaixa\RedsysWDG::checkData($get['Ds_SignatureVersion'],$get['Ds_MerchantParameters'],$get['Ds_Signature']); if($rs){ $rsParam = \kholmatov\lacaixa\RedsysWDG::decodeData($get['Ds_MerchantParameters']); $myParam = json_decode($rsParam,true); print_r($myParam); .... } endif; //return $this->redirect(array('/')); } ...
Put this example code in any controller script for testing cancel or error url in action (URLKO):
... public function actionKo(){ $get = Yii::$app->request->get(); if(isset($get) && isset($get['Ds_SignatureVersion']) && isset($get['Ds_MerchantParameters']) && isset($get['Ds_Signature'])): $rs = \kholmatov\lacaixa\RedsysWDG::checkData($get['Ds_SignatureVersion'],$get['Ds_MerchantParameters'],$get['Ds_Signature']); if($rs){ $rsParam = RedsysWDG::decodeData($get['Ds_MerchantParameters']); $myParam = json_decode($rsParam,true); print_r($myParam); ... } endif; //return $this->redirect(array('/')); } ... ```