/**
  * Get set transaction resource.
  *
  * @return mixed
  */
 public function getTransactionResource()
 {
     return $this->transactionResource ?: new TransactionResource(PaystackHttpClientFactory::make());
 }
Exemplo n.º 2
0
 /**
  * Make a HTTP Client for making requests.
  *
  * @param $key
  *
  * @return \GuzzleHttp\Client
  */
 private function makePaystackHttpClient($key)
 {
     return is_null($key) ? PaystackHttpClientFactory::make() : PaystackHttpClientFactory::make(['headers' => ['Authorization' => 'Bearer ' . $key, 'Content-Type' => 'application/json']]);
 }
 public function testPaystackHttpClientReturnsGuzzleClient()
 {
     $this->assertInstanceOf(Client::class, PaystackHttpClientFactory::make());
 }
 public function setUp()
 {
     parent::setUp();
     // TODO: Change the autogenerated stub
     $this->transactionResource = new TransactionResource(PaystackHttpClientFactory::make());
 }
 public function tearDown()
 {
     $this->paystack = Paystack::make();
     $this->paystackHttpClient = PaystackHttpClientFactory::make();
     $this->customerResource = new CustomerResource($this->paystackHttpClient);
     $this->planResource = new PlanResource($this->paystackHttpClient);
     $this->transactionResource = new TransactionResource($this->paystackHttpClient);
     parent::tearDown();
     // TODO: Change the autogenerated stub
 }
 public function testGetAllCustomersThrowsException()
 {
     $customerResource = new CustomerResource(PaystackHttpClientFactory::make($this->fakeAuthHeader));
     $retrieveUsers = $customerResource->getAll(1);
     $this->assertInstanceOf(PaystackUnauthorizedException::class, $retrieveUsers);
 }
 public function testGetTransactionTotalsReturnsError()
 {
     $transactionResource = new TransactionResource(PaystackHttpClientFactory::make($this->fakeAuthHeader));
     $transactionTotals = $transactionResource->getTransactionTotals();
     $this->assertInstanceOf(PaystackUnauthorizedException::class, $transactionTotals);
     $this->assertStringStartsWith('Format is Authorization', $transactionTotals->getErrors());
 }
Exemplo n.º 8
0
 public function setUp()
 {
     parent::setUp();
     $this->customerResource = new CustomerResource(PaystackHttpClientFactory::make());
 }
 public function setUp()
 {
     parent::setUp();
     $this->transactionResource = new TransactionResource(PaystackHttpClientFactory::make());
 }
 public function testGetAllPlansThrowsError()
 {
     $planResource = new PlanResource(PaystackHttpClientFactory::make($this->fakeAuthHeader));
     $retrievedPlans = $planResource->getAll();
     $this->assertInstanceOf(PaystackUnauthorizedException::class, $retrievedPlans);
 }
 public function testSetAttributesThrowsException()
 {
     $this->setExpectedException(\InvalidArgumentException::class);
     $plan = new Plan(new PlanResource(PaystackHttpClientFactory::make()));
     $plan->_setAttributes('');
 }