Yii2 lacaixa Module
Yii2 lacaixa module to integrate the payment gateway (TPV Virtual) Redsys to be integrated into virtual web shops that have been developed under Yii2., (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist kholmatov/yii2-lacaixa "*"
or add, (*4)
"kholmatov/yii2-lacaixa": "*"
to the require section of your composer.json
file., (*5)
Usage
Setting configuration file kholmatov/yii2-lacaixa/config.php
, (*6)
Once the extension is installed, simply use it in your code by :, (*7)
<?= \kholmatov\lacaixa\RedsysWDG::getFormData($DS_MERCHANT_ORDER,$DS_MERCHANT_AMOUNT,$languageCode,$ProductDescription); ?>
or get result on Json format:, (*8)
<?= \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):, (*9)
```php, (*10)
...
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('/'));
}
...
```, (*11)
Put this example code in any controller script for testing cancel or error url in action (URLKO):, (*12)
```php, (*13)
...
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('/'));
}
...
```