コード例 #1
0
 /**
  * @return \Zend\Http\Client
  */
 public function getClient()
 {
     if (!$this->client) {
         $posId = $this->configHelper->getConfig('pos_id');
         $keyMd5 = $this->configHelper->getConfig('key_md5');
         $url = 'https://secure.payu.com/paygw/UTF/xml/' . $posId . '/' . substr($keyMd5, 0, 2) . '/paytype.xml';
         $this->client = new \Zend\Http\Client($url, ['adapter' => 'Zend\\Http\\Client\\Adapter\\Curl']);
     }
     return $this->client;
 }
コード例 #2
0
ファイル: ConfigTest.php プロジェクト: ORBA/magento2_payupl
 public function testSetConfigSuccess()
 {
     $posId = '123456';
     $keyMd5 = 'ABC';
     $secondKeyMd5 = 'DEF';
     $posAuthKey = 'GHI';
     $this->scopeConfig->expects($this->at(0))->method('getValue')->with($this->equalTo(Payupl::XML_PATH_POS_ID), $this->equalTo('store'))->willReturn($posId);
     $this->scopeConfig->expects($this->at(1))->method('getValue')->with($this->equalTo(Payupl::XML_PATH_KEY_MD5), $this->equalTo('store'))->willReturn($keyMd5);
     $this->scopeConfig->expects($this->at(2))->method('getValue')->with($this->equalTo(Payupl::XML_PATH_SECOND_KEY_MD5), $this->equalTo('store'))->willReturn($secondKeyMd5);
     $this->scopeConfig->expects($this->at(3))->method('getValue')->with($this->equalTo(Payupl::XML_PATH_POS_AUTH_KEY), $this->equalTo('store'))->willReturn($posAuthKey);
     $this->assertTrue($this->model->setConfig());
     $this->assertEquals($this->model->getConfig(), ['pos_id' => $posId, 'key_md5' => $keyMd5, 'second_key_md5' => $secondKeyMd5, 'pos_auth_key' => $posAuthKey]);
 }
コード例 #3
0
ファイル: Notification.php プロジェクト: ORBA/magento2_payupl
 public function getPayuplOrderId($request)
 {
     if (!$request->isPost()) {
         throw new LocalizedException(new Phrase('POST request is required.'));
     }
     $sig = $request->getParam('sig');
     $ts = $request->getParam('ts');
     $posId = $request->getParam('pos_id');
     $sessionId = $request->getParam('session_id');
     $secondKeyMd5 = $this->configHelper->getConfig('second_key_md5');
     if (md5($posId . $sessionId . $ts . $secondKeyMd5) === $sig) {
         return $sessionId;
     }
     throw new LocalizedException(new Phrase('Invalid SIG.'));
 }
コード例 #4
0
 /**
  * @param array $data
  * @return string
  */
 public function getSigForOrderRetrieve(array $data = [])
 {
     return md5($data['pos_id'] . $data['session_id'] . $data['ts'] . $this->configHelper->getConfig('key_md5'));
 }