@spreeloop/orange_money 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +47 -0
- package/.prettierrc +6 -0
- package/README.md +192 -0
- package/babel.config.js +3 -0
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +18 -0
- package/dist/logging/index.js.map +1 -0
- 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/main.js +3 -0
- package/dist/main.js.LICENSE.txt +1 -0
- package/dist/main.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/common/utils/https.d.ts +77 -0
- package/dist/orange_money/src/common/utils/https.d.ts.map +1 -0
- package/dist/orange_money/src/common/utils/https.js +240 -0
- package/dist/orange_money/src/common/utils/https.js.map +1 -0
- package/dist/orange_money/src/common/utils/https.spec.d.ts +2 -0
- package/dist/orange_money/src/common/utils/https.spec.d.ts.map +1 -0
- package/dist/orange_money/src/common/utils/https.spec.js +77 -0
- package/dist/orange_money/src/common/utils/https.spec.js.map +1 -0
- package/dist/orange_money/src/common/utils/logging_interface.d.ts +23 -0
- package/dist/orange_money/src/common/utils/logging_interface.d.ts.map +1 -0
- package/dist/orange_money/src/common/utils/logging_interface.js +3 -0
- package/dist/orange_money/src/common/utils/logging_interface.js.map +1 -0
- package/dist/orange_money/src/common/utils/operation_response.d.ts +16 -0
- package/dist/orange_money/src/common/utils/operation_response.d.ts.map +1 -0
- package/dist/orange_money/src/common/utils/operation_response.js +3 -0
- package/dist/orange_money/src/common/utils/operation_response.js.map +1 -0
- package/dist/orange_money/src/common/utils/utils.d.ts +6 -0
- package/dist/orange_money/src/common/utils/utils.d.ts.map +1 -0
- package/dist/orange_money/src/common/utils/utils.js +10 -0
- package/dist/orange_money/src/common/utils/utils.js.map +1 -0
- package/dist/orange_money/src/constants.d.ts +95 -0
- package/dist/orange_money/src/constants.d.ts.map +1 -0
- package/dist/orange_money/src/constants.js +111 -0
- package/dist/orange_money/src/constants.js.map +1 -0
- package/dist/orange_money/src/disbursements/implementations/disbursement_service.d.ts +63 -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 +45 -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/dist/orange_money/src/disbursements/utils/https.d.ts +74 -0
- package/dist/orange_money/src/disbursements/utils/https.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/https.js +206 -0
- package/dist/orange_money/src/disbursements/utils/https.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/https.spec.d.ts +2 -0
- package/dist/orange_money/src/disbursements/utils/https.spec.d.ts.map +1 -0
- package/dist/orange_money/src/disbursements/utils/https.spec.js +77 -0
- package/dist/orange_money/src/disbursements/utils/https.spec.js.map +1 -0
- package/dist/orange_money/src/disbursements/utils/regex.d.ts +9 -0
- 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/dist/orange_money/src/index.d.ts +8 -0
- package/dist/orange_money/src/index.d.ts.map +1 -0
- package/dist/orange_money/src/index.js +21 -0
- package/dist/orange_money/src/index.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money.d.ts +58 -0
- package/dist/orange_money/src/orange_money/orange_money.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money.js +33 -0
- package/dist/orange_money/src/orange_money/orange_money.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.d.ts +7 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.js +16 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.d.ts +29 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.js +67 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.d.ts +2 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.js +51 -0
- package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.d.ts +105 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.js +459 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.d.ts +2 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.js +497 -0
- package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.js.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.d.ts +26 -0
- package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.d.ts.map +1 -0
- package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.js +26 -0
- package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.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/implementations/payment_service.d.ts +44 -0
- package/dist/orange_money/src/payments/implementations/payment_service.d.ts.map +1 -0
- package/dist/orange_money/src/payments/implementations/payment_service.js +44 -0
- package/dist/orange_money/src/payments/implementations/payment_service.js.map +1 -0
- package/dist/orange_money/src/payments/implementations/src/fake.d.ts +31 -0
- package/dist/orange_money/src/payments/implementations/src/fake.d.ts.map +1 -0
- package/dist/orange_money/src/payments/implementations/src/fake.js +62 -0
- package/dist/orange_money/src/payments/implementations/src/fake.js.map +1 -0
- package/dist/orange_money/src/payments/implementations/src/live.d.ts +29 -0
- package/dist/orange_money/src/payments/implementations/src/live.d.ts.map +1 -0
- package/dist/orange_money/src/payments/implementations/src/live.js +44 -0
- package/dist/orange_money/src/payments/implementations/src/live.js.map +1 -0
- package/dist/orange_money/src/payments/operations/create_access_token.d.ts +19 -0
- package/dist/orange_money/src/payments/operations/create_access_token.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/create_access_token.js +51 -0
- package/dist/orange_money/src/payments/operations/create_access_token.js.map +1 -0
- package/dist/orange_money/src/payments/operations/create_access_token.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/create_access_token.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/create_access_token.spec.js +70 -0
- package/dist/orange_money/src/payments/operations/create_access_token.spec.js.map +1 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.d.ts +12 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.js +62 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.js.map +1 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.spec.js +91 -0
- package/dist/orange_money/src/payments/operations/create_pay_token.spec.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 +75 -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 +75 -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 +102 -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 +246 -0
- package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.js.map +1 -0
- package/dist/orange_money/src/payments/operations/payment.d.ts +21 -0
- package/dist/orange_money/src/payments/operations/payment.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/payment.js +204 -0
- package/dist/orange_money/src/payments/operations/payment.js.map +1 -0
- package/dist/orange_money/src/payments/operations/payment.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/operations/payment.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/operations/payment.spec.js +282 -0
- package/dist/orange_money/src/payments/operations/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 +100 -0
- package/dist/orange_money/src/payments/utils/constants.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/constants.js +117 -0
- package/dist/orange_money/src/payments/utils/constants.js.map +1 -0
- package/dist/orange_money/src/payments/utils/https.d.ts +43 -0
- package/dist/orange_money/src/payments/utils/https.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/https.js +137 -0
- package/dist/orange_money/src/payments/utils/https.js.map +1 -0
- package/dist/orange_money/src/payments/utils/joi_schema.d.ts +71 -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/logging_interface.d.ts +23 -0
- package/dist/orange_money/src/payments/utils/logging_interface.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/logging_interface.js +3 -0
- package/dist/orange_money/src/payments/utils/logging_interface.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/payments/utils/utils.spec.d.ts +2 -0
- package/dist/orange_money/src/payments/utils/utils.spec.d.ts.map +1 -0
- package/dist/orange_money/src/payments/utils/utils.spec.js +17 -0
- package/dist/orange_money/src/payments/utils/utils.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/dist/orange_money/src/utils/requests_responses.d.ts +118 -0
- package/dist/orange_money/src/utils/requests_responses.d.ts.map +1 -0
- package/dist/orange_money/src/utils/requests_responses.js +31 -0
- package/dist/orange_money/src/utils/requests_responses.js.map +1 -0
- package/dist/orange_money/src/utils/resquest_params.d.ts +222 -0
- package/dist/orange_money/src/utils/resquest_params.d.ts.map +1 -0
- package/dist/orange_money/src/utils/resquest_params.js +57 -0
- package/dist/orange_money/src/utils/resquest_params.js.map +1 -0
- package/dist/orange_money/src/utils/utils.d.ts +65 -0
- package/dist/orange_money/src/utils/utils.d.ts.map +1 -0
- package/dist/orange_money/src/utils/utils.js +199 -0
- package/dist/orange_money/src/utils/utils.js.map +1 -0
- package/dist/orange_money/src/utils/utils.spec.d.ts +2 -0
- package/dist/orange_money/src/utils/utils.spec.d.ts.map +1 -0
- package/dist/orange_money/src/utils/utils.spec.js +17 -0
- package/dist/orange_money/src/utils/utils.spec.js.map +1 -0
- package/index.spec.ts +9 -0
- package/index.ts +1 -0
- package/jest.before-test.ts +3 -0
- package/jest.config.ts +54 -0
- package/package.json +52 -0
- package/src/disbursements/implementations/disbursement_service.ts +133 -0
- package/src/disbursements/implementations/src/live.ts +79 -0
- package/src/disbursements/implementations/src/sandbox.ts +124 -0
- package/src/disbursements/operations/create_access_token.spec.ts +87 -0
- package/src/disbursements/operations/create_access_token.ts +83 -0
- package/src/disbursements/operations/get_transfer_status.spec.ts +132 -0
- package/src/disbursements/operations/get_transfer_status.ts +265 -0
- package/src/disbursements/operations/transfer.spec.ts +158 -0
- package/src/disbursements/operations/transfer.ts +125 -0
- package/src/disbursements/routes/routes.ts +54 -0
- package/src/disbursements/utils/constants.ts +4 -0
- package/src/disbursements/utils/regex.spec.ts +39 -0
- package/src/disbursements/utils/regex.ts +10 -0
- package/src/disbursements/utils/status.ts +62 -0
- package/src/disbursements/utils/utils.spec.ts +42 -0
- package/src/disbursements/utils/utils.ts +24 -0
- package/src/index.ts +9 -0
- package/src/payments/implementations/fake.ts +133 -0
- package/src/payments/implementations/live.ts +87 -0
- package/src/payments/operations/get_access_token.spec.ts +60 -0
- package/src/payments/operations/get_access_token.ts +77 -0
- package/src/payments/operations/get_pay_token.spec.ts +65 -0
- package/src/payments/operations/get_pay_token.ts +66 -0
- package/src/payments/operations/get_payment_status.spec.ts +82 -0
- package/src/payments/operations/get_payment_status.ts +78 -0
- package/src/payments/operations/initialize_om_payment.spec.ts +234 -0
- package/src/payments/operations/initialize_om_payment.ts +191 -0
- package/src/payments/payments.ts +86 -0
- package/src/payments/routes/routes.ts +61 -0
- package/src/payments/utils/constants.ts +120 -0
- package/src/payments/utils/joi_schema.ts +117 -0
- package/src/payments/utils/request_model.ts +103 -0
- package/src/payments/utils/utils.ts +31 -0
- package/src/utils/https.spec.ts +101 -0
- package/src/utils/https.ts +266 -0
- package/src/utils/logging_interface.ts +25 -0
- package/src/utils/operation_response.ts +17 -0
- package/src/utils/utils.ts +5 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.dev.json +4 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TransferRequest,
|
|
3
|
+
TransferResponse,
|
|
4
|
+
transfer,
|
|
5
|
+
} from '../../operations/transfer';
|
|
6
|
+
import {
|
|
7
|
+
CreateAccessTokenResponse,
|
|
8
|
+
createAccessToken,
|
|
9
|
+
} from '../../operations/create_access_token';
|
|
10
|
+
import { Routes } from '../../routes/routes';
|
|
11
|
+
import {
|
|
12
|
+
DisbursementInterface,
|
|
13
|
+
DisbursementServiceConfig,
|
|
14
|
+
} from '../disbursement_service';
|
|
15
|
+
import {
|
|
16
|
+
GetTransferStatusRequest,
|
|
17
|
+
GetTransferStatusResponse,
|
|
18
|
+
getTransferStatus,
|
|
19
|
+
} from '../../operations/get_transfer_status';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Orange Money API Live Disbursement.
|
|
23
|
+
* @class
|
|
24
|
+
*/
|
|
25
|
+
export class DisbursementLive implements DisbursementInterface {
|
|
26
|
+
protected readonly config: DisbursementServiceConfig;
|
|
27
|
+
protected readonly routes: Routes;
|
|
28
|
+
/**
|
|
29
|
+
* Constructs a new {Disbursement}.
|
|
30
|
+
* @constructor
|
|
31
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
32
|
+
*/
|
|
33
|
+
constructor(config: DisbursementServiceConfig) {
|
|
34
|
+
this.routes = new Routes();
|
|
35
|
+
this.config = config;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates an access token.
|
|
40
|
+
*
|
|
41
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
42
|
+
*/
|
|
43
|
+
async createAccessToken(): Promise<CreateAccessTokenResponse> {
|
|
44
|
+
return await createAccessToken({
|
|
45
|
+
configs: this.config,
|
|
46
|
+
endPoint: this.routes.createAccessToken(),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Transfers the specified amount of money from one account to another.
|
|
52
|
+
*
|
|
53
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
54
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
55
|
+
*/
|
|
56
|
+
async transfer(params: TransferRequest): Promise<TransferResponse> {
|
|
57
|
+
return await transfer({
|
|
58
|
+
configs: this.config,
|
|
59
|
+
params: params,
|
|
60
|
+
endPoint: this.routes.transfer(),
|
|
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
|
+
params: GetTransferStatusRequest
|
|
72
|
+
): Promise<GetTransferStatusResponse> {
|
|
73
|
+
return await getTransferStatus({
|
|
74
|
+
configs: this.config,
|
|
75
|
+
params: params,
|
|
76
|
+
endPoint: this.routes.transferStatus(params.messageId),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { TransferResponse } from '../../operations/transfer';
|
|
2
|
+
import { CreateAccessTokenResponse } from '../../operations/create_access_token';
|
|
3
|
+
import { Routes } from '../../routes/routes';
|
|
4
|
+
import {
|
|
5
|
+
DisbursementInterface,
|
|
6
|
+
DisbursementServiceConfig,
|
|
7
|
+
} from '../disbursement_service';
|
|
8
|
+
import {
|
|
9
|
+
DisbursementStep,
|
|
10
|
+
GetTransferStatusResponse,
|
|
11
|
+
} from '../../operations/get_transfer_status';
|
|
12
|
+
import {
|
|
13
|
+
DisbursementApiRawStatus,
|
|
14
|
+
DisbursementStatus,
|
|
15
|
+
} from '../../utils/status';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Orange Money API Fake Disbursement.
|
|
19
|
+
* @class
|
|
20
|
+
*/
|
|
21
|
+
export class DisbursementFake implements DisbursementInterface {
|
|
22
|
+
protected readonly config: DisbursementServiceConfig;
|
|
23
|
+
protected readonly routes: Routes;
|
|
24
|
+
/**
|
|
25
|
+
* Constructs a new {Disbursement}.
|
|
26
|
+
* @constructor
|
|
27
|
+
* @param {DisbursementServiceConfig} config - The required global route configuration.
|
|
28
|
+
*/
|
|
29
|
+
constructor(config: DisbursementServiceConfig) {
|
|
30
|
+
this.routes = new Routes();
|
|
31
|
+
this.config = config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates an access token.
|
|
36
|
+
*
|
|
37
|
+
* @return {Promise<CreateAccessTokenResponse>} The method response containing a string and a token.
|
|
38
|
+
*/
|
|
39
|
+
async createAccessToken(): Promise<CreateAccessTokenResponse> {
|
|
40
|
+
return {
|
|
41
|
+
data: 'accessToken',
|
|
42
|
+
raw: {
|
|
43
|
+
access_token: 'accessToken',
|
|
44
|
+
token_type: 'Bearer',
|
|
45
|
+
expires_in: '300',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Transfers the specified amount of money from one account to another.
|
|
52
|
+
*
|
|
53
|
+
* @param {TransferRequest} params - The parameters for the transfer.
|
|
54
|
+
* @return {Promise<TransferResponse>} - The response from the transfer method.
|
|
55
|
+
*/
|
|
56
|
+
async transfer(): Promise<TransferResponse> {
|
|
57
|
+
return {
|
|
58
|
+
data: 'f7ec5a39-b1ad-4fa5-a734-60ab4217ba75',
|
|
59
|
+
raw: {
|
|
60
|
+
MD5OfMessageBody: '4b55cf6629b5f0ee3c8ac91435a2eb35',
|
|
61
|
+
MD5OfMessageAttributes: '50e3084aee2bf840dd63b6bbf0a62fa9',
|
|
62
|
+
MessageId: 'f7ec5a39-b1ad-4fa5-a734-60ab4217ba75',
|
|
63
|
+
ResponseMetadata: {
|
|
64
|
+
RequestId: 'bbb43d42-95d1-5a6b-92a7-60c0d420e103',
|
|
65
|
+
HTTPStatusCode: 200,
|
|
66
|
+
HTTPHeaders: {
|
|
67
|
+
'x-amzn-requestid': 'bbb43d42-95d1-5a6b-92a7-60c0d420e103',
|
|
68
|
+
'x-amzn-trace-id':
|
|
69
|
+
'Root=1-65083fb1-37fbf881380338ed3b5fcd2b;Parent=6bfc3c24556c9b27;Sampled=0;Lineage=79e6faf7:0',
|
|
70
|
+
date: 'Mon, 18 Sep 2023 12:16:49 GMT',
|
|
71
|
+
'content-type': 'text/xml',
|
|
72
|
+
'content-length': '459',
|
|
73
|
+
},
|
|
74
|
+
RetryAttempts: 0,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves the status of a transfer.
|
|
82
|
+
*
|
|
83
|
+
* @param {GetTransferStatusRequest} params - The parameters for retrieving the transfer status.
|
|
84
|
+
* @return {Promise<GetTransferStatusResponse>} - The method response containing the status and transfer status response.
|
|
85
|
+
*/
|
|
86
|
+
async getTransferStatus(): Promise<GetTransferStatusResponse> {
|
|
87
|
+
return {
|
|
88
|
+
data: {
|
|
89
|
+
status: DisbursementStatus.succeeded,
|
|
90
|
+
refundStep: DisbursementStep.TransferSent,
|
|
91
|
+
},
|
|
92
|
+
raw: {
|
|
93
|
+
result: {
|
|
94
|
+
message: 'Cash in performed successfully',
|
|
95
|
+
data: {
|
|
96
|
+
subscriberMsisdn: 'subscriberMsisdn',
|
|
97
|
+
channelUserMsisdn: 'channelUserMsisdn',
|
|
98
|
+
createtime: '1695039280',
|
|
99
|
+
amount: 100,
|
|
100
|
+
payToken: 'C2C2309183CB702A1CBB39ECE32C',
|
|
101
|
+
txnid: 'PP230918.1314.B57973',
|
|
102
|
+
txnmode: 'refundYNote',
|
|
103
|
+
txnstatus: '00068',
|
|
104
|
+
orderId: 'refundYNote',
|
|
105
|
+
status: DisbursementApiRawStatus.succeeded,
|
|
106
|
+
description: 'Remboursement Fond',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
parameters: {
|
|
110
|
+
amount: '100',
|
|
111
|
+
xauth: 'WU5PVEVIRUFEOllOT1RFSEVBRDIwMjA=',
|
|
112
|
+
channel_user_msisdn: 'channel_user_msisdn',
|
|
113
|
+
customer_key: 'customer_key',
|
|
114
|
+
customer_secret: 'customer_secret',
|
|
115
|
+
final_customer_name: 'Steve',
|
|
116
|
+
final_customer_phone: '692232239',
|
|
117
|
+
},
|
|
118
|
+
CreateAt: '09-18-2023 12:14:43',
|
|
119
|
+
MessageId: 'caee8310-02fa-45da-9b22-a1effcada25c',
|
|
120
|
+
RefundStep: DisbursementStep.TransferSent,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
|
+
import { Logger } from '../../../../logging/src/logging';
|
|
3
|
+
import * as requests from '../../utils/https';
|
|
4
|
+
import { DisbursementXTargetEnvironmentType } from '../utils/constants';
|
|
5
|
+
import { Token, createAccessToken } from './create_access_token';
|
|
6
|
+
|
|
7
|
+
describe('createAccessToken', () => {
|
|
8
|
+
it('Should fail on invalid parameter', async () => {
|
|
9
|
+
const result = await createAccessToken({
|
|
10
|
+
endPoint: '',
|
|
11
|
+
configs: {
|
|
12
|
+
channelUserMsisdn: '',
|
|
13
|
+
clientId: '',
|
|
14
|
+
clientSecret: '',
|
|
15
|
+
customerKey: '',
|
|
16
|
+
customerSecret: '',
|
|
17
|
+
pin: '',
|
|
18
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
19
|
+
logger: new Logger(),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
expect(result.data).toBeUndefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('Should fail on request rejection', async () => {
|
|
26
|
+
const errorMessage = 'mock reject the request';
|
|
27
|
+
const postSpy = jest
|
|
28
|
+
.spyOn(requests, 'postRequest')
|
|
29
|
+
.mockImplementation()
|
|
30
|
+
.mockResolvedValue({ error: new AxiosError(errorMessage) });
|
|
31
|
+
|
|
32
|
+
const result = await createAccessToken({
|
|
33
|
+
endPoint: 'https://route.com/link',
|
|
34
|
+
configs: {
|
|
35
|
+
channelUserMsisdn: '237699947943',
|
|
36
|
+
clientId: 'clientId',
|
|
37
|
+
clientSecret: 'clientSecret',
|
|
38
|
+
customerKey: 'customerKey',
|
|
39
|
+
customerSecret: 'customerSecret',
|
|
40
|
+
pin: 'pin',
|
|
41
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
42
|
+
logger: new Logger(),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(postSpy).toHaveBeenCalledTimes(1);
|
|
47
|
+
expect(result.data).toBeUndefined();
|
|
48
|
+
expect(result.error).toBeDefined();
|
|
49
|
+
postSpy.mockRestore();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('Should successfully retrieve token', async () => {
|
|
53
|
+
const accessToken = 'THEaCCESStOKEN';
|
|
54
|
+
const postSpy = jest
|
|
55
|
+
.spyOn(requests, 'postRequest')
|
|
56
|
+
.mockImplementation()
|
|
57
|
+
.mockResolvedValue({
|
|
58
|
+
response: <AxiosResponse<Token>>{
|
|
59
|
+
data: {
|
|
60
|
+
access_token: accessToken,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const result = await createAccessToken({
|
|
66
|
+
endPoint: 'https://route.com/link',
|
|
67
|
+
configs: {
|
|
68
|
+
channelUserMsisdn: '237699947943',
|
|
69
|
+
clientId: 'clientId',
|
|
70
|
+
clientSecret: 'clientSecret',
|
|
71
|
+
customerKey: 'customerKey',
|
|
72
|
+
customerSecret: 'customerSecret',
|
|
73
|
+
pin: 'pin',
|
|
74
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
75
|
+
logger: new Logger(),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
expect(postSpy).toHaveBeenCalledTimes(1);
|
|
80
|
+
expect(result.error).toBeUndefined();
|
|
81
|
+
expect(result.raw).toEqual({
|
|
82
|
+
access_token: accessToken,
|
|
83
|
+
});
|
|
84
|
+
expect(result.data).toBe(accessToken);
|
|
85
|
+
postSpy.mockRestore();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RequestResponse,
|
|
3
|
+
encodeDataToXFormUrl,
|
|
4
|
+
hash,
|
|
5
|
+
postRequest,
|
|
6
|
+
} from '../../utils/https';
|
|
7
|
+
import { OperationResponse } from '../../utils/operation_response';
|
|
8
|
+
import {
|
|
9
|
+
DisbursementServiceConfig,
|
|
10
|
+
DisbursementServiceConfigSchema,
|
|
11
|
+
} from '../implementations/disbursement_service';
|
|
12
|
+
|
|
13
|
+
export type Token = {
|
|
14
|
+
/**
|
|
15
|
+
* The requested token.
|
|
16
|
+
*/
|
|
17
|
+
access_token: string;
|
|
18
|
+
|
|
19
|
+
scope?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The type of the requested token.
|
|
23
|
+
*/
|
|
24
|
+
token_type: string;
|
|
25
|
+
|
|
26
|
+
/** The time to live in seconds. */
|
|
27
|
+
expires_in: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type CreateAccessTokenResponse = OperationResponse<string, Token>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates an access token.
|
|
34
|
+
*
|
|
35
|
+
* @param {CreateAccessTokenRequest} configs - The disbursement service config.
|
|
36
|
+
* @param {string} endPoint - The end point.
|
|
37
|
+
* @return {CreateAccessTokenResponse} The method response containing the access token and raw response.
|
|
38
|
+
*/
|
|
39
|
+
export async function createAccessToken({
|
|
40
|
+
configs,
|
|
41
|
+
endPoint,
|
|
42
|
+
}: {
|
|
43
|
+
configs: DisbursementServiceConfig;
|
|
44
|
+
endPoint: string;
|
|
45
|
+
}): Promise<CreateAccessTokenResponse> {
|
|
46
|
+
const logger = configs.logger;
|
|
47
|
+
logger.info('createAccessToken is running ...');
|
|
48
|
+
const { error: configsValidationError, value: configValues } =
|
|
49
|
+
DisbursementServiceConfigSchema.validate(configs);
|
|
50
|
+
|
|
51
|
+
if (configsValidationError) {
|
|
52
|
+
logger.error(
|
|
53
|
+
`Invalid DisbursementServiceConfig request parameters. params : ${JSON.stringify(
|
|
54
|
+
configsValidationError.details
|
|
55
|
+
)}`
|
|
56
|
+
);
|
|
57
|
+
return { error: configsValidationError.details };
|
|
58
|
+
}
|
|
59
|
+
const authorization = hash(configValues.clientId, configValues.clientSecret);
|
|
60
|
+
const headers = {
|
|
61
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
62
|
+
Authorization: `Basic ${authorization}`,
|
|
63
|
+
};
|
|
64
|
+
const body = encodeDataToXFormUrl({
|
|
65
|
+
grant_type: 'client_credentials',
|
|
66
|
+
});
|
|
67
|
+
const response: RequestResponse<Token> = await postRequest<Token>({
|
|
68
|
+
logger: logger,
|
|
69
|
+
route: endPoint,
|
|
70
|
+
data: body,
|
|
71
|
+
headers: headers,
|
|
72
|
+
rejectUnauthorized: false,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!response.response) {
|
|
76
|
+
return { error: response.error };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
data: response.response.data.access_token,
|
|
81
|
+
raw: response.response.data,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { Logger } from '../../../../logging/src/logging';
|
|
3
|
+
import * as requests from '../../utils/https';
|
|
4
|
+
import { DisbursementXTargetEnvironmentType } from '../utils/constants';
|
|
5
|
+
import { DisbursementApiRawStatus, DisbursementStatus } from '../utils/status';
|
|
6
|
+
import { DisbursementStep, getTransferStatus } from './get_transfer_status';
|
|
7
|
+
|
|
8
|
+
describe('getTransferStatus', () => {
|
|
9
|
+
it('should fail on invalid parameter provided', async () => {
|
|
10
|
+
const { error, data, raw } = await getTransferStatus({
|
|
11
|
+
configs: {
|
|
12
|
+
channelUserMsisdn: '',
|
|
13
|
+
clientId: '',
|
|
14
|
+
clientSecret: '',
|
|
15
|
+
customerKey: '',
|
|
16
|
+
customerSecret: '',
|
|
17
|
+
pin: '',
|
|
18
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
19
|
+
logger: new Logger(),
|
|
20
|
+
},
|
|
21
|
+
params: {
|
|
22
|
+
token: 55 as unknown as string,
|
|
23
|
+
messageId: 'messageId',
|
|
24
|
+
},
|
|
25
|
+
endPoint: 'https://example.com',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
expect(data).not.toBeDefined();
|
|
29
|
+
expect(raw).not.toBeDefined();
|
|
30
|
+
expect(error).toBeDefined();
|
|
31
|
+
});
|
|
32
|
+
it('should fail on request failure', async () => {
|
|
33
|
+
const requestSpy = jest
|
|
34
|
+
.spyOn(requests, 'getRequest')
|
|
35
|
+
.mockImplementation()
|
|
36
|
+
.mockResolvedValue({
|
|
37
|
+
error: {},
|
|
38
|
+
});
|
|
39
|
+
const { error, data, raw } = await getTransferStatus({
|
|
40
|
+
configs: {
|
|
41
|
+
channelUserMsisdn: '237699947943',
|
|
42
|
+
clientId: 'clientId',
|
|
43
|
+
clientSecret: 'clientSecret',
|
|
44
|
+
customerKey: 'customerKey',
|
|
45
|
+
customerSecret: 'customerSecret',
|
|
46
|
+
pin: 'pin',
|
|
47
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
48
|
+
logger: new Logger(),
|
|
49
|
+
},
|
|
50
|
+
params: {
|
|
51
|
+
token: 'token',
|
|
52
|
+
messageId: 'messageId',
|
|
53
|
+
},
|
|
54
|
+
endPoint: 'https://example.com',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
expect(data).not.toBeDefined();
|
|
58
|
+
expect(raw).not.toBeDefined();
|
|
59
|
+
expect(requestSpy).toHaveBeenCalledTimes(1);
|
|
60
|
+
expect(error).toBeDefined();
|
|
61
|
+
});
|
|
62
|
+
it('should succeed on request succeed', async () => {
|
|
63
|
+
const succeedEg = {
|
|
64
|
+
result: {
|
|
65
|
+
message: 'message',
|
|
66
|
+
data: {
|
|
67
|
+
createtime: 'createtime',
|
|
68
|
+
subscriberMsisdn: 'subscriberMsisdn',
|
|
69
|
+
amount: 500,
|
|
70
|
+
payToken: 'payToken',
|
|
71
|
+
txnid: 'txnid',
|
|
72
|
+
txnmode: 'txnmode',
|
|
73
|
+
txnstatus: 'txnstatus',
|
|
74
|
+
orderId: 'orderId',
|
|
75
|
+
status: DisbursementApiRawStatus.succeeded,
|
|
76
|
+
channelUserMsisdn: 'channelUserMsisdn',
|
|
77
|
+
description: 'description',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
parameters: {
|
|
81
|
+
amount: 500,
|
|
82
|
+
xauth: 'xauth',
|
|
83
|
+
channel_user_msisdn: 'channel_user_msisdn',
|
|
84
|
+
customer_key: 'customer_key',
|
|
85
|
+
customer_secret: 'customer_secret',
|
|
86
|
+
final_customer_name: 'final_customer_name',
|
|
87
|
+
final_customer_phone: 'final_customer_phone',
|
|
88
|
+
},
|
|
89
|
+
CreateAt: 'CreateAt',
|
|
90
|
+
MessageId: 'MessageId',
|
|
91
|
+
RefundStep: DisbursementStep.TransferSent,
|
|
92
|
+
};
|
|
93
|
+
const requestSpy = jest
|
|
94
|
+
.spyOn(requests, 'getRequest')
|
|
95
|
+
.mockImplementation()
|
|
96
|
+
.mockResolvedValue({
|
|
97
|
+
response: { data: Object(succeedEg) } as AxiosResponse<
|
|
98
|
+
unknown,
|
|
99
|
+
unknown
|
|
100
|
+
>,
|
|
101
|
+
});
|
|
102
|
+
const { error, data, raw } = await getTransferStatus({
|
|
103
|
+
configs: {
|
|
104
|
+
channelUserMsisdn: '237699947943',
|
|
105
|
+
clientId: 'clientId',
|
|
106
|
+
clientSecret: 'clientSecret',
|
|
107
|
+
customerKey: 'customerKey',
|
|
108
|
+
customerSecret: 'customerSecret',
|
|
109
|
+
pin: 'pin',
|
|
110
|
+
environment: DisbursementXTargetEnvironmentType.sandbox,
|
|
111
|
+
logger: new Logger(),
|
|
112
|
+
},
|
|
113
|
+
params: {
|
|
114
|
+
token: 'token',
|
|
115
|
+
messageId: 'messageId',
|
|
116
|
+
},
|
|
117
|
+
endPoint: 'https://example.com',
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
expect(error).not.toBeDefined();
|
|
121
|
+
expect(requestSpy).toHaveBeenCalledTimes(1);
|
|
122
|
+
expect(raw).toEqual(succeedEg);
|
|
123
|
+
expect(
|
|
124
|
+
(raw as { parameters?: { customer_secret?: unknown } })?.parameters
|
|
125
|
+
?.customer_secret
|
|
126
|
+
).toBeNull();
|
|
127
|
+
expect(data).toStrictEqual({
|
|
128
|
+
status: DisbursementStatus.succeeded,
|
|
129
|
+
refundStep: DisbursementStep.TransferSent,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|