@spreeloop/orange_money 1.0.7 → 1.0.8
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/logging/src/log_level.d.ts +24 -0
- package/dist/logging/src/log_level.d.ts.map +1 -0
- package/dist/logging/src/log_level.js +34 -0
- package/dist/logging/src/log_level.js.map +1 -0
- package/dist/logging/src/logging.d.ts +50 -0
- package/dist/logging/src/logging.d.ts.map +1 -0
- package/dist/logging/src/logging.js +87 -0
- package/dist/logging/src/logging.js.map +1 -0
- package/dist/logging/src/printer.d.ts +10 -0
- package/dist/logging/src/printer.d.ts.map +1 -0
- package/dist/logging/src/printer.js +3 -0
- package/dist/logging/src/printer.js.map +1 -0
- package/dist/orange_money/index.d.ts +2 -0
- package/dist/orange_money/index.d.ts.map +1 -0
- package/dist/orange_money/index.js +18 -0
- package/dist/orange_money/index.js.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/disbursement_service.d.ts +62 -0
- package/dist/orange_money/src/disbursements/implementations/disbursement_service.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/disbursement_service.js +84 -0
- package/dist/orange_money/src/disbursements/implementations/disbursement_service.js.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/src/live.d.ts +40 -0
- package/dist/orange_money/src/disbursements/implementations/src/live.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/src/live.js +61 -0
- package/dist/orange_money/src/disbursements/implementations/src/live.js.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/src/sandbox.d.ts +40 -0
- package/dist/orange_money/src/disbursements/implementations/src/sandbox.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/src/sandbox.js +110 -0
- package/dist/orange_money/src/disbursements/implementations/src/sandbox.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.d.ts +28 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.js +45 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.spec.js +106 -0
- package/dist/orange_money/src/disbursements/operations/create_access_token.spec.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.d.ts +114 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.js +128 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.js +148 -0
- package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/transfer.d.ts +44 -0
- package/dist/orange_money/src/disbursements/operations/transfer.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/transfer.js +74 -0
- package/dist/orange_money/src/disbursements/operations/transfer.js.map +1 -0
- package/dist/orange_money/src/disbursements/operations/transfer.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/operations/transfer.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/operations/transfer.spec.js +178 -0
- package/dist/orange_money/src/disbursements/operations/transfer.spec.js.map +1 -0
- package/dist/orange_money/src/disbursements/routes/routes.d.ts +38 -0
- package/dist/orange_money/src/disbursements/routes/routes.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/routes/routes.js +53 -0
- package/dist/orange_money/src/disbursements/routes/routes.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/constants.d.ts +5 -0
- package/dist/orange_money/src/disbursements/utils/constants.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/constants.js +9 -0
- package/dist/orange_money/src/disbursements/utils/constants.js.map +1 -0
- package/{src/disbursements/utils/regex.ts → dist/orange_money/src/disbursements/utils/regex.d.ts} +3 -4
- package/dist/orange_money/src/disbursements/utils/regex.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/regex.js +12 -0
- package/dist/orange_money/src/disbursements/utils/regex.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/regex.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/utils/regex.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/regex.spec.js +32 -0
- package/dist/orange_money/src/disbursements/utils/regex.spec.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/status.d.ts +53 -0
- package/dist/orange_money/src/disbursements/utils/status.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/status.js +58 -0
- package/dist/orange_money/src/disbursements/utils/status.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/utils.d.ts +9 -0
- package/dist/orange_money/src/disbursements/utils/utils.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/utils.js +26 -0
- package/dist/orange_money/src/disbursements/utils/utils.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/utils.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/utils/utils.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/utils.spec.js +43 -0
- package/dist/orange_money/src/disbursements/utils/utils.spec.js.map +1 -0
- package/{src/index.ts → dist/orange_money/src/index.d.ts} +3 -8
- package/dist/orange_money/src/index.d.ts.map +1 -0
- package/dist/orange_money/src/index.js +15 -0
- package/dist/orange_money/src/index.js.map +1 -0
- package/dist/orange_money/src/payments/implementations/fake.d.ts +33 -0
- package/dist/orange_money/src/payments/implementations/fake.d.ts.map +1 -0
- package/dist/orange_money/src/payments/implementations/fake.js +110 -0
- package/dist/orange_money/src/payments/implementations/fake.js.map +1 -0
- package/dist/orange_money/src/payments/implementations/live.d.ts +45 -0
- package/dist/orange_money/src/payments/implementations/live.d.ts.map +1 -0
- package/dist/orange_money/src/payments/implementations/live.js +69 -0
- package/dist/orange_money/src/payments/implementations/live.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_access_token.d.ts +11 -0
- package/dist/orange_money/src/payments/operations/get_access_token.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_access_token.js +47 -0
- package/dist/orange_money/src/payments/operations/get_access_token.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_access_token.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/get_access_token.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_access_token.spec.js +74 -0
- package/dist/orange_money/src/payments/operations/get_access_token.spec.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.d.ts +12 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.js +43 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.spec.js +74 -0
- package/dist/orange_money/src/payments/operations/get_pay_token.spec.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.d.ts +23 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.js +51 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.js.map +1 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.spec.js +101 -0
- package/dist/orange_money/src/payments/operations/get_payment_status.spec.js.map +1 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.d.ts +22 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.js +124 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.js.map +1 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.js +245 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.js.map +1 -0
- package/dist/orange_money/src/payments/payments.d.ts +57 -0
- package/dist/orange_money/src/payments/payments.d.ts.map +1 -0
- package/dist/orange_money/src/payments/payments.js +36 -0
- package/dist/orange_money/src/payments/payments.js.map +1 -0
- package/dist/orange_money/src/payments/routes/routes.d.ts +48 -0
- package/dist/orange_money/src/payments/routes/routes.d.ts.map +1 -0
- package/dist/orange_money/src/payments/routes/routes.js +61 -0
- package/dist/orange_money/src/payments/routes/routes.js.map +1 -0
- package/dist/orange_money/src/payments/utils/constants.d.ts +96 -0
- package/dist/orange_money/src/payments/utils/constants.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/constants.js +112 -0
- package/dist/orange_money/src/payments/utils/constants.js.map +1 -0
- package/dist/orange_money/src/payments/utils/joi_schema.d.ts +70 -0
- package/dist/orange_money/src/payments/utils/joi_schema.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/joi_schema.js +44 -0
- package/dist/orange_money/src/payments/utils/joi_schema.js.map +1 -0
- package/dist/orange_money/src/payments/utils/request_model.d.ts +75 -0
- package/dist/orange_money/src/payments/utils/request_model.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/request_model.js +3 -0
- package/dist/orange_money/src/payments/utils/request_model.js.map +1 -0
- package/dist/orange_money/src/payments/utils/utils.d.ts +15 -0
- package/dist/orange_money/src/payments/utils/utils.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/utils.js +27 -0
- package/dist/orange_money/src/payments/utils/utils.js.map +1 -0
- package/dist/orange_money/src/utils/https.d.ts +77 -0
- package/dist/orange_money/src/utils/https.d.ts.map +1 -0
- package/dist/orange_money/src/utils/https.js +240 -0
- package/dist/orange_money/src/utils/https.js.map +1 -0
- package/dist/orange_money/src/utils/https.spec.d.ts +2 -0
- package/dist/orange_money/src/utils/https.spec.d.ts.map +1 -0
- package/dist/orange_money/src/utils/https.spec.js +77 -0
- package/dist/orange_money/src/utils/https.spec.js.map +1 -0
- package/dist/orange_money/src/utils/logging_interface.d.ts +23 -0
- package/dist/orange_money/src/utils/logging_interface.d.ts.map +1 -0
- package/dist/orange_money/src/utils/logging_interface.js +3 -0
- package/dist/orange_money/src/utils/logging_interface.js.map +1 -0
- package/{src/utils/operation_response.ts → dist/orange_money/src/utils/operation_response.d.ts} +9 -10
- package/dist/orange_money/src/utils/operation_response.d.ts.map +1 -0
- package/dist/orange_money/src/utils/operation_response.js +3 -0
- package/dist/orange_money/src/utils/operation_response.js.map +1 -0
- package/dist/orange_money/src/utils/utils.d.ts +6 -0
- package/dist/orange_money/src/utils/utils.d.ts.map +1 -0
- package/dist/orange_money/src/utils/utils.js +10 -0
- package/dist/orange_money/src/utils/utils.js.map +1 -0
- package/package.json +6 -2
- package/.eslintrc.js +0 -47
- package/.prettierrc +0 -6
- package/babel.config.js +0 -3
- package/index.spec.ts +0 -9
- package/index.ts +0 -1
- package/jest.before-test.ts +0 -3
- package/jest.config.ts +0 -54
- package/src/disbursements/implementations/disbursement_service.ts +0 -133
- package/src/disbursements/implementations/src/live.ts +0 -79
- package/src/disbursements/implementations/src/sandbox.ts +0 -124
- package/src/disbursements/operations/create_access_token.spec.ts +0 -87
- package/src/disbursements/operations/create_access_token.ts +0 -83
- package/src/disbursements/operations/get_transfer_status.spec.ts +0 -132
- package/src/disbursements/operations/get_transfer_status.ts +0 -265
- package/src/disbursements/operations/transfer.spec.ts +0 -158
- package/src/disbursements/operations/transfer.ts +0 -125
- package/src/disbursements/routes/routes.ts +0 -54
- package/src/disbursements/utils/constants.ts +0 -4
- package/src/disbursements/utils/regex.spec.ts +0 -39
- package/src/disbursements/utils/status.ts +0 -62
- package/src/disbursements/utils/utils.spec.ts +0 -42
- package/src/disbursements/utils/utils.ts +0 -24
- package/src/payments/implementations/fake.ts +0 -133
- package/src/payments/implementations/live.ts +0 -87
- package/src/payments/operations/get_access_token.spec.ts +0 -60
- package/src/payments/operations/get_access_token.ts +0 -77
- package/src/payments/operations/get_pay_token.spec.ts +0 -65
- package/src/payments/operations/get_pay_token.ts +0 -66
- package/src/payments/operations/get_payment_status.spec.ts +0 -82
- package/src/payments/operations/get_payment_status.ts +0 -78
- package/src/payments/operations/initialize_om_payment.spec.ts +0 -234
- package/src/payments/operations/initialize_om_payment.ts +0 -191
- package/src/payments/payments.ts +0 -86
- package/src/payments/routes/routes.ts +0 -61
- package/src/payments/utils/constants.ts +0 -120
- package/src/payments/utils/joi_schema.ts +0 -117
- package/src/payments/utils/request_model.ts +0 -103
- package/src/payments/utils/utils.ts +0 -31
- package/src/utils/https.spec.ts +0 -101
- package/src/utils/https.ts +0 -266
- package/src/utils/logging_interface.ts +0 -25
- package/src/utils/utils.ts +0 -5
- package/tsconfig.build.json +0 -4
- package/tsconfig.dev.json +0 -4
- package/tsconfig.json +0 -27
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DisbursementApiRawStatus, DisbursementStatus } from './status';
|
|
2
|
-
import { getStatusFromProviderRawStatus } from './utils';
|
|
3
|
-
|
|
4
|
-
describe('getStatusFromProviderRawStatus', () => {
|
|
5
|
-
test('should map raw status to disbursement status', () => {
|
|
6
|
-
const testCases = [
|
|
7
|
-
{
|
|
8
|
-
rawStatus: DisbursementApiRawStatus.pending,
|
|
9
|
-
expectedStatus: DisbursementStatus.pending,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
rawStatus: DisbursementApiRawStatus.initialized,
|
|
13
|
-
expectedStatus: DisbursementStatus.pending,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
rawStatus: DisbursementApiRawStatus.succeeded,
|
|
17
|
-
expectedStatus: DisbursementStatus.succeeded,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
rawStatus: DisbursementApiRawStatus.succeeded2,
|
|
21
|
-
expectedStatus: DisbursementStatus.succeeded,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
rawStatus: DisbursementApiRawStatus.canceled,
|
|
25
|
-
expectedStatus: DisbursementStatus.failed,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
rawStatus: DisbursementApiRawStatus.expired,
|
|
29
|
-
expectedStatus: DisbursementStatus.failed,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
rawStatus: DisbursementApiRawStatus.failed,
|
|
33
|
-
expectedStatus: DisbursementStatus.failed,
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
testCases.forEach(({ rawStatus, expectedStatus }) => {
|
|
38
|
-
const result = getStatusFromProviderRawStatus(rawStatus);
|
|
39
|
-
expect(result).toBe(expectedStatus);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DisbursementApiRawStatus, DisbursementStatus } from './status';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Maps a raw status from the Disbursement API to a DisbursementStatus.
|
|
5
|
-
*
|
|
6
|
-
* @param {DisbursementApiRawStatus} rawStatus - The raw status from the Disbursement API.
|
|
7
|
-
* @return {DisbursementStatus} The corresponding DisbursementStatus.
|
|
8
|
-
*/
|
|
9
|
-
export function getStatusFromProviderRawStatus(
|
|
10
|
-
rawStatus: DisbursementApiRawStatus
|
|
11
|
-
): DisbursementStatus {
|
|
12
|
-
switch (rawStatus) {
|
|
13
|
-
case DisbursementApiRawStatus.pending:
|
|
14
|
-
case DisbursementApiRawStatus.initialized:
|
|
15
|
-
return DisbursementStatus.pending;
|
|
16
|
-
case DisbursementApiRawStatus.succeeded:
|
|
17
|
-
case DisbursementApiRawStatus.succeeded2:
|
|
18
|
-
return DisbursementStatus.succeeded;
|
|
19
|
-
case DisbursementApiRawStatus.canceled:
|
|
20
|
-
case DisbursementApiRawStatus.expired:
|
|
21
|
-
case DisbursementApiRawStatus.failed:
|
|
22
|
-
return DisbursementStatus.failed;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { OrangeMoneyPaymentStatus } from '../utils/constants';
|
|
2
|
-
import {
|
|
3
|
-
AccessTokenRequestResponse,
|
|
4
|
-
PayTokenRequestResponse,
|
|
5
|
-
} from '../utils/joi_schema';
|
|
6
|
-
import {
|
|
7
|
-
GetAccessTokenResponse,
|
|
8
|
-
GetOrangeMoneyPaymentRequest,
|
|
9
|
-
GetOrangeMoneyPaymentResponse,
|
|
10
|
-
InitializeOrangeMoneyRequest,
|
|
11
|
-
InitializeOrangeMoneyResponse,
|
|
12
|
-
GetPayTokenResponse,
|
|
13
|
-
} from '../utils/request_model';
|
|
14
|
-
import { OrangeMoneyPaymentInterface } from '../payments';
|
|
15
|
-
|
|
16
|
-
const payTokenResponse: PayTokenRequestResponse = {
|
|
17
|
-
message: 'success',
|
|
18
|
-
data: {
|
|
19
|
-
payToken: 'MP220807558VEF7A9C4F09AED',
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const mobileAccessTokenResponse: AccessTokenRequestResponse = {
|
|
24
|
-
access_token: '1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
25
|
-
token_type: 'bearer',
|
|
26
|
-
expires_in: 3600,
|
|
27
|
-
scope: 'read write',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Implement the orange money fake payment.
|
|
32
|
-
*/
|
|
33
|
-
export class OrangeMoneyPaymentFake implements OrangeMoneyPaymentInterface {
|
|
34
|
-
/**
|
|
35
|
-
* Generates a pay token using the provided access token.
|
|
36
|
-
*
|
|
37
|
-
* @return {Promise<GetPayTokenResponse>} A promise that resolves to the pay token response.
|
|
38
|
-
*/
|
|
39
|
-
async getPayToken(): Promise<GetPayTokenResponse> {
|
|
40
|
-
return Promise.resolve({
|
|
41
|
-
raw: payTokenResponse,
|
|
42
|
-
data: 'MP220806C74C8F5787A9C4F79AED',
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Generates an access token.
|
|
48
|
-
*
|
|
49
|
-
* @return {Promise<GetAccessTokenResponse>} the access token response
|
|
50
|
-
*/
|
|
51
|
-
async getAccessToken(): Promise<GetAccessTokenResponse> {
|
|
52
|
-
return Promise.resolve({
|
|
53
|
-
raw: mobileAccessTokenResponse,
|
|
54
|
-
data: '1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves The orange money payment status.
|
|
59
|
-
* @param {MobileParamsForCheckStatus} checkStatusParams the necessary parameters to get the mobile payment status.
|
|
60
|
-
* @return {GetOrangeMoneyPaymentResponse} the response who contains the payment state.
|
|
61
|
-
*/
|
|
62
|
-
async getOrangeMoneyPaymentStatus(
|
|
63
|
-
checkStatusParams: GetOrangeMoneyPaymentRequest
|
|
64
|
-
): Promise<GetOrangeMoneyPaymentResponse> {
|
|
65
|
-
return Promise.resolve({
|
|
66
|
-
raw: {
|
|
67
|
-
message: 'Transaction retrieved successfully',
|
|
68
|
-
data: {
|
|
69
|
-
id: 74581010,
|
|
70
|
-
createtime: '1682001669',
|
|
71
|
-
subscriberMsisdn: '655637944',
|
|
72
|
-
amount: 1100,
|
|
73
|
-
payToken: checkStatusParams.payToken,
|
|
74
|
-
txnid: 'MP230420.1541.C39196',
|
|
75
|
-
txnmode: 'zSapffVPWccheVZQRtvG',
|
|
76
|
-
inittxnmessage:
|
|
77
|
-
'Paiement e la clientele done.The devrez confirmer le paiement en saisissant son code PIN et vous recevrez alors un SMS. Merci dutiliser des services Orange Money.',
|
|
78
|
-
inittxnstatus: '200',
|
|
79
|
-
confirmtxnstatus: '200',
|
|
80
|
-
confirmtxnmessage:
|
|
81
|
-
'Paiement de SPREELOOP reussi par 655637944 PEKE. ID transaction:MP230420.1541.C39196, Montant:1100 FCFA. Solde: 55.81 FCFA.',
|
|
82
|
-
status: OrangeMoneyPaymentStatus.SUCCESSFULL_MOBILE_PAYMENT,
|
|
83
|
-
notifUrl:
|
|
84
|
-
'https://europe-west1-place-prod.cloudfunctions.net/api-1/payment/orange_money/live/zSapffVPWccheVZQRtvG',
|
|
85
|
-
description: 'Commande',
|
|
86
|
-
channelUserMsisdn: '696431937',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
data: {
|
|
90
|
-
status: OrangeMoneyPaymentStatus.SUCCESSFULL_MOBILE_PAYMENT,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Initiates the orange money payment.
|
|
97
|
-
* @param {InitializeOrangeMoneyRequest} mobileInitParams the necessary parameters to initialize the mobile payment.
|
|
98
|
-
* @return {InitializeOrangeMoneyResponse} the response of initialization.
|
|
99
|
-
*
|
|
100
|
-
**/
|
|
101
|
-
async initializeOrangeMoneyPayment(
|
|
102
|
-
mobileInitParams: InitializeOrangeMoneyRequest
|
|
103
|
-
): Promise<InitializeOrangeMoneyResponse> {
|
|
104
|
-
return Promise.resolve({
|
|
105
|
-
raw: {
|
|
106
|
-
message: 'Transaction retrieved successfully',
|
|
107
|
-
data: {
|
|
108
|
-
id: 74581010,
|
|
109
|
-
createtime: '1682001669',
|
|
110
|
-
subscriberMsisdn: '655637944',
|
|
111
|
-
amount: 1100,
|
|
112
|
-
payToken: mobileInitParams.payToken,
|
|
113
|
-
txnid: 'MP230420.1541.C39196',
|
|
114
|
-
txnmode: 'zSapffVPWccheVZQRtvG',
|
|
115
|
-
inittxnmessage:
|
|
116
|
-
'Paiement e la clientele done.The devrez confirmer le paiement en saisissant son code PIN et vous recevrez alors un SMS. Merci dutiliser des services Orange Money.',
|
|
117
|
-
inittxnstatus: '200',
|
|
118
|
-
confirmtxnstatus: '200',
|
|
119
|
-
confirmtxnmessage:
|
|
120
|
-
'Paiement de SPREELOOP reussi par 655637944 PEKE. ID transaction:MP230420.1541.C39196, Montant:1100 FCFA. Solde: 55.81 FCFA.',
|
|
121
|
-
status: OrangeMoneyPaymentStatus.PENDING_PAYMENT,
|
|
122
|
-
notifUrl:
|
|
123
|
-
'https://europe-west1-place-prod.cloudfunctions.net/api-1/payment/orange_money/live/zSapffVPWccheVZQRtvG',
|
|
124
|
-
description: 'Commande',
|
|
125
|
-
channelUserMsisdn: '696431937',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
data: {
|
|
129
|
-
payToken: mobileInitParams.payToken,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { getAccessToken } from '../operations/get_access_token';
|
|
2
|
-
import { getPayToken } from '../operations/get_pay_token';
|
|
3
|
-
import { getPaymentStatus } from '../operations/get_payment_status';
|
|
4
|
-
import { OrangeMoneyPaymentParams } from '../utils/joi_schema';
|
|
5
|
-
|
|
6
|
-
import { initializeOmPayment } from '../operations/initialize_om_payment';
|
|
7
|
-
import { OrangeMoneyPaymentInterface } from '../payments';
|
|
8
|
-
import { Routes } from '../routes/routes';
|
|
9
|
-
import {
|
|
10
|
-
GetAccessTokenResponse,
|
|
11
|
-
GetOrangeMoneyPaymentRequest,
|
|
12
|
-
GetOrangeMoneyPaymentResponse,
|
|
13
|
-
GetPayTokenResponse,
|
|
14
|
-
InitializeOrangeMoneyRequest,
|
|
15
|
-
InitializeOrangeMoneyResponse,
|
|
16
|
-
} from '../utils/request_model';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Implements the orange money live payment.
|
|
20
|
-
*/
|
|
21
|
-
export class OrangeMoneyPaymentLive implements OrangeMoneyPaymentInterface {
|
|
22
|
-
protected readonly config: OrangeMoneyPaymentParams;
|
|
23
|
-
protected readonly route: Routes;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates a new instance of the PaymentConfig class.
|
|
27
|
-
*
|
|
28
|
-
* @param {PaymentConfig} config - The configuration for the PaymentConfig instance.
|
|
29
|
-
*/
|
|
30
|
-
constructor(config: OrangeMoneyPaymentParams) {
|
|
31
|
-
this.config = config;
|
|
32
|
-
this.route = new Routes(config.orangeMoneyVersion);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Gets a pay token using the provided access token.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} accessToken - The access token used to create the pay token.
|
|
39
|
-
* @return {Promise<GetPayTokenResponse>} A promise that resolves to the pay token response.
|
|
40
|
-
*/
|
|
41
|
-
async getPayToken(accessToken: string): Promise<GetPayTokenResponse> {
|
|
42
|
-
return getPayToken(this.config, accessToken, this.route.mobilePayToken());
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Gets an access token.
|
|
47
|
-
*
|
|
48
|
-
* @return {Promise<GetAccessTokenResponse>} the access token response
|
|
49
|
-
*/
|
|
50
|
-
async getAccessToken(): Promise<GetAccessTokenResponse> {
|
|
51
|
-
return getAccessToken(this.config, this.route.mobileAccessToken());
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Initializes the orange money payment.
|
|
56
|
-
*
|
|
57
|
-
* @param {InitializeOrangeMoneyRequest} mobileInitParams - Parameters for mobile initialization
|
|
58
|
-
* @return {Promise<InitializeOrangeMoneyResponse>} A promise that resolves with the mobile payment initialization response
|
|
59
|
-
*/
|
|
60
|
-
async initializeOrangeMoneyPayment(
|
|
61
|
-
mobileInitParams: InitializeOrangeMoneyRequest
|
|
62
|
-
): Promise<InitializeOrangeMoneyResponse> {
|
|
63
|
-
return initializeOmPayment({
|
|
64
|
-
paymentConfig: this.config,
|
|
65
|
-
mobileInitParams: mobileInitParams,
|
|
66
|
-
endPoint: this.route.mobileInitPayment(),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Gets the status of a payment.
|
|
72
|
-
*
|
|
73
|
-
* @param {GetOrangeMoneyPaymentRequest} checkStatusParams - The parameters for checking the status.
|
|
74
|
-
* @return {Promise<GetOrangeMoneyPaymentResponse>} The response containing the payment status.
|
|
75
|
-
*/
|
|
76
|
-
async getOrangeMoneyPaymentStatus(
|
|
77
|
-
checkStatusParams: GetOrangeMoneyPaymentRequest
|
|
78
|
-
): Promise<GetOrangeMoneyPaymentResponse> {
|
|
79
|
-
return getPaymentStatus({
|
|
80
|
-
paymentServiceConfig: this.config,
|
|
81
|
-
mobileStatusVerificationParams: checkStatusParams,
|
|
82
|
-
endPoint: this.route.mobilePaymentStatus({
|
|
83
|
-
payToken: checkStatusParams.payToken,
|
|
84
|
-
}),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as requests from '../../utils/https';
|
|
2
|
-
import { TargetEnvironment } from '../../utils/utils';
|
|
3
|
-
import { AccessTokenRequestResponse } from '../utils/joi_schema';
|
|
4
|
-
|
|
5
|
-
import { getAccessToken } from './get_access_token';
|
|
6
|
-
|
|
7
|
-
const mobileAccessTokenResponse: AccessTokenRequestResponse = {
|
|
8
|
-
access_token: '1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
9
|
-
token_type: 'bearer',
|
|
10
|
-
expires_in: 3600,
|
|
11
|
-
scope: 'read write',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const logger = console;
|
|
15
|
-
describe('Test the generation of access-token', () => {
|
|
16
|
-
it('Generates the access token failed', async () => {
|
|
17
|
-
jest.spyOn(requests, 'postRequest').mockResolvedValue({
|
|
18
|
-
error: {
|
|
19
|
-
responseError: {
|
|
20
|
-
data: [Object],
|
|
21
|
-
status: 401,
|
|
22
|
-
statusText: 'Unauthorized',
|
|
23
|
-
headers: null,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
const result = await getAccessToken(
|
|
28
|
-
{
|
|
29
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
30
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
31
|
-
apiUserName: 'secret',
|
|
32
|
-
apiPassword: 'secret',
|
|
33
|
-
logger: logger,
|
|
34
|
-
},
|
|
35
|
-
'https://api.paytoken.co'
|
|
36
|
-
);
|
|
37
|
-
expect(result.error).toBeDefined();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('Successful generate access token', async () => {
|
|
41
|
-
jest.spyOn(requests, 'postRequest').mockResolvedValue({
|
|
42
|
-
response: {
|
|
43
|
-
data: mobileAccessTokenResponse,
|
|
44
|
-
status: 202,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const result = await getAccessToken(
|
|
49
|
-
{
|
|
50
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
51
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
52
|
-
apiUserName: 'secret',
|
|
53
|
-
apiPassword: 'secret',
|
|
54
|
-
logger: logger,
|
|
55
|
-
},
|
|
56
|
-
'https://api.paytoken.co'
|
|
57
|
-
);
|
|
58
|
-
expect(result.data).toBe('1e23bee1-37dc-3015-a7d6-cb70e566bd64');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
encodeTheBodyOfRequest,
|
|
3
|
-
encodeToBase64,
|
|
4
|
-
postRequest,
|
|
5
|
-
} from '../../utils/https';
|
|
6
|
-
import { ApiErrorType, ApiKey, ConstantRequestField } from '../utils/constants';
|
|
7
|
-
import {
|
|
8
|
-
AccessTokenRequestResponse,
|
|
9
|
-
OrangeMoneyPaymentParams,
|
|
10
|
-
} from '../utils/joi_schema';
|
|
11
|
-
import { GetAccessTokenResponse } from '../utils/request_model';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Gets the access token for the API.
|
|
15
|
-
*
|
|
16
|
-
* @param {OrangeMoneyPaymentParams} paymentConfig - The payment configuration.
|
|
17
|
-
* @param {string} endPoint - The end point route.
|
|
18
|
-
* @return {Promise<GetAccessTokenResponse>} The access token response.
|
|
19
|
-
*/
|
|
20
|
-
export const getAccessToken = async (
|
|
21
|
-
paymentConfig: OrangeMoneyPaymentParams,
|
|
22
|
-
endPoint: string
|
|
23
|
-
): Promise<GetAccessTokenResponse> => {
|
|
24
|
-
const logger = paymentConfig.logger;
|
|
25
|
-
|
|
26
|
-
const encodeToBase64UserAndPassword = encodeToBase64(
|
|
27
|
-
paymentConfig.apiUserName,
|
|
28
|
-
paymentConfig.apiPassword
|
|
29
|
-
);
|
|
30
|
-
const authorization = `Basic ${encodeToBase64UserAndPassword}`;
|
|
31
|
-
const bodyRequest: Record<string, string> = {
|
|
32
|
-
[ApiKey.keyGrantType]: 'client_credentials',
|
|
33
|
-
};
|
|
34
|
-
const options = {
|
|
35
|
-
[ApiKey.keyAuthorization]: authorization,
|
|
36
|
-
[ApiKey.keyContentType]: ConstantRequestField.TypeWwwFrom,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
logger.info(
|
|
40
|
-
`Generates the access token with data: \nheaders: ${JSON.stringify(
|
|
41
|
-
options
|
|
42
|
-
)}\ndata: ${JSON.stringify(
|
|
43
|
-
encodeTheBodyOfRequest(bodyRequest)
|
|
44
|
-
)}\nroute: ${endPoint}`
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const result = await postRequest<AccessTokenRequestResponse>({
|
|
48
|
-
headers: options,
|
|
49
|
-
data: encodeTheBodyOfRequest(bodyRequest),
|
|
50
|
-
route: endPoint,
|
|
51
|
-
logger: logger,
|
|
52
|
-
});
|
|
53
|
-
const accessToken = result.response?.data?.access_token;
|
|
54
|
-
|
|
55
|
-
if (result.error || !accessToken) {
|
|
56
|
-
logger.warn(
|
|
57
|
-
`Request failed to generate the access token. Error retrieved: ${JSON.stringify(
|
|
58
|
-
result.error
|
|
59
|
-
)}`
|
|
60
|
-
);
|
|
61
|
-
return {
|
|
62
|
-
raw: result.error,
|
|
63
|
-
error: ApiErrorType.failedToGenerateAccessToken,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
logger.info(
|
|
68
|
-
`Access token successfully generated with data ${JSON.stringify(
|
|
69
|
-
result.response?.data
|
|
70
|
-
)}`
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
data: accessToken,
|
|
75
|
-
raw: result.response?.data,
|
|
76
|
-
};
|
|
77
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as requests from '../../utils/https';
|
|
2
|
-
|
|
3
|
-
import { TargetEnvironment } from '../../utils/utils';
|
|
4
|
-
import { PayTokenRequestResponse } from '../utils/joi_schema';
|
|
5
|
-
import { getPayToken } from './get_pay_token';
|
|
6
|
-
|
|
7
|
-
const payTokenResponse: PayTokenRequestResponse = {
|
|
8
|
-
message: 'success',
|
|
9
|
-
data: {
|
|
10
|
-
payToken: 'MP220807558VEF7A9C4F09AED',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const logger = console;
|
|
15
|
-
|
|
16
|
-
describe('Test the generation of payToken', () => {
|
|
17
|
-
it('Generate the payToken failed due to invalid credential.', async () => {
|
|
18
|
-
jest.spyOn(requests, 'postRequest').mockImplementationOnce(() =>
|
|
19
|
-
Promise.resolve({
|
|
20
|
-
error: {
|
|
21
|
-
responseError: {
|
|
22
|
-
data: [Object],
|
|
23
|
-
status: 401,
|
|
24
|
-
statusText: 'Unauthorized',
|
|
25
|
-
headers: null,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
const result = await getPayToken(
|
|
31
|
-
{
|
|
32
|
-
logger: logger,
|
|
33
|
-
apiPassword: 'secret',
|
|
34
|
-
apiUserName: 'secret',
|
|
35
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
36
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
37
|
-
},
|
|
38
|
-
'1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
39
|
-
'https://api.paytoken.co'
|
|
40
|
-
);
|
|
41
|
-
expect(result.error).toBeDefined();
|
|
42
|
-
});
|
|
43
|
-
it('Generate the payToken successfully', async () => {
|
|
44
|
-
jest.spyOn(requests, 'postRequest').mockImplementationOnce(() =>
|
|
45
|
-
Promise.resolve({
|
|
46
|
-
response: {
|
|
47
|
-
data: payTokenResponse,
|
|
48
|
-
status: 202,
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
const result = await getPayToken(
|
|
53
|
-
{
|
|
54
|
-
logger: logger,
|
|
55
|
-
apiPassword: 'secret',
|
|
56
|
-
apiUserName: 'secret',
|
|
57
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
58
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
59
|
-
},
|
|
60
|
-
'1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
61
|
-
'https://api.paytoken.co'
|
|
62
|
-
);
|
|
63
|
-
expect(result.data).toBe('MP220807558VEF7A9C4F09AED');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { postRequest } from '../../utils/https';
|
|
2
|
-
import { ApiErrorType, ApiKey, ConstantRequestField } from '../utils/constants';
|
|
3
|
-
import {
|
|
4
|
-
OrangeMoneyPaymentParams,
|
|
5
|
-
PayTokenRequestResponse,
|
|
6
|
-
} from '../utils/joi_schema';
|
|
7
|
-
import { GetPayTokenResponse } from '../utils/request_model';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Gets a pay token using the provided payment configuration.
|
|
11
|
-
*
|
|
12
|
-
* @param {OrangeMoneyPaymentParams} paymentConfig - The payment configuration.
|
|
13
|
-
* @param {OrangeMoneyPaymentParams} accessToken - The payment configuration.
|
|
14
|
-
* @param {string} endPoint - The payToken endpoint.
|
|
15
|
-
* @return {Promise<GetPayTokenResponse>} The generated pay token response.
|
|
16
|
-
*/
|
|
17
|
-
export const getPayToken = async (
|
|
18
|
-
paymentConfig: OrangeMoneyPaymentParams,
|
|
19
|
-
accessToken: string,
|
|
20
|
-
endPoint: string
|
|
21
|
-
): Promise<GetPayTokenResponse> => {
|
|
22
|
-
const logger = paymentConfig.logger;
|
|
23
|
-
|
|
24
|
-
logger.info(
|
|
25
|
-
`Request to generate the pay-token token using the provided payment configuration: ${JSON.stringify(
|
|
26
|
-
paymentConfig
|
|
27
|
-
)}`
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const headers = {
|
|
31
|
-
[ApiKey.keyAuthorization]: `Bearer ${accessToken}`,
|
|
32
|
-
[ApiKey.keyContentType]: ConstantRequestField.typeJson,
|
|
33
|
-
[ApiKey.keyXAuthToken]: paymentConfig.xAuthToken,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const result = await postRequest<PayTokenRequestResponse>({
|
|
37
|
-
headers: headers,
|
|
38
|
-
logger: logger,
|
|
39
|
-
route: endPoint,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const payToken = result.response?.data?.data?.payToken;
|
|
43
|
-
|
|
44
|
-
if (result.error || !payToken) {
|
|
45
|
-
logger.warn(
|
|
46
|
-
`Request failed to generate the pay-token. Error retrieved: ${JSON.stringify(
|
|
47
|
-
result.error
|
|
48
|
-
)}`
|
|
49
|
-
);
|
|
50
|
-
return {
|
|
51
|
-
raw: result.error,
|
|
52
|
-
error: ApiErrorType.failedToGeneratePayToken,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
logger.info(
|
|
57
|
-
`Pay-token generated successfully with data: ${JSON.stringify(
|
|
58
|
-
result.response?.data
|
|
59
|
-
)}`
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
raw: result.response?.data,
|
|
64
|
-
data: payToken,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as requests from '../../utils/https';
|
|
2
|
-
import { OrangeMoneyPaymentStatus } from '../utils/constants';
|
|
3
|
-
|
|
4
|
-
import { TargetEnvironment } from '../../utils/utils';
|
|
5
|
-
import { GetOrangeMoneyPaymentRequest } from '../utils/request_model';
|
|
6
|
-
import { getPaymentStatus } from './get_payment_status';
|
|
7
|
-
|
|
8
|
-
const logger = console;
|
|
9
|
-
describe('Test the status verification', () => {
|
|
10
|
-
const mobilePaymentParamForCheckStatus: GetOrangeMoneyPaymentRequest = {
|
|
11
|
-
accessToken: '1e23bee1-37dc-3015-a7d6-cb70e566bd64',
|
|
12
|
-
payToken: 'MP220807558VEF7A9C4F09AED',
|
|
13
|
-
};
|
|
14
|
-
it('Return the payment status', async () => {
|
|
15
|
-
jest.spyOn(requests, 'getRequest').mockResolvedValue({
|
|
16
|
-
response: {
|
|
17
|
-
status: 200,
|
|
18
|
-
data: {
|
|
19
|
-
message: 'Transaction retrieved successfully',
|
|
20
|
-
data: {
|
|
21
|
-
id: 74581010,
|
|
22
|
-
createtime: '1682001669',
|
|
23
|
-
subscriberMsisdn: '655637944',
|
|
24
|
-
amount: 1100,
|
|
25
|
-
payToken: 'MP23042031A1724A914DF0382D01',
|
|
26
|
-
txnid: 'MP230420.1541.C39196',
|
|
27
|
-
txnmode: 'zSapffVPWccheVZQRtvG',
|
|
28
|
-
inittxnmessage:
|
|
29
|
-
'Paiement e la clientele done.The devrez confirmer le paiement en saisissant son code PIN et vous recevrez alors un SMS. Merci dutiliser des services Orange Money.',
|
|
30
|
-
inittxnstatus: '200',
|
|
31
|
-
confirmtxnstatus: '200',
|
|
32
|
-
confirmtxnmessage:
|
|
33
|
-
'Paiement de SPREELOOP reussi par 655637944 PEKE. ID transaction:MP230420.1541.C39196, Montant:1100 FCFA. Solde: 55.81 FCFA.',
|
|
34
|
-
status: 'SUCCESSFULL',
|
|
35
|
-
notifUrl:
|
|
36
|
-
'https://europe-west1-place-prod.cloudfunctions.net/api-1/payment/orange_money/live/zSapffVPWccheVZQRtvG',
|
|
37
|
-
description: 'Commande',
|
|
38
|
-
channelUserMsisdn: '696431937',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const result = await getPaymentStatus({
|
|
44
|
-
mobileStatusVerificationParams: mobilePaymentParamForCheckStatus,
|
|
45
|
-
paymentServiceConfig: {
|
|
46
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
47
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
48
|
-
apiUserName: 'secret',
|
|
49
|
-
apiPassword: 'secret',
|
|
50
|
-
logger: logger,
|
|
51
|
-
},
|
|
52
|
-
endPoint: 'https://api.paytoken.co',
|
|
53
|
-
});
|
|
54
|
-
expect(result.data?.status).toBe(
|
|
55
|
-
OrangeMoneyPaymentStatus.SUCCESSFULL_MOBILE_PAYMENT
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
it('Return the error response', async () => {
|
|
59
|
-
jest.spyOn(requests, 'getRequest').mockResolvedValue({
|
|
60
|
-
error: {
|
|
61
|
-
responseError: {
|
|
62
|
-
data: [Object],
|
|
63
|
-
status: 401,
|
|
64
|
-
statusText: 'Unauthorized',
|
|
65
|
-
headers: null,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
const result = await getPaymentStatus({
|
|
70
|
-
mobileStatusVerificationParams: mobilePaymentParamForCheckStatus,
|
|
71
|
-
paymentServiceConfig: {
|
|
72
|
-
targetEnvironment: TargetEnvironment.fake,
|
|
73
|
-
xAuthToken: 'ABCDEGHIJKLMNOPQRSTUVW',
|
|
74
|
-
apiUserName: 'secret',
|
|
75
|
-
apiPassword: 'secret',
|
|
76
|
-
logger: logger,
|
|
77
|
-
},
|
|
78
|
-
endPoint: 'https://api.paytoken.co',
|
|
79
|
-
});
|
|
80
|
-
expect(result.error).toBeDefined();
|
|
81
|
-
});
|
|
82
|
-
});
|