public function testChargeReturningTransaction()
 {
     $mockTransactionResource = \Mockery::mock($this->transactionResource)->makePartial();
     $mockTransactionResource->shouldReceive('chargeAuthorization')->once()->andReturn($this->chargeReturningTransactionResourceResponseData);
     $returningTransaction = ReturningTransaction::make('AUTH_jonwwppn', $this->planData['amount'], $this->customerData['email'], '');
     $returningTransaction->setTransactionResource($mockTransactionResource);
     $chargeReturningTransaction = $returningTransaction->charge();
     $this->assertEquals($this->chargeReturningTransactionResourceResponseData, $chargeReturningTransaction);
 }
Пример #2
0
 /**
  * Charge a returning customer.
  *
  * @param $authorization
  * @param $amount
  * @param $email
  * @param string $plan
  *
  * @throws \Exception|mixed|Exceptions\PaystackInvalidTransactionException
  *
  * @return \Exception|mixed|Exceptions\PaystackInvalidTransactionException
  */
 public function chargeReturningTransaction($authorization, $amount, $email, $plan = '')
 {
     $returningTransaction = ReturningTransaction::make($authorization, $amount, $email, $plan instanceof Plan ? $plan->get('plan_code') : $plan);
     $returningTransaction->setTransactionResource($this->getTransactionResource());
     $transaction = $returningTransaction->charge();
     if ($transaction instanceof \Exception) {
         throw $transaction;
     }
     return $transaction;
 }