62 lines
1.5 KiB
PHP
62 lines
1.5 KiB
PHP
<?php namespace TPS\Birzha\Classes;
|
|
|
|
use TPS\Birzha\Models\Settings;
|
|
|
|
class Rysgal extends Payment
|
|
{
|
|
protected function getApiCredentials()
|
|
{
|
|
return [
|
|
'userName' => Settings::getValue('api_login_rysgal'),
|
|
'password' => Settings::getValue('api_password_rysgal'),
|
|
];
|
|
|
|
}
|
|
|
|
protected function getApiUrl()
|
|
{
|
|
return 'https://epg.rysgalbank.tm/epg/rest/';
|
|
}
|
|
|
|
protected function getRegistrationUri()
|
|
{
|
|
return 'register.do';
|
|
}
|
|
|
|
protected function getStatusUri()
|
|
{
|
|
return 'getOrderStatusExtended.do';
|
|
}
|
|
|
|
protected function registerOrderParams($payment, $url)
|
|
{
|
|
return [
|
|
'amount' => $payment->amount * 100, //multiply by 100 to obtain tenge
|
|
'currency' => 934,
|
|
'description' => 'Balansa pul goşmak - Birža şahsy otag',
|
|
'orderNumber' => strtoupper(str_random(5)) . date('jn'),
|
|
'returnUrl' => $url,
|
|
];
|
|
}
|
|
|
|
public function checkRegisterOrderErrorCode($registerOrderResponse)
|
|
{
|
|
return !isset($registerOrderResponse['errorCode']);
|
|
}
|
|
|
|
public function checkReturnUrlParams($returnUrlParams, $payment)
|
|
{
|
|
if($payment) {
|
|
return true;
|
|
|
|
} else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
public function checkOrderStatusResponseCodes($orderStatusResponse)
|
|
{
|
|
return $orderStatusResponse['errorCode'] == 0 && $orderStatusResponse['orderStatus'] == 2;
|
|
}
|
|
} |