Skip to content

Commit

Permalink
doc links update and added new endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
timoladoyinbo committed Feb 19, 2021
1 parent f980d8f commit 9eb1050
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 46 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to `paystack-php` will be documented in this file

## v1.0.3 - 2021-02-19
- Updated doc links to match the new API docs
- Added `Bank::resolveBvnPremium(string $bvn)` method
- Added `BulkCharge::fetchBulkChargeBatch(string $id_or_code, $params = nul)` method
- Added `Charge::submitAddress(array $params)` method
- Added `Transaction::checkAuthorization(array $params)` method
- Added `TransferRecipient::createBulk(array $params)` method

## v1.0.2 - 2020-06-18
- Removed redundant ApiErrorException Exception
- Fixed UnexpectedValueException Exception namespace to be psr-4 compliant
Expand Down
22 changes: 18 additions & 4 deletions src/Bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Bank extends ApiResource
/**
* @param string $bvn
*
* @link https://developers.paystack.co/reference#resolve-bvn
* @link https://paystack.com/docs/api/#verification-resolve-bvn
*
* @return array|object
*/
Expand All @@ -21,10 +21,24 @@ public static function resolveBvn(string $bvn)
return static::staticRequest('GET', $url);
}

/**
* @param string $bvn
* @return array|object
* @throws Exceptions\InvalidArgumentException
* @throws Exceptions\IsNullException
* @link https://paystack.com/docs/api/#verification-resolve-bvn-premium
*/
public static function resolveBvnPremium(string $bvn)
{
$url = "identity/bvn/resolve/{$bvn}";

return static::staticRequest('GET', $url);
}

/**
* @param array $params
*
* @link https://developers.paystack.co/reference#match-bvn
* @link https://paystack.com/docs/api/#verification-match-bvn
*
* @return array|object
*/
Expand All @@ -39,7 +53,7 @@ public static function bvnMatch($params)
/**
* @param array $params
*
* @link https://developers.paystack.co/reference#resolve-account-number
* @link https://paystack.com/docs/api/#verification-resolve-account
*
* @return array|object
*/
Expand All @@ -54,7 +68,7 @@ public static function resolveAccountNumber($params)
/**
* @param string $bin
*
* @link https://developers.paystack.co/reference#resolve-card-bin
* @link https://paystack.com/docs/api/#verification-resolve-card
*
* @return array|object
*/
Expand Down
25 changes: 21 additions & 4 deletions src/BulkCharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BulkCharge extends ApiResource
*
* @return array | Object
*
* @link https://developers.paystack.co/reference#initiate-bulk-charge
* @link https://paystack.com/docs/api/#bulk-charge-initiate
*/
public static function initiate($reference, $params)
{
Expand All @@ -28,11 +28,28 @@ public static function initiate($reference, $params)
return static::staticRequest('POST', $url);
}

/**
* @param string $id_or_code
* @param null $params
* @return array|object
* @throws Exceptions\InvalidArgumentException
* @throws Exceptions\IsNullException
* @link https://paystack.com/docs/api/#bulk-charge-fetch-batch
*/
public static function fetchBulkChargeBatch($id_or_code, $params = null)
{
self::validateParams($params);
$url = "{$id_or_code}";
$url = static::buildQueryString($url, $params);

return static::staticRequest('GET', $url);
}

