@maxkabechani/mtn-momo-sdk 0.1.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/LICENSE +21 -0
- package/README.md +187 -0
- package/lib/cjs/auth.d.ts +17 -0
- package/lib/cjs/auth.d.ts.map +1 -0
- package/lib/cjs/auth.js +86 -0
- package/lib/cjs/auth.js.map +1 -0
- package/lib/cjs/cli.d.ts +3 -0
- package/lib/cjs/cli.d.ts.map +1 -0
- package/lib/cjs/cli.js +66 -0
- package/lib/cjs/cli.js.map +1 -0
- package/lib/cjs/client.d.ts +7 -0
- package/lib/cjs/client.d.ts.map +1 -0
- package/lib/cjs/client.js +67 -0
- package/lib/cjs/client.js.map +1 -0
- package/lib/cjs/collections.d.ts +176 -0
- package/lib/cjs/collections.d.ts.map +1 -0
- package/lib/cjs/collections.js +219 -0
- package/lib/cjs/collections.js.map +1 -0
- package/lib/cjs/common.d.ts +299 -0
- package/lib/cjs/common.d.ts.map +1 -0
- package/lib/cjs/common.js +41 -0
- package/lib/cjs/common.js.map +1 -0
- package/lib/cjs/disbursements.d.ts +190 -0
- package/lib/cjs/disbursements.d.ts.map +1 -0
- package/lib/cjs/disbursements.js +268 -0
- package/lib/cjs/disbursements.js.map +1 -0
- package/lib/cjs/errors.d.ts +67 -0
- package/lib/cjs/errors.d.ts.map +1 -0
- package/lib/cjs/errors.js +207 -0
- package/lib/cjs/errors.js.map +1 -0
- package/lib/cjs/index.d.ts +24 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/index.js +87 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/remittance.d.ts +59 -0
- package/lib/cjs/remittance.d.ts.map +1 -0
- package/lib/cjs/remittance.js +145 -0
- package/lib/cjs/remittance.js.map +1 -0
- package/lib/cjs/users.d.ts +22 -0
- package/lib/cjs/users.d.ts.map +1 -0
- package/lib/cjs/users.js +42 -0
- package/lib/cjs/users.js.map +1 -0
- package/lib/cjs/validate.d.ts +14 -0
- package/lib/cjs/validate.d.ts.map +1 -0
- package/lib/cjs/validate.js +111 -0
- package/lib/cjs/validate.js.map +1 -0
- package/lib/esm/auth.d.ts +17 -0
- package/lib/esm/auth.d.ts.map +1 -0
- package/lib/esm/auth.js +78 -0
- package/lib/esm/auth.js.map +1 -0
- package/lib/esm/cli.d.ts +3 -0
- package/lib/esm/cli.d.ts.map +1 -0
- package/lib/esm/cli.js +31 -0
- package/lib/esm/cli.js.map +1 -0
- package/lib/esm/client.d.ts +7 -0
- package/lib/esm/client.d.ts.map +1 -0
- package/lib/esm/client.js +29 -0
- package/lib/esm/client.js.map +1 -0
- package/lib/esm/collections.d.ts +176 -0
- package/lib/esm/collections.d.ts.map +1 -0
- package/lib/esm/collections.js +216 -0
- package/lib/esm/collections.js.map +1 -0
- package/lib/esm/common.d.ts +299 -0
- package/lib/esm/common.d.ts.map +1 -0
- package/lib/esm/common.js +38 -0
- package/lib/esm/common.js.map +1 -0
- package/lib/esm/disbursements.d.ts +190 -0
- package/lib/esm/disbursements.d.ts.map +1 -0
- package/lib/esm/disbursements.js +265 -0
- package/lib/esm/disbursements.js.map +1 -0
- package/lib/esm/errors.d.ts +67 -0
- package/lib/esm/errors.d.ts.map +1 -0
- package/lib/esm/errors.js +182 -0
- package/lib/esm/errors.js.map +1 -0
- package/lib/esm/index.d.ts +24 -0
- package/lib/esm/index.d.ts.map +1 -0
- package/lib/esm/index.js +63 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/package.json +1 -0
- package/lib/esm/remittance.d.ts +59 -0
- package/lib/esm/remittance.d.ts.map +1 -0
- package/lib/esm/remittance.js +142 -0
- package/lib/esm/remittance.js.map +1 -0
- package/lib/esm/users.d.ts +22 -0
- package/lib/esm/users.d.ts.map +1 -0
- package/lib/esm/users.js +39 -0
- package/lib/esm/users.js.map +1 -0
- package/lib/esm/validate.d.ts +14 -0
- package/lib/esm/validate.d.ts.map +1 -0
- package/lib/esm/validate.js +100 -0
- package/lib/esm/validate.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { v4 as uuid } from "uuid";
|
|
2
|
+
import { getTransactionError } from "./errors";
|
|
3
|
+
import { validateRequestToPay, validateWithdrawalRequest } from "./validate";
|
|
4
|
+
import { FailureReason, PartyIdType, TransactionStatus, } from "./common";
|
|
5
|
+
export default class Collections {
|
|
6
|
+
constructor(client, config) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This method is used to request a payment from a consumer (Payer).
|
|
12
|
+
* The payer will be asked to authorize the payment. The transaction will
|
|
13
|
+
* be executed once the payer has authorized the payment.
|
|
14
|
+
* The requesttopay will be in status PENDING until the transaction
|
|
15
|
+
* is authorized or declined by the payer or it is timed out by the system.
|
|
16
|
+
* Status of the transaction can be validated by using `getTransation`
|
|
17
|
+
*
|
|
18
|
+
* @param paymentRequest
|
|
19
|
+
*/
|
|
20
|
+
requestToPay({ callbackUrl, ...paymentRequest }) {
|
|
21
|
+
return validateRequestToPay(paymentRequest).then(() => {
|
|
22
|
+
const referenceId = uuid();
|
|
23
|
+
return this.client
|
|
24
|
+
.post("/collection/v1_0/requesttopay", paymentRequest, {
|
|
25
|
+
headers: {
|
|
26
|
+
"X-Reference-Id": referenceId,
|
|
27
|
+
...(callbackUrl ? { "X-Callback-Url": callbackUrl } : {}),
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
.then(() => referenceId);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This method is used to retrieve transaction information. You can invoke it
|
|
35
|
+
* at intervals until your transaction fails or succeeds.
|
|
36
|
+
*
|
|
37
|
+
* If the transaction has failed, it will throw an appropriate error. The error will be a subclass
|
|
38
|
+
* of `MtnMoMoError`. Check [`src/error.ts`](https://github.com/maxkabechani/mtn-momo-sdk/blob/master/src/errors.ts)
|
|
39
|
+
* for the various errors that can be thrown
|
|
40
|
+
*
|
|
41
|
+
* @param referenceId the value returned from `requestToPay`
|
|
42
|
+
*/
|
|
43
|
+
getTransaction(referenceId) {
|
|
44
|
+
return this.client
|
|
45
|
+
.get(`/collection/v1_0/requesttopay/${referenceId}`)
|
|
46
|
+
.then((response) => response.data)
|
|
47
|
+
.then((transaction) => {
|
|
48
|
+
if (transaction.status === TransactionStatus.FAILED) {
|
|
49
|
+
return Promise.reject(getTransactionError(transaction));
|
|
50
|
+
}
|
|
51
|
+
return Promise.resolve(transaction);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get the balance of the account.
|
|
56
|
+
*/
|
|
57
|
+
getBalance() {
|
|
58
|
+
return this.client
|
|
59
|
+
.get("/collection/v1_0/account/balance")
|
|
60
|
+
.then((response) => response.data);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* This method is used to check if an account holder is registered and active in the system.
|
|
64
|
+
*
|
|
65
|
+
* @param id Specifies the type of the party ID. Allowed values [msisdn, email, party_code].
|
|
66
|
+
* accountHolderId should explicitly be in small letters.
|
|
67
|
+
*
|
|
68
|
+
* @param type The party number. Validated according to the party ID type (case Sensitive).
|
|
69
|
+
* msisdn - Mobile Number validated according to ITU-T E.164. Validated with IsMSISDN
|
|
70
|
+
* email - Validated to be a valid e-mail format. Validated with IsEmail
|
|
71
|
+
* party_code - UUID of the party. Validated with IsUuid
|
|
72
|
+
*/
|
|
73
|
+
isPayerActive(id, type = PartyIdType.MSISDN) {
|
|
74
|
+
// OpenAPI says msisdn/email should be lowercase for some endpoints
|
|
75
|
+
return this.client
|
|
76
|
+
.get(`/collection/v1_0/accountholder/${type}/${id}/active`)
|
|
77
|
+
.then((response) => response.data)
|
|
78
|
+
.then((data) => (data.result !== undefined ? data.result : false));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* This method is used to request a withdrawal from a payer account (V1).
|
|
82
|
+
* The payer will be asked to authorize the withdrawal.
|
|
83
|
+
*
|
|
84
|
+
* @param withdrawalRequest The withdrawal request details
|
|
85
|
+
* @returns A promise that resolves to the withdrawal reference ID
|
|
86
|
+
*/
|
|
87
|
+
requestToWithdraw(withdrawalRequest) {
|
|
88
|
+
const referenceId = uuid();
|
|
89
|
+
return validateWithdrawalRequest(withdrawalRequest).then(() => {
|
|
90
|
+
return this.client
|
|
91
|
+
.post("/collection/v1_0/requesttowithdraw", {
|
|
92
|
+
amount: withdrawalRequest.amount,
|
|
93
|
+
currency: withdrawalRequest.currency,
|
|
94
|
+
externalId: withdrawalRequest.externalId,
|
|
95
|
+
payee: withdrawalRequest.payee,
|
|
96
|
+
payerMessage: withdrawalRequest.payerMessage,
|
|
97
|
+
payeeNote: withdrawalRequest.payeeNote,
|
|
98
|
+
}, {
|
|
99
|
+
headers: {
|
|
100
|
+
"X-Reference-Id": referenceId,
|
|
101
|
+
...(withdrawalRequest.callbackUrl
|
|
102
|
+
? { "X-Callback-Url": withdrawalRequest.callbackUrl }
|
|
103
|
+
: {}),
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
.then(() => referenceId);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* This method is used to request a withdrawal from a payer account (V2).
|
|
111
|
+
* The payer will be asked to authorize the withdrawal.
|
|
112
|
+
*
|
|
113
|
+
* @param withdrawalRequest The withdrawal request details
|
|
114
|
+
* @returns A promise that resolves to the withdrawal reference ID
|
|
115
|
+
*/
|
|
116
|
+
requestToWithdrawV2(withdrawalRequest) {
|
|
117
|
+
const referenceId = uuid();
|
|
118
|
+
return validateWithdrawalRequest(withdrawalRequest).then(() => {
|
|
119
|
+
return this.client
|
|
120
|
+
.post("/collection/v2_0/requesttowithdraw", {
|
|
121
|
+
amount: withdrawalRequest.amount,
|
|
122
|
+
currency: withdrawalRequest.currency,
|
|
123
|
+
externalId: withdrawalRequest.externalId,
|
|
124
|
+
payee: withdrawalRequest.payee,
|
|
125
|
+
payerMessage: withdrawalRequest.payerMessage,
|
|
126
|
+
payeeNote: withdrawalRequest.payeeNote,
|
|
127
|
+
}, {
|
|
128
|
+
headers: {
|
|
129
|
+
"X-Reference-Id": referenceId,
|
|
130
|
+
...(withdrawalRequest.callbackUrl
|
|
131
|
+
? { "X-Callback-Url": withdrawalRequest.callbackUrl }
|
|
132
|
+
: {}),
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
.then(() => referenceId);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get the details and status of a withdrawal request.
|
|
140
|
+
*
|
|
141
|
+
* @param referenceId The withdrawal reference ID from requestToWithdraw
|
|
142
|
+
* @returns A promise that resolves to the withdrawal details
|
|
143
|
+
*/
|
|
144
|
+
getWithdrawal(referenceId) {
|
|
145
|
+
return this.client
|
|
146
|
+
.get(`/collection/v1_0/requesttowithdraw/${referenceId}`)
|
|
147
|
+
.then((response) => response.data)
|
|
148
|
+
.then((withdrawal) => {
|
|
149
|
+
if (withdrawal.status === TransactionStatus.FAILED) {
|
|
150
|
+
return Promise.reject(getTransactionError(withdrawal));
|
|
151
|
+
}
|
|
152
|
+
return Promise.resolve(withdrawal);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Send a delivery notification for a completed request to pay.
|
|
157
|
+
*
|
|
158
|
+
* @param referenceId The request to pay reference ID
|
|
159
|
+
* @param notification The delivery notification details
|
|
160
|
+
* @returns A promise that resolves when the notification is sent
|
|
161
|
+
*/
|
|
162
|
+
sendDeliveryNotification(referenceId, notification) {
|
|
163
|
+
return this.client
|
|
164
|
+
.post(`/collection/v1_0/requesttopay/${referenceId}/deliverynotification`, {
|
|
165
|
+
notificationMessage: notification.notificationMessage,
|
|
166
|
+
})
|
|
167
|
+
.then(() => undefined);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get basic user information for an account holder.
|
|
171
|
+
*
|
|
172
|
+
* @param partyIdType The type of party ID (MSISDN, EMAIL, or PARTY_CODE)
|
|
173
|
+
* @param partyId The party identifier
|
|
174
|
+
* @returns A promise that resolves to the basic user information
|
|
175
|
+
*/
|
|
176
|
+
getBasicUserInfo(partyIdType, partyId) {
|
|
177
|
+
return this.client
|
|
178
|
+
.get(`/collection/v1_0/accountholder/${partyIdType}/${partyId}/basicuserinfo`)
|
|
179
|
+
.then((response) => response.data);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get the balance of the account in a specific currency.
|
|
183
|
+
*
|
|
184
|
+
* @param currency The ISO4217 currency code
|
|
185
|
+
* @returns A promise that resolves to the account balance in the specified currency
|
|
186
|
+
*/
|
|
187
|
+
getBalanceInCurrency(currency) {
|
|
188
|
+
return this.client
|
|
189
|
+
.get(`/collection/v1_0/account/balance/${currency}`)
|
|
190
|
+
.then((response) => response.data);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Request Biometric Consent (BC) authorization.
|
|
194
|
+
* This initiates the BC authorization flow for enhanced security.
|
|
195
|
+
*
|
|
196
|
+
* @param request The BC authorization request
|
|
197
|
+
* @returns A promise that resolves to the BC authorization response with auth_req_id
|
|
198
|
+
*/
|
|
199
|
+
bcAuthorize(request) {
|
|
200
|
+
const params = new URLSearchParams();
|
|
201
|
+
params.append("login_hint", request.login_hint);
|
|
202
|
+
params.append("scope", request.scope);
|
|
203
|
+
params.append("access_type", request.access_type);
|
|
204
|
+
if (request.consent_valid_in) {
|
|
205
|
+
params.append("consent_valid_in", String(request.consent_valid_in));
|
|
206
|
+
}
|
|
207
|
+
return this.client
|
|
208
|
+
.post("/collection/v1_0/bc-authorize", params, {
|
|
209
|
+
headers: {
|
|
210
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
211
|
+
},
|
|
212
|
+
})
|
|
213
|
+
.then((response) => response.data);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|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,UAAU,CAAC,CAAC;QAChD,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACtE,CAAC;QAED,OAAO,IAAI,CAAC,MAAM;aACf,IAAI,CAAsB,+BAA+B,EAAE,MAAM,EAAE;YAClE,OAAO,EAAE;gBACP,cAAc,EAAE,mCAAmC;aACpD;SACF,CAAC;aACD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
export type Config = GlobalConfig & ProductConfig;
|
|
2
|
+
export type ProductConfig = SubscriptionConfig & UserConfig;
|
|
3
|
+
export interface GlobalConfig {
|
|
4
|
+
/**
|
|
5
|
+
* The provider callback host
|
|
6
|
+
*/
|
|
7
|
+
callbackHost?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The base URL of the EWP system where the transaction shall be processed.
|
|
10
|
+
* This parameter is used to route the request to the EWP system that will
|
|
11
|
+
* initiate the transaction.
|
|
12
|
+
*/
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The identifier of the EWP system where the transaction shall be processed.
|
|
16
|
+
* This parameter is used to route the request to the EWP system that will
|
|
17
|
+
* initiate the transaction.
|
|
18
|
+
*/
|
|
19
|
+
environment?: Environment;
|
|
20
|
+
}
|
|
21
|
+
export interface SubscriptionConfig {
|
|
22
|
+
/**
|
|
23
|
+
* Subscription key which provides access to this API. Found in your Profile
|
|
24
|
+
*/
|
|
25
|
+
primaryKey: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UserConfig {
|
|
28
|
+
/**
|
|
29
|
+
* The API user's key
|
|
30
|
+
*/
|
|
31
|
+
userSecret: string;
|
|
32
|
+
/**
|
|
33
|
+
* Recource ID for the API user
|
|
34
|
+
*/
|
|
35
|
+
userId: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Credentials {
|
|
38
|
+
apiKey: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ApiUserInfo {
|
|
41
|
+
providerCallbackHost?: string;
|
|
42
|
+
paymentServerUrl?: {
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
};
|
|
45
|
+
targetEnvironment?: {
|
|
46
|
+
apiKey?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface AccessToken {
|
|
50
|
+
/**
|
|
51
|
+
* A JWT token which can be used to authrize against the other API end-points.
|
|
52
|
+
* The format of the token follows the JWT standard format (see jwt.io for an example).
|
|
53
|
+
* This is the token that should be sent in in the Authorization header when calling the other API end-points.
|
|
54
|
+
*/
|
|
55
|
+
access_token: string;
|
|
56
|
+
/**
|
|
57
|
+
* The token type.
|
|
58
|
+
*
|
|
59
|
+
* TODO: Find list of complete token types
|
|
60
|
+
*/
|
|
61
|
+
token_type: string;
|
|
62
|
+
/**
|
|
63
|
+
* The validity time in seconds of the token
|
|
64
|
+
*/
|
|
65
|
+
expires_in: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The available balance of the account
|
|
69
|
+
*/
|
|
70
|
+
export interface Balance {
|
|
71
|
+
/**
|
|
72
|
+
* The available balance of the account
|
|
73
|
+
*/
|
|
74
|
+
availableBalance: string;
|
|
75
|
+
/**
|
|
76
|
+
* ISO4217 Currency
|
|
77
|
+
*/
|
|
78
|
+
currency: string;
|
|
79
|
+
}
|
|
80
|
+
export interface Party {
|
|
81
|
+
partyIdType: PartyIdType;
|
|
82
|
+
partyId: string;
|
|
83
|
+
}
|
|
84
|
+
export declare enum PartyIdType {
|
|
85
|
+
MSISDN = "MSISDN",
|
|
86
|
+
EMAIL = "EMAIL",
|
|
87
|
+
PARTY_CODE = "PARTY_CODE"
|
|
88
|
+
}
|
|
89
|
+
export declare enum Environment {
|
|
90
|
+
SANDBOX = "sandbox",
|
|
91
|
+
PRODUCTION = "production"
|
|
92
|
+
}
|
|
93
|
+
export declare enum TransactionStatus {
|
|
94
|
+
SUCCESSFUL = "SUCCESSFUL",
|
|
95
|
+
PENDING = "PENDING",
|
|
96
|
+
FAILED = "FAILED"
|
|
97
|
+
}
|
|
98
|
+
export declare enum FailureReason {
|
|
99
|
+
PAYEE_NOT_FOUND = "PAYEE_NOT_FOUND",
|
|
100
|
+
PAYER_NOT_FOUND = "PAYER_NOT_FOUND",
|
|
101
|
+
NOT_ALLOWED = "NOT_ALLOWED",
|
|
102
|
+
NOT_ALLOWED_TARGET_ENVIRONMENT = "NOT_ALLOWED_TARGET_ENVIRONMENT",
|
|
103
|
+
INVALID_CALLBACK_URL_HOST = "INVALID_CALLBACK_URL_HOST",
|
|
104
|
+
INVALID_CURRENCY = "INVALID_CURRENCY",
|
|
105
|
+
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
106
|
+
INTERNAL_PROCESSING_ERROR = "INTERNAL_PROCESSING_ERROR",
|
|
107
|
+
NOT_ENOUGH_FUNDS = "NOT_ENOUGH_FUNDS",
|
|
108
|
+
PAYER_LIMIT_REACHED = "PAYER_LIMIT_REACHED",
|
|
109
|
+
PAYEE_NOT_ALLOWED_TO_RECEIVE = "PAYEE_NOT_ALLOWED_TO_RECEIVE",
|
|
110
|
+
PAYMENT_NOT_APPROVED = "PAYMENT_NOT_APPROVED",
|
|
111
|
+
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
|
|
112
|
+
APPROVAL_REJECTED = "APPROVAL_REJECTED",
|
|
113
|
+
EXPIRED = "EXPIRED",
|
|
114
|
+
TRANSACTION_CANCELED = "TRANSACTION_CANCELED",
|
|
115
|
+
RESOURCE_ALREADY_EXIST = "RESOURCE_ALREADY_EXIST"
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Basic user information response
|
|
119
|
+
*/
|
|
120
|
+
export interface BasicUserInfo {
|
|
121
|
+
given_name?: string;
|
|
122
|
+
family_name?: string;
|
|
123
|
+
birthdate?: string;
|
|
124
|
+
locale?: string;
|
|
125
|
+
gender?: string;
|
|
126
|
+
status?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Biometric Consent (BC) authorization response
|
|
130
|
+
*/
|
|
131
|
+
export interface BcAuthorizeResponse {
|
|
132
|
+
auth_req_id: string;
|
|
133
|
+
interval: number;
|
|
134
|
+
expires_in: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* OAuth2 token response
|
|
138
|
+
*/
|
|
139
|
+
export interface OAuth2TokenResponse {
|
|
140
|
+
access_token: string;
|
|
141
|
+
token_type: string;
|
|
142
|
+
expires_in: number;
|
|
143
|
+
scope?: string;
|
|
144
|
+
refresh_token?: string;
|
|
145
|
+
refresh_token_expired_in?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Consent/KYC response with user information
|
|
149
|
+
*/
|
|
150
|
+
export interface ConsentKycResponse {
|
|
151
|
+
sub?: string;
|
|
152
|
+
name?: string;
|
|
153
|
+
given_name?: string;
|
|
154
|
+
family_name?: string;
|
|
155
|
+
middle_name?: string;
|
|
156
|
+
email?: string;
|
|
157
|
+
email_verified?: boolean;
|
|
158
|
+
gender?: string;
|
|
159
|
+
locale?: string;
|
|
160
|
+
phone_number?: string;
|
|
161
|
+
phone_number_verified?: boolean;
|
|
162
|
+
address?: string;
|
|
163
|
+
updated_at?: number;
|
|
164
|
+
status?: string;
|
|
165
|
+
birthdate?: string;
|
|
166
|
+
credit_score?: string;
|
|
167
|
+
active?: boolean;
|
|
168
|
+
country_of_birth?: string;
|
|
169
|
+
region_of_birth?: string;
|
|
170
|
+
city_of_birth?: string;
|
|
171
|
+
occupation?: string;
|
|
172
|
+
employer_name?: string;
|
|
173
|
+
identification_type?: string;
|
|
174
|
+
identification_value?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Request to withdraw (Collections)
|
|
178
|
+
*/
|
|
179
|
+
export interface WithdrawalRequest {
|
|
180
|
+
amount: string;
|
|
181
|
+
currency: string;
|
|
182
|
+
externalId?: string;
|
|
183
|
+
payee: Party;
|
|
184
|
+
payerMessage?: string;
|
|
185
|
+
payeeNote?: string;
|
|
186
|
+
callbackUrl?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Withdrawal result (Collections)
|
|
190
|
+
*/
|
|
191
|
+
export interface Withdrawal {
|
|
192
|
+
amount: string;
|
|
193
|
+
currency: string;
|
|
194
|
+
financialTransactionId: string;
|
|
195
|
+
externalId: string;
|
|
196
|
+
payee: Party;
|
|
197
|
+
payerMessage?: string;
|
|
198
|
+
payeeNote?: string;
|
|
199
|
+
status: TransactionStatus;
|
|
200
|
+
reason?: FailureReason;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Delivery notification request
|
|
204
|
+
*/
|
|
205
|
+
export interface DeliveryNotification {
|
|
206
|
+
notificationMessage: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Biometric Consent (BC) authorization request
|
|
210
|
+
*/
|
|
211
|
+
export interface BcAuthorizeRequest {
|
|
212
|
+
login_hint: string;
|
|
213
|
+
scope: string;
|
|
214
|
+
access_type: "online" | "offline";
|
|
215
|
+
consent_valid_in?: number;
|
|
216
|
+
client_notification_token?: string;
|
|
217
|
+
scope_instruction?: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Deposit request (Disbursements v1_0)
|
|
221
|
+
*/
|
|
222
|
+
export interface DepositRequest {
|
|
223
|
+
amount: string;
|
|
224
|
+
currency: string;
|
|
225
|
+
externalId?: string;
|
|
226
|
+
payee: Party;
|
|
227
|
+
payerMessage?: string;
|
|
228
|
+
payeeNote?: string;
|
|
229
|
+
callbackUrl?: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Deposit result (Disbursements v1_0)
|
|
233
|
+
*/
|
|
234
|
+
export interface Deposit {
|
|
235
|
+
amount: string;
|
|
236
|
+
currency: string;
|
|
237
|
+
financialTransactionId: string;
|
|
238
|
+
externalId: string;
|
|
239
|
+
payee: Party;
|
|
240
|
+
payerMessage?: string;
|
|
241
|
+
payeeNote?: string;
|
|
242
|
+
status: TransactionStatus;
|
|
243
|
+
reason?: FailureReason;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Refund request (Disbursements v1_0)
|
|
247
|
+
*/
|
|
248
|
+
export interface RefundRequest {
|
|
249
|
+
amount: string;
|
|
250
|
+
currency: string;
|
|
251
|
+
externalId?: string;
|
|
252
|
+
payerMessage?: string;
|
|
253
|
+
payeeNote?: string;
|
|
254
|
+
referenceIdToRefund: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Refund result (Disbursements v1_0)
|
|
258
|
+
*/
|
|
259
|
+
export interface Refund {
|
|
260
|
+
amount: string;
|
|
261
|
+
currency: string;
|
|
262
|
+
financialTransactionId: string;
|
|
263
|
+
externalId: string;
|
|
264
|
+
payee: Party;
|
|
265
|
+
payerMessage?: string;
|
|
266
|
+
payeeNote?: string;
|
|
267
|
+
status: TransactionStatus;
|
|
268
|
+
reason?: FailureReason;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Cash transfer request (Remittance)
|
|
272
|
+
*/
|
|
273
|
+
export interface CashTransferRequest {
|
|
274
|
+
amount: string;
|
|
275
|
+
currency: string;
|
|
276
|
+
externalId?: string;
|
|
277
|
+
payee: Party;
|
|
278
|
+
originatingCountry?: string;
|
|
279
|
+
originalAmount?: string;
|
|
280
|
+
originalCurrency?: string;
|
|
281
|
+
payerMessage?: string;
|
|
282
|
+
payeeNote?: string;
|
|
283
|
+
callbackUrl?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Cash transfer result (Remittance)
|
|
287
|
+
*/
|
|
288
|
+
export interface CashTransfer {
|
|
289
|
+
amount: string;
|
|
290
|
+
currency: string;
|
|
291
|
+
financialTransactionId: string;
|
|
292
|
+
externalId: string;
|
|
293
|
+
payee: Party;
|
|
294
|
+
payerMessage?: string;
|
|
295
|
+
payeeNote?: string;
|
|
296
|
+
status: TransactionStatus;
|
|
297
|
+
reason?: FailureReason;
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,YAAY,GAAG,aAAa,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,iBAAiB,CAAC,EAAE;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,YAAY,EA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CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export var PartyIdType;
|
|
2
|
+
(function (PartyIdType) {
|
|
3
|
+
PartyIdType["MSISDN"] = "MSISDN";
|
|
4
|
+
PartyIdType["EMAIL"] = "EMAIL";
|
|
5
|
+
PartyIdType["PARTY_CODE"] = "PARTY_CODE";
|
|
6
|
+
})(PartyIdType || (PartyIdType = {}));
|
|
7
|
+
export var Environment;
|
|
8
|
+
(function (Environment) {
|
|
9
|
+
Environment["SANDBOX"] = "sandbox";
|
|
10
|
+
Environment["PRODUCTION"] = "production";
|
|
11
|
+
})(Environment || (Environment = {}));
|
|
12
|
+
export var TransactionStatus;
|
|
13
|
+
(function (TransactionStatus) {
|
|
14
|
+
TransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";
|
|
15
|
+
TransactionStatus["PENDING"] = "PENDING";
|
|
16
|
+
TransactionStatus["FAILED"] = "FAILED";
|
|
17
|
+
})(TransactionStatus || (TransactionStatus = {}));
|
|
18
|
+
export var FailureReason;
|
|
19
|
+
(function (FailureReason) {
|
|
20
|
+
FailureReason["PAYEE_NOT_FOUND"] = "PAYEE_NOT_FOUND";
|
|
21
|
+
FailureReason["PAYER_NOT_FOUND"] = "PAYER_NOT_FOUND";
|
|
22
|
+
FailureReason["NOT_ALLOWED"] = "NOT_ALLOWED";
|
|
23
|
+
FailureReason["NOT_ALLOWED_TARGET_ENVIRONMENT"] = "NOT_ALLOWED_TARGET_ENVIRONMENT";
|
|
24
|
+
FailureReason["INVALID_CALLBACK_URL_HOST"] = "INVALID_CALLBACK_URL_HOST";
|
|
25
|
+
FailureReason["INVALID_CURRENCY"] = "INVALID_CURRENCY";
|
|
26
|
+
FailureReason["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
27
|
+
FailureReason["INTERNAL_PROCESSING_ERROR"] = "INTERNAL_PROCESSING_ERROR";
|
|
28
|
+
FailureReason["NOT_ENOUGH_FUNDS"] = "NOT_ENOUGH_FUNDS";
|
|
29
|
+
FailureReason["PAYER_LIMIT_REACHED"] = "PAYER_LIMIT_REACHED";
|
|
30
|
+
FailureReason["PAYEE_NOT_ALLOWED_TO_RECEIVE"] = "PAYEE_NOT_ALLOWED_TO_RECEIVE";
|
|
31
|
+
FailureReason["PAYMENT_NOT_APPROVED"] = "PAYMENT_NOT_APPROVED";
|
|
32
|
+
FailureReason["RESOURCE_NOT_FOUND"] = "RESOURCE_NOT_FOUND";
|
|
33
|
+
FailureReason["APPROVAL_REJECTED"] = "APPROVAL_REJECTED";
|
|
34
|
+
FailureReason["EXPIRED"] = "EXPIRED";
|
|
35
|
+
FailureReason["TRANSACTION_CANCELED"] = "TRANSACTION_CANCELED";
|
|
36
|
+
FailureReason["RESOURCE_ALREADY_EXIST"] = "RESOURCE_ALREADY_EXIST";
|
|
37
|
+
})(FailureReason || (FailureReason = {}));
|
|
38
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":"AAmGA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,wCAAyB,CAAA;AAC3B,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;AAC3B,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,8CAAyB,CAAA;IACzB,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;AACnB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED,MAAM,CAAN,IAAY,aAkBX;AAlBD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,oDAAmC,CAAA;IACnC,4CAA2B,CAAA;IAC3B,kFAAiE,CAAA;IACjE,wEAAuD,CAAA;IACvD,sDAAqC,CAAA;IACrC,4DAA2C,CAAA;IAC3C,wEAAuD,CAAA;IACvD,sDAAqC,CAAA;IACrC,4DAA2C,CAAA;IAC3C,8EAA6D,CAAA;IAC7D,8DAA6C,CAAA;IAC7C,0DAAyC,CAAA;IACzC,wDAAuC,CAAA;IACvC,oCAAmB,CAAA;IACnB,8DAA6C,CAAA;IAC7C,kEAAiD,CAAA;AACnD,CAAC,EAlBW,aAAa,KAAb,aAAa,QAkBxB"}
|