A PHP Wrapper for Okra
- guzzlehttp/guzzle: ~6.0
- PHP 7.0 or more recent
$ composer require mmuodev/okra-php-wrapper
The wrapper provides a simple interface to use Okra's core products - Auth, Identity, Balance and Transaction. Each of these products are represented by its own trait.
You need to initiate the Client
class (and pass your Okra's bearer token), to access methods of these traits. All methods return an array, thus making it easy to use in your application.
$client = new Client(BEARER_TOKEN)
Okra offers a path for a customer to successfully verify their bank. The customer enters their credentials and are authenticated immediately.
This returns auth information in an array or pdf format for all customers.
$client->getAllAuth();
Optional: Pass the boolean value
true
to return the data in pdf format
This returns auth information for a cutomer using auth id
$client->getAuthById();
Required: Pass the
auth id
This returns auth information for a cutomer using customer id
$client->getAuthByCustomerId();
Required: Pass the
customer id
This returns auth information based on date range they were created.
$client->getAuthByDateRange(from, to);
Method expects 5 parameters - first 2 are required while last 3 optional. The first 2 parameters -
from
andto
are the date ranges in this format2020-05-10
.
Pass the boolean valuetrue
for the third parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
For example, to fetch all auth records between
2020-05-01
and2020-05-20
, you do this:
$client->getAuthByDateRange('2020-05-01', '2020-05-20', true)
To fetch only page 2 and limit the number of records to 10 for the same date range as above, you do this:
$client->getAuthByDateRange('2020-05-01', '2020-05-20', ,2,10)
Receive customer-authorized transaction data for current, savings, and domiciliary Accounts.
This returns summarized info on the transactions in an array or pdf format.
$client->getTransactions();
Optional: Pass the boolean value
true
to return the data in pdf format
This returns transactions for a particular customer
$client->getTransactionsPerCustomer(customer_id);
Method expects 4 parameters - first is required while last 3 optional. The first -
customer_id
is theid
of the customer returned from the previous method.
Pass the boolean valuetrue
for the second parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
This returns transactions filtered by date range
$client->getTransactionsByDateRange();
Method expects 5 parameters - first 2 are required while last 3 optional. The first 2 parameters -
from
andto
are the date ranges in this format2020-05-10
.
Pass the boolean valuetrue
for the third parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
For example, to fetch all transaction records between
2020-05-01
and2020-05-20
, you do this:
$client->getTransactionsByDateRange('2020-05-01', '2020-05-20', true)
To fetch only page 2 and limit the number of records to 10 for the same date range as above, you do this:
$client->getTransactionsByDateRange('2020-05-01', '2020-05-20', ,2,10)
This returns transactions filtered by bank
$client->getTransactionsPerBank(bank_id);
Method expects 4 parameters - first is required while last 3 optional. The first -
bank_id
is the id of the bank. Each bank has a unique id.
Pass the boolean valuetrue
for the second parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
This returns spending pattern for a cutomer using customer id
$client->getSpendingPatternPerCustomer(customer_id);
Required: Pass the
customer id
Retrieve various account holder information on file with the bank, including names, emails, phone numbers, and addresses
This returns identities' information in an array or pdf format for all customers.
$client->getIdentities();
Optional: Pass the boolean value
true
to return the data in pdf format
This returns identity information using id
returned from the above method.
$client->getIdentityById(id);
Required: Pass the
identity id
This returns identity information for a customer using customer id.
$client->getIdentityByCustomerId(customer_id);
Required: Pass the
customer_id
This returns identity information based on date range they were created.
$client->getIdentityByDateRange(from, to);
Method expects 5 parameters - first 2 are required while last 3 optional. The first 2 parameters -
from
andto
are the date ranges in this format2020-05-10
.
Pass the boolean valuetrue
for the third parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
For example, to fetch all records between
2020-05-01
and2020-05-20
, you do this:
$client->getIdentityByDateRange('2020-05-01', '2020-05-20', true)
To fetch only page 2 and limit the number of records to 10 for the same date range as above, you do this:
$client->getIdentityByDateRange('2020-05-01', '2020-05-20', ,2,10)
Retrieve retrieve the real-time balance for each of a record's accounts.
This returns balance information in an array or pdf format for all customers.
$client->getAllBalance();
Optional: Pass the boolean value
true
to return the data in pdf format
This returns balance information using id
returned from the above method.
$client->getBalanceById(id);
Required: Pass the
balance id
This returns balance information for a customer using customer id.
$client->getBalanceByCustomerId(customer_id);
Required: Pass the
customer_id
This returns balance information based on date range they were created.
$client->getBalanceByDateRange(from, to);
Method expects 5 parameters - first 2 are required while last 3 optional. The first 2 parameters -
from
andto
are the date ranges in this format2020-05-10
.
Pass the boolean valuetrue
for the third parameter to return all records. Ignore to return one page.
The penultimate and last parameters -page
andlimit
are integers stating thepage
number you wish to return and the number of records - limit - to return on this page. Ignore these if you are fetching all records.
For example, to fetch all records between
2020-05-01
and2020-05-20
, you do this:
$client->getBalanceByDateRange('2020-05-01', '2020-05-20', true)
To fetch only page 2 and limit the number of records to 10 for the same date range as above, you do this:
$client->getBalanceByDateRange('2020-05-01', '2020-05-20', ,2,10)