Esempio n. 1
0
 /**
  * @return void
  */
 public function testCreateBillSuccess()
 {
     Bill::truncate();
     // запрос на создание счета, проверяем авторизацию с этим логином и паролем
     $this->client->request('PUT', Config::get('ff-qiwi-gate::app.url') . '/qiwi/gate/api/v2/prv/1/bills/4a5s6d', array('user' => 'tel:+79161234567', 'amount' => '123.34', 'ccy' => 'RUB'), array(), array('HTTP_Authorization' => 'Basic ' . base64_encode('1:password')));
     $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
 }
 public function setUp()
 {
     parent::setUp();
     // создаём счёт
     Bill::truncate();
     $bill = new Bill();
     $bill->create(array('merchant_id' => 1, 'bill_id' => '1q2w3e', 'user' => 'tel:+7123', 'amount' => 123.45, 'ccy' => 'RUB', 'comment' => 'test', 'status' => 'waiting'));
 }
 /**
  *
  * @return void
  */
 public function testCreateBillSuccess()
 {
     Route::enableFilters();
     Bill::truncate();
     $this->call('PUT', Config::get('ff-qiwi-gate::app.url') . '/qiwi/gate/api/v2/prv/1/bills/4a5s6d', array('user' => 'tel:+79161234567', 'amount' => '123.34', 'ccy' => 'RUB', 'comment' => 'Test!'), array(), array('HTTP_Authorization' => 'Basic ' . base64_encode('1:password')));
     $oResponse = $this->response()->getData();
     $this->assertEquals('4a5s6d', $oResponse->response->bill->bill_id);
     $this->assertEquals('Test!', $oResponse->response->bill->comment);
     $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
 }
 /**
  * Омена невозможна, текущий статус счёта не waiting
  *
  * @return void
  */
 public function testRefundBillFailStatus()
 {
     // создаём счёт со статусом paid
     Bill::truncate();
     $bill = new Bill();
     $bill->create(array('merchant_id' => 1, 'bill_id' => '1q2w3e', 'user' => 'tel:+7123', 'amount' => 123.45, 'ccy' => 'RUB', 'comment' => 'test', 'status' => 'waiting'));
     $this->call('PUT', Config::get('ff-qiwi-gate::app.url') . '/qiwi/gate/api/v2/prv/1/bills/1q2w3e/refund/456', array('amount' => 50));
     $oResponse = $this->response()->getData();
     $this->assertEquals(210, $oResponse->response->result_code);
     $this->assertEquals(404, $this->client->getResponse()->getStatusCode());
 }
 public function setUp()
 {
     parent::setUp();
     // создаём счёт
     Bill::truncate();
     $bill = new Bill();
     $bill->create(array('merchant_id' => 1, 'bill_id' => '1q2w3e', 'user' => 'tel:+7123', 'amount' => 123.45, 'ccy' => 'RUB', 'comment' => 'test', 'status' => 'paid'));
     // создаём возврат оплаты по счёту
     Refund::truncate();
     $refund = new Refund();
     $refund->create(array('bill_id' => 1, 'refund_id' => '456', 'amount' => 123.45, 'status' => 'processing'));
 }