Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
59 lines (52 loc) · 2.98 KB
/
Copy pathindex.js
File metadata and controls
59 lines (52 loc) · 2.98 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Monnify API wrapper — main entry point
* @authors: Tochukwu Nwokolo & Benjamin Ononogbu
*/
import { BaseRequestAPI } from "./src/base_api.js";
import { ReservedAccount } from "./src/collections/reservedAccount.js";
import { Transaction } from "./src/collections/transaction.js";
import { SubAccount } from "./src/collections/subaccount.js";
import { Invoice } from "./src/collections/invoice.js";
import { Settlement } from "./src/collections/settlement.js";
import { LimitProfile } from "./src/collections/limitProfile.js";
import { DirectDebit } from "./src/collections/directDebit.js";
import { Wallet } from "./src/collections/wallet.js";
import { Disbursement } from "./src/disbursements/disbursement.js";
import { TransactionRefund } from "./src/disbursements/refund.js";
import { Verification } from "./src/valueAddedService/verification.js";
import { BillsPayment } from "./src/valueAddedService/billsPayment.js";
export class MonnifyAPI extends BaseRequestAPI {
constructor(config = {}) {
if (config.MONNIFY_APIKEY) process.env.MONNIFY_APIKEY = config.MONNIFY_APIKEY;
if (config.MONNIFY_SECRET) process.env.MONNIFY_SECRET = config.MONNIFY_SECRET;
if (config.env && !process.env.MONNIFY_ENV) {
console.warn(
`[monnify] Passing env in the MonnifyAPI config is deprecated and will be removed in a future version. ` +
`Add MONNIFY_ENV=${config.env} to your .env file instead.`
);
process.env.MONNIFY_ENV = config.env;
}
super();
// ── Collections ──────────────────────────────────────────────────────
this.reservedAccount = new ReservedAccount();
this.transaction = new Transaction();
this.subAccount = new SubAccount();
this.invoice = new Invoice();
this.settlement = new Settlement();
this.limitProfile = new LimitProfile();
this.directDebit = new DirectDebit();
// ── Disbursements ────────────────────────────────────────────────────
this.disbursement = new Disbursement();
this.refund = new TransactionRefund();
this.wallet = new Wallet();
// ── Value-added services ─────────────────────────────────────────────
this.verification = new Verification();
this.billsPayment = new BillsPayment();
}
}
// Named re-exports so consumers can tree-shake or import individual classes
export {
ReservedAccount, Transaction, SubAccount, Invoice,
Settlement, LimitProfile, DirectDebit, Wallet,
Disbursement, TransactionRefund, Verification, BillsPayment
};