@spreeloop/orange_money 1.0.9 → 1.0.10
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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/src/disbursements/implementations/disbursement_service.d.ts +63 -0
- package/dist/src/disbursements/implementations/disbursement_service.d.ts.map +1 -0
- package/dist/src/disbursements/implementations/disbursement_service.js +84 -0
- package/dist/src/disbursements/implementations/disbursement_service.js.map +1 -0
- package/dist/src/disbursements/implementations/src/live.d.ts +40 -0
- package/dist/src/disbursements/implementations/src/live.d.ts.map +1 -0
- package/dist/src/disbursements/implementations/src/live.js +61 -0
- package/dist/src/disbursements/implementations/src/live.js.map +1 -0
- package/dist/src/disbursements/implementations/src/sandbox.d.ts +40 -0
- package/dist/src/disbursements/implementations/src/sandbox.d.ts.map +1 -0
- package/dist/src/disbursements/implementations/src/sandbox.js +110 -0
- package/dist/src/disbursements/implementations/src/sandbox.js.map +1 -0
- package/dist/src/disbursements/operations/create_access_token.d.ts +28 -0
- package/dist/src/disbursements/operations/create_access_token.d.ts.map +1 -0
- package/dist/src/disbursements/operations/create_access_token.js +45 -0
- package/dist/src/disbursements/operations/create_access_token.js.map +1 -0
- package/dist/src/disbursements/operations/create_access_token.spec.d.ts +2 -0
- package/dist/src/disbursements/operations/create_access_token.spec.d.ts.map +1 -0
- package/dist/src/disbursements/operations/create_access_token.spec.js +105 -0
- package/dist/src/disbursements/operations/create_access_token.spec.js.map +1 -0
- package/dist/src/disbursements/operations/get_transfer_status.d.ts +114 -0
- package/dist/src/disbursements/operations/get_transfer_status.d.ts.map +1 -0
- package/dist/src/disbursements/operations/get_transfer_status.js +128 -0
- package/dist/src/disbursements/operations/get_transfer_status.js.map +1 -0
- package/dist/src/disbursements/operations/get_transfer_status.spec.d.ts +2 -0
- package/dist/src/disbursements/operations/get_transfer_status.spec.d.ts.map +1 -0
- package/dist/src/disbursements/operations/get_transfer_status.spec.js +147 -0
- package/dist/src/disbursements/operations/get_transfer_status.spec.js.map +1 -0
- package/dist/src/disbursements/operations/transfer.d.ts +45 -0
- package/dist/src/disbursements/operations/transfer.d.ts.map +1 -0
- package/dist/src/disbursements/operations/transfer.js +74 -0
- package/dist/src/disbursements/operations/transfer.js.map +1 -0
- package/dist/src/disbursements/operations/transfer.spec.d.ts +2 -0
- package/dist/src/disbursements/operations/transfer.spec.d.ts.map +1 -0
- package/dist/src/disbursements/operations/transfer.spec.js +177 -0
- package/dist/src/disbursements/operations/transfer.spec.js.map +1 -0
- package/dist/src/disbursements/routes/routes.d.ts +38 -0
- package/dist/src/disbursements/routes/routes.d.ts.map +1 -0
- package/dist/src/disbursements/routes/routes.js +53 -0
- package/dist/src/disbursements/routes/routes.js.map +1 -0
- package/dist/src/disbursements/utils/constants.d.ts +5 -0
- package/dist/src/disbursements/utils/constants.d.ts.map +1 -0
- package/dist/src/disbursements/utils/constants.js +9 -0
- package/dist/src/disbursements/utils/constants.js.map +1 -0
- package/dist/src/disbursements/utils/regex.d.ts +9 -0
- package/dist/src/disbursements/utils/regex.d.ts.map +1 -0
- package/dist/src/disbursements/utils/regex.js +12 -0
- package/dist/src/disbursements/utils/regex.js.map +1 -0
- package/dist/src/disbursements/utils/regex.spec.d.ts +2 -0
- package/dist/src/disbursements/utils/regex.spec.d.ts.map +1 -0
- package/dist/src/disbursements/utils/regex.spec.js +32 -0
- package/dist/src/disbursements/utils/regex.spec.js.map +1 -0
- package/dist/src/disbursements/utils/status.d.ts +53 -0
- package/dist/src/disbursements/utils/status.d.ts.map +1 -0
- package/dist/src/disbursements/utils/status.js +58 -0
- package/dist/src/disbursements/utils/status.js.map +1 -0
- package/dist/src/disbursements/utils/utils.d.ts +9 -0
- package/dist/src/disbursements/utils/utils.d.ts.map +1 -0
- package/dist/src/disbursements/utils/utils.js +26 -0
- package/dist/src/disbursements/utils/utils.js.map +1 -0
- package/dist/src/disbursements/utils/utils.spec.d.ts +2 -0
- package/dist/src/disbursements/utils/utils.spec.d.ts.map +1 -0
- package/dist/src/disbursements/utils/utils.spec.js +43 -0
- package/dist/src/disbursements/utils/utils.spec.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/payments/implementations/fake.d.ts +33 -0
- package/dist/src/payments/implementations/fake.d.ts.map +1 -0
- package/dist/src/payments/implementations/fake.js +110 -0
- package/dist/src/payments/implementations/fake.js.map +1 -0
- package/dist/src/payments/implementations/live.d.ts +45 -0
- package/dist/src/payments/implementations/live.d.ts.map +1 -0
- package/dist/src/payments/implementations/live.js +69 -0
- package/dist/src/payments/implementations/live.js.map +1 -0
- package/dist/src/payments/operations/get_access_token.d.ts +11 -0
- package/dist/src/payments/operations/get_access_token.d.ts.map +1 -0
- package/dist/src/payments/operations/get_access_token.js +47 -0
- package/dist/src/payments/operations/get_access_token.js.map +1 -0
- package/dist/src/payments/operations/get_access_token.spec.d.ts +2 -0
- package/dist/src/payments/operations/get_access_token.spec.d.ts.map +1 -0
- package/dist/src/payments/operations/get_access_token.spec.js +74 -0
- package/dist/src/payments/operations/get_access_token.spec.js.map +1 -0
- package/dist/src/payments/operations/get_pay_token.d.ts +12 -0
- package/dist/src/payments/operations/get_pay_token.d.ts.map +1 -0
- package/dist/src/payments/operations/get_pay_token.js +43 -0
- package/dist/src/payments/operations/get_pay_token.js.map +1 -0
- package/dist/src/payments/operations/get_pay_token.spec.d.ts +2 -0
- package/dist/src/payments/operations/get_pay_token.spec.d.ts.map +1 -0
- package/dist/src/payments/operations/get_pay_token.spec.js +74 -0
- package/dist/src/payments/operations/get_pay_token.spec.js.map +1 -0
- package/dist/src/payments/operations/get_payment_status.d.ts +23 -0
- package/dist/src/payments/operations/get_payment_status.d.ts.map +1 -0
- package/dist/src/payments/operations/get_payment_status.js +51 -0
- package/dist/src/payments/operations/get_payment_status.js.map +1 -0
- package/dist/src/payments/operations/get_payment_status.spec.d.ts +2 -0
- package/dist/src/payments/operations/get_payment_status.spec.d.ts.map +1 -0
- package/dist/src/payments/operations/get_payment_status.spec.js +101 -0
- package/dist/src/payments/operations/get_payment_status.spec.js.map +1 -0
- package/dist/src/payments/operations/initialize_om_payment.d.ts +22 -0
- package/dist/src/payments/operations/initialize_om_payment.d.ts.map +1 -0
- package/dist/src/payments/operations/initialize_om_payment.js +124 -0
- package/dist/src/payments/operations/initialize_om_payment.js.map +1 -0
- package/dist/src/payments/operations/initialize_om_payment.spec.d.ts +2 -0
- package/dist/src/payments/operations/initialize_om_payment.spec.d.ts.map +1 -0
- package/dist/src/payments/operations/initialize_om_payment.spec.js +245 -0
- package/dist/src/payments/operations/initialize_om_payment.spec.js.map +1 -0
- package/dist/src/payments/payments.d.ts +57 -0
- package/dist/src/payments/payments.d.ts.map +1 -0
- package/dist/src/payments/payments.js +36 -0
- package/dist/src/payments/payments.js.map +1 -0
- package/dist/src/payments/routes/routes.d.ts +48 -0
- package/dist/src/payments/routes/routes.d.ts.map +1 -0
- package/dist/src/payments/routes/routes.js +61 -0
- package/dist/src/payments/routes/routes.js.map +1 -0
- package/dist/src/payments/utils/constants.d.ts +96 -0
- package/dist/src/payments/utils/constants.d.ts.map +1 -0
- package/dist/src/payments/utils/constants.js +112 -0
- package/dist/src/payments/utils/constants.js.map +1 -0
- package/dist/src/payments/utils/joi_schema.d.ts +71 -0
- package/dist/src/payments/utils/joi_schema.d.ts.map +1 -0
- package/dist/src/payments/utils/joi_schema.js +44 -0
- package/dist/src/payments/utils/joi_schema.js.map +1 -0
- package/dist/src/payments/utils/request_model.d.ts +75 -0
- package/dist/src/payments/utils/request_model.d.ts.map +1 -0
- package/dist/src/payments/utils/request_model.js +3 -0
- package/dist/src/payments/utils/request_model.js.map +1 -0
- package/dist/src/payments/utils/utils.d.ts +15 -0
- package/dist/src/payments/utils/utils.d.ts.map +1 -0
- package/dist/src/payments/utils/utils.js +27 -0
- package/dist/src/payments/utils/utils.js.map +1 -0
- package/dist/src/utils/https.d.ts +77 -0
- package/dist/src/utils/https.d.ts.map +1 -0
- package/dist/src/utils/https.js +240 -0
- package/dist/src/utils/https.js.map +1 -0
- package/dist/src/utils/https.spec.d.ts +2 -0
- package/dist/src/utils/https.spec.d.ts.map +1 -0
- package/dist/src/utils/https.spec.js +77 -0
- package/dist/src/utils/https.spec.js.map +1 -0
- package/dist/src/utils/logging_interface.d.ts +23 -0
- package/dist/src/utils/logging_interface.d.ts.map +1 -0
- package/dist/src/utils/logging_interface.js +3 -0
- package/dist/src/utils/logging_interface.js.map +1 -0
- package/dist/src/utils/operation_response.d.ts +16 -0
- package/dist/src/utils/operation_response.d.ts.map +1 -0
- package/dist/src/utils/operation_response.js +3 -0
- package/dist/src/utils/operation_response.js.map +1 -0
- package/dist/src/utils/utils.d.ts +6 -0
- package/dist/src/utils/utils.d.ts.map +1 -0
- package/dist/src/utils/utils.js +10 -0
- package/dist/src/utils/utils.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/index"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Joi from 'joi';
|
|
2
|
+
import { DisbursementXTargetEnvironmentType } from '../utils/constants';
|
|
3
|
+
import { LoggerInterface } from '../../utils/logging_interface';
|
|
4
|
+
import { CreateAccessTokenResponse } from '../operations/create_access_token';
|
|
5
|
+
import { TransferRequest, TransferResponse } from '../operations/transfer';
|
|
6
|
+
import { GetTransferStatusRequest, GetTransferStatusResponse } from '../operations/get_transfer_status';
|
|
7
|
+
/**
|
|
8
|
+
* Interface for DisbursementServiceConfig.
|
|
9
|
+
*/
|
|
10
|
+
export interface DisbursementServiceConfig {
|
|
11
|
+
clientId: string;
|
|
12
|
+
clientSecret: string;
|
|
13
|
+
customerKey: string;
|
|
14
|
+
customerSecret: string;
|
|
15
|
+
channelUserMsisdn: string;
|
|
16
|
+
pin: string;
|
|
17
|
+
environment: DisbursementXTargetEnvironmentType;
|
|
18
|
+
logger: LoggerInterface;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Joi schema for DisbursementServiceConfigSchema.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DisbursementServiceConfigSchema: Joi.ObjectSchema<DisbursementServiceConfig>;
|
|
24
|
+
/**
|
|
25
|
+
* Orange Money API Disbursement.
|
|
26
|
+
* @class
|
|
27
|
+
*/
|
|
28
|
+
export interface DisbursementInterface {
|
|
29
|
+
/**
|
|
30
|
+
* Creates an access token.
|
|
31
|
+
*
|
|
32
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
33
|
+
*/
|
|
34
|
+
createAccessToken(): Promise<CreateAccessTokenResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Transfers the specified amount of money from one account to another.
|
|
37
|
+
*
|
|
38
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
39
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
40
|
+
*/
|
|
41
|
+
transfer(params: TransferRequest): Promise<TransferResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the status of a transfer.
|
|
44
|
+
*
|
|
45
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
46
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
47
|
+
*/
|
|
48
|
+
getTransferStatus(params: GetTransferStatusRequest): Promise<GetTransferStatusResponse>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Orange Money API Disbursement.
|
|
52
|
+
* @class
|
|
53
|
+
*/
|
|
54
|
+
export declare class Disbursement {
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new Disbursement object based on the provided configuration.
|
|
57
|
+
*
|
|
58
|
+
* @param {DisbursementServiceConfig} config - The configuration for the Disbursement object.
|
|
59
|
+
* @return {Disbursement} A new Disbursement object based on the provided configuration.
|
|
60
|
+
*/
|
|
61
|
+
static createDisbursement(config: DisbursementServiceConfig): DisbursementInterface;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=disbursement_service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disbursement_service.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/implementations/disbursement_service.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAI3C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,kCAAkC,CAAC;IAChD,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,+BAA+B,6CAgDxC,CAAC;AAEL;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAExD;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE7D;;;;;OAKG;IACH,iBAAiB,CACf,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACvC;AAED;;;GAGG;AACH,qBAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CACvB,MAAM,EAAE,yBAAyB,GAChC,qBAAqB;CAQzB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Disbursement = exports.DisbursementServiceConfigSchema = void 0;
|
|
7
|
+
const joi_1 = __importDefault(require("joi"));
|
|
8
|
+
const constants_1 = require("../utils/constants");
|
|
9
|
+
const regex_1 = require("../utils/regex");
|
|
10
|
+
const live_1 = require("./src/live");
|
|
11
|
+
const sandbox_1 = require("./src/sandbox");
|
|
12
|
+
/**
|
|
13
|
+
* Joi schema for DisbursementServiceConfigSchema.
|
|
14
|
+
*/
|
|
15
|
+
exports.DisbursementServiceConfigSchema = joi_1.default.object({
|
|
16
|
+
clientId: joi_1.default.string().required().messages({
|
|
17
|
+
'string.base': '"clientId" should be a type of \'text\'',
|
|
18
|
+
'string.empty': '"clientId" cannot be an empty field',
|
|
19
|
+
'any.required': '"clientId" is a required field',
|
|
20
|
+
}),
|
|
21
|
+
clientSecret: joi_1.default.string().required().messages({
|
|
22
|
+
'string.base': '"clientSecret" should be a type of \'text\'',
|
|
23
|
+
'string.empty': '"clientSecret" cannot be an empty field',
|
|
24
|
+
'any.required': '"clientSecret" is a required field',
|
|
25
|
+
}),
|
|
26
|
+
customerKey: joi_1.default.string().required().messages({
|
|
27
|
+
'string.base': '"customerKey" should be a type of \'text\'',
|
|
28
|
+
'string.empty': '"customerKey" cannot be an empty field',
|
|
29
|
+
'any.required': '"customerKey" is a required field',
|
|
30
|
+
}),
|
|
31
|
+
customerSecret: joi_1.default.string().required().messages({
|
|
32
|
+
'string.base': '"customerSecret" should be a type of \'text\'',
|
|
33
|
+
'string.empty': '"customerSecret" cannot be an empty field',
|
|
34
|
+
'any.required': '"customerSecret" is a required field',
|
|
35
|
+
}),
|
|
36
|
+
channelUserMsisdn: joi_1.default.string()
|
|
37
|
+
.pattern(regex_1.merchantPhoneNumberRegex)
|
|
38
|
+
.required()
|
|
39
|
+
.messages({
|
|
40
|
+
'string.base': '"channelUserMsisdn" should be a type of \'text\'',
|
|
41
|
+
'string.empty': '"channelUserMsisdn" cannot be an empty field',
|
|
42
|
+
'any.required': '"channelUserMsisdn" is a required field',
|
|
43
|
+
}),
|
|
44
|
+
pin: joi_1.default.string().required().messages({
|
|
45
|
+
'string.base': '"pin" should be a type of \'text\'',
|
|
46
|
+
'string.empty': '"pin" cannot be an empty field',
|
|
47
|
+
'any.required': '"pin" is a required field',
|
|
48
|
+
}),
|
|
49
|
+
environment: joi_1.default.string()
|
|
50
|
+
.valid(...Object.values(constants_1.DisbursementXTargetEnvironmentType))
|
|
51
|
+
.required()
|
|
52
|
+
.messages({
|
|
53
|
+
'string.base': '"environment" should be a type of \'text\'',
|
|
54
|
+
'string.empty': '"environment" cannot be an empty field',
|
|
55
|
+
'any.required': '"environment" is a required field',
|
|
56
|
+
}),
|
|
57
|
+
logger: joi_1.default.object().required().messages({
|
|
58
|
+
'string.base': '"logger" should be a type of \'object\'',
|
|
59
|
+
'string.empty': '"logger" cannot be an empty field',
|
|
60
|
+
'any.required': '"logger" is a required field',
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Orange Money API Disbursement.
|
|
65
|
+
* @class
|
|
66
|
+
*/
|
|
67
|
+
class Disbursement {
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new Disbursement object based on the provided configuration.
|
|
70
|
+
*
|
|
71
|
+
* @param {DisbursementServiceConfig} config - The configuration for the Disbursement object.
|
|
72
|
+
* @return {Disbursement} A new Disbursement object based on the provided configuration.
|
|
73
|
+
*/
|
|
74
|
+
static createDisbursement(config) {
|
|
75
|
+
switch (config.environment) {
|
|
76
|
+
case constants_1.DisbursementXTargetEnvironmentType.prod:
|
|
77
|
+
return new live_1.DisbursementLive(config);
|
|
78
|
+
case constants_1.DisbursementXTargetEnvironmentType.sandbox:
|
|
79
|
+
return new sandbox_1.DisbursementFake(config);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.Disbursement = Disbursement;
|
|
84
|
+
//# sourceMappingURL=disbursement_service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disbursement_service.js","sourceRoot":"","sources":["../../../../src/disbursements/implementations/disbursement_service.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,kDAAwE;AAExE,0CAA0D;AAO1D,qCAA8C;AAC9C,2CAAiD;AAgBjD;;GAEG;AACU,QAAA,+BAA+B,GAC1C,aAAG,CAAC,MAAM,CAA4B;IACpC,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACzC,aAAa,EAAE,yCAAyC;QACxD,cAAc,EAAE,qCAAqC;QACrD,cAAc,EAAE,gCAAgC;KACjD,CAAC;IACF,YAAY,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QAC7C,aAAa,EAAE,6CAA6C;QAC5D,cAAc,EAAE,yCAAyC;QACzD,cAAc,EAAE,oCAAoC;KACrD,CAAC;IACF,WAAW,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QAC5C,aAAa,EAAE,4CAA4C;QAC3D,cAAc,EAAE,wCAAwC;QACxD,cAAc,EAAE,mCAAmC;KACpD,CAAC;IACF,cAAc,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QAC/C,aAAa,EAAE,+CAA+C;QAC9D,cAAc,EAAE,2CAA2C;QAC3D,cAAc,EAAE,sCAAsC;KACvD,CAAC;IACF,iBAAiB,EAAE,aAAG,CAAC,MAAM,EAAE;SAC5B,OAAO,CAAC,gCAAwB,CAAC;SACjC,QAAQ,EAAE;SACV,QAAQ,CAAC;QACR,aAAa,EAAE,kDAAkD;QACjE,cAAc,EAAE,8CAA8C;QAC9D,cAAc,EAAE,yCAAyC;KAC1D,CAAC;IACJ,GAAG,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpC,aAAa,EAAE,oCAAoC;QACnD,cAAc,EAAE,gCAAgC;QAChD,cAAc,EAAE,2BAA2B;KAC5C,CAAC;IACF,WAAW,EAAE,aAAG,CAAC,MAAM,EAAE;SACtB,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,8CAAkC,CAAC,CAAC;SAC3D,QAAQ,EAAE;SACV,QAAQ,CAAC;QACR,aAAa,EAAE,4CAA4C;QAC3D,cAAc,EAAE,wCAAwC;QACxD,cAAc,EAAE,mCAAmC;KACpD,CAAC;IACJ,MAAM,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACvC,aAAa,EAAE,yCAAyC;QACxD,cAAc,EAAE,mCAAmC;QACnD,cAAc,EAAE,8BAA8B;KAC/C,CAAC;CACH,CAAC,CAAC;AAiCL;;;GAGG;AACH,MAAa,YAAY;IACvB;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CACvB,MAAiC;QAEjC,QAAQ,MAAM,CAAC,WAAW,EAAE;YAC1B,KAAK,8CAAkC,CAAC,IAAI;gBAC1C,OAAO,IAAI,uBAAgB,CAAC,MAAM,CAAC,CAAC;YACtC,KAAK,8CAAkC,CAAC,OAAO;gBAC7C,OAAO,IAAI,0BAAgB,CAAC,MAAM,CAAC,CAAC;SACvC;IACH,CAAC;CACF;AAjBD,oCAiBC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TransferRequest, TransferResponse } from '../../operations/transfer';
|
|
2
|
+
import { CreateAccessTokenResponse } from '../../operations/create_access_token';
|
|
3
|
+
import { Routes } from '../../routes/routes';
|
|
4
|
+
import { DisbursementInterface, DisbursementServiceConfig } from '../disbursement_service';
|
|
5
|
+
import { GetTransferStatusRequest, GetTransferStatusResponse } from '../../operations/get_transfer_status';
|
|
6
|
+
/**
|
|
7
|
+
* Orange Money API Live Disbursement.
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
export declare class DisbursementLive implements DisbursementInterface {
|
|
11
|
+
protected readonly config: DisbursementServiceConfig;
|
|
12
|
+
protected readonly routes: Routes;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new {Disbursement}.
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
17
|
+
*/
|
|
18
|
+
constructor(config: DisbursementServiceConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Creates an access token.
|
|
21
|
+
*
|
|
22
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
23
|
+
*/
|
|
24
|
+
createAccessToken(): Promise<CreateAccessTokenResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Transfers the specified amount of money from one account to another.
|
|
27
|
+
*
|
|
28
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
29
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
30
|
+
*/
|
|
31
|
+
transfer(params: TransferRequest): Promise<TransferResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the status of a transfer.
|
|
34
|
+
*
|
|
35
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
36
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
37
|
+
*/
|
|
38
|
+
getTransferStatus(params: GetTransferStatusRequest): Promise<GetTransferStatusResponse>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../../../../src/disbursements/implementations/src/live.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EAE1B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EAE1B,MAAM,sCAAsC,CAAC;AAE9C;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,qBAAqB;IAC5D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IACrD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC;;;;OAIG;gBACS,MAAM,EAAE,yBAAyB;IAK7C;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAO7D;;;;;OAKG;IACG,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQlE;;;;;OAKG;IACG,iBAAiB,CACrB,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,yBAAyB,CAAC;CAOtC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisbursementLive = void 0;
|
|
4
|
+
const transfer_1 = require("../../operations/transfer");
|
|
5
|
+
const create_access_token_1 = require("../../operations/create_access_token");
|
|
6
|
+
const routes_1 = require("../../routes/routes");
|
|
7
|
+
const get_transfer_status_1 = require("../../operations/get_transfer_status");
|
|
8
|
+
/**
|
|
9
|
+
* Orange Money API Live Disbursement.
|
|
10
|
+
* @class
|
|
11
|
+
*/
|
|
12
|
+
class DisbursementLive {
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new {Disbursement}.
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
17
|
+
*/
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.routes = new routes_1.Routes();
|
|
20
|
+
this.config = config;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates an access token.
|
|
24
|
+
*
|
|
25
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
26
|
+
*/
|
|
27
|
+
async createAccessToken() {
|
|
28
|
+
return await (0, create_access_token_1.createAccessToken)({
|
|
29
|
+
configs: this.config,
|
|
30
|
+
endPoint: this.routes.createAccessToken(),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Transfers the specified amount of money from one account to another.
|
|
35
|
+
*
|
|
36
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
37
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
38
|
+
*/
|
|
39
|
+
async transfer(params) {
|
|
40
|
+
return await (0, transfer_1.transfer)({
|
|
41
|
+
configs: this.config,
|
|
42
|
+
params: params,
|
|
43
|
+
endPoint: this.routes.transfer(),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves the status of a transfer.
|
|
48
|
+
*
|
|
49
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
50
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
51
|
+
*/
|
|
52
|
+
async getTransferStatus(params) {
|
|
53
|
+
return await (0, get_transfer_status_1.getTransferStatus)({
|
|
54
|
+
configs: this.config,
|
|
55
|
+
params: params,
|
|
56
|
+
endPoint: this.routes.transferStatus(params.messageId),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.DisbursementLive = DisbursementLive;
|
|
61
|
+
//# sourceMappingURL=live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../../../../src/disbursements/implementations/src/live.ts"],"names":[],"mappings":";;;AAAA,wDAImC;AACnC,8EAG8C;AAC9C,gDAA6C;AAK7C,8EAI8C;AAE9C;;;GAGG;AACH,MAAa,gBAAgB;IAG3B;;;;OAIG;IACH,YAAY,MAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO,MAAM,IAAA,uCAAiB,EAAC;YAC7B,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;SAC1C,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAuB;QACpC,OAAO,MAAM,IAAA,mBAAQ,EAAC;YACpB,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,MAAgC;QAEhC,OAAO,MAAM,IAAA,uCAAiB,EAAC;YAC7B,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,4CAsDC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TransferResponse } from '../../operations/transfer';
|
|
2
|
+
import { CreateAccessTokenResponse } from '../../operations/create_access_token';
|
|
3
|
+
import { Routes } from '../../routes/routes';
|
|
4
|
+
import { DisbursementInterface, DisbursementServiceConfig } from '../disbursement_service';
|
|
5
|
+
import { GetTransferStatusResponse } from '../../operations/get_transfer_status';
|
|
6
|
+
/**
|
|
7
|
+
* Orange Money API Fake Disbursement.
|
|
8
|
+
* @class
|
|
9
|
+
*/
|
|
10
|
+
export declare class DisbursementFake implements DisbursementInterface {
|
|
11
|
+
protected readonly config: DisbursementServiceConfig;
|
|
12
|
+
protected readonly routes: Routes;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new {Disbursement}.
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
17
|
+
*/
|
|
18
|
+
constructor(config: DisbursementServiceConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Creates an access token.
|
|
21
|
+
*
|
|
22
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
23
|
+
*/
|
|
24
|
+
createAccessToken(): Promise<CreateAccessTokenResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Transfers the specified amount of money from one account to another.
|
|
27
|
+
*
|
|
28
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
29
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
30
|
+
*/
|
|
31
|
+
transfer(): Promise<TransferResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the status of a transfer.
|
|
34
|
+
*
|
|
35
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
36
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
37
|
+
*/
|
|
38
|
+
getTransferStatus(): Promise<GetTransferStatusResponse>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../../../src/disbursements/implementations/src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,yBAAyB,EAC1B,MAAM,sCAAsC,CAAC;AAM9C;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,qBAAqB;IAC5D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IACrD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAClC;;;;OAIG;gBACS,MAAM,EAAE,yBAAyB;IAK7C;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAW7D;;;;;OAKG;IACG,QAAQ,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAwB3C;;;;;OAKG;IACG,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAsC9D"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisbursementFake = void 0;
|
|
4
|
+
const routes_1 = require("../../routes/routes");
|
|
5
|
+
const get_transfer_status_1 = require("../../operations/get_transfer_status");
|
|
6
|
+
const status_1 = require("../../utils/status");
|
|
7
|
+
/**
|
|
8
|
+
* Orange Money API Fake Disbursement.
|
|
9
|
+
* @class
|
|
10
|
+
*/
|
|
11
|
+
class DisbursementFake {
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new {Disbursement}.
|
|
14
|
+
* @constructor
|
|
15
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
16
|
+
*/
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.routes = new routes_1.Routes();
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an access token.
|
|
23
|
+
*
|
|
24
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
25
|
+
*/
|
|
26
|
+
async createAccessToken() {
|
|
27
|
+
return {
|
|
28
|
+
data: 'accessToken',
|
|
29
|
+
raw: {
|
|
30
|
+
access_token: 'accessToken',
|
|
31
|
+
token_type: 'Bearer',
|
|
32
|
+
expires_in: '300',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Transfers the specified amount of money from one account to another.
|
|
38
|
+
*
|
|
39
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
40
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
41
|
+
*/
|
|
42
|
+
async transfer() {
|
|
43
|
+
return {
|
|
44
|
+
data: 'f7ec5a39-b1ad-4fa5-a734-60ab4217ba75',
|
|
45
|
+
raw: {
|
|
46
|
+
MD5OfMessageBody: '4b55cf6629b5f0ee3c8ac91435a2eb35',
|
|
47
|
+
MD5OfMessageAttributes: '50e3084aee2bf840dd63b6bbf0a62fa9',
|
|
48
|
+
MessageId: 'f7ec5a39-b1ad-4fa5-a734-60ab4217ba75',
|
|
49
|
+
ResponseMetadata: {
|
|
50
|
+
RequestId: 'bbb43d42-95d1-5a6b-92a7-60c0d420e103',
|
|
51
|
+
HTTPStatusCode: 200,
|
|
52
|
+
HTTPHeaders: {
|
|
53
|
+
'x-amzn-requestid': 'bbb43d42-95d1-5a6b-92a7-60c0d420e103',
|
|
54
|
+
'x-amzn-trace-id': 'Root=1-65083fb1-37fbf881380338ed3b5fcd2b;Parent=6bfc3c24556c9b27;Sampled=0;Lineage=79e6faf7:0',
|
|
55
|
+
date: 'Mon, 18 Sep 2023 12:16:49 GMT',
|
|
56
|
+
'content-type': 'text/xml',
|
|
57
|
+
'content-length': '459',
|
|
58
|
+
},
|
|
59
|
+
RetryAttempts: 0,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Retrieves the status of a transfer.
|
|
66
|
+
*
|
|
67
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
68
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
69
|
+
*/
|
|
70
|
+
async getTransferStatus() {
|
|
71
|
+
return {
|
|
72
|
+
data: {
|
|
73
|
+
status: status_1.DisbursementStatus.succeeded,
|
|
74
|
+
refundStep: get_transfer_status_1.DisbursementStep.TransferSent,
|
|
75
|
+
},
|
|
76
|
+
raw: {
|
|
77
|
+
result: {
|
|
78
|
+
message: 'Cash in performed successfully',
|
|
79
|
+
data: {
|
|
80
|
+
subscriberMsisdn: 'subscriberMsisdn',
|
|
81
|
+
channelUserMsisdn: 'channelUserMsisdn',
|
|
82
|
+
createtime: '1695039280',
|
|
83
|
+
amount: 100,
|
|
84
|
+
payToken: 'C2C2309183CB702A1CBB39ECE32C',
|
|
85
|
+
txnid: 'PP230918.1314.B57973',
|
|
86
|
+
txnmode: 'refundYNote',
|
|
87
|
+
txnstatus: '00068',
|
|
88
|
+
orderId: 'refundYNote',
|
|
89
|
+
status: status_1.DisbursementApiRawStatus.succeeded,
|
|
90
|
+
description: 'Remboursement Fond',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
parameters: {
|
|
94
|
+
amount: '100',
|
|
95
|
+
xauth: 'WU5PVEVIRUFEOllOT1RFSEVBRDIwMjA=',
|
|
96
|
+
channel_user_msisdn: 'channel_user_msisdn',
|
|
97
|
+
customer_key: 'customer_key',
|
|
98
|
+
customer_secret: 'customer_secret',
|
|
99
|
+
final_customer_name: 'Steve',
|
|
100
|
+
final_customer_phone: '692232239',
|
|
101
|
+
},
|
|
102
|
+
CreateAt: '09-18-2023 12:14:43',
|
|
103
|
+
MessageId: 'caee8310-02fa-45da-9b22-a1effcada25c',
|
|
104
|
+
RefundStep: get_transfer_status_1.DisbursementStep.TransferSent,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.DisbursementFake = DisbursementFake;
|
|
110
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../../../../../src/disbursements/implementations/src/sandbox.ts"],"names":[],"mappings":";;;AAEA,gDAA6C;AAK7C,8EAG8C;AAC9C,+CAG4B;AAE5B;;;GAGG;AACH,MAAa,gBAAgB;IAG3B;;;;OAIG;IACH,YAAY,MAAiC;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,GAAG,EAAE;gBACH,YAAY,EAAE,aAAa;gBAC3B,UAAU,EAAE,QAAQ;gBACpB,UAAU,EAAE,KAAK;aAClB;SACF,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO;YACL,IAAI,EAAE,sCAAsC;YAC5C,GAAG,EAAE;gBACH,gBAAgB,EAAE,kCAAkC;gBACpD,sBAAsB,EAAE,kCAAkC;gBAC1D,SAAS,EAAE,sCAAsC;gBACjD,gBAAgB,EAAE;oBAChB,SAAS,EAAE,sCAAsC;oBACjD,cAAc,EAAE,GAAG;oBACnB,WAAW,EAAE;wBACX,kBAAkB,EAAE,sCAAsC;wBAC1D,iBAAiB,EACf,+FAA+F;wBACjG,IAAI,EAAE,+BAA+B;wBACrC,cAAc,EAAE,UAAU;wBAC1B,gBAAgB,EAAE,KAAK;qBACxB;oBACD,aAAa,EAAE,CAAC;iBACjB;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB;QACrB,OAAO;YACL,IAAI,EAAE;gBACJ,MAAM,EAAE,2BAAkB,CAAC,SAAS;gBACpC,UAAU,EAAE,sCAAgB,CAAC,YAAY;aAC1C;YACD,GAAG,EAAE;gBACH,MAAM,EAAE;oBACN,OAAO,EAAE,gCAAgC;oBACzC,IAAI,EAAE;wBACJ,gBAAgB,EAAE,kBAAkB;wBACpC,iBAAiB,EAAE,mBAAmB;wBACtC,UAAU,EAAE,YAAY;wBACxB,MAAM,EAAE,GAAG;wBACX,QAAQ,EAAE,8BAA8B;wBACxC,KAAK,EAAE,sBAAsB;wBAC7B,OAAO,EAAE,aAAa;wBACtB,SAAS,EAAE,OAAO;wBAClB,OAAO,EAAE,aAAa;wBACtB,MAAM,EAAE,iCAAwB,CAAC,SAAS;wBAC1C,WAAW,EAAE,oBAAoB;qBAClC;iBACF;gBACD,UAAU,EAAE;oBACV,MAAM,EAAE,KAAK;oBACb,KAAK,EAAE,kCAAkC;oBACzC,mBAAmB,EAAE,qBAAqB;oBAC1C,YAAY,EAAE,cAAc;oBAC5B,eAAe,EAAE,iBAAiB;oBAClC,mBAAmB,EAAE,OAAO;oBAC5B,oBAAoB,EAAE,WAAW;iBAClC;gBACD,QAAQ,EAAE,qBAAqB;gBAC/B,SAAS,EAAE,sCAAsC;gBACjD,UAAU,EAAE,sCAAgB,CAAC,YAAY;aAC1C;SACF,CAAC;IACJ,CAAC;CACF;AAvGD,4CAuGC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OperationResponse } from '../../utils/operation_response';
|
|
2
|
+
import { DisbursementServiceConfig } from '../implementations/disbursement_service';
|
|
3
|
+
export declare type Token = {
|
|
4
|
+
/**
|
|
5
|
+
* The requested token.
|
|
6
|
+
*/
|
|
7
|
+
access_token: string;
|
|
8
|
+
scope?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The type of the requested token.
|
|
11
|
+
*/
|
|
12
|
+
token_type: string;
|
|
13
|
+
/** The time to live in seconds. */
|
|
14
|
+
expires_in: string;
|
|
15
|
+
};
|
|
16
|
+
export declare type CreateAccessTokenResponse = OperationResponse<string, Token>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an access token.
|
|
19
|
+
*
|
|
20
|
+
* @param {CreateAccessTokenRequest} configs - The disbursement service config.
|
|
21
|
+
* @param {string} endPoint - The end point.
|
|
22
|
+
* @return {CreateAccessTokenResponse} The method response containing the access token and raw response.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createAccessToken({ configs, endPoint, }: {
|
|
25
|
+
configs: DisbursementServiceConfig;
|
|
26
|
+
endPoint: string;
|
|
27
|
+
}): Promise<CreateAccessTokenResponse>;
|
|
28
|
+
//# sourceMappingURL=create_access_token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_access_token.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/operations/create_access_token.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,yBAAyB,EAE1B,MAAM,yCAAyC,CAAC;AAEjD,oBAAY,KAAK,GAAG;IAClB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,yBAAyB,GAAG,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,yBAAyB,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAsCrC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAccessToken = void 0;
|
|
4
|
+
const https_1 = require("../../utils/https");
|
|
5
|
+
const disbursement_service_1 = require("../implementations/disbursement_service");
|
|
6
|
+
/**
|
|
7
|
+
* Creates an access token.
|
|
8
|
+
*
|
|
9
|
+
* @param {CreateAccessTokenRequest} configs - The disbursement service config.
|
|
10
|
+
* @param {string} endPoint - The end point.
|
|
11
|
+
* @return {CreateAccessTokenResponse} The method response containing the access token and raw response.
|
|
12
|
+
*/
|
|
13
|
+
async function createAccessToken({ configs, endPoint, }) {
|
|
14
|
+
const logger = configs.logger;
|
|
15
|
+
logger.info('createAccessToken is running ...');
|
|
16
|
+
const { error: configsValidationError, value: configValues } = disbursement_service_1.DisbursementServiceConfigSchema.validate(configs);
|
|
17
|
+
if (configsValidationError) {
|
|
18
|
+
logger.error(`Invalid DisbursementServiceConfig request parameters. params : ${JSON.stringify(configsValidationError.details)}`);
|
|
19
|
+
return { error: configsValidationError.details };
|
|
20
|
+
}
|
|
21
|
+
const authorization = (0, https_1.hash)(configValues.clientId, configValues.clientSecret);
|
|
22
|
+
const headers = {
|
|
23
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
24
|
+
Authorization: `Basic ${authorization}`,
|
|
25
|
+
};
|
|
26
|
+
const body = (0, https_1.encodeDataToXFormUrl)({
|
|
27
|
+
grant_type: 'client_credentials',
|
|
28
|
+
});
|
|
29
|
+
const response = await (0, https_1.postRequest)({
|
|
30
|
+
logger: logger,
|
|
31
|
+
route: endPoint,
|
|
32
|
+
data: body,
|
|
33
|
+
headers: headers,
|
|
34
|
+
rejectUnauthorized: false,
|
|
35
|
+
});
|
|
36
|
+
if (!response.response) {
|
|
37
|
+
return { error: response.error };
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
data: response.response.data.access_token,
|
|
41
|
+
raw: response.response.data,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
exports.createAccessToken = createAccessToken;
|
|
45
|
+
//# sourceMappingURL=create_access_token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_access_token.js","sourceRoot":"","sources":["../../../../src/disbursements/operations/create_access_token.ts"],"names":[],"mappings":";;;AAAA,6CAK2B;AAE3B,kFAGiD;AAqBjD;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CAAC,EACtC,OAAO,EACP,QAAQ,GAIT;IACC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChD,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,YAAY,EAAE,GAC1D,sDAA+B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,sBAAsB,EAAE;QAC1B,MAAM,CAAC,KAAK,CACV,kEAAkE,IAAI,CAAC,SAAS,CAC9E,sBAAsB,CAAC,OAAO,CAC/B,EAAE,CACJ,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,sBAAsB,CAAC,OAAO,EAAE,CAAC;KAClD;IACD,MAAM,aAAa,GAAG,IAAA,YAAI,EAAC,YAAY,CAAC,QAAQ,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG;QACd,cAAc,EAAE,mCAAmC;QACnD,aAAa,EAAE,SAAS,aAAa,EAAE;KACxC,CAAC;IACF,MAAM,IAAI,GAAG,IAAA,4BAAoB,EAAC;QAChC,UAAU,EAAE,oBAAoB;KACjC,CAAC,CAAC;IACH,MAAM,QAAQ,GAA2B,MAAM,IAAA,mBAAW,EAAQ;QAChE,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,OAAO;QAChB,kBAAkB,EAAE,KAAK;KAC1B,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;QACtB,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;KAClC;IAED,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY;QACzC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;KAC5B,CAAC;AACJ,CAAC;AA5CD,8CA4CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_access_token.spec.d.ts","sourceRoot":"","sources":["../../../../src/disbursements/operations/create_access_token.spec.ts"],"names":[],"mappings":""}
|