wallets-africa
Version:
Nodejs API wrapper for wallets africa
55 lines (54 loc) • 1.83 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
/**
* @class Self
* All self functionality and methods based on api
* {@link https://https://documenter.getpostman.com/view/10058163/SWLk4RPL?version=latest#90e5b45a-9ae1-4eaa-85ae-9aa569835bdb View Api Docs}
*/
class Self {
/**
* To get balance of account in different currency
*
* @param currency - currency to get balance in
*/
static async checkBalance(currency = 'NGN') {
const body = { currency, SecretKey: this.secretKey };
const url = `${this.endpoint}/balance`;
return axios_1.default.post(url, body);
}
/**
* Retrieves and returns a list of performed transactions within a specified time period
*
*/
static async transactions(options = {}) {
const body = Object.assign(Object.assign({}, options), { SecretKey: this.secretKey, currency: 'NGN' });
const url = `${this.endpoint}/transactions`;
return axios_1.default.post(url, body);
}
/**
* Verifies BVN
*/
static async verifyBvn(options) {
const body = Object.assign(Object.assign({}, options), { SecretKey: this.secretKey });
const url = `${this.endpoint}/verifybvn`;
return axios_1.default.post(url, body);
}
/**
* Retrieves and returns a list of users
*/
static async getWallets() {
const body = { SecretKey: this.secretKey };
const url = `${this.endpoint}/users`;
return axios_1.default.post(url, body);
}
}
/*
Api keys
*/
Self.secretKey = '';
Self.endpoint = '/self';
exports.default = Self;