Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamolayemi committed Jul 2, 2023
2 parents 82b097e + 64edb89 commit 917928f
Show file tree
Hide file tree
Showing 40 changed files with 346 additions and 528 deletions.
50 changes: 25 additions & 25 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@

'secret_key' => env('PAYSTACK_SECRET_KEY', 'sk_*'),

// /*
// |--------------------------------------------------------------------------
// | Callback URL - Optional
// |--------------------------------------------------------------------------
// |
// | This should correspond to the callback URL set in your Paystack dashboard:
// | https://dashboard.paystack.com/#/settings/developer.
// |
// | Remember to also add this as an exception in your VerifyCsrfToken middleware.
// |
// */
// 'callback_url' => env('PAYSTACK_CALLBACK_URL', 'https://example.com'),
//
// /*
// |--------------------------------------------------------------------------
// | Webhooks URL
// |--------------------------------------------------------------------------
// |
// | This should correspond to the webhooks URL set in your Paystack dashboard:
// | https://dashboard.paystack.com/#/settings/developer.
// |
// | Remember to also add this as an exception in your VerifyCsrfToken middleware.
// |
// */
// 'webhook_url' => env('PAYSTACK_WEBHOOK_URL', 'https://example.com'),
// /*
// |--------------------------------------------------------------------------
// | Callback URL - Optional
// |--------------------------------------------------------------------------
// |
// | This should correspond to the callback URL set in your Paystack dashboard:
// | https://dashboard.paystack.com/#/settings/developer.
// |
// | Remember to also add this as an exception in your VerifyCsrfToken middleware.
// |
// */
// 'callback_url' => env('PAYSTACK_CALLBACK_URL', 'https://example.com'),
//
// /*
// |--------------------------------------------------------------------------
// | Webhooks URL
// |--------------------------------------------------------------------------
// |
// | This should correspond to the webhooks URL set in your Paystack dashboard:
// | https://dashboard.paystack.com/#/settings/developer.
// |
// | Remember to also add this as an exception in your VerifyCsrfToken middleware.
// |
// */
// 'webhook_url' => env('PAYSTACK_WEBHOOK_URL', 'https://example.com'),
];
6 changes: 3 additions & 3 deletions src/Endpoints/Balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ class Balance extends Endpoint
/**
* Fetch the available balance.
*
* @return Balance
* @link https://paystack.com/docs/api/#transfer-control-balance
*/
public function check(): self
{
$this->get($this->url(self::ENDPOINT));

return $this;
}

/**
* Fetch all pay-ins and pay-outs that occurred on your integration.
*
* @return Balance
* @link https://paystack.com/docs/api/#transfer-control-balance-ledger
*/
public function ledger(): self
{
$this->get($this->url(self::ENDPOINT). '/ledger');
$this->get($this->url(self::ENDPOINT).'/ledger');

return $this;
}
}
4 changes: 1 addition & 3 deletions src/Endpoints/Bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@

class Bank extends Endpoint
{

protected const ENDPOINT = '/bank';

/**
* Get a list of all supported banks and their properties.
*
* @param array $query
* @return Bank
* @link https://paystack.com/docs/api/#miscellaneous-bank
*/
public function list(array $query = []): self
{
$this->get($this->url(self::ENDPOINT), $query);

return $this;
}
}
6 changes: 2 additions & 4 deletions src/Endpoints/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@

class Country extends Endpoint
{

protected const ENDPOINT = '/country';

/**
* Gets a list of Countries that Paystack currently supports.
*
* @return Country
* @link https://paystack.com/docs/api/#miscellaneous-bank
*/
public function list(): self
{
$this->get($this->url(self::ENDPOINT));

return $this;
}

/**
* Get a list of states for a country for address verification.
*
* @param string $country_code
* @return Country
* @link https://paystack.com/docs/api/#miscellaneous-avs-states
*/
public function states(string $country_code): self
{
$this->get($this->url('/address_verification/states'), ['country' => $country_code]);

return $this;
}
}
34 changes: 12 additions & 22 deletions src/Endpoints/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,94 +9,84 @@ class Customer extends Endpoint
/**
* Create a customer on your integration.
*
* @param array $payload
* @return Customer
* @link https://paystack.com/docs/api/#customer-create
*/
public function create(array $payload): self
{
$this->post($this->url(self::ENDPOINT), $payload);

return $this;
}

/**
* List customers available on your integration.
*
* @param array $query
* @return Customer
* @link https://paystack.com/docs/api/#customer-list
*/
public function list(array $query = []): self
{
$this->get($this->url(self::ENDPOINT), $query);

return $this;
}

