@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,266 @@
|
|
|
1
|
+
import * as axios from 'axios';
|
|
2
|
+
import { AxiosError } from 'axios';
|
|
3
|
+
import base64url from 'base64url';
|
|
4
|
+
import * as https from 'https';
|
|
5
|
+
import { LoggerInterface } from './logging_interface';
|
|
6
|
+
|
|
7
|
+
export enum RequestStatusCode {
|
|
8
|
+
unauthorized = 401,
|
|
9
|
+
expectationFailed = 417,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type RequestResponse<T> = {
|
|
13
|
+
response?: {
|
|
14
|
+
data: T;
|
|
15
|
+
status: number;
|
|
16
|
+
};
|
|
17
|
+
error?: unknown;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Posts an http request to the given route.
|
|
22
|
+
* @param {Record<string, string | undefined> | string} data The data to be posted.
|
|
23
|
+
* @param {string} route The end point url.
|
|
24
|
+
* @param {Record<string, string>} headers The type content of request.
|
|
25
|
+
* @param {LoggerInterface} logger The logger to use when posting data.
|
|
26
|
+
* @return {Promise<unknown | undefined>} The server response.
|
|
27
|
+
*/
|
|
28
|
+
export async function postRequest<T>({
|
|
29
|
+
data,
|
|
30
|
+
route,
|
|
31
|
+
headers,
|
|
32
|
+
logger,
|
|
33
|
+
rejectUnauthorized = true,
|
|
34
|
+
}: {
|
|
35
|
+
data?: Record<string, unknown> | string | null;
|
|
36
|
+
route: string;
|
|
37
|
+
logger: LoggerInterface;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
rejectUnauthorized?: boolean;
|
|
40
|
+
}): Promise<RequestResponse<T>> {
|
|
41
|
+
try {
|
|
42
|
+
logger.info(
|
|
43
|
+
`Request on the route ${route} is running with data : ${JSON.stringify({
|
|
44
|
+
headers,
|
|
45
|
+
data,
|
|
46
|
+
route,
|
|
47
|
+
})}`
|
|
48
|
+
);
|
|
49
|
+
const agent = new https.Agent({
|
|
50
|
+
rejectUnauthorized: rejectUnauthorized,
|
|
51
|
+
});
|
|
52
|
+
const response = await axios.default({
|
|
53
|
+
method: 'post',
|
|
54
|
+
url: route,
|
|
55
|
+
headers: headers,
|
|
56
|
+
data: data,
|
|
57
|
+
httpsAgent: agent,
|
|
58
|
+
});
|
|
59
|
+
logger.info(
|
|
60
|
+
`Request on the route ${route} completed successfully with data : ${JSON.stringify(
|
|
61
|
+
{
|
|
62
|
+
response: response.data,
|
|
63
|
+
status: response.status,
|
|
64
|
+
statusText: response.statusText,
|
|
65
|
+
}
|
|
66
|
+
)}`
|
|
67
|
+
);
|
|
68
|
+
return { response: { data: response.data, status: response.status } };
|
|
69
|
+
} catch (error) {
|
|
70
|
+
logger.warn(
|
|
71
|
+
`[Axios] failed to post request on the route: ${route} with data : ${JSON.stringify(
|
|
72
|
+
{ headers, data, route }
|
|
73
|
+
)}`
|
|
74
|
+
);
|
|
75
|
+
const parsedError = parseAxiosError(error);
|
|
76
|
+
logger.warn(JSON.stringify(error));
|
|
77
|
+
if (error instanceof AxiosError) {
|
|
78
|
+
if (error.response) {
|
|
79
|
+
return {
|
|
80
|
+
response: {
|
|
81
|
+
status: error.response.status,
|
|
82
|
+
data: error.response.data,
|
|
83
|
+
},
|
|
84
|
+
error: parsedError,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return { error: parsedError };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Gets an http request to the given route.
|
|
95
|
+
* @param {Record<string, string | undefined> | string} data The data to be posted.
|
|
96
|
+
* @param {string} route The end point url.
|
|
97
|
+
* @param {Record<string, string>} headers The type content of request.
|
|
98
|
+
* @param {LoggerInterface} logger The logger to use when getting data.
|
|
99
|
+
* @return {Promise<unknown | undefined>} The server response.
|
|
100
|
+
*/
|
|
101
|
+
export async function getRequest<T>({
|
|
102
|
+
data,
|
|
103
|
+
route,
|
|
104
|
+
headers,
|
|
105
|
+
logger,
|
|
106
|
+
rejectUnauthorized = true,
|
|
107
|
+
}: {
|
|
108
|
+
data?: Record<string, string | undefined> | string;
|
|
109
|
+
route: string;
|
|
110
|
+
headers?: Record<string, string>;
|
|
111
|
+
logger: LoggerInterface;
|
|
112
|
+
rejectUnauthorized?: boolean;
|
|
113
|
+
}): Promise<RequestResponse<T>> {
|
|
114
|
+
try {
|
|
115
|
+
logger.info(
|
|
116
|
+
`Request on the route ${route} is running with data : ${JSON.stringify({
|
|
117
|
+
headers,
|
|
118
|
+
data,
|
|
119
|
+
route,
|
|
120
|
+
})}`
|
|
121
|
+
);
|
|
122
|
+
const agent = new https.Agent({
|
|
123
|
+
rejectUnauthorized: rejectUnauthorized,
|
|
124
|
+
});
|
|
125
|
+
const response = await axios.default({
|
|
126
|
+
method: 'get',
|
|
127
|
+
url: route,
|
|
128
|
+
headers: headers,
|
|
129
|
+
data: data,
|
|
130
|
+
httpsAgent: agent,
|
|
131
|
+
});
|
|
132
|
+
logger.info(
|
|
133
|
+
`Request on the route ${route} completed successfully with data : ${JSON.stringify(
|
|
134
|
+
{
|
|
135
|
+
response: response.data,
|
|
136
|
+
status: response.status,
|
|
137
|
+
statusText: response.statusText,
|
|
138
|
+
}
|
|
139
|
+
)}`
|
|
140
|
+
);
|
|
141
|
+
return { response: { data: response.data, status: response.status } };
|
|
142
|
+
} catch (error) {
|
|
143
|
+
logger.warn(
|
|
144
|
+
`[Axios] failed to get request on the route: ${route} with data : ${JSON.stringify(
|
|
145
|
+
{ headers, data, route }
|
|
146
|
+
)}`
|
|
147
|
+
);
|
|
148
|
+
const parsedError = parseAxiosError(error);
|
|
149
|
+
logger.warn(JSON.stringify(error));
|
|
150
|
+
if (error instanceof AxiosError) {
|
|
151
|
+
if (error.response) {
|
|
152
|
+
return {
|
|
153
|
+
response: {
|
|
154
|
+
status: error.response.status,
|
|
155
|
+
data: error.response.data,
|
|
156
|
+
},
|
|
157
|
+
error: parsedError,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return { error: parsedError };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Parses an Axios error and returns a modified error object.
|
|
168
|
+
*
|
|
169
|
+
* @param {unknown} error - The error object to be parsed.
|
|
170
|
+
* @return {unknown} The modified error object.
|
|
171
|
+
*/
|
|
172
|
+
export function parseAxiosError(error: unknown): unknown {
|
|
173
|
+
let err = error;
|
|
174
|
+
if (error instanceof AxiosError) {
|
|
175
|
+
if (error.response) {
|
|
176
|
+
err = {
|
|
177
|
+
responseError: {
|
|
178
|
+
data: error.response.data,
|
|
179
|
+
status: error.response.status,
|
|
180
|
+
statusText: error.response.statusText,
|
|
181
|
+
headers: error.response.headers,
|
|
182
|
+
},
|
|
183
|
+
requestBody: error.request.body,
|
|
184
|
+
};
|
|
185
|
+
} else if (error.request) {
|
|
186
|
+
err = {
|
|
187
|
+
requestFailed: {
|
|
188
|
+
headers: error.config?.headers,
|
|
189
|
+
data: error.config?.data,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
} else {
|
|
193
|
+
err = {
|
|
194
|
+
configFailed: error.message,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return err;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Generates a hash using the given key and secret.
|
|
203
|
+
*
|
|
204
|
+
* @param {string} key - The key to be hashed.
|
|
205
|
+
* @param {string} secret - The secret to be hashed.
|
|
206
|
+
* @return {string} - The generated hash.
|
|
207
|
+
*/
|
|
208
|
+
export function hash(key: string, secret: string): string {
|
|
209
|
+
const toHash = `${key}:${secret}`;
|
|
210
|
+
if (!global.btoa) {
|
|
211
|
+
return Buffer.from(toHash).toString('base64');
|
|
212
|
+
}
|
|
213
|
+
return global.btoa(toHash);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Encode the body of the request.
|
|
218
|
+
* @param {Record<string, string>} bodyRequest the body request.
|
|
219
|
+
* @return {string} the encoded body request result.
|
|
220
|
+
*/
|
|
221
|
+
export function encodeTheBodyOfRequest(
|
|
222
|
+
bodyRequest: Record<string, string>
|
|
223
|
+
): string {
|
|
224
|
+
const formBody = [];
|
|
225
|
+
for (const key in bodyRequest) {
|
|
226
|
+
if ({}.hasOwnProperty.call(bodyRequest, key)) {
|
|
227
|
+
const encodedKey = encodeURIComponent(key);
|
|
228
|
+
const encodedValue = encodeURIComponent(bodyRequest[key]);
|
|
229
|
+
formBody.push(encodedKey + '=' + encodedValue);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return formBody.join('&');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Encode to base64
|
|
236
|
+
export const encodeToBase64 = (
|
|
237
|
+
apiUsername: string,
|
|
238
|
+
apiPassword: string
|
|
239
|
+
): string => {
|
|
240
|
+
return base64url(`${apiUsername}:${apiPassword}`);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Encode the data to w3 x form encoded url.
|
|
245
|
+
* @param {Record<string, string>} data the data to encode.
|
|
246
|
+
* @return {string} the encoded value.
|
|
247
|
+
*/
|
|
248
|
+
export function encodeDataToXFormUrl(data: Record<string, string>): string {
|
|
249
|
+
const segments: string[] = [];
|
|
250
|
+
for (const key in data) {
|
|
251
|
+
if (Object.hasOwnProperty.call(data, key)) {
|
|
252
|
+
const encodedKey = encodeURIComponent(key);
|
|
253
|
+
const encodedValue = encodeURIComponent(data[key]);
|
|
254
|
+
segments.push(`${encodedKey}=${encodedValue}`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return segments.join('&');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Checks if the code is a successful code response.
|
|
262
|
+
* @param {num} code .
|
|
263
|
+
* @return {boolean} true if the code is valid.
|
|
264
|
+
*/
|
|
265
|
+
export const isSuccessfulCodeResponse = (code: number): boolean =>
|
|
266
|
+
code >= 200 && code < 300;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface LoggerInterface {
|
|
2
|
+
/**
|
|
3
|
+
* Logs a debug level message.
|
|
4
|
+
* @param {string[]} args
|
|
5
|
+
*/
|
|
6
|
+
log(...args: string[]): void;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Logs an info level message.
|
|
10
|
+
* @param {string[]} args
|
|
11
|
+
*/
|
|
12
|
+
info(...args: string[]): void;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Logs a waning level message.
|
|
16
|
+
* @param {string[]} args
|
|
17
|
+
*/
|
|
18
|
+
warn(...args: string[]): void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Logs an error level message.
|
|
22
|
+
* @param {string[]} args
|
|
23
|
+
*/
|
|
24
|
+
error(...args: string[]): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data return to user when requesting an operation.
|
|
3
|
+
*/
|
|
4
|
+
export type OperationResponse<T, T2 = unknown, R = unknown> = Promise<
|
|
5
|
+
SuccessfulOperationResponse<T, T2> | FailedOperationResponse<R>
|
|
6
|
+
>;
|
|
7
|
+
type SuccessfulOperationResponse<T, T2 = unknown> = {
|
|
8
|
+
data: T;
|
|
9
|
+
raw: T2;
|
|
10
|
+
error?: never;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type FailedOperationResponse<R = unknown> = {
|
|
14
|
+
data?: never;
|
|
15
|
+
raw?: unknown;
|
|
16
|
+
error: R;
|
|
17
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
4
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
5
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
6
|
+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
7
|
+
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
8
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
9
|
+
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
|
10
|
+
"removeComments": false, /* Disable emitting comments. */
|
|
11
|
+
"allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
12
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
13
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
14
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
15
|
+
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
16
|
+
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
17
|
+
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
18
|
+
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
19
|
+
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
|
20
|
+
"baseUrl": ".",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@spreeloop-core/logging": ["../logging"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": ["src", "index.ts"],
|
|
26
|
+
"exclude": []
|
|
27
|
+
}
|