/** * @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; }
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]); }
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.')); }
/** * @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')); }