@maxkabechani/mtn-momo-sdk 0.2.2 → 1.0.0
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/MIGRATION.md +79 -0
- package/README.md +68 -5
- package/lib/cjs/auth.d.ts +2 -2
- package/lib/cjs/auth.d.ts.map +1 -1
- package/lib/cjs/auth.js +31 -11
- package/lib/cjs/auth.js.map +1 -1
- package/lib/cjs/cli.js +5 -2
- package/lib/cjs/cli.js.map +1 -1
- package/lib/cjs/client.d.ts +3 -3
- package/lib/cjs/client.d.ts.map +1 -1
- package/lib/cjs/client.js +15 -7
- package/lib/cjs/client.js.map +1 -1
- package/lib/cjs/collections.d.ts +6 -5
- package/lib/cjs/collections.d.ts.map +1 -1
- package/lib/cjs/collections.js +45 -25
- package/lib/cjs/collections.js.map +1 -1
- package/lib/cjs/common.d.ts +13 -4
- package/lib/cjs/common.d.ts.map +1 -1
- package/lib/cjs/common.js.map +1 -1
- package/lib/cjs/disbursements.d.ts +7 -10
- package/lib/cjs/disbursements.d.ts.map +1 -1
- package/lib/cjs/disbursements.js +46 -31
- package/lib/cjs/disbursements.js.map +1 -1
- package/lib/cjs/errors.d.ts +15 -6
- package/lib/cjs/errors.d.ts.map +1 -1
- package/lib/cjs/errors.js +33 -23
- package/lib/cjs/errors.js.map +1 -1
- package/lib/cjs/httpClient.d.ts +50 -17
- package/lib/cjs/httpClient.d.ts.map +1 -1
- package/lib/cjs/httpClient.js +276 -78
- package/lib/cjs/httpClient.js.map +1 -1
- package/lib/cjs/index.d.ts +12 -11
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +30 -28
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/remittance.d.ts +5 -5
- package/lib/cjs/remittance.d.ts.map +1 -1
- package/lib/cjs/remittance.js +58 -41
- package/lib/cjs/remittance.js.map +1 -1
- package/lib/cjs/security.d.ts +32 -0
- package/lib/cjs/security.d.ts.map +1 -0
- package/lib/cjs/security.js +253 -0
- package/lib/cjs/security.js.map +1 -0
- package/lib/cjs/users.d.ts +5 -3
- package/lib/cjs/users.d.ts.map +1 -1
- package/lib/cjs/users.js +17 -6
- package/lib/cjs/users.js.map +1 -1
- package/lib/cjs/validate.d.ts +7 -7
- package/lib/cjs/validate.d.ts.map +1 -1
- package/lib/cjs/validate.js +67 -84
- package/lib/cjs/validate.js.map +1 -1
- package/lib/esm/auth.d.ts +2 -2
- package/lib/esm/auth.d.ts.map +1 -1
- package/lib/esm/auth.js +28 -8
- package/lib/esm/auth.js.map +1 -1
- package/lib/esm/cli.js +5 -2
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/client.d.ts +3 -3
- package/lib/esm/client.d.ts.map +1 -1
- package/lib/esm/client.js +14 -6
- package/lib/esm/client.js.map +1 -1
- package/lib/esm/collections.d.ts +6 -5
- package/lib/esm/collections.d.ts.map +1 -1
- package/lib/esm/collections.js +38 -18
- package/lib/esm/collections.js.map +1 -1
- package/lib/esm/common.d.ts +13 -4
- package/lib/esm/common.d.ts.map +1 -1
- package/lib/esm/common.js.map +1 -1
- package/lib/esm/disbursements.d.ts +7 -10
- package/lib/esm/disbursements.d.ts.map +1 -1
- package/lib/esm/disbursements.js +34 -19
- package/lib/esm/disbursements.js.map +1 -1
- package/lib/esm/errors.d.ts +15 -6
- package/lib/esm/errors.d.ts.map +1 -1
- package/lib/esm/errors.js +16 -6
- package/lib/esm/errors.js.map +1 -1
- package/lib/esm/httpClient.d.ts +50 -17
- package/lib/esm/httpClient.d.ts.map +1 -1
- package/lib/esm/httpClient.js +271 -77
- package/lib/esm/httpClient.js.map +1 -1
- package/lib/esm/index.d.ts +12 -11
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +12 -11
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/remittance.d.ts +5 -5
- package/lib/esm/remittance.d.ts.map +1 -1
- package/lib/esm/remittance.js +52 -35
- package/lib/esm/remittance.js.map +1 -1
- package/lib/esm/security.d.ts +32 -0
- package/lib/esm/security.d.ts.map +1 -0
- package/lib/esm/security.js +234 -0
- package/lib/esm/security.js.map +1 -0
- package/lib/esm/users.d.ts +5 -3
- package/lib/esm/users.d.ts.map +1 -1
- package/lib/esm/users.js +17 -6
- package/lib/esm/users.js.map +1 -1
- package/lib/esm/validate.d.ts +7 -7
- package/lib/esm/validate.d.ts.map +1 -1
- package/lib/esm/validate.js +66 -84
- package/lib/esm/validate.js.map +1 -1
- package/package.json +23 -5
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Migrating to 1.0.0
|
|
2
|
+
|
|
3
|
+
## Financial references
|
|
4
|
+
|
|
5
|
+
Generate and persist a UUIDv4 before every new financial operation:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
const referenceId = generateReferenceId();
|
|
9
|
+
await persist(referenceId);
|
|
10
|
+
|
|
11
|
+
await collections.requestToPay({
|
|
12
|
+
referenceId,
|
|
13
|
+
amount: "10.00",
|
|
14
|
+
currency: "EUR",
|
|
15
|
+
payer,
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Reuse that exact `referenceId` after a timeout, connection reset, or other
|
|
20
|
+
ambiguous failure. Do not reuse it for a genuinely new operation.
|
|
21
|
+
|
|
22
|
+
The optional field is available on request-to-pay, withdrawals, transfers,
|
|
23
|
+
deposits, refunds, and remittance cash transfers.
|
|
24
|
+
|
|
25
|
+
## Production configuration
|
|
26
|
+
|
|
27
|
+
Production now requires an explicit HTTPS base URL:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
create({
|
|
31
|
+
callbackHost: "payments.example.com",
|
|
32
|
+
environment: Environment.PRODUCTION,
|
|
33
|
+
baseUrl: "https://approved-mtn-host.example",
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Embedded URL credentials, HTTP, unsupported protocols, queries, and fragments
|
|
38
|
+
are rejected.
|
|
39
|
+
|
|
40
|
+
## Consent APIs
|
|
41
|
+
|
|
42
|
+
Pass the returned consent access token explicitly:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const token = await collections.getOAuth2Token(request);
|
|
46
|
+
const user = await collections.getUserInfoWithConsent(token.access_token);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Consent tokens are not cached globally or shared between customers.
|
|
50
|
+
|
|
51
|
+
## Errors
|
|
52
|
+
|
|
53
|
+
Public request errors no longer contain raw request headers or payloads.
|
|
54
|
+
`error.config` is now only:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
{
|
|
58
|
+
method: string;
|
|
59
|
+
url: string; // redacted
|
|
60
|
+
timeout: number;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Stop reading `error.config.headers`, `Authorization`, or subscription keys.
|
|
65
|
+
|
|
66
|
+
## Runtime validation
|
|
67
|
+
|
|
68
|
+
- Amounts must be positive decimal strings.
|
|
69
|
+
- Amount strings are preserved exactly; currency-specific precision and scale
|
|
70
|
+
remain subject to the applicable MTN product contract.
|
|
71
|
+
- MTN references and API-user IDs must be UUIDv4.
|
|
72
|
+
- Currency path parameters must be uppercase three-letter codes.
|
|
73
|
+
- Party identifiers and types are validated and safely encoded.
|
|
74
|
+
- Production sandbox-user provisioning is rejected.
|
|
75
|
+
|
|
76
|
+
## Runtime support
|
|
77
|
+
|
|
78
|
+
Node.js 20.19+ and Bun are supported. Both ESM import and CommonJS require are
|
|
79
|
+
verified against the packed artifact.
|
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ This SDK provides a type-safe, developer-friendly interface for integrating MTN
|
|
|
11
11
|
- **V1 & V2 Coexistence**: Use stable V1 endpoints by default or opt-in to V2 features (`depositV2`, `refundV2`, `requestToWithdrawV2`, `cashTransfer`).
|
|
12
12
|
- **Comprehensive Coverage**: Request-to-pay, transfers, deposits, refunds, withdrawals, BC Authorize, OAuth2 consent, delivery notifications, and more.
|
|
13
13
|
- **TypeScript First**: Full type definitions for all requests, responses, and errors.
|
|
14
|
-
- **Bun & Node.js**:
|
|
14
|
+
- **Bun & Node.js**: Supports Node.js 20.19+ and Bun.
|
|
15
|
+
- **Retry-safe references**: Callers can generate and persist MTN reference IDs before dispatch.
|
|
16
|
+
- **Secure transport and errors**: Production requires HTTPS and public errors never expose request credentials.
|
|
15
17
|
|
|
16
18
|
---
|
|
17
19
|
|
|
@@ -35,9 +37,13 @@ import { create, Environment } from "@maxkabechani/mtn-momo-sdk";
|
|
|
35
37
|
const momo = create({
|
|
36
38
|
callbackHost: "yourdomain.com",
|
|
37
39
|
environment: Environment.SANDBOX, // or Environment.PRODUCTION
|
|
40
|
+
timeoutMs: 30_000, // optional
|
|
41
|
+
maxResponseBytes: 1024 * 1024, // optional
|
|
38
42
|
});
|
|
39
43
|
```
|
|
40
44
|
|
|
45
|
+
Production additionally requires an explicit HTTPS `baseUrl`. HTTP is rejected.
|
|
46
|
+
|
|
41
47
|
### 2. Provision Sandbox Credentials
|
|
42
48
|
|
|
43
49
|
Use the `Users` client to create sandbox API users, or use the CLI tool:
|
|
@@ -65,6 +71,28 @@ const collections = momo.Collections({
|
|
|
65
71
|
});
|
|
66
72
|
```
|
|
67
73
|
|
|
74
|
+
### 4. Persist references before financial requests
|
|
75
|
+
|
|
76
|
+
Production applications must generate and persist the MTN reference before the
|
|
77
|
+
first attempt. Reuse the same value after timeouts or ambiguous network errors.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { generateReferenceId } from "@maxkabechani/mtn-momo-sdk";
|
|
81
|
+
|
|
82
|
+
const referenceId = generateReferenceId();
|
|
83
|
+
await saveReferenceForRetry(referenceId);
|
|
84
|
+
|
|
85
|
+
await collections.requestToPay({
|
|
86
|
+
referenceId,
|
|
87
|
+
amount: "500",
|
|
88
|
+
currency: "EUR",
|
|
89
|
+
payer: { partyIdType: "MSISDN", partyId: "46733123454" },
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If `referenceId` is omitted, the SDK still generates one for compatibility.
|
|
94
|
+
That fallback must not be used by applications that retry financial operations.
|
|
95
|
+
|
|
68
96
|
---
|
|
69
97
|
|
|
70
98
|
## API Reference
|
|
@@ -213,7 +241,9 @@ Requests a payment from a consumer (payer).
|
|
|
213
241
|
- **Errors**: Validation errors for missing/invalid fields
|
|
214
242
|
|
|
215
243
|
```ts
|
|
216
|
-
const referenceId =
|
|
244
|
+
const referenceId = generateReferenceId();
|
|
245
|
+
await collections.requestToPay({
|
|
246
|
+
referenceId,
|
|
217
247
|
amount: "500",
|
|
218
248
|
currency: "EUR",
|
|
219
249
|
externalId: "order-123",
|
|
@@ -340,10 +370,11 @@ const authResult = await collections.bcAuthorize({
|
|
|
340
370
|
});
|
|
341
371
|
```
|
|
342
372
|
|
|
343
|
-
#### `getUserInfoWithConsent(): Promise<ConsentKycResponse>`
|
|
373
|
+
#### `getUserInfoWithConsent(consentToken: string): Promise<ConsentKycResponse>`
|
|
344
374
|
|
|
345
375
|
Retrieves user information with KYC consent (requires prior OAuth2 authorization).
|
|
346
376
|
|
|
377
|
+
- **Arguments**: `consentToken` — the access token returned by `getOAuth2Token`
|
|
347
378
|
- **Returns**: User info including `sub`, `name`, `phone_number`, `status`
|
|
348
379
|
|
|
349
380
|
#### `getOAuth2Token(request: OAuth2TokenRequest): Promise<OAuth2TokenResponse>`
|
|
@@ -358,6 +389,8 @@ const token = await collections.getOAuth2Token({
|
|
|
358
389
|
grant_type: "urn:openid:params:grant-type:ciba",
|
|
359
390
|
auth_req_id: authResult.auth_req_id,
|
|
360
391
|
});
|
|
392
|
+
|
|
393
|
+
const userInfo = await collections.getUserInfoWithConsent(token.access_token);
|
|
361
394
|
```
|
|
362
395
|
|
|
363
396
|
---
|
|
@@ -660,12 +693,34 @@ try {
|
|
|
660
693
|
const momo = create({
|
|
661
694
|
callbackHost: "production-api.yoursite.com",
|
|
662
695
|
environment: Environment.PRODUCTION,
|
|
696
|
+
baseUrl: "https://your-approved-mtn-production-host.example",
|
|
663
697
|
});
|
|
664
698
|
```
|
|
665
699
|
|
|
666
700
|
2. **Use production credentials** from the [MTN MoMo Developer Portal](https://momodeveloper.mtn.com/).
|
|
667
701
|
|
|
668
|
-
3. **
|
|
702
|
+
3. **Transport**: Production URLs must be valid HTTPS URLs without embedded credentials, queries, or fragments.
|
|
703
|
+
|
|
704
|
+
4. **Provisioning**: `Users` is sandbox-only and rejects production use before network dispatch.
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
## Version 1 migration
|
|
709
|
+
|
|
710
|
+
Version 1 contains security-related behavior changes:
|
|
711
|
+
|
|
712
|
+
- Every financial request accepts `referenceId?: string`. Generate and persist it before the first attempt and reuse it on retries.
|
|
713
|
+
- `getUserInfoWithConsent` now requires an explicit consent token.
|
|
714
|
+
- Production requires an explicit HTTPS `baseUrl`.
|
|
715
|
+
- Dynamic status, currency, party, and user identifiers are runtime-validated.
|
|
716
|
+
- Financial amounts must be complete positive decimal strings.
|
|
717
|
+
- The SDK preserves decimal strings exactly. Confirm currency-specific provider
|
|
718
|
+
precision and scale limits with MTN before production use.
|
|
719
|
+
- Public network errors expose only a redacted request summary; do not inspect raw `error.config.headers`.
|
|
720
|
+
- Requests reject redirects, default to a 30-second timeout, and limit responses to 1 MiB unless configured otherwise.
|
|
721
|
+
- Node.js 20.19 or newer is required.
|
|
722
|
+
|
|
723
|
+
See [`MIGRATION.md`](./MIGRATION.md) for a compact adapter migration checklist.
|
|
669
724
|
|
|
670
725
|
---
|
|
671
726
|
|
|
@@ -706,12 +761,20 @@ const collections = momo.Collections({
|
|
|
706
761
|
|
|
707
762
|
```bash
|
|
708
763
|
bun install
|
|
709
|
-
bun run test # Run all tests
|
|
764
|
+
bun run test # Run all tests; live sandbox tests skip without keys
|
|
765
|
+
bun run test:security # Run the security regression suite
|
|
766
|
+
bun run test:integration # Run deterministic public-factory integration tests
|
|
767
|
+
bun run test:integration:live # Run credential-gated MTN sandbox tests
|
|
710
768
|
bun run test:coverage # Run tests with coverage
|
|
711
769
|
bun run typecheck # Type check
|
|
770
|
+
bun run lint # Static project checks
|
|
712
771
|
bun run build # Build for production (ESM + CJS)
|
|
772
|
+
bun run test:package # Packed Node ESM/CJS, Bun, and declarations
|
|
713
773
|
```
|
|
714
774
|
|
|
775
|
+
Releases are published from version tags through npm Trusted Publishing. See
|
|
776
|
+
[`RELEASING.md`](./RELEASING.md) for the release procedure.
|
|
777
|
+
|
|
715
778
|
## License
|
|
716
779
|
|
|
717
780
|
ISC
|
package/lib/cjs/auth.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { HttpClient } from "./httpClient";
|
|
2
|
-
import type { AccessToken, Config, UserConfig } from "./common";
|
|
1
|
+
import type { HttpClient } from "./httpClient.js";
|
|
2
|
+
import type { AccessToken, Config, UserConfig } from "./common.js";
|
|
3
3
|
export type TokenRefresher = () => Promise<string>;
|
|
4
4
|
export interface AuthorizerOptions {
|
|
5
5
|
grant_type?: string;
|
package/lib/cjs/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGnE,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,EAC3B,MAAM,CAAC,EAAE,UAAU,KAChB,OAAO,CAAC,WAAW,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAS1F,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,MAAM,GACb,cAAc,CA8DhB;AASD,eAAO,MAAM,oBAAoB,EAAE,UAalC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,UAapC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,UAajC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAI/D"}
|
package/lib/cjs/auth.js
CHANGED
|
@@ -3,22 +3,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.authorizeRemittance = exports.authorizeDisbursements = exports.authorizeCollections = void 0;
|
|
4
4
|
exports.createTokenRefresher = createTokenRefresher;
|
|
5
5
|
exports.createBasicAuthToken = createBasicAuthToken;
|
|
6
|
-
const
|
|
6
|
+
const client_js_1 = require("./client.js");
|
|
7
|
+
const security_js_1 = require("./security.js");
|
|
7
8
|
function createTokenRefresher(authorize, config) {
|
|
8
9
|
let credentials;
|
|
9
|
-
|
|
10
|
+
let inFlight;
|
|
11
|
+
return async () => {
|
|
12
|
+
if (!isExpired(credentials)) {
|
|
13
|
+
return credentials.accessToken;
|
|
14
|
+
}
|
|
15
|
+
if (inFlight) {
|
|
16
|
+
return inFlight;
|
|
17
|
+
}
|
|
10
18
|
if (isExpired(credentials)) {
|
|
11
19
|
const isRefreshTokenValid = credentials?.refreshToken && !isRefreshExpired(credentials);
|
|
12
20
|
const options = isRefreshTokenValid
|
|
13
|
-
? {
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
? {
|
|
22
|
+
grant_type: "refresh_token",
|
|
23
|
+
refresh_token: credentials.refreshToken,
|
|
24
|
+
}
|
|
25
|
+
: { grant_type: "client_credentials" };
|
|
26
|
+
inFlight = authorize(config, options)
|
|
16
27
|
.then((tokenData) => {
|
|
17
|
-
const { access_token, expires_in, refresh_token, refresh_token_expired_in } = tokenData;
|
|
28
|
+
const { access_token, expires_in, refresh_token, refresh_token_expired_in, } = tokenData;
|
|
29
|
+
(0, security_js_1.validateAccessToken)(access_token, "access_token");
|
|
30
|
+
if (!Number.isFinite(expires_in)) {
|
|
31
|
+
throw new TypeError("expires_in must be a finite number");
|
|
32
|
+
}
|
|
18
33
|
const expires = Date.now() + expires_in * 1000 - 60000;
|
|
19
34
|
let refreshExpires;
|
|
20
35
|
if (refresh_token_expired_in) {
|
|
21
|
-
refreshExpires =
|
|
36
|
+
refreshExpires =
|
|
37
|
+
Date.now() + refresh_token_expired_in * 1000 - 60000;
|
|
22
38
|
}
|
|
23
39
|
return {
|
|
24
40
|
accessToken: access_token,
|
|
@@ -30,9 +46,13 @@ function createTokenRefresher(authorize, config) {
|
|
|
30
46
|
.then((freshCredentials) => {
|
|
31
47
|
credentials = freshCredentials;
|
|
32
48
|
return credentials.accessToken;
|
|
49
|
+
})
|
|
50
|
+
.finally(() => {
|
|
51
|
+
inFlight = undefined;
|
|
33
52
|
});
|
|
53
|
+
return inFlight;
|
|
34
54
|
}
|
|
35
|
-
return
|
|
55
|
+
return credentials.accessToken;
|
|
36
56
|
};
|
|
37
57
|
}
|
|
38
58
|
function isRefreshExpired(credentials) {
|
|
@@ -41,7 +61,7 @@ function isRefreshExpired(credentials) {
|
|
|
41
61
|
}
|
|
42
62
|
return Date.now() > credentials.refreshExpires;
|
|
43
63
|
}
|
|
44
|
-
const authorizeCollections = function (config, options, client = (0,
|
|
64
|
+
const authorizeCollections = function (config, options, client = (0, client_js_1.createClient)(config)) {
|
|
45
65
|
const basicAuthToken = createBasicAuthToken(config);
|
|
46
66
|
return client
|
|
47
67
|
.post("/collection/token/", null, {
|
|
@@ -52,7 +72,7 @@ const authorizeCollections = function (config, options, client = (0, client_1.cr
|
|
|
52
72
|
.then((response) => response.data);
|
|
53
73
|
};
|
|
54
74
|
exports.authorizeCollections = authorizeCollections;
|
|
55
|
-
const authorizeDisbursements = function (config, options, client = (0,
|
|
75
|
+
const authorizeDisbursements = function (config, options, client = (0, client_js_1.createClient)(config)) {
|
|
56
76
|
const basicAuthToken = createBasicAuthToken(config);
|
|
57
77
|
return client
|
|
58
78
|
.post("/disbursement/token/", null, {
|
|
@@ -63,7 +83,7 @@ const authorizeDisbursements = function (config, options, client = (0, client_1.
|
|
|
63
83
|
.then((response) => response.data);
|
|
64
84
|
};
|
|
65
85
|
exports.authorizeDisbursements = authorizeDisbursements;
|
|
66
|
-
const authorizeRemittance = function (config, options, client = (0,
|
|
86
|
+
const authorizeRemittance = function (config, options, client = (0, client_js_1.createClient)(config)) {
|
|
67
87
|
const basicAuthToken = createBasicAuthToken(config);
|
|
68
88
|
return client
|
|
69
89
|
.post("/remittance/token/", null, {
|
package/lib/cjs/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;AA2BA,oDAiEC;AAsDD,oDAIC;AApJD,2CAA2C;AAG3C,+CAAoD;AAsBpD,SAAgB,oBAAoB,CAClC,SAAqB,EACrB,MAAc;IAEd,IAAI,WAA6B,CAAC;IAClC,IAAI,QAAqC,CAAC;IAE1C,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5B,OAAO,WAAW,CAAC,WAAW,CAAC;QACjC,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,IAAI,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3B,MAAM,mB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EzC,MAAM,cAAc,GAAW,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC5D,OAAO,MAAM;SACV,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE;QAChC,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,cAAc,EAAE;SACzC;KACF,CAAC;SACD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC;AAbW,QAAA,mBAAmB,uBAa9B;AAEF,SAAgB,oBAAoB,CAAC,MAAkB;IACrD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAClE,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,WAA6B;IAC9C,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;AAC1C,CAAC"}
|
package/lib/cjs/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
const commander_1 = require("commander");
|
|
38
|
-
const momo = __importStar(require("./index"));
|
|
38
|
+
const momo = __importStar(require("./index.js"));
|
|
39
39
|
const version = process.env.npm_package_version || "0.0.0";
|
|
40
40
|
commander_1.program
|
|
41
41
|
.version(version)
|
|
@@ -61,6 +61,9 @@ users
|
|
|
61
61
|
});
|
|
62
62
|
})
|
|
63
63
|
.catch((error) => {
|
|
64
|
-
|
|
64
|
+
const name = error instanceof Error ? error.name : "Error";
|
|
65
|
+
const message = error instanceof Error ? error.message : "Request failed";
|
|
66
|
+
console.error(`${name}: ${message}`);
|
|
67
|
+
process.exitCode = 1;
|
|
65
68
|
});
|
|
66
69
|
//# sourceMappingURL=cli.js.map
|
package/lib/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AAEpC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AAEpC,iDAAmC;AAGnC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,OAAO,CAAC;AAE3D,mBAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAC7C,MAAM,CAAC,uBAAuB,EAAE,aAAa,CAAC;KAC9C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,OAAO,GAAG,mBAAO,CAAC,IAAI,EAA0C,CAAC;AAEvE,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACzC,mBAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,GAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAEzE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAE9D,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAExD,KAAK;KACF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;KACpB,IAAI,CAAC,CAAC,MAAc,EAAE,EAAE;IACvB,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,WAAwB,EAAE,EAAE;QAC3D,OAAO,CAAC,GAAG,CACT,0BAA0B,EAC1B,SAAS,CAAC;YACR,UAAU,EAAE,WAAW,CAAC,MAAM;YAC9B,MAAM;SACP,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3D,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC1E,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IACrC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
package/lib/cjs/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HttpClient } from "./httpClient";
|
|
2
|
-
import type { TokenRefresher } from "./auth";
|
|
3
|
-
import type
|
|
1
|
+
import { HttpClient } from "./httpClient.js";
|
|
2
|
+
import type { TokenRefresher } from "./auth.js";
|
|
3
|
+
import { type GlobalConfig, type SubscriptionConfig } from "./common.js";
|
|
4
4
|
export declare function createClient(config: SubscriptionConfig & GlobalConfig, client?: HttpClient): HttpClient;
|
|
5
5
|
export declare function createAuthClient(refresh: TokenRefresher, client: HttpClient): HttpClient;
|
|
6
6
|
export declare function withErrorHandling(client: HttpClient): HttpClient;
|
package/lib/cjs/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAC;AAK/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,GAAG,YAAY,EACzC,MAAM,GAAE,UAA+B,GACtC,UAAU,CAgBZ;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,UAAU,GACjB,UAAU,CAiBZ;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAYhE"}
|
package/lib/cjs/client.js
CHANGED
|
@@ -3,12 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createClient = createClient;
|
|
4
4
|
exports.createAuthClient = createAuthClient;
|
|
5
5
|
exports.withErrorHandling = withErrorHandling;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
const httpClient_js_1 = require("./httpClient.js");
|
|
7
|
+
const errors_js_1 = require("./errors.js");
|
|
8
|
+
const common_js_1 = require("./common.js");
|
|
9
|
+
const security_js_1 = require("./security.js");
|
|
10
|
+
function createClient(config, client = (0, httpClient_js_1.createHttpClient)()) {
|
|
9
11
|
if (config.baseUrl) {
|
|
10
|
-
client.defaults.baseURL = config.baseUrl;
|
|
12
|
+
client.defaults.baseURL = (0, security_js_1.normalizeBaseUrl)(config.baseUrl, config.environment ?? common_js_1.Environment.SANDBOX);
|
|
11
13
|
}
|
|
14
|
+
client.defaults.timeout = config.timeoutMs ?? security_js_1.DEFAULT_TIMEOUT_MS;
|
|
15
|
+
client.defaults.maxResponseBytes =
|
|
16
|
+
config.maxResponseBytes ?? security_js_1.DEFAULT_MAX_RESPONSE_BYTES;
|
|
12
17
|
client.defaults.headers.common["Ocp-Apim-Subscription-Key"] =
|
|
13
18
|
config.primaryKey;
|
|
14
19
|
client.defaults.headers.common["X-Target-Environment"] =
|
|
@@ -17,15 +22,18 @@ function createClient(config, client = (0, httpClient_1.createHttpClient)()) {
|
|
|
17
22
|
}
|
|
18
23
|
function createAuthClient(refresh, client) {
|
|
19
24
|
client.interceptors.request.use(async (request) => {
|
|
20
|
-
const accessToken = await refresh();
|
|
21
25
|
request.headers = request.headers || {};
|
|
22
|
-
request.headers
|
|
26
|
+
const hasExplicitAuthorization = Object.keys(request.headers).some((name) => name.toLowerCase() === "authorization");
|
|
27
|
+
if (!hasExplicitAuthorization) {
|
|
28
|
+
const accessToken = await refresh();
|
|
29
|
+
request.headers["Authorization"] = `Bearer ${accessToken}`;
|
|
30
|
+
}
|
|
23
31
|
return request;
|
|
24
32
|
});
|
|
25
33
|
return client;
|
|
26
34
|
}
|
|
27
35
|
function withErrorHandling(client) {
|
|
28
|
-
client.interceptors.response.use((response) => response, (error) => Promise.reject((0,
|
|
36
|
+
client.interceptors.response.use((response) => response, (error) => Promise.reject((0, errors_js_1.handleError)(error instanceof Error ? error : new Error(String(error)))));
|
|
29
37
|
return client;
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=client.js.map
|
package/lib/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;AAiBA,oCAmBC;AAED,4CAoBC;AAED,8CAYC;AAxED,mDAA+D;AAG/D,2CAA0C;AAG1C,2CAIqB;AACrB,+CAIuB;AAEvB,SAAgB,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;QAED,OAAO,OAAO,CAAC;IACjB,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,iBAAiB,CAAC,MAAkB;IAClD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAC9B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAK,EAAE,EAAE,CACR,OAAO,CAAC,MAAM,CACZ,IAAA,uBAAW,EACT,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC1D,CACF,CACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/lib/cjs/collections.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { HttpClient } from "./httpClient";
|
|
2
|
-
import { type Balance, type BasicUserInfo, type BcAuthorizeRequest, type BcAuthorizeResponse, type Config, type ConsentKycResponse, type DeliveryNotification, FailureReason, type OAuth2TokenRequest, type OAuth2TokenResponse, type Party, PartyIdType, TransactionStatus, type Withdrawal, type WithdrawalRequest } from "./common";
|
|
3
|
-
|
|
1
|
+
import type { HttpClient } from "./httpClient.js";
|
|
2
|
+
import { type Balance, type BasicUserInfo, type BcAuthorizeRequest, type BcAuthorizeResponse, type Config, type ConsentKycResponse, type DeliveryNotification, FailureReason, type OAuth2TokenRequest, type OAuth2TokenResponse, type Party, PartyIdType, TransactionStatus, type Withdrawal, type WithdrawalRequest } from "./common.js";
|
|
3
|
+
import { type FinancialOperationOptions } from "./security.js";
|
|
4
|
+
export interface PaymentRequest extends FinancialOperationOptions {
|
|
4
5
|
/**
|
|
5
6
|
* Amount that will be debited from the payer account
|
|
6
7
|
*/
|
|
@@ -90,7 +91,7 @@ export default class Collections {
|
|
|
90
91
|
*
|
|
91
92
|
* @param paymentRequest
|
|
92
93
|
*/
|
|
93
|
-
requestToPay(
|
|
94
|
+
requestToPay(request: PaymentRequest): Promise<string>;
|
|
94
95
|
/**
|
|
95
96
|
* This method is used to retrieve transaction information. You can invoke it
|
|
96
97
|
* at intervals until your transaction fails or succeeds.
|
|
@@ -178,7 +179,7 @@ export default class Collections {
|
|
|
178
179
|
*
|
|
179
180
|
* @returns A promise that resolves to the user's information and KYC consent details
|
|
180
181
|
*/
|
|
181
|
-
getUserInfoWithConsent(): Promise<ConsentKycResponse>;
|
|
182
|
+
getUserInfoWithConsent(consentToken: string): Promise<ConsentKycResponse>;
|
|
182
183
|
/**
|
|
183
184
|
* Create an OAuth2 token for consent-based access.
|
|
184
185
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AASlD,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAOL,KAAK,yBAAyB,EAC/B,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAe,SAAQ,yBAAyB;IAC/D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,KAA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