/**
* @param string $batch_id_or_code An ID or code for the batch whose charges you want to retrieve.
* @param array $params
*
* @link https://developers.paystack.co/reference#fetch-charges-in-a-batch
* @link https://paystack.com/docs/api/#bulk-charge-fetch-charge
*
* @return array | Object
*/
Expand All @@ -48,7 +65,7 @@ public static function fetchChargesInABatch($batch_id_or_code, $params = null)
/**
* @param string $batch_code
*
* @link https://developers.paystack.co/reference#pause-bulk-charge-batch
* @link https://paystack.com/docs/api/#bulk-charge-pause
*
* @return array | Object
*/
Expand All @@ -63,7 +80,7 @@ public static function pause($batch_code)
/**
* @param string $batch_code
*
* @link https://developers.paystack.co/reference#resume-bulk-charge-batch
* @link https://paystack.com/docs/api/#bulk-charge-resume
*
* @return array|object
*/
Expand Down
25 changes: 20 additions & 5 deletions src/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Charge extends ApiResource
/**
* @param array $params
*
* @link https://developers.paystack.co/reference#submit-pin
* @link https://paystack.com/docs/api/#charge-submit-pin
*
* @return array|object
*/
Expand All @@ -32,7 +32,7 @@ public static function submitPin($params)
/**
* @param array $params
*
* @link https://developers.paystack.co/reference#submit-otp
* @link https://paystack.com/docs/api/#charge-submit-otp
*
* @return array|object
*/
Expand All @@ -47,7 +47,7 @@ public static function submitOtp($params)
/**
* @param array $params
*
* @link https://developers.paystack.co/reference#submit-phone
* @link https://paystack.com/docs/api/#charge-submit-phone
*
* @return array|object
*/
Expand All @@ -62,7 +62,7 @@ public static function submitPhone($params)
/**
* @param array $params dates in the format 2016-09-21
*
* @link https://developers.paystack.co/reference#submit-birthday
* @link https://paystack.com/docs/api/#charge-submit-birthday
*
* @return array|object
*/
Expand All @@ -74,10 +74,25 @@ public static function submitBirthday($params)
return static::staticRequest('POST', $url, $params);
}

/**
* @param array $params
*
* @link https://paystack.com/docs/api/#charge-submit-address
*
* @return array|object
*/
public static function submitAddress($params)
{
self::validateParams($params, true);
$url = static::endPointUrl('submit_address');

return static::staticRequest('POST', $url, $params);
}

/**
* @param string $reference Charge reference to check
*
* @link https://developers.paystack.co/reference#check-pending-charge
* @link https://paystack.com/docs/api/#charge-check
*
* @return array|object
*/
Expand Down
22 changes: 18 additions & 4 deletions src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ class Customer extends ApiResource
use ApiOperations\Fetch;
use ApiOperations\Update;

/**
* @param $customerCode
* @return array|object
* @throws Exceptions\InvalidArgumentException
* @throws Exceptions\IsNullException
* @link https://paystack.com/docs/api/#customer-validate
*/
public static function validate($customerCode)
{
$url = static::classUrl().'/{$customerCode}/identification';

return static::staticRequest('POST', $url);
}

/**
* @param array $params containing the customer code of the customer to white/black list and
* one can be one of the possible risk actions:
Expand All @@ -22,14 +36,14 @@ class Customer extends ApiResource
*
* @return array|object
*
* @link https://developers.paystack.co/reference#whiteblacklist-customer
* @link https://paystack.com/docs/api/#customer-whitelist-blacklist
*/
public static function whiteOrBlackList($params)
{
self::validateParams($params);
$url = static::classUrl().'/set_risk_action';

return static::staticRequest('post', $url, $params);
return static::staticRequest('POST', $url, $params);
}

