Skip to content

Commit

Permalink
updated docblocks for Bill and AuthBill
Browse files Browse the repository at this point in the history
  • Loading branch information
rukykf committed Jan 15, 2020
1 parent a6d4be2 commit da04341
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/AuthBill.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Kofi\NgPayments;

use Kofi\NgPayments\Exceptions\FailedPaymentException;

class AuthBill extends Bill
{
public function __construct($authorization_code = null, $customer_email = null, $naira_amount = null)
Expand All @@ -15,6 +17,11 @@ public function __construct($authorization_code = null, $customer_email = null,
}
}

/**
* @return string|null payment reference or null if the request failed
* @throws Exceptions\InvalidRequestBodyException
* @throws Exceptions\FailedPaymentException if PaymentExceptions are enabled
*/
public function charge()
{
$this->paymentReference = $this->paymentProvider->chargeAuth($this->attributes);
Expand Down
18 changes: 18 additions & 0 deletions src/Bill.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public function __construct($customer_email = null, $naira_amount = null)
}
}

/**
* @return $this
* @throws Exceptions\InvalidRequestBodyException
*/
public function charge()
{
$this->paymentReference = $this->paymentProvider->initializePayment($this->attributes);
Expand All @@ -44,11 +48,25 @@ public function subscribe($plan_code)
return $this->charge();
}

/**
* @param $payment_reference
* @param $naira_amount
* @return bool
* @throws Exceptions\InvalidPaymentProviderConfigException
* @throws Exceptions\FailedPaymentException if paymentExceptions are enabled
*/
public static function isPaymentValid($payment_reference, $naira_amount)
{
return PaymentProviderFactory::getPaymentProvider()->isPaymentValid($payment_reference, $naira_amount);
}

/**
* @param $payment_reference
* @param $naira_amount
* @return string|null authorization_code or null if the request failed
* @throws Exceptions\InvalidPaymentProviderConfigException
* @throws Exceptions\FailedPaymentException if paymentExceptions are enabled
*/
public static function getPaymentAuthorizationCode($payment_reference, $naira_amount)
{
$payment_provider = PaymentProviderFactory::getPaymentProvider();
Expand Down

0 comments on commit da04341

Please sign in to comment.