/**
  * Отмена счёта
  */
 public function testCancelBill()
 {
     App::bind('FintechFab\\QiwiSdk\\Curl', function () {
         $reject = array('status' => 'rejected');
         $args = array(1, 'PATCH', $reject);
         $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 0)));
         return $this->mock;
     });
     $resp = $this->call('POST', Config::get('ff-qiwi-shop::testConfig.testUrl') . '/action/cancelBill', array('order_id' => '1'));
     $this->assertContains('Счёт отменён.', $resp->original['message']);
 }
 /**
  * Получить новый счёт
  *
  * @return void
  */
 public function testGetBillSuccess()
 {
     App::bind('FintechFab\\QiwiSdk\\Curl', function () {
         $bill = array('user' => 'tel:+7123', 'amount' => 543.21, 'ccy' => 'RUB', 'comment' => 'without', 'lifetime' => date('Y-m-d\\TH:i:s', time() + 3600 * 24 * 3), 'prv_name' => Gateway::getConfig('provider.name'));
         $args = array(1, 'PUT', $bill);
         $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 0, 'bill' => (object) array('bill_id' => 123))));
         return $this->mock;
     });
     $order = new Order();
     $order->create(array('user_id' => 1, 'item' => 'New Lamp2', 'sum' => 543.21, 'tel' => '+7123', 'comment' => 'without', 'status' => 'new', 'lifetime' => date('Y-m-d H:i:s', time() + 3600 * 24 * 3)));
     $resp = $this->call('POST', Config::get('ff-qiwi-shop::testConfig.testUrl') . '/action/createBill', array('order_id' => '1'));
     $this->assertContains('Счёт выставлен', $resp->original['message']);
 }
 /**
  * Проверка статуса возврата с несозданным возвратом
  */
 public function testShowStatusPayReturn()
 {
     App::bind('FintechFab\\QiwiSdk\\Curl', function () {
         $args = array(1, 'GET', null, 1);
         $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 0, 'refund' => (object) array('status' => 'processing'))));
         return $this->mock;
     });
     $order = Order::find(1);
     $order->idLastReturn = 1;
     $order->save();
     $payReturn = new PayReturn();
     $payReturn->create(array('order_id' => $order->id, 'sum' => 15, 'status' => 'onReturn'));
     $resp = $this->call('POST', Config::get('ff-qiwi-shop::testConfig.testUrl') . '/action/statusReturn', array('order_id' => '1'));
     $this->assertContains('Текущий статус возврата - на возврате', $resp->original['message']);
 }
Example #4
0
 public function testGetPayReturnStatusFail()
 {
     $connector = new Gateway($this->mock);
     $args = array(123, 'GET', null, 1);
     $this->mock->shouldReceive('request')->withArgs($args)->andReturn((object) array('response' => (object) array('result_code' => 210)));
     $isSuccess = $connector->doRequestReturnStatus(123, 1);
     $this->assertFalse($isSuccess);
     $this->assertEquals('Счет не найден', $connector->getError());
 }