public function init() { PaytureConfiguration::setEnvironment($this->paytureEnv); PaytureConfiguration::setMerchantKey($this->paytureMerchantKey); PaytureConfiguration::setApiPrefix($this->paytureAPIPrefix); parent::init(); /*if (Yii::$app instanceof \yii\console\Application) { $this->controllerNamespace = 'bfday\yii2_payture_module\commands'; }*/ //$this->params['foo'] = 'bar'; //\Yii::configure($this, require(__DIR__ . '/config.php')); }
/** * Executes request to Payture gateway and return answer, converted to \stdClass * * @param string $operation Operation name, i.e. "Pay" * @param string $apiPrefix Prefix for api type in URL * @param array $params Array of pairs kay => value, that will be used as GET parameters * * @return \stdClass */ protected static function request($operation, $apiPrefix, $params = array()) { PaytureConfiguration::setApiPrefix($apiPrefix); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, self::generateLink($operation, $params)); // ToDo: turn on SSL //curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); return self::_convertResponse($result); }