-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
27 lines (24 loc) · 921 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { AuthKeyError, TypeError } = require("./Errors");
const account = require("./modules/Account");
const info = require("./modules/Info");
const payouts = require("./modules/Payouts");
const wallet = require("./modules/Wallet");
const redeem = require("./modules/Redeem");
const mobileMoney = require("./modules/MobileMoney");
const subAccount = require("./modules/SubAccount");
/**
* This function sets up the chimoneyjs modules using an optional key
* @param {string?} apiKey Chi Money API key
* @returns The chimoneyjs Modules
*/
module.exports = function (apiKey) {
if (apiKey) {
// apikey must be a string
if (typeof apiKey !== "string")
throw new TypeError("apikey must be of type string");
// Set CHIMONEY_API_KEY environment variable
process.env.CHIMONEY_API_KEY = apiKey;
}
// Return modules
return { account, info, payouts, wallet, subAccount, redeem, mobileMoney };
};