/**
Expand All @@ -40,13 +54,13 @@ public static function whiteOrBlackList($params)
*
* @return array|object
*
* @link https://developers.paystack.co/reference#deactivate-authorization
* @link https://paystack.com/docs/api/#customer-deactivate-authorization
*/
public static function deactivateAuthorization($params)
{
self::validateParams($params);
$url = static::classUrl().'/deactivate_authorization';

return static::staticRequest('post', $url, $params, 'arr');
return static::staticRequest('POST', $url, $params, 'arr');
}
}
10 changes: 5 additions & 5 deletions src/Dispute.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Dispute extends ApiResource
/**
* @param string $transaction_id
*
* @link https://developers.paystack.co/reference#list-transaction-disputes
* @link https://paystack.com/docs/api/#dispute-transaction
*
* @return array|object
*/
Expand All @@ -29,7 +29,7 @@ public static function listTransactionDisputes(string $transaction_id)
* @param string $dispute_id
* @param array $params
*
* @link https://developers.paystack.co/reference#add-evidence
* @link https://paystack.com/docs/api/#dispute-evidence
*
* @return array|object
*/
Expand All @@ -45,7 +45,7 @@ public static function addEvidence(string $dispute_id, $params)
/**
* @param string $dispute_id
*
* @link https://developers.paystack.co/reference#get-upload-url
* @link https://paystack.com/docs/api/#dispute-upload-url
*
* @return array|object
*/
Expand All @@ -61,7 +61,7 @@ public static function getUploadUrl(string $dispute_id)
* @param string $dispute_id
* @param array $params
*
* @link https://developers.paystack.co/reference#resolve-dispute
* @link https://paystack.com/docs/api/#dispute-resolve
*
* @return array|object
*/
Expand All @@ -77,7 +77,7 @@ public static function resolve(string $dispute_id, $params)
/**
* @param array $params
*
* @link https://developers.paystack.co/reference#export-disputes
* @link https://paystack.com/docs/api/#dispute-export
*
* @return array|object
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Integration extends ApiResource
/**
* Paystack Documentation Reference.
*
* @link https://developers.paystack.co/reference#fetch-payment-session-timeout
* @link https://paystack.com/docs/api/#control-panel-fetch-timeout
*
* @return array|object
*/
Expand All @@ -24,7 +24,7 @@ public static function fetchPaymentSessionTimeout()
* @param $params the time before stopping session (in seconds). Set to 0 to cancel session timeouts
* Paystack Documentation Reference
*
* @link https://developers.paystack.co/reference#update-payment-session-timeout
* @link https://paystack.com/docs/api/#control-panel-update-timeout
*
* @return array|object
*/
Expand Down
10 changes: 5 additions & 5 deletions src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Invoice extends ApiResource
/**
* @param string $invoice_code details at
*
* @link https://developers.paystack.co/reference#verify-invoice
* @link https://paystack.com/docs/api/#invoice-verify
*
* @return array|object
*/
Expand All @@ -35,7 +35,7 @@ public static function verify(string $invoice_code)
*
* @return array|object
*
* @link https://developers.paystack.co/reference#send-notification
* @link https://paystack.com/docs/api/#invoice-send-notification
*/
public static function notify(string $invoice_id, $params)
{
Expand All @@ -48,7 +48,7 @@ public static function notify(string $invoice_id, $params)
/**
* Get invoice totals for dashboard.
*
* @link https://developers.paystack.co/reference#get-invoice-metrics-for-dashboard
* @link https://paystack.com/docs/api/#invoice-total
*
* @throws Exceptions\InvalidArgumentException
* @throws Exceptions\IsNullException
Expand All @@ -71,7 +71,7 @@ public static function totals()
*
* @return array|object
*
* @link https://developers.paystack.co/reference#finalize-a-draft-invoice
* @link https://paystack.com/docs/api/#invoice-finalize
*/
public static function finalize($invoice_id, $params = null)
{
Expand All @@ -91,7 +91,7 @@ public static function finalize($invoice_id, $params = null)
*
* @return array|object
*
* @link https://developers.paystack.co/reference#archive-invoice
* @link https://paystack.com/docs/api/#invoice-archive
*/
public static function archive($invoice_id, $params)
{
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PaymentPage extends ApiResource
/**
* @param string $slug details at
*
* @link https://developers.paystack.co/reference#check-slug-availability
* @link https://paystack.com/docs/api/#page-check-slug
*
* @return array|object
*/
Expand All @@ -30,7 +30,7 @@ public static function checkSlugAvailability($slug)
* @param string $page_id
* @param array $params details at
*
* @link https://developers.paystack.co/reference#add-products
* @link https://paystack.com/docs/api/#page-add-products
*
* @return array|object
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Settlement.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Settlement extends ApiResource
* @param string $settlement_id
* @param array $params
*
* @link https://developers.paystack.co/reference#fetch-settlement-transactions
* @link https://paystack.com/docs/api/#settlement-transactions
*
* @return array|object
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Subscription extends ApiResource
/**
* @param array $params details at
*
* @link https://developers.paystack.co/reference#disable-subscription
* @link https://paystack.com/docs/api/#subscription-disable
*
* @return array|object
*/
Expand All @@ -28,7 +28,7 @@ public static function disable($params)
/**
* @param array $params details at
*
* @link https://developers.paystack.co/reference#enable-subscription
* @link https://paystack.com/docs/api/#subscription-enable
*
* @return array|object
*/
Expand Down
Loading

0 comments on commit 9eb1050

Please sign in to comment.