monei-sdk 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,6 +125,9 @@ console.log(`Signature: ${transferResult.data.signature}`);
125
125
  ### 4. Bill Payments
126
126
 
127
127
  ```typescript
128
+ // Get Available Electricity Billers
129
+ const electricityBillersResult = await sdk.bills.getElectricityBiller();
130
+
128
131
  // Buy airtime
129
132
  const airtimeResult = await sdk.bills.buyAirtime({
130
133
  phoneNumber: "08012345678",
@@ -280,7 +283,7 @@ interface MoneiConfig {
280
283
  ### Available Services
281
284
 
282
285
  - `sdk.user` - User profile and management
283
- - `sdk.wallet` - Wallet operations and banking
286
+ - `sdk.wallet` - Wallet and financial operations
284
287
  - `sdk.evm` - EVM blockchain operations
285
288
  - `sdk.solana` - Solana blockchain operations
286
289
  - `sdk.transactions` - Transaction history
@@ -17,7 +17,7 @@ class MoneiClient {
17
17
  baseURL: this.config.baseUrl,
18
18
  timeout: this.config.timeout,
19
19
  headers: {
20
- 'X-API-KEY': this.config.apiKey,
20
+ 'X-API-KEY': this.config.apiKey || process.env.MONEI_API_KEY,
21
21
  'Content-Type': 'application/json',
22
22
  },
23
23
  });
@@ -1,13 +1,16 @@
1
1
  import { MoneiClient } from '../client/MoneiClient';
2
- import { BillCategory, BillerItemsResponseDto, ValidateBillDto, AirtimePurchaseDto, DataPurchaseDto, ElectricityPaymentDto, CableTvPaymentDto, BillPaymentResponseDto, BillDto } from '../types';
2
+ import { BillCategory, BillerItemsResponseDto, ValidateBillDto, AirtimePurchaseDto, DataPurchaseDto, ElectricityPaymentDto, CableTvPaymentDto, BillPaymentResponseDto, ElectricityBillerResponseDto, PaginatedBillResponseDto, BillResponseDto } from '../types';
3
3
  export declare class BillService {
4
4
  private client;
5
5
  constructor(client: MoneiClient);
6
6
  getBillerItems(category: BillCategory, billerName: string): Promise<BillerItemsResponseDto>;
7
+ getElectricityBiller(): Promise<ElectricityBillerResponseDto>;
7
8
  validateBill(validateData: ValidateBillDto): Promise<any>;
8
9
  buyAirtime(airtimeData: AirtimePurchaseDto): Promise<BillPaymentResponseDto>;
9
10
  buyMobileData(dataData: DataPurchaseDto): Promise<BillPaymentResponseDto>;
10
11
  buyElectricity(electricityData: ElectricityPaymentDto): Promise<BillPaymentResponseDto>;
11
12
  subscribeCableTv(cableData: CableTvPaymentDto): Promise<BillPaymentResponseDto>;
12
- getBillHistory(): Promise<BillDto[]>;
13
+ getBills(): Promise<PaginatedBillResponseDto[]>;
14
+ getBillByReference(reference: string): Promise<BillResponseDto[]>;
15
+ generateReceipt(transactionId: string): Promise<any>;
13
16
  }
@@ -8,6 +8,9 @@ class BillService {
8
8
  async getBillerItems(category, billerName) {
9
9
  return this.client.get(`/api/v1/bills/get-biller-items/${category}/${billerName}`);
10
10
  }
11
+ async getElectricityBiller() {
12
+ return this.client.get('/api/v1/bills/billers/electricity');
13
+ }
11
14
  async validateBill(validateData) {
12
15
  return this.client.post('/api/v1/bills/validate', validateData);
13
16
  }
@@ -23,8 +26,14 @@ class BillService {
23
26
  async subscribeCableTv(cableData) {
24
27
  return this.client.post('/api/v1/bills/subscribe-cable-tv', cableData);
25
28
  }
26
- async getBillHistory() {
27
- return this.client.get('/api/v1/bills/history');
29
+ async getBills() {
30
+ return this.client.get('/api/v1/bills');
31
+ }
32
+ async getBillByReference(reference) {
33
+ return this.client.get(`/api/v1/bills/reference/${reference}`);
34
+ }
35
+ async generateReceipt(transactionId) {
36
+ return this.client.get(`/api/v1/bills/receipt/${transactionId}`);
28
37
  }
29
38
  }
30
39
  exports.BillService = BillService;
@@ -1,13 +1,13 @@
1
1
  import { MoneiClient } from '../client/MoneiClient';
2
- import { SwapNativeToTokenDto, SwapTokenToTokenDto, SwapTokenToNativeDto, QuoteResponseDto, TxHashResponseDto, SwapSolToTokenDto, SwapResponseDto } from '../types';
2
+ import { SwapNativeToTokenDto, SwapTokenToTokenDto, SwapTokenToNativeDto, PriceResponseDto, TxHashResponseDto, SwapSolToTokenDto, SwapResponseDto } from '../types';
3
3
  export declare class ExchangeService {
4
4
  private client;
5
5
  constructor(client: MoneiClient);
6
- getNativeToTokenQuote(quoteData: SwapNativeToTokenDto): Promise<QuoteResponseDto>;
6
+ getNativeToTokenPrice(quoteData: SwapNativeToTokenDto): Promise<PriceResponseDto>;
7
7
  swapNativeToToken(swapData: SwapNativeToTokenDto): Promise<TxHashResponseDto>;
8
- getTokenToTokenQuote(quoteData: SwapTokenToTokenDto): Promise<QuoteResponseDto>;
8
+ getTokenToTokenPrice(quoteData: SwapTokenToTokenDto): Promise<PriceResponseDto>;
9
9
  swapTokenToToken(swapData: SwapTokenToTokenDto): Promise<TxHashResponseDto>;
10
- getTokenToNativeQuote(quoteData: SwapTokenToNativeDto): Promise<QuoteResponseDto>;
10
+ getTokenToNativePrice(quoteData: SwapTokenToNativeDto): Promise<PriceResponseDto>;
11
11
  swapTokenToNative(swapData: SwapTokenToNativeDto): Promise<TxHashResponseDto>;
12
12
  getSolanaQuote(inputMint: string, outputMint: string, amount: number): Promise<any>;
13
13
  swapSolToToken(swapData: SwapSolToTokenDto): Promise<SwapResponseDto>;
@@ -6,20 +6,20 @@ class ExchangeService {
6
6
  this.client = client;
7
7
  }
8
8
  // EVM Exchange
9
- async getNativeToTokenQuote(quoteData) {
10
- return this.client.post('/api/v1/evm-exchange/quote/native-to-token', quoteData);
9
+ async getNativeToTokenPrice(quoteData) {
10
+ return this.client.post('/api/v1/evm-exchange/price/native-to-token', quoteData);
11
11
  }
12
12
  async swapNativeToToken(swapData) {
13
13
  return this.client.post('/api/v1/evm-exchange/native-to-token', swapData);
14
14
  }
15
- async getTokenToTokenQuote(quoteData) {
16
- return this.client.post('/api/v1/evm-exchange/quote/token-to-token', quoteData);
15
+ async getTokenToTokenPrice(quoteData) {
16
+ return this.client.post('/api/v1/evm-exchange/price/token-to-token', quoteData);
17
17
  }
18
18
  async swapTokenToToken(swapData) {
19
19
  return this.client.post('/api/v1/evm-exchange/token-to-token', swapData);
20
20
  }
21
- async getTokenToNativeQuote(quoteData) {
22
- return this.client.post('/api/v1/evm-exchange/quote/token-to-native', quoteData);
21
+ async getTokenToNativePrice(quoteData) {
22
+ return this.client.post('/api/v1/evm-exchange/price/token-to-native', quoteData);
23
23
  }
24
24
  async swapTokenToNative(swapData) {
25
25
  return this.client.post('/api/v1/evm-exchange/token-to-native', swapData);
@@ -0,0 +1,5 @@
1
+ import { MoneiClient } from '../client/MoneiClient';
2
+ export declare class SecuritiesService {
3
+ private client;
4
+ constructor(client: MoneiClient);
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SecuritiesService = void 0;
4
+ class SecuritiesService {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ }
9
+ exports.SecuritiesService = SecuritiesService;
@@ -15,6 +15,22 @@ export interface ConversationMessagesResponseDto {
15
15
  export interface CreateConversationDto {
16
16
  id: string;
17
17
  }
18
+ export interface initializeConversationDto {
19
+ statusCode: number;
20
+ message: string;
21
+ data: ConversationDto;
22
+ }
23
+ export interface ConversationDto {
24
+ id: string;
25
+ user?: {};
26
+ messages?: {};
27
+ title: string;
28
+ context?: string;
29
+ isPinned: boolean;
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ deletedDate?: string;
33
+ }
18
34
  export interface PinConversationDto {
19
35
  pin: boolean;
20
36
  }
@@ -28,8 +28,19 @@ export interface BillerItemsResponseDto {
28
28
  message: string;
29
29
  data: BillerDto[];
30
30
  }
31
+ export interface ElectricityBillerDto {
32
+ name: string;
33
+ code: string;
34
+ billerCode: string;
35
+ }
36
+ export interface ElectricityBillerResponseDto {
37
+ statusCode: number;
38
+ message: string;
39
+ data: ElectricityBillerDto[];
40
+ }
31
41
  export interface ValidateBillDto {
32
- itemCode: string;
42
+ itemCode?: string;
43
+ billerCode: string;
33
44
  customer: string;
34
45
  }
35
46
  export interface CreateBillScheduleDto {
@@ -116,3 +127,32 @@ export interface BillDto {
116
127
  token?: string;
117
128
  units?: string;
118
129
  }
130
+ export interface BillResponseDto {
131
+ statusCode: 200;
132
+ message: string;
133
+ data: BillDto;
134
+ }
135
+ export interface PaginatedBillDto {
136
+ bills: BillDto[];
137
+ page: number;
138
+ total: number;
139
+ totalPages: number;
140
+ hasNext: boolean;
141
+ hasPrev: boolean;
142
+ }
143
+ export interface PaginatedBillResponseDto {
144
+ statusCode: number;
145
+ message: string;
146
+ data: PaginatedBillDto;
147
+ }
148
+ export interface BillDataDto {
149
+ type: false;
150
+ status: string;
151
+ billerName: string;
152
+ billerCode: string;
153
+ customer: string;
154
+ startDate: string;
155
+ endDate: string;
156
+ amount: number;
157
+ reference: string;
158
+ }
@@ -18,7 +18,7 @@ export interface ZeroExQuoteDto {
18
18
  permit2?: any;
19
19
  transaction: any;
20
20
  }
21
- export interface QuoteResponseDto {
21
+ export interface PriceResponseDto {
22
22
  statusCode: number;
23
23
  message: string;
24
24
  data: ZeroExQuoteDto;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,35 +1,47 @@
1
1
  export interface TransactionResponseDto {
2
2
  id: string;
3
- createdAt: string;
4
- updatedAt: string;
5
- deletedDate: string;
6
3
  userId: string;
7
4
  amount: number;
8
- type: string;
9
- status: string;
5
+ type: 'CREDIT' | 'DEBIT';
6
+ status: 'SUCCESS' | 'PENDING' | 'FAILED';
10
7
  reference: string;
11
8
  currency: string;
12
9
  narration: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ deletedDate: string | null;
13
+ }
14
+ export interface UserTransactionsDataDto {
15
+ transactions: TransactionResponseDto[];
16
+ pagination: PaginationDto;
13
17
  }
14
18
  export interface UserTransactionsResponseDto {
15
19
  statusCode: number;
16
20
  message: string;
17
- data: TransactionResponseDto[];
21
+ data: UserTransactionsDataDto;
18
22
  }
19
23
  export interface TransactionDto {
20
24
  id: string;
21
- createdAt: string;
22
- updatedAt: string;
23
- deletedDate: string;
24
- user: any;
25
- wallet: any;
26
- subwallet: any;
27
25
  amount: number;
28
- type: string;
29
- status: string;
26
+ type: 'CREDIT' | 'DEBIT';
27
+ status: 'SUCCESS' | 'PENDING' | 'FAILED';
30
28
  currency: string;
31
29
  reference: string;
32
30
  fincraReference?: string;
33
31
  narration: string;
32
+ user: any;
33
+ wallet: any;
34
+ subwallet: any;
34
35
  metadata?: any;
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ deletedDate: string | null;
39
+ }
40
+ export interface PaginationDto {
41
+ page: number;
42
+ limit: number;
43
+ total: number;
44
+ totalPages: number;
45
+ hasNextPage: boolean;
46
+ hasPreviousPage: boolean;
35
47
  }
@@ -6,8 +6,21 @@ export interface BalanceResponseDto {
6
6
  message: string;
7
7
  data: BalanceDto;
8
8
  }
9
+ interface Customization {
10
+ title?: string;
11
+ }
12
+ interface Customer {
13
+ email: string;
14
+ phoneNumber: string;
15
+ name: string;
16
+ }
9
17
  export interface FundWalletByNairaDto {
10
18
  amount: number;
19
+ reference?: string;
20
+ currency?: string;
21
+ redirectUrl?: string;
22
+ customization?: Customization;
23
+ customer?: Customer;
11
24
  }
12
25
  export interface DepositResponseDto {
13
26
  link: string;
@@ -74,8 +87,11 @@ export interface WithdrawWalletDto {
74
87
  accountNumber: string;
75
88
  transactionPin: string;
76
89
  currency?: string;
90
+ reference?: string;
77
91
  narration?: string;
78
92
  }
93
+ export interface WithdrawResponseDto {
94
+ }
79
95
  export interface PeerTransferDto {
80
96
  receiver: string;
81
97
  amount: number;
@@ -100,3 +116,14 @@ export interface UserKycInfoDto {
100
116
  kycStatus: string;
101
117
  verifiedAt: string;
102
118
  }
119
+ export interface WithdrawDto {
120
+ reference: string;
121
+ status: string;
122
+ amount: number;
123
+ }
124
+ export interface WalletResponseDto {
125
+ statusCode: number;
126
+ message: string;
127
+ data: WithdrawDto;
128
+ }
129
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monei-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Node.js SDK for Monei API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,11 @@
8
8
  "build": "tsc",
9
9
  "prepublishOnly": "npm run build",
10
10
  "test": "jest",
11
- "test:watch": "jest --watch"
11
+ "test:unit": "jest test/unit",
12
+ "test:integration": "jest test/integration",
13
+ "test:watch": "jest --watch",
14
+ "test:coverage": "jest --coverage",
15
+ "test:all": "npm run test:unit && npm run test:integration"
12
16
  },
13
17
  "keywords": [
14
18
  "mrmonei",
@@ -20,13 +24,16 @@
20
24
  "author": "Ayodeji Osayemi",
21
25
  "license": "MIT",
22
26
  "dependencies": {
23
- "axios": "^1.13.2"
27
+ "axios": "^1.13.2",
28
+ "dotenv": "^17.2.3",
29
+ "ts-node": "^10.9.2"
24
30
  },
25
31
  "devDependencies": {
26
- "@types/jest": "^29.0.0",
32
+ "@types/jest": "^29.5.14",
27
33
  "@types/node": "^20.0.0",
28
- "jest": "^29.0.0",
29
- "ts-jest": "^29.0.0",
34
+ "axios-mock-adapter": "^2.1.0",
35
+ "jest": "^29.7.0",
36
+ "ts-jest": "^29.4.5",
30
37
  "typescript": "^5.0.0"
31
38
  },
32
39
  "files": [