コード例 #1
0
ファイル: GatewayTest.php プロジェクト: fintech-fab/qiwi-sdk
 public function testCancelBillFail()
 {
     $connector = new Gateway($this->mock);
     $reject = array('status' => 'rejected');
     $args = array(123, 'PATCH', $reject);
     $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 150)));
     $isSuccess = $connector->cancelBill(123);
     $this->assertFalse($isSuccess);
     $this->assertEquals('Ошибка авторизации', $connector->getError());
 }
コード例 #2
0
 /**
  * Отменить счёт.
  *
  * @param Order $order
  *
  * @return array
  */
 public function cancelBill($order)
 {
     $gate = new Gateway($this->makeCurl());
     $isSuccess = $gate->cancelBill($order->id);
     if (!$isSuccess) {
         return $this->resultMessage($gate->getError());
     }
     $order->changeStatus(Order::C_ORDER_STATUS_CANCELED);
     if ($order->status == Order::C_ORDER_STATUS_CANCELED) {
         $message = 'Счёт отменён.';
         return $this->resultMessage($message, 'Сообщение');
     }
     return $this->resultMessage('Счёт не отменён');
 }