As (PS) generally, modules payment systems are built on the same principle:
On the side of the online store (MI) and the payment system server (CAS) is a secret key by which generates a verification code (PC).
When making a reservation the client store (IM), IM receives data, such as:
(Mandatory data differ from the SPS)
By processing the data on the side of MI with a secret klyuem formed PC, which, together with the data transmitted to the ATP.
If the PCA processing data received from them to receive the same PC, the client is given the opportunity to pay for your order. After taking actions KM (payment, refusal, etc.) SPS sends a new PC and payment data to MI way.
MI checks the correctness of the PC and changes the status of the order.
Create a payment system class, which is a subclass of app\components\payment\AbstractPayment
and overriding the 2 methods
content — called at the last stage of the basket, in this method you need to implement the ability to move the user to the SPS payment page. Most often at this stage it is necessary to form a PC and redirect pass it along with the data on the order page SPS handler.
CheckResult — here comes the data from the SPS on the result of the payment of the order of clients. Usually come payment data and a new PC. The method should be to implement checks come from the PC server and PC data generated from the payment. If the check came and the order must be paid in the transaction get the id of the data received from the ATP and change the data transaction.
$transaction->result_data = Json::encode($arrParams);
$transaction->status = OrderTransaction::TRANSACTION_SUCCESS;
$transaction->save(true, ['status', 'result_data']);
public function up()
{
$this->insert(
\app\models\PaymentType::tableName(),
[
'name' => 'Platron',
'class' => 'app\components\payment\PlatronPayment',
'params' => \yii\helpers\Json::encode(
[
'merchantId' => '',
'secretKey' => '',
'strCurrency' => 'RUR',
'merchantUrl' => 'www.platron.ru',
'merchantScriptName' => 'payment.php'
]
),
]
);
}
where :
* name - the name of the payment system
* class - the class path of the payment system
* params - the data in JSON, which will be assigned to the SS-class properties.