From 40daad01036733a0558d119c3bda9b88a78cc5bd Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:11:22 +0100 Subject: [PATCH 1/8] docs: Add base doc to readme --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37db984..9f736cc 100644 --- a/README.md +++ b/README.md @@ -1 +1,59 @@ -# bloc-nodejs \ No newline at end of file +# Bloc Nodejs SDK + +![npm (scoped)](https://img.shields.io/npm/v/bloc-nodejs?color=%23FF7B37&style=flat-square) ![npm](https://img.shields.io/npm/dm/bloc-nodejs?style=flat-square) + +A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written in typescript + +## Table of content + +- [Prerequisites](#prerequisites) +- [Getting started](#getting-started) +- [Installation](#installation) +- [Usage](#usage) +- [License](#license) + +## Prerequisites + +Node v16 and higher is required. To make sure you have them available on your machine, try running the following command. + +```sh + node -v +``` + +## Getting Started + +To get started with this SDK, create an account on [Bloc](https://app.blochq.io/auth/sign-up) if you haven't already. +You can then retrieve your API keys from your [Bloc dashboard](https://docs.blochq.io/docs/quick-start). + +## Installation + +This SDK can be installed with npm or yarn or pnpm. + +```sh +# using npm +npm install bloc-nodejs +# using yarn +yarn install bloc-nodejs +# using pnpm +pnpm add bloc-nodejs +``` + +## Usage + +Import and Initialize the library + +```ts +// use modules +import { Bloc } from 'bloc-nodejs'; +// use cjs +const { Bloc } = require('bloc-nodejs') + +// Instantiate the bloc class +const bloc = new Bloc('SECRET_KEY, PUBLIC_KEY'); +``` + +## License + +[MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) + +[Back to Top](#table-of-content) \ No newline at end of file From 0e6c71eaa94c2d6d4cd90addc37e9b9127c78359 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:13:37 +0100 Subject: [PATCH 2/8] docs: Add checkout api methods to readme --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 9f736cc..ebf6463 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Getting started](#getting-started) - [Installation](#installation) - [Usage](#usage) +- [Available Methods exposed by the SDK](#available-methods-exposed-by-the-sdk) + - [Checkout API](#checkout-api) + - [Create Checkout](#create-checkout) - [License](#license) ## Prerequisites @@ -52,6 +55,28 @@ const { Bloc } = require('bloc-nodejs') const bloc = new Bloc('SECRET_KEY, PUBLIC_KEY'); ``` +## Available Methods exposed by the SDK + +### Checkout API + +Checkout API operations + +#### Create Checkout + +```ts +// import the create checkout interfaces from the sdk +import type { ICreateCheckout, ICheckoutResponse } from 'bloc-nodejs'; + +const payload: ICreateCheckout = { + // payload to create checkout +} + +const response = await bloc.createCheckout(payload) +console.log(response) // ICheckoutResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/createcheckout) + ## License [MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) From 67d08be7fcd203e87e13d7288f2b18cb2b0045a6 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:15:15 +0100 Subject: [PATCH 3/8] docs: Add customer api methods to readme --- README.md | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/README.md b/README.md index ebf6463..184e514 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,16 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Available Methods exposed by the SDK](#available-methods-exposed-by-the-sdk) - [Checkout API](#checkout-api) - [Create Checkout](#create-checkout) + - [Customers API](#customers-api) + - [Create Customer](#create-customer) + - [Get Customers](#get-customers) + - [Upgrade Customer to KYC T1](#upgrade-customer-to-kyc-t1) + - [Upgrade Customer to KYC T2](#upgrade-customer-to-kyc-t2) + - [Upgrade Customer to KYC T3](#upgrade-customer-to-kyc-t3) + - [Update Customer](#update-customer) + - [Get Customer By ID](#get-customer-by-id) + - [Means of Identification](#means-of-identification) + - [Revalidate Customer KYC](#revalidate-customer-kyc) - [License](#license) ## Prerequisites @@ -77,6 +87,139 @@ console.log(response) // ICheckoutResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/createcheckout) +### Customers API + +Customer API operations + +#### Create Customer + +```ts +// import the customer interfaces from the sdk +import type { ICreateCustomer, ICreateCustomerResponse } from 'bloc-nodejs'; + +const payload: ICreateCustomer = { + // payload to create checkout +} + +const response = await bloc.createCustomer(payload) +console.log(response) // ICreateCustomerResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/createcustomers) + +#### Get Customers + +```ts +// import the message interfaces from the sdk +import type { IGetCustomerResponse } from 'bloc-nodejs'; + +const response = await bloc.getCustomers() +console.log(response) // IGetCustomerResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getcustomers) + +#### Upgrade Customer to KYC T1 + +```ts +// import the customer interfaces from the sdk +import type { IUpgradeCustomerToKYCT1, IUpgradeCustomerToKYCTierResponse } from 'bloc-nodejs'; + +const payload: IUpgradeCustomerToKYCT1 = { + // payload data +} + +const response = await bloc.upgradeCustomerToKYCT1('customer-id', payload) +console.log(response) // IUpgradeCustomerToKYCTierResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/upgradecustomertokyct1) + +#### Upgrade Customer to KYC T2 + +```ts +// import the customer interfaces from the sdk +import type { IUpgradeCustomerToKYCT2, IUpgradeCustomerToKYCTierResponse } from 'bloc-nodejs'; + +const payload: IUpgradeCustomerToKYCT2 = { + // payload data +} + +const response = await bloc.upgradeCustomerToKYCT2('customer-id', payload) +console.log(response) // IUpgradeCustomerToKYCTierResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/upgradecustomertokyct2) + +#### Upgrade Customer to KYC T3 + +```ts +// import the customer interfaces from the sdk +import type { IUpgradeCustomerToKYCT3, IUpgradeCustomerToKYCTierResponse } from 'bloc-nodejs'; + +const payload: IUpgradeCustomerToKYCT3 = { + // payload data +} + +const response = await bloc.upgradeCustomerToKYCT3('customer-id', payload) +console.log(response) // IUpgradeCustomerToKYCTierResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/upgradecustomertokyct3) + +#### Update Customer + +```ts +// import the customer interfaces from the sdk +import type { IUpdateCustomer, IUpdateCustomerResponse } from 'bloc-nodejs'; + +const payload: IUpdateCustomer = { + // payload data +} + +const response = await bloc.updateCustomer('customer-id', payload) +console.log(response) // IUpdateCustomerResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/updatecustomer) + +#### Get Customer By ID + +```ts +// import the customer interfaces from the sdk +import type { IGetCustomerByIdResponse } from 'bloc-nodejs'; + +const response = await bloc.getCustomerById('customer-id') +console.log(response) // IGetCustomerByIdResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getcustomerbyid) + +#### Means of Identification + +```ts +// import the customer interfaces from the sdk +import type { IMeansOfIdentification } from 'bloc-nodejs'; + +const response = await bloc.meansOfIdentification() +console.log(response) // IMeansOfIdentification +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/meansofidentification) + +#### Revalidate Customer KYC + +```ts +// import the customer interfaces from the sdk +import type { IRevalidateCustomerKYCResponse } from 'bloc-nodejs'; + +const response = await bloc.revalidateCustomerKYC('customer-id') +console.log(response) // IRevalidateCustomerKYCResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/revalidatecustomerkyc) + + ## License [MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) From c312de2c5ec8bed1b5cae475b60c170a6a1ca8d8 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:16:09 +0100 Subject: [PATCH 4/8] docs: Add miscellaneous api methods to readme --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/README.md b/README.md index 184e514..e68c0d9 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Get Customer By ID](#get-customer-by-id) - [Means of Identification](#means-of-identification) - [Revalidate Customer KYC](#revalidate-customer-kyc) + - [Miscellaneous API](#miscellaneous-api) + - [Get List of Banks](#get-list-of-banks) + - [Resolve Account](#resolve-account) + - [Get Exchange Rate](#get-exchange-rate) - [License](#license) ## Prerequisites @@ -219,6 +223,45 @@ console.log(response) // IRevalidateCustomerKYCResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/revalidatecustomerkyc) +### Miscellaneous API + +Miscellaneous API operations + +#### Get List of Banks + +```ts +// import the miscellaneous interfaces from the sdk +import type { IListOfBanksResponse } from 'bloc-nodejs'; + +const response = await bloc.getListOfBanks() +console.log(response) // IListOfBanksResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getlistofbanks) + +#### Resolve Account + +```ts +// import the miscellaneous interfaces from the sdk +import type { IResolveAccountResponse } from 'bloc-nodejs'; + +const response = await bloc.resolveAccount() +console.log(response) // IResolveAccountResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/resolveaccount) + +#### Get Exchange Rate + +```ts +// import the miscellaneous interfaces from the sdk +import type { IGetExchangeRateResponse } from 'bloc-nodejs'; + +const response = await bloc.getExchangeRate('NGN-USD') +console.log(response) // IGetExchangeRateResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getexchangerate) ## License From d513480bc26b143ef48b01ae23de6f78277a79b7 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:17:13 +0100 Subject: [PATCH 5/8] docs: Add simulation api methods to readme --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index e68c0d9..d28de69 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Get List of Banks](#get-list-of-banks) - [Resolve Account](#resolve-account) - [Get Exchange Rate](#get-exchange-rate) + - [Simulation API](#simulation-api) + - [Credit Account](#credit-account) + - [Debit Account](#debit-account) - [License](#license) ## Prerequisites @@ -263,6 +266,42 @@ console.log(response) // IGetExchangeRateResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getexchangerate) +### Simulation API + +Simulation API operations + +#### Credit Account + +```ts +// import the simulation interfaces from the sdk +import type { ISimulationAccount, ICreditAccountResponse } from 'bloc-nodejs'; + +const payload: ISimulationAccount = { + // payload data +} + +const response = await bloc.creditAccount(payload) +console.log(response) // ICreditAccountResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/creditaccount) + +#### Debit Account + +```ts +// import the simulation interfaces from the sdk +import type { ISimulationAccount, IDebitAccountResponse } from 'bloc-nodejs'; + +const payload: ISimulationAccount = { + // payload data +} + +const response = await bloc.debitAccount(payload) +console.log(response) // IDebitAccountResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/debitaccount) + ## License [MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) From 68b76c6b12227d68aaba9d0105b8fd005a63a098 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:18:04 +0100 Subject: [PATCH 6/8] docs: Add transactions api methods to readme --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index d28de69..bbc0676 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,9 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Simulation API](#simulation-api) - [Credit Account](#credit-account) - [Debit Account](#debit-account) + - [Transactions API](#transactions-api) + - [Get All Transactions](#get-all-transactions) + - [Get Transaction by Reference](#get-transaction-by-reference) - [License](#license) ## Prerequisites @@ -302,6 +305,34 @@ console.log(response) // IDebitAccountResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/debitaccount) +### Transactions API + +Transactions API operations + +#### Get All Transactions + +```ts +// import the transactions interfaces from the sdk +import type { ITransactionResponse } from 'bloc-nodejs'; + +const response = await bloc.getAllTransactions() +console.log(response) // ITransactionResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getalltransactions) + +#### Get Transaction by Reference + +```ts +// import the transactions interfaces from the sdk +import type { ITransactionByReferenceResponse } from 'bloc-nodejs'; + +const response = await bloc.getTransactionByReference('ref_num') +console.log(response) // ITransactionByReferenceResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getalltransactions) + ## License [MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) From ebdeae5f61cc4b8a7ba1aaba4ca0442250029cae Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:19:03 +0100 Subject: [PATCH 7/8] docs: Add webhook api methods to readme --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index bbc0676..c6a754c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Transactions API](#transactions-api) - [Get All Transactions](#get-all-transactions) - [Get Transaction by Reference](#get-transaction-by-reference) + - [Webhook API](#webhook-api) + - [Set Webhook](#set-webhook) + - [Get Webhook](#get-webhook) - [License](#license) ## Prerequisites @@ -333,6 +336,38 @@ console.log(response) // ITransactionByReferenceResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getalltransactions) +### Webhook API + +Webhook API operations + +#### Set Webhook + +```ts +// import the webhook interfaces from the sdk +import type { ISetWebhook, IWebhookResponse } from 'bloc-nodejs'; + +const payload: ISetWebhook = { + // payload data +} + +const response = await bloc.setWebhook(payload) +console.log(response) // IWebhookResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/setwebhook) + +#### Get Webhook + +```ts +// import the webhook interfaces from the sdk +import type { IWebhookResponse } from 'bloc-nodejs'; + +const response = await bloc.getWebhook() +console.log(response) // IWebhookResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getwebhook) + ## License [MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) From 45cb5ad39b882e8309cd4067252e24ff28b8f581 Mon Sep 17 00:00:00 2001 From: peoray Date: Fri, 26 Jan 2024 18:20:52 +0100 Subject: [PATCH 8/8] docs: Add beneficiaries api methods to readme --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c6a754c..30bddfd 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,11 @@ A Nodejs API wrapper for [Bloc](https://www.blochq.io/) banking services written - [Webhook API](#webhook-api) - [Set Webhook](#set-webhook) - [Get Webhook](#get-webhook) + - [Beneficiaries API](#beneficiaries-api) + - [Create Beneficiary](#create-beneficiary) + - [Get Beneficiary by ID](#get-beneficiary-by-id) + - [Update Beneficiary](#update-beneficiary) + - [Delete beneficiary](#delete-beneficiary) - [License](#license) ## Prerequisites @@ -368,8 +373,65 @@ console.log(response) // IWebhookResponse Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getwebhook) +### Beneficiaries API + +Beneficiaries API operations + +#### Create Beneficiary + +```ts +// import the beneficiary interfaces from the sdk +import type { ICreateBeneficiary, IBeneficiaryResponse } from 'bloc-nodejs'; + +const payload: ICreateBeneficiary = { + // payload data +} + +const response = await bloc.createBeneficiary(payload) +console.log(response) // IBeneficiaryResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/createbeneficiary) + +#### Get Beneficiary by ID + +```ts +// import the beneficiary interfaces from the sdk +import type { IBeneficiaryResponse } from 'bloc-nodejs'; + +const response = await bloc.getBeneficiaryById('beneficiary-id') +console.log(response) // IBeneficiaryResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/getbeneficiarybyid) + +#### Update Beneficiary + +```ts +// import the beneficiary interfaces from the sdk +import type { IUpdateBeneficiary, IBeneficiaryResponse } from 'bloc-nodejs'; + +const payload: ICreateBeneficiary = { + // payload data +} + +const response = await bloc.updateBeneficiary('beneficiary-id', payload) +console.log(response) // IBeneficiaryResponse +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/updatebeneficiary) + +#### Delete Beneficiary + +```ts +const response = await bloc.deleteBeneficiary('beneficiary-id') +console.log(response) // any +``` + +Find more details about the parameters and response for the above method [here](https://docs.blochq.io/reference/deletebeneficiary) + ## License -[MIT](https://github.com/peoray/bloc-nodejs/blob/main/LICENSE) +[MIT](./LICENSE) [Back to Top](#table-of-content) \ No newline at end of file