Example #1
0
 public function testSigForOrderRetrieve()
 {
     $data = ['pos_id' => '123456', 'session_id' => 'ABC', 'ts' => 12345678];
     $keyMd5 = 'GHI';
     $this->configHelper->expects($this->once())->method('getConfig')->with($this->equalTo('key_md5'))->willReturn($keyMd5);
     $sig = md5($data['pos_id'] . $data['session_id'] . $data['ts'] . $keyMd5);
     $this->assertEquals($sig, $this->model->getSigForOrderRetrieve($data));
 }
Example #2
0
 /**
  * @inheritDoc
  */
 public function addSpecialDataToOrder(array $data = [])
 {
     $data['pos_id'] = $this->dataGetter->getPosId();
     $data['pos_auth_key'] = $this->dataGetter->getPosAuthKey();
     $data['client_ip'] = $this->dataGetter->getClientIp();
     $data['ts'] = $this->dataGetter->getTs();
     $data['sig'] = $this->dataGetter->getSigForOrderCreate($data);
     return $data;
 }
Example #3
0
 /**
  * @inheritDoc
  */
 public function create($orderId = '', $description = '', $amount = null)
 {
     $realPayuplOrderId = $this->transactionResource->getExtOrderIdByPayuplOrderId($orderId);
     if ($realPayuplOrderId) {
         $posId = $this->orderDataGetter->getPosId();
         $ts = $this->orderDataGetter->getTs();
         $sig = $this->orderDataGetter->getSigForOrderRetrieve(['pos_id' => $posId, 'session_id' => $realPayuplOrderId, 'ts' => $ts]);
         $authData = ['posId' => $posId, 'sessionId' => $realPayuplOrderId, 'ts' => $ts, 'sig' => $sig];
         $getResult = $this->methodCaller->call('refundGet', [$authData]);
         if ($getResult) {
             $createResult = $this->methodCaller->call('refundAdd', [$authData, ['refundsHash' => $getResult->refsHash, 'amount' => $amount, 'desc' => $description, 'autoData' => true]]);
             if ($createResult < 0) {
                 $this->logger->error('Refund error ' . $createResult . ' for transaction ' . $orderId);
             }
             return $createResult === 0;
         }
     }
     return false;
 }