/**
* Get details of a customer on your integration.
*
* @param string $customer_email
* @return Customer
* @link https://paystack.com/docs/api/#customer-fetch
*/
public function fetch(string $customer_email): self
{
$this->get($this->url(self::ENDPOINT) . '/' . $customer_email);
$this->get($this->url(self::ENDPOINT).'/'.$customer_email);

return $this;
}

/**
* Update a customer's details on your integration.
*
* @param string $customer_code
* @param array $payload
* @return Customer
* @link https://paystack.com/docs/api/#customer-update
*/
public function update(string $customer_code, array $payload = []): self
{
$this->put($this->url(self::ENDPOINT) . '/' . $customer_code, $payload);
$this->put($this->url(self::ENDPOINT).'/'.$customer_code, $payload);

return $this;
}

/**
* Validate a customer's identity.
*
* @param string $customer_code
* @param array $payload
* @return Customer
* @link https://paystack.com/docs/api/#customer-validate
*/
public function validate(string $customer_code, array $payload = []): self
{
$this->post($this->url(self::ENDPOINT) . '/' . $customer_code . '/identification', $payload);
$this->post($this->url(self::ENDPOINT).'/'.$customer_code.'/identification', $payload);

return $this;
}

/**
* Whitelist or blacklist a customer on your integration.
*
* @param array $payload
* @return Customer
* @link https://paystack.com/docs/api/#customer-whitelist-blacklist
*/
public function whitelist(array $payload): self
{
$this->post($this->url(self::ENDPOINT) . '/set_risk_action', $payload);
$this->post($this->url(self::ENDPOINT).'/set_risk_action', $payload);

return $this;
}


/**
* Deactivate an authorization when the card needs to be forgotten.
*
* @param array $payload
* @return Customer
* @link https://paystack.com/docs/api/#customer-deactivate-authorization
*/
public function deactivateAuthorization(array $payload): self
{
$this->post($this->url(self::ENDPOINT) . '/deactivate_authorization', $payload);
$this->post($this->url(self::ENDPOINT).'/deactivate_authorization', $payload);

return $this;
}
}
31 changes: 12 additions & 19 deletions src/Endpoints/DedicatedAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,96 +4,89 @@

class DedicatedAccount extends Endpoint
{

protected const ENDPOINT = '/dedicated_account';

/**
* Create a Dedicated NUBAN and assign to a customer.
*
* @param array $payload
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-create
*/
public function create(array $payload): self
{
$this->post($this->url(self::ENDPOINT), $payload);

return $this;
}

/**
* List dedicated accounts available on your integration.
*
* @param array $query
* @return DedicatedAccount
* @link
*/
public function list(array $query = []): self
{
$this->get($this->url(self::ENDPOINT), $query);

return $this;
}

/**
* Get details of a dedicated account on your integration.
*
* @param string $account_id
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-fetch
*/
public function fetch(string $account_id): self
{
$this->get($this->url(self::ENDPOINT) . '/' . $account_id);
$this->get($this->url(self::ENDPOINT).'/'.$account_id);

return $this;
}

/**
* Get details of a dedicated account on your integration.
*
* @param string $account_id
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-deactivate
*/
public function deactivate(string $account_id): self
{
$this->delete($this->url(self::ENDPOINT) . '/' . $account_id);
$this->delete($this->url(self::ENDPOINT).'/'.$account_id);

return $this;
}

/**
* Split a dedicated account transaction with one or more accounts.
*
* @param array $payload
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-add-split
*/
public function addSplit(array $payload): self
{
$this->post($this->url(self::ENDPOINT) . '/split', $payload);
$this->post($this->url(self::ENDPOINT).'/split', $payload);

return $this;
}

/**
* Remove split payment for a dedicated account.
*
* @param array $payload
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-remove-split
*/
public function removeSplit(array $payload): self
{
$this->delete($this->url(self::ENDPOINT) . '/split', $payload);
$this->delete($this->url(self::ENDPOINT).'/split', $payload);

return $this;
}

/**
* Get available bank providers for Dedicated NUBAN.
*
* @return DedicatedAccount
* @link https://paystack.com/docs/api/#dedicated-nuban-providers
*/
public function providers(): self
{
$this->get($this->url(self::ENDPOINT) . '/available_providers');
$this->get($this->url(self::ENDPOINT).'/available_providers');

return $this;
}
}
Loading

0 comments on commit 917928f

Please sign in to comment.