コード例 #1
0
 public function testConsumeNotificationSuccess()
 {
     $ts = '123';
     $posId = '123456';
     $sessionId = 'DEF';
     $secondKeyMd5 = 'GHI';
     $sig = md5($posId . $sessionId . $ts . $secondKeyMd5);
     $request = $this->getRequestMock();
     $request->expects($this->once())->method('isPost')->willReturn(true);
     $request->expects($this->at(1))->method('getParam')->with($this->equalTo('sig'))->willReturn($sig);
     $request->expects($this->at(2))->method('getParam')->with($this->equalTo('ts'))->willReturn($ts);
     $request->expects($this->at(3))->method('getParam')->with($this->equalTo('pos_id'))->willReturn($posId);
     $request->expects($this->at(4))->method('getParam')->with($this->equalTo('session_id'))->willReturn($sessionId);
     $this->configHelper->expects($this->once())->method('getConfig')->with($this->equalTo('second_key_md5'))->willReturn($secondKeyMd5);
     $this->assertEquals($sessionId, $this->model->getPayuplOrderId($request));
 }
コード例 #2
0
ファイル: Order.php プロジェクト: tozwierz/magento2_payupl
 /**
  * @inheritDoc
  */
 public function consumeNotification(\Magento\Framework\App\Request\Http $request)
 {
     $payuplOrderId = $this->notificationHelper->getPayuplOrderId($request);
     $orderData = $this->retrieve($payuplOrderId);
     if ($orderData) {
         return ['payuplOrderId' => md5($payuplOrderId), 'status' => $orderData['status'], 'amount' => $orderData['amount']];
     }
     return false;
 }