├── pawapay_node ├── src │ ├── resources │ │ ├── toolkit │ │ │ └── .gitkeep │ │ ├── wallet │ │ │ └── .gitkeep │ │ ├── payments_page │ │ │ └── index.ts │ │ ├── refunds │ │ │ └── index.ts │ │ ├── deposits │ │ │ └── index.ts │ │ └── payouts │ │ │ └── index.ts │ ├── .env.example │ ├── types │ │ ├── pawaPayErrorResponse.ts │ │ ├── payments.ts │ │ └── payout.ts │ ├── .prettierignore │ ├── utils │ │ ├── internalLogger.ts │ │ ├── moMoOps.ts │ │ └── pawapayBaseService.ts │ ├── config │ │ ├── Constants.ts │ │ └── networkManager.ts │ ├── .prettierrc │ └── index.ts ├── .gitignore ├── dist │ ├── types │ │ ├── payments.js │ │ ├── pawaPayErrorResponse.js │ │ ├── pawaPayErrorResponse.d.ts │ │ ├── pawaPayErrorResponse.d.ts.map │ │ ├── pawaPayErrorResponse.js.map │ │ ├── payments.d.ts │ │ ├── payments.js.map │ │ ├── payments.d.ts.map │ │ ├── payout.js │ │ ├── payout.d.ts.map │ │ ├── payout.js.map │ │ └── payout.d.ts │ ├── utils │ │ ├── moMoOps.js │ │ ├── internalLogger.d.ts │ │ ├── internalLogger.d.ts.map │ │ ├── pawapayBaseService.d.ts.map │ │ ├── internalLogger.js.map │ │ ├── internalLogger.js │ │ ├── moMoOps.d.ts.map │ │ ├── moMoOps.d.ts │ │ ├── moMoOps.js.map │ │ ├── pawapayBaseService.d.ts │ │ ├── pawapayBaseService.js.map │ │ └── pawapayBaseService.js │ ├── config │ │ ├── Constants.d.ts.map │ │ ├── Constants.d.ts │ │ ├── networkManager.d.ts.map │ │ ├── networkManager.d.ts │ │ ├── Constants.js │ │ ├── Constants.js.map │ │ ├── networkManager.js │ │ └── networkManager.js.map │ ├── resources │ │ ├── payments_page │ │ │ ├── index.d.ts.map │ │ │ ├── index.d.ts │ │ │ ├── index.js.map │ │ │ └── index.js │ │ ├── refunds │ │ │ ├── index.d.ts.map │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ │ ├── payouts │ │ │ ├── index.d.ts.map │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ │ └── deposits │ │ │ ├── index.d.ts.map │ │ │ ├── index.d.ts │ │ │ ├── index.js │ │ │ └── index.js.map │ ├── index.d.ts.map │ ├── index.d.ts │ ├── index.js.map │ └── index.js ├── package.json ├── tsconfig.json ├── ReadMe.md └── pnpm-lock.yaml ├── pawapay_rust ├── src │ ├── structs │ │ ├── mod.rs │ │ └── pawapay.rs │ ├── resources │ │ ├── mod.rs │ │ └── deposits │ │ │ ├── mod.rs │ │ │ └── deposits.rs │ ├── config │ │ ├── mod.rs │ │ └── network_manager.rs │ └── lib.rs └── Cargo.toml ├── .gitignore ├── .idea ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── vcs.xml ├── misc.xml ├── jsLinters │ └── eslint.xml ├── modules.xml ├── prettier.xml ├── inspectionProfiles │ └── Project_Default.xml ├── git_toolbox_prj.xml └── pawapay_api.iml ├── examples └── nodejs │ ├── package.json │ ├── deposits.js │ ├── paymentsPage.js │ └── pnpm-lock.yaml ├── pawapay_api.iml ├── ReadMe.md ├── .github └── workflows │ └── publish.yml └── CONTRIBUTING.md /pawapay_node/src/resources/toolkit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pawapay_node/src/resources/wallet/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pawapay_rust/src/structs/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod pawapay; -------------------------------------------------------------------------------- /pawapay_rust/src/resources/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod deposits; -------------------------------------------------------------------------------- /pawapay_rust/src/config/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod network_manager; -------------------------------------------------------------------------------- /pawapay_rust/src/resources/deposits/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod deposits; 2 | 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pawapay_node/node_modules 2 | pawapay_rust/target 3 | .idea 4 | 5 | -------------------------------------------------------------------------------- /pawapay_node/src/.env.example: -------------------------------------------------------------------------------- 1 | PAWA_PAY_RETURN_URL=test.xyz.com #CANT BE LOCAL HOST 2 | PAWAPAY_JWT=dsddsdsd -------------------------------------------------------------------------------- /pawapay_node/.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | ../examples/nodejs/node_modules/pawapay_api/dist 4 | pawapay_api.iml 5 | -------------------------------------------------------------------------------- /pawapay_node/dist/types/payments.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=payments.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/utils/moMoOps.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=moMoOps.js.map -------------------------------------------------------------------------------- /pawapay_node/src/types/pawaPayErrorResponse.ts: -------------------------------------------------------------------------------- 1 | export interface PawaPayNetworkResponse { 2 | errorMessage: string; 3 | statusCode: number; 4 | errorObject: string; 5 | } -------------------------------------------------------------------------------- /pawapay_node/dist/types/pawaPayErrorResponse.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=pawaPayErrorResponse.js.map -------------------------------------------------------------------------------- /pawapay_rust/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod resources; 2 | mod structs; 3 | mod config; 4 | 5 | 6 | pub use resources::deposits; 7 | pub use structs::pawapay; 8 | pub use config::network_manager; -------------------------------------------------------------------------------- /pawapay_node/dist/utils/internalLogger.d.ts: -------------------------------------------------------------------------------- 1 | declare const internalLogger: import("pino").Logger; 2 | export default internalLogger; 3 | //# sourceMappingURL=internalLogger.d.ts.map -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/jsLinters/eslint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /pawapay_node/dist/utils/internalLogger.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"internalLogger.d.ts","sourceRoot":"","sources":["../../src/utils/internalLogger.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,8BAWlB,CAAC;AAEH,eAAe,cAAc,CAAC"} -------------------------------------------------------------------------------- /pawapay_node/dist/types/pawaPayErrorResponse.d.ts: -------------------------------------------------------------------------------- 1 | export interface PawaPayNetworkResponse { 2 | errorMessage: string; 3 | statusCode: number; 4 | errorObject: string; 5 | } 6 | //# sourceMappingURL=pawaPayErrorResponse.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/src/.prettierignore: -------------------------------------------------------------------------------- 1 | # Ignore artifacts: 2 | build 3 | dist 4 | coverage 5 | 6 | # Ignore all HTML files: 7 | *.html 8 | 9 | .gitignore 10 | .prettierignore 11 | migrations 12 | jest.config.js 13 | -------------------------------------------------------------------------------- /pawapay_node/dist/types/pawaPayErrorResponse.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pawaPayErrorResponse.d.ts","sourceRoot":"","sources":["../../src/types/pawaPayErrorResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB"} -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/prettier.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | -------------------------------------------------------------------------------- /pawapay_node/dist/types/pawaPayErrorResponse.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pawaPayErrorResponse.js","sourceRoot":"","sources":["../../src/types/pawaPayErrorResponse.ts"],"names":[],"mappings":"","sourcesContent":["export interface PawaPayNetworkResponse {\n errorMessage: string;\n statusCode: number;\n errorObject: string;\n}"]} -------------------------------------------------------------------------------- /pawapay_node/dist/config/Constants.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/config/Constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAA+B;IACzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAkC;IAE/E,MAAM,CAAC,QAAQ,CAAC,IAAI;;;MAGnB;CACJ"} -------------------------------------------------------------------------------- /pawapay_rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pawapay_rust" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | 7 | 8 | [dependencies] 9 | reqwest = { version = "0.11", features = ["json"] } 10 | tokio = { version = "1", features = ["full"] } 11 | serde_json = "1.0.114" 12 | serde = { version = "1.0.197", features = ["derive"] } 13 | -------------------------------------------------------------------------------- /examples/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodejs", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Joel Fickson", 10 | "license": "ISC", 11 | "dependencies": { 12 | "pawapay_api": "^0.0.15" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pawapay_node/dist/config/Constants.d.ts: -------------------------------------------------------------------------------- 1 | export default class Constants { 2 | private static readonly _PAWA_PAY_PROD_URL; 3 | private static readonly _PAWA_PAY_SANDBOX_URL; 4 | static readonly URLs: { 5 | [Constants._PAWA_PAY_PROD_URL]: string; 6 | [Constants._PAWA_PAY_SANDBOX_URL]: string; 7 | }; 8 | } 9 | //# sourceMappingURL=Constants.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/src/utils/internalLogger.ts: -------------------------------------------------------------------------------- 1 | import pino from "pino"; 2 | 3 | const internalLogger = pino({ 4 | level: "info", 5 | transport: { 6 | target: "pino-pretty", 7 | options: { 8 | colorize: true, 9 | translateTime: "SYS:standard", 10 | ignore: "pid,hostname" 11 | } 12 | } 13 | 14 | }); 15 | 16 | export default internalLogger; 17 | -------------------------------------------------------------------------------- /pawapay_node/dist/utils/pawapayBaseService.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pawapayBaseService.d.ts","sourceRoot":"","sources":["../../src/utils/pawapayBaseService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAIpE,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAErC,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAI9C;;;;;;;;;;;;;;;;;OAiBG;IACH,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,sBAAsB;CAc9E"} -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /pawapay_node/src/types/payments.ts: -------------------------------------------------------------------------------- 1 | export interface PaymentData { 2 | deposit_id: string; 3 | price: number; 4 | title: string; 5 | name?: string; 6 | currency: string; 7 | basePaymentCountryIso: string; 8 | reason: string; 9 | returnUrl: string; 10 | } 11 | 12 | export interface InitiatePaymentResponse { 13 | redirectUrl: string; 14 | error: boolean; 15 | message?: string; 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /pawapay_node/dist/config/networkManager.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"networkManager.d.ts","sourceRoot":"","sources":["../../src/config/networkManager.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAuB,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,cAEM,cAAc;IAClB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;;IAwBvC,WAAW,IAAI,aAAa;IAI5B,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB;IA0B3D,OAAO,CAAC,iBAAiB;CAa1B;AAED,eAAe,cAAc,CAAC"} -------------------------------------------------------------------------------- /pawapay_api.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /pawapay_node/src/config/Constants.ts: -------------------------------------------------------------------------------- 1 | export default class Constants { 2 | private static readonly _PAWA_PAY_PROD_URL = Symbol("PAWA_PAY_PROD_URL"); 3 | private static readonly _PAWA_PAY_SANDBOX_URL = Symbol("PAWA_PAY_SANDBOX_URL"); 4 | 5 | static readonly URLs = { 6 | [Constants._PAWA_PAY_PROD_URL]: "https://api.pawapay.cloud", 7 | [Constants._PAWA_PAY_SANDBOX_URL]: "https://api.sandbox.pawapay.cloud" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /pawapay_node/dist/types/payments.d.ts: -------------------------------------------------------------------------------- 1 | export interface PaymentData { 2 | deposit_id: string; 3 | price: number; 4 | title: string; 5 | name?: string; 6 | currency: string; 7 | basePaymentCountryIso: string; 8 | reason: string; 9 | returnUrl: string; 10 | } 11 | export interface InitiatePaymentResponse { 12 | redirectUrl: string; 13 | error: boolean; 14 | message?: string; 15 | } 16 | //# sourceMappingURL=payments.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/config/networkManager.d.ts: -------------------------------------------------------------------------------- 1 | import { AxiosInstance } from "axios"; 2 | import { PawaPayNetworkResponse } from "../types/pawaPayErrorResponse"; 3 | declare class NetworkHandler { 4 | private readonly axiosInstance; 5 | constructor(); 6 | getInstance(): AxiosInstance; 7 | handleErrors(error: unknown): PawaPayNetworkResponse; 8 | private setupInterceptors; 9 | } 10 | export default NetworkHandler; 11 | //# sourceMappingURL=networkManager.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/types/payments.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/types/payments.ts"],"names":[],"mappings":"","sourcesContent":["export interface PaymentData {\n deposit_id: string;\n price: number;\n title: string;\n name?: string;\n currency: string;\n basePaymentCountryIso: string;\n reason: string;\n returnUrl: string;\n}\n\nexport interface InitiatePaymentResponse {\n redirectUrl: string;\n error: boolean;\n message?: string;\n}\n\n\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/types/payments.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/types/payments.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"} -------------------------------------------------------------------------------- /pawapay_node/dist/types/payout.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PayoutStatus = void 0; 4 | var PayoutStatus; 5 | (function (PayoutStatus) { 6 | PayoutStatus["ACCEPTED"] = "ACCEPTED"; 7 | PayoutStatus["ENQUEUED"] = "ENQUEUED"; 8 | PayoutStatus["REJECTED"] = "REJECTED"; 9 | PayoutStatus["DUPLICATE_IGNORED"] = "DUPLICATE_IGNORED"; 10 | })(PayoutStatus || (exports.PayoutStatus = PayoutStatus = {})); 11 | //# sourceMappingURL=payout.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payments_page/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/payments_page/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,CAAC,OAAO,OAAO,YAAY;IAInB,SAAS,CAAC,cAAc,EAAE,cAAc;IAFpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAER,cAAc,EAAE,cAAc;IAIpD;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,uBAAuB,GAAG,sBAAsB,CAAC;CAsBlH"} -------------------------------------------------------------------------------- /pawapay_node/dist/config/Constants.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | class Constants { 4 | static _PAWA_PAY_PROD_URL = Symbol("PAWA_PAY_PROD_URL"); 5 | static _PAWA_PAY_SANDBOX_URL = Symbol("PAWA_PAY_SANDBOX_URL"); 6 | static URLs = { 7 | [Constants._PAWA_PAY_PROD_URL]: "https://api.pawapay.cloud", 8 | [Constants._PAWA_PAY_SANDBOX_URL]: "https://api.sandbox.pawapay.cloud" 9 | }; 10 | } 11 | exports.default = Constants; 12 | //# sourceMappingURL=Constants.js.map -------------------------------------------------------------------------------- /.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/pawapay_api.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /pawapay_node/dist/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AACzC,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAE3D,QAAA,MAAM,gBAAgB,cAAkC,CAAC;AAEzD,QAAA,MAAM,cAAc,SAA6B,CAAC;AAClD,QAAA,MAAM,eAAe,UAA8B,CAAC;AACpD,QAAA,MAAM,cAAc,SAA6B,CAAC;AAClD,QAAA,MAAM,kBAAkB,oBAAwC,CAAC;AAEjE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EACnB,CAAC"} -------------------------------------------------------------------------------- /pawapay_node/dist/resources/refunds/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/refunds/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,CAAC,OAAO,OAAO,OAAO;IAId,SAAS,CAAC,cAAc,EAAE,cAAc;IAFpD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAER,cAAc,EAAE,cAAc;IAIpD;;;;;;;;;;;OAWG;IAEG,mBAAmB,CAAC,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,GAAG,sBAAsB,CAAC;IAqB5F;;;;;;;;;;OAUG;IAEG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,sBAAsB,CAAC;CAc7F"} -------------------------------------------------------------------------------- /examples/nodejs/deposits.js: -------------------------------------------------------------------------------- 1 | const { pawaPayBaseService, pawaDeposits } = require("pawapay_api"); 2 | 3 | const getDeposit = async () => { 4 | try { 5 | const response = await pawaDeposits.getDeposit( 6 | "82d2c0fb-690a-0483-7ea1-6a0181a2e362", 7 | ); 8 | 9 | if (pawaPayBaseService.isPawaPayErrorResponse(response)) { 10 | // Check if response is an error 11 | console.error(response); 12 | return; 13 | } 14 | 15 | return response; 16 | } catch (error) { 17 | console.error(error); 18 | } 19 | }; 20 | 21 | const response = await getDeposit(); 22 | -------------------------------------------------------------------------------- /pawapay_rust/src/config/network_manager.rs: -------------------------------------------------------------------------------- 1 | pub struct NetworkManager { 2 | pub base_url: String, 3 | pub api_key: String, 4 | } 5 | 6 | impl NetworkManager { 7 | pub fn new(base_url: String, api_key: String) -> NetworkManager { 8 | NetworkManager { base_url, api_key } 9 | } 10 | 11 | pub fn client(&self) -> reqwest::Client { 12 | let base_client = reqwest::Client::new(); 13 | let client = base_client 14 | .builder() 15 | .header("Authorization", &self.api_key) 16 | .timeout(std::time::Duration::from_secs(10)) 17 | .build() 18 | .unwrap(); 19 | 20 | client 21 | } 22 | } -------------------------------------------------------------------------------- /pawapay_node/dist/utils/internalLogger.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"internalLogger.js","sourceRoot":"","sources":["../../src/utils/internalLogger.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAExB,MAAM,cAAc,GAAG,IAAA,cAAI,EAAC;IAC1B,KAAK,EAAE,MAAM;IACb,SAAS,EAAE;QACT,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE;YACP,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,cAAc;YAC7B,MAAM,EAAE,cAAc;SACvB;KACF;CAEF,CAAC,CAAC;AAEH,kBAAe,cAAc,CAAC","sourcesContent":["import pino from \"pino\";\n\nconst internalLogger = pino({\n level: \"info\",\n transport: {\n target: \"pino-pretty\",\n options: {\n colorize: true,\n translateTime: \"SYS:standard\",\n ignore: \"pid,hostname\"\n }\n }\n\n});\n\nexport default internalLogger;\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/utils/internalLogger.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __importDefault = (this && this.__importDefault) || function (mod) { 3 | return (mod && mod.__esModule) ? mod : { "default": mod }; 4 | }; 5 | Object.defineProperty(exports, "__esModule", { value: true }); 6 | const pino_1 = __importDefault(require("pino")); 7 | const internalLogger = (0, pino_1.default)({ 8 | level: "info", 9 | transport: { 10 | target: "pino-pretty", 11 | options: { 12 | colorize: true, 13 | translateTime: "SYS:standard", 14 | ignore: "pid,hostname" 15 | } 16 | } 17 | }); 18 | exports.default = internalLogger; 19 | //# sourceMappingURL=internalLogger.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import "reflect-metadata"; 2 | import PaymentsPage from "./resources/payments_page"; 3 | import Refunds from "./resources/refunds"; 4 | import Deposits from "./resources/deposits"; 5 | import Payouts from "./resources/payouts"; 6 | import PawapayBaseService from "./utils/pawapayBaseService"; 7 | declare const pawaPaymentsPage: PaymentsPage; 8 | declare const pawaPayRefunds: Refunds; 9 | declare const pawaPayDeposits: Deposits; 10 | declare const pawaPayPayouts: Payouts; 11 | declare const pawapayBaseService: PawapayBaseService; 12 | export * from "./types/payments"; 13 | export * from "./types/payout"; 14 | export { pawaPaymentsPage, pawaPayPayouts, pawaPayRefunds, pawaPayDeposits, pawapayBaseService }; 15 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | #### PawaPay Payment API 2 | 3 | https://docs.pawapay.co.uk/ 4 | 5 | PawaPay is a payment gateway that allows you to accept payments from your customers. This API allows you to integrate 6 | PawaPay into your website or application. You can use this API to create payments, retrieve payment details, and more. 7 | 8 | ## Getting Started 9 | 10 | ### NodeJs 11 | 12 | Read the [NodeJs](https://github.com/JoelFickson/pawapay_api/blob/master/pawapay_node/ReadMe.md) documentation to get started with the NodeJs SDK. 13 | 14 | ## Contributing 15 | 16 | We welcome contributors of all experience levels and backgrounds to help maintain this awesome project. 17 | If you would like to contribute to our curriculum, be sure to thoroughly read our [contributing guide](./CONTRIBUTING.md). 18 | -------------------------------------------------------------------------------- /pawapay_node/dist/utils/moMoOps.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"moMoOps.d.ts","sourceRoot":"","sources":["../../src/utils/moMoOps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,UAAU,GACV,cAAc,GACd,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,mBAAmB,GACnB,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,cAAc,GACd,WAAW,GACX,YAAY,GACZ,SAAS,GACT,aAAa,GACb,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,UAAU,GACV,aAAa,GACb,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC"} -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payouts/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/payouts/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,CAAC,OAAO,OAAO,OAAO;IAId,SAAS,CAAC,cAAc,EAAE,cAAc;IAAE,SAAS,CAAC,kBAAkB,EAAE,kBAAkB;IAFtG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAER,cAAc,EAAE,cAAc,EAAY,kBAAkB,EAAE,kBAAkB;IAItG;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,UAAU,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC;IAoC5G;;;;;;;;;;OAUG;IAEG,cAAc,CAAC,YAAY,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,wBAAwB,EAAE,GAAG,sBAAsB,CAAC;IAgCrH;;;;;;;;;;OAUG;IAEG,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC;CAc/F"} -------------------------------------------------------------------------------- /pawapay_node/src/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSpacing": true, 3 | "printWidth": 100, 4 | "proseWrap": "preserve", 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "all", 8 | "tabWidth": 2, 9 | "useTabs": true, 10 | "parser": "typescript", 11 | "arrowParens": "always", 12 | "requirePragma": true, 13 | "insertPragma": true, 14 | "endOfLine": "lf", 15 | "overrides": [ 16 | { 17 | "files": "*.json", 18 | "options": { 19 | "singleQuote": false, 20 | "tabWidth": 2, 21 | "useTabs": true 22 | } 23 | }, 24 | { 25 | "files": ".*rc", 26 | "options": { 27 | "singleQuote": false, 28 | "parser": "json", 29 | "tabWidth": 2, 30 | "useTabs": true 31 | } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /pawapay_node/dist/config/Constants.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/config/Constants.ts"],"names":[],"mappings":";;AAAA,MAAqB,SAAS;IAClB,MAAM,CAAU,kBAAkB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACjE,MAAM,CAAU,qBAAqB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;IAE/E,MAAM,CAAU,IAAI,GAAG;QACnB,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,2BAA2B;QAC3D,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE,mCAAmC;KACzE,CAAA;;AAPL,4BAQC","sourcesContent":["export default class Constants {\n private static readonly _PAWA_PAY_PROD_URL = Symbol(\"PAWA_PAY_PROD_URL\");\n private static readonly _PAWA_PAY_SANDBOX_URL = Symbol(\"PAWA_PAY_SANDBOX_URL\");\n\n static readonly URLs = {\n [Constants._PAWA_PAY_PROD_URL]: \"https://api.pawapay.cloud\",\n [Constants._PAWA_PAY_SANDBOX_URL]: \"https://api.sandbox.pawapay.cloud\"\n }\n}\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/resources/deposits/index.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/deposits/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAC;AAGpD,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAKpE,MAAM,CAAC,OAAO,OAAO,QAAQ;IAIf,SAAS,CAAC,cAAc,EAAE,cAAc;IAAE,SAAS,CAAC,kBAAkB,EAAE,kBAAkB;IAFtG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAER,cAAc,EAAE,cAAc,EAAY,kBAAkB,EAAE,kBAAkB;IAItG;;;;;;;;;;;;;;;;;;;OAmBG;IAEG,WAAW,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,sBAAsB,CAAC;IAmC7G;;;;;;;;;;;;;;OAcG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,GAAG,sBAAsB,CAAC;IAgB3F;;;;;;;;;;;;;OAaG;IAEG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;CAgBlG"} -------------------------------------------------------------------------------- /pawapay_node/dist/utils/moMoOps.d.ts: -------------------------------------------------------------------------------- 1 | export type MoMoCurrency = "XOF" | "XAF" | "CDF" | "GHS" | "KES" | "MWK" | "MZN" | "NGN" | "RWF" | "SLE" | "TZS" | "UGX" | "ZMW"; 2 | export type Correspondent = "MTN_MOMO_BEN" | "MOOV_BEN" | "MTN_MOMO_CMR" | "ORANGE_CMR" | "MTN_MOMO_CIV" | "ORANGE_CIV" | "VODACOM_MPESA_COD" | "AIRTEL_COD" | "ORANGE_COD" | "MTN_MOMO_GHA" | "AIRTELTIGO_GHA" | "VODAFONE_GHA" | "MPESA_KEN" | "AIRTEL_MWI" | "TNM_MWI" | "VODACOM_MOZ" | "AIRTEL_NGA" | "MTN_MOMO_NGA" | "AIRTEL_RWA" | "MTN_MOMO_RWA" | "FREE_SEN" | "ORANGE_SEN" | "ORANGE_SLE" | "AIRTEL_TZA" | "VODACOM_TZA" | "TIGO_TZA" | "HALOTEL_TZA" | "AIRTEL_OAPI_UGA" | "MTN_MOMO_UGA" | "AIRTEL_OAPI_ZMB" | "MTN_MOMO_ZMB" | "ZAMTEL_ZMB"; 3 | export type MoMoOperatorType = { 4 | MNO: string; 5 | Correspondent: Correspondent; 6 | Country: string; 7 | Currency: MoMoCurrency; 8 | }; 9 | //# sourceMappingURL=moMoOps.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pawapay_api", 3 | "version": "0.0.23", 4 | "description": "Pawapay Gateway API Wrapper", 5 | "main": "./dist/index.js", 6 | "scripts": { 7 | "build": "tsc -p . && tsc-alias", 8 | "format": "prettier --write 'src/**/*.ts'" 9 | }, 10 | "keywords": [ 11 | "pawapay", 12 | "api" 13 | ], 14 | "author": "Joel Fickson", 15 | "license": "ISC", 16 | "dependencies": { 17 | "axios": "^1.6.8", 18 | "pino": "^8.19.0", 19 | "pino-pretty": "^11.0.0", 20 | "reflect-metadata": "^0.1.13", 21 | "tsyringe": "^4.8.0" 22 | }, 23 | "devDependencies": { 24 | "@types/node": "^20.11.30", 25 | "prettier": "^3.0.3", 26 | "tsc-alias": "^1.8.8", 27 | "typescript": "^5.2.2" 28 | }, 29 | "files": [ 30 | "dist", 31 | "@types/*", 32 | "package.json", 33 | "../ReadMe.md" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /pawapay_node/src/index.ts: -------------------------------------------------------------------------------- 1 | import "reflect-metadata"; 2 | import { container } from "tsyringe"; 3 | import PaymentsPage from "@resources/payments_page"; 4 | import Refunds from "@resources/refunds"; 5 | import Deposits from "@resources/deposits"; 6 | import Payouts from "@resources/payouts"; 7 | import PawapayBaseService from "@utils/pawapayBaseService"; 8 | 9 | const pawaPaymentsPage = container.resolve(PaymentsPage); 10 | 11 | const pawaPayRefunds = container.resolve(Refunds); 12 | const pawaPayDeposits = container.resolve(Deposits); 13 | const pawaPayPayouts = container.resolve(Payouts); 14 | const pawapayBaseService = container.resolve(PawapayBaseService); 15 | 16 | export * from "types/payments"; 17 | export * from "types/payout"; 18 | 19 | export { 20 | pawaPaymentsPage, 21 | pawaPayPayouts, 22 | pawaPayRefunds, 23 | pawaPayDeposits, 24 | pawapayBaseService 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /examples/nodejs/paymentsPage.js: -------------------------------------------------------------------------------- 1 | const { pawaPaymentsPage, pawapayBaseService } = require("pawapay_api"); 2 | 3 | const payment = { 4 | reason: `Buy song`, 5 | deposit_id: "82d2c0fb-690a-0483-7ea1-6a0181a2e362", 6 | price: 3000, 7 | title: "Buy song", 8 | basePaymentCountryIso: "MWI", 9 | currency: "MWK", 10 | returnUrl: "https://test.test.com/payments/success", 11 | }; 12 | 13 | const instantiatePayment = async () => { 14 | try { 15 | const response = await pawaPaymentsPage.initiatePayment(payment); 16 | 17 | if (pawapayBaseService.isPawaPayErrorResponse(response)) { 18 | // Check if response is an error 19 | console.error(response); 20 | return; 21 | } 22 | 23 | return response; 24 | } catch (error) { 25 | console.error(error); 26 | } 27 | }; 28 | 29 | const response = await instantiatePayment(); 30 | 31 | // response will contain the redirect url to the payment page 32 | -------------------------------------------------------------------------------- /pawapay_node/src/utils/moMoOps.ts: -------------------------------------------------------------------------------- 1 | export type MoMoCurrency = 2 | | "XOF" 3 | | "XAF" 4 | | "CDF" 5 | | "GHS" 6 | | "KES" 7 | | "MWK" 8 | | "MZN" 9 | | "NGN" 10 | | "RWF" 11 | | "SLE" 12 | | "TZS" 13 | | "UGX" 14 | | "ZMW"; 15 | 16 | export type Correspondent = 17 | | "MTN_MOMO_BEN" 18 | | "MOOV_BEN" 19 | | "MTN_MOMO_CMR" 20 | | "ORANGE_CMR" 21 | | "MTN_MOMO_CIV" 22 | | "ORANGE_CIV" 23 | | "VODACOM_MPESA_COD" 24 | | "AIRTEL_COD" 25 | | "ORANGE_COD" 26 | | "MTN_MOMO_GHA" 27 | | "AIRTELTIGO_GHA" 28 | | "VODAFONE_GHA" 29 | | "MPESA_KEN" 30 | | "AIRTEL_MWI" 31 | | "TNM_MWI" 32 | | "VODACOM_MOZ" 33 | | "AIRTEL_NGA" 34 | | "MTN_MOMO_NGA" 35 | | "AIRTEL_RWA" 36 | | "MTN_MOMO_RWA" 37 | | "FREE_SEN" 38 | | "ORANGE_SEN" 39 | | "ORANGE_SLE" 40 | | "AIRTEL_TZA" 41 | | "VODACOM_TZA" 42 | | "TIGO_TZA" 43 | | "HALOTEL_TZA" 44 | | "AIRTEL_OAPI_UGA" 45 | | "MTN_MOMO_UGA" 46 | | "AIRTEL_OAPI_ZMB" 47 | | "MTN_MOMO_ZMB" 48 | | "ZAMTEL_ZMB"; 49 | 50 | export type MoMoOperatorType = { 51 | MNO: string; 52 | Correspondent: Correspondent; 53 | Country: string; 54 | Currency: MoMoCurrency; 55 | }; -------------------------------------------------------------------------------- /pawapay_node/dist/utils/moMoOps.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"moMoOps.js","sourceRoot":"","sources":["../../src/utils/moMoOps.ts"],"names":[],"mappings":"","sourcesContent":["export type MoMoCurrency =\n | \"XOF\"\n | \"XAF\"\n | \"CDF\"\n | \"GHS\"\n | \"KES\"\n | \"MWK\"\n | \"MZN\"\n | \"NGN\"\n | \"RWF\"\n | \"SLE\"\n | \"TZS\"\n | \"UGX\"\n | \"ZMW\";\n\nexport type Correspondent =\n | \"MTN_MOMO_BEN\"\n | \"MOOV_BEN\"\n | \"MTN_MOMO_CMR\"\n | \"ORANGE_CMR\"\n | \"MTN_MOMO_CIV\"\n | \"ORANGE_CIV\"\n | \"VODACOM_MPESA_COD\"\n | \"AIRTEL_COD\"\n | \"ORANGE_COD\"\n | \"MTN_MOMO_GHA\"\n | \"AIRTELTIGO_GHA\"\n | \"VODAFONE_GHA\"\n | \"MPESA_KEN\"\n | \"AIRTEL_MWI\"\n | \"TNM_MWI\"\n | \"VODACOM_MOZ\"\n | \"AIRTEL_NGA\"\n | \"MTN_MOMO_NGA\"\n | \"AIRTEL_RWA\"\n | \"MTN_MOMO_RWA\"\n | \"FREE_SEN\"\n | \"ORANGE_SEN\"\n | \"ORANGE_SLE\"\n | \"AIRTEL_TZA\"\n | \"VODACOM_TZA\"\n | \"TIGO_TZA\"\n | \"HALOTEL_TZA\"\n | \"AIRTEL_OAPI_UGA\"\n | \"MTN_MOMO_UGA\"\n | \"AIRTEL_OAPI_ZMB\"\n | \"MTN_MOMO_ZMB\"\n | \"ZAMTEL_ZMB\";\n\nexport type MoMoOperatorType = {\n MNO: string;\n Correspondent: Correspondent;\n Country: string;\n Currency: MoMoCurrency;\n};"]} -------------------------------------------------------------------------------- /pawapay_node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "ts-node": { 3 | "files": true, 4 | "require": [ 5 | "tsconfig-paths/register" 6 | ] 7 | }, 8 | "compilerOptions": { 9 | "baseUrl": "./src", 10 | "paths": { 11 | "@resources/*": [ 12 | "resources/*" 13 | ], 14 | "types/*": [ 15 | "types/*" 16 | ], 17 | "@config/*": [ 18 | "config/*" 19 | ], 20 | "@utils/*": [ 21 | "utils/*" 22 | ] 23 | }, 24 | "declaration": true, 25 | "declarationMap": true, 26 | "esModuleInterop": true, 27 | "forceConsistentCasingInFileNames": true, 28 | "inlineSources": true, 29 | "lib": [ 30 | "esnext" 31 | ], 32 | "module": "commonjs", 33 | "moduleResolution": "node", 34 | "noImplicitReturns": false, 35 | "noUnusedLocals": true, 36 | "noUnusedParameters": true, 37 | "outDir": "./dist", 38 | "resolveJsonModule": true, 39 | "sourceMap": true, 40 | "strict": true, 41 | "target": "esnext", 42 | "skipLibCheck": true, 43 | "experimentalDecorators": true, 44 | "emitDecoratorMetadata": true 45 | }, 46 | "include": [ 47 | "src/**/*" 48 | ], 49 | "exclude": [ 50 | "node_modules" 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /pawapay_node/ReadMe.md: -------------------------------------------------------------------------------- 1 | ### PawaPay NodeJs SDK 2 | 3 | ### Getting Started 4 | 5 | This assumes that you have already set up your account information found in 6 | the [PawaPay API documentation](https://docs.pawapay.co.uk/). 7 | 8 | ### Installation 9 | 10 | ```bash 11 | npm install pawapay-node 12 | ``` 13 | 14 | ### Payments Page 15 | 16 | ```javascript 17 | const { pawaPaymentsPage, pawapayBaseService } = require('pawapay_api'); 18 | 19 | const payment: PaymentData = { 20 | reason: `Buy Test Song`, 21 | deposit_id: "", 22 | price: song.price, 23 | title: so.title, 24 | artist_name: pricedMusic.artist_name, 25 | basePaymentCountryIso: pricedMusic.basePaymentCountryIso, 26 | currency: pricedMusic.currency, 27 | returnUrl: 'https://test.test.com/payments/success' 28 | }; 29 | 30 | try { 31 | 32 | const response = await pawaPaymentsPage.initiatePayment(paymentData); 33 | 34 | if (pawapayBaseService.isPawaPayErrorResponse(response)) { 35 | return { 36 | redirectUrl: '', 37 | error: true, 38 | message: response.errorMessage, 39 | }; 40 | } 41 | 42 | return { 43 | redirectUrl: response.redirectUrl, 44 | error: false, 45 | }; 46 | } catch (error: unknown) { 47 | 48 | // handle error 49 | } 50 | 51 | ``` 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /pawapay_node/dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,4BAA0B;AAC1B,uCAAqC;AACrC,6EAAoD;AACpD,iEAAyC;AACzC,mEAA2C;AAC3C,iEAAyC;AACzC,mFAA2D;AAE3D,MAAM,gBAAgB,GAAG,oBAAS,CAAC,OAAO,CAAC,uBAAY,CAAC,CAAC;AAWvD,4CAAgB;AATlB,MAAM,cAAc,GAAG,oBAAS,CAAC,OAAO,CAAC,iBAAO,CAAC,CAAC;AAWhD,wCAAc;AAVhB,MAAM,eAAe,GAAG,oBAAS,CAAC,OAAO,CAAC,kBAAQ,CAAC,CAAC;AAWlD,0CAAe;AAVjB,MAAM,cAAc,GAAG,oBAAS,CAAC,OAAO,CAAC,iBAAO,CAAC,CAAC;AAQhD,wCAAc;AAPhB,MAAM,kBAAkB,GAAG,oBAAS,CAAC,OAAO,CAAC,4BAAkB,CAAC,CAAC;AAU/D,gDAAkB;AARpB,iDAA+B;AAC/B,+CAA6B","sourcesContent":["import \"reflect-metadata\";\nimport { container } from \"tsyringe\";\nimport PaymentsPage from \"@resources/payments_page\";\nimport Refunds from \"@resources/refunds\";\nimport Deposits from \"@resources/deposits\";\nimport Payouts from \"@resources/payouts\";\nimport PawapayBaseService from \"@utils/pawapayBaseService\";\n\nconst pawaPaymentsPage = container.resolve(PaymentsPage);\n\nconst pawaPayRefunds = container.resolve(Refunds);\nconst pawaPayDeposits = container.resolve(Deposits);\nconst pawaPayPayouts = container.resolve(Payouts);\nconst pawapayBaseService = container.resolve(PawapayBaseService);\n\nexport * from \"types/payments\";\nexport * from \"types/payout\";\n\nexport {\n pawaPaymentsPage,\n pawaPayPayouts,\n pawaPayRefunds,\n pawaPayDeposits,\n pawapayBaseService\n};\n\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/utils/pawapayBaseService.d.ts: -------------------------------------------------------------------------------- 1 | import { PawaPayNetworkResponse } from "../types/pawaPayErrorResponse"; 2 | export default class PawapayBaseService { 3 | formatPhoneNumber(phoneNumber: string): string; 4 | /** 5 | * Checks if a given response is a PawaPayNetworkResponse. 6 | * 7 | * This function is a type guard that attempts to determine if an unknown input 8 | * conforms to the PawaPayNetworkResponse interface by checking for the presence 9 | * and type of specific properties. Specifically, it checks for the properties 10 | * `errorMessage`, `statusCode`, and `errorObject`, and verifies that these properties 11 | * are of the correct types (string for `errorMessage` and `errorObject`, and number 12 | * for `statusCode`). 13 | * 14 | * @param {unknown} response - The response object to check. Its type is unknown 15 | * to allow for any input, as the purpose of this function 16 | * is to perform runtime type checking. 17 | * @returns {response is PawaPayNetworkResponse} True if the input object matches 18 | * the PawaPayNetworkResponse interface, otherwise false. This return type 19 | * enables TypeScript's type narrowing, allowing the compiler to treat 20 | * validated objects as being of type PawaPayNetworkResponse within conditional blocks. 21 | */ 22 | isPawaPayErrorResponse(response: unknown): response is PawaPayNetworkResponse; 23 | } 24 | //# sourceMappingURL=pawapayBaseService.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payments_page/index.d.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "../../config/networkManager"; 2 | import { InitiatePaymentResponse, PaymentData } from "../../types/payments"; 3 | import { PawaPayNetworkResponse } from "../../types/pawaPayErrorResponse"; 4 | export default class PaymentsPage { 5 | protected networkHandler: NetworkHandler; 6 | private readonly baseEndpoint; 7 | constructor(networkHandler: NetworkHandler); 8 | /** 9 | * Initiates a payment process by sending payment data to v1/widget/sessions. 10 | * This method constructs the payment request and handles the response, returning 11 | * a URL to which the user can be redirected to complete the payment process. 12 | * 13 | * @param {PaymentData} paymentData - An object containing all necessary data for initiating the payment. 14 | * The `PaymentData` object should include: 15 | * - `deposit_id`: The ID of the deposit. 16 | * - `price`: The amount of the payment. 17 | * - `returnUrl`: The URL to which the user will be redirected after payment completion (can be specified in `.env` as `RETURN_URL`). 18 | * - `basePaymentCountryIso`: ISO country code representing the base country for the payment. 19 | * - `reason`: A text description of the reason for the payment. 20 | * 21 | * @returns {Promise} A promise that resolves to an object containing 22 | * the `redirectUrl` for the payment completion if successful, and an `error` flag set to `false`. 23 | * In case of failure, the promise may resolve to an `unknown` type or be rejected with an error. 24 | * It's recommended to handle errors appropriately in the calling context. 25 | * 26 | * @throws {PawaPayNetworkResponse} Throws an error if the request fails for reasons such as network issues, 27 | * invalid payment data, or server errors. `. 28 | */ 29 | initiatePayment(paymentData: PaymentData): Promise; 30 | } 31 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Build, Version, and Publish 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | checkout: 8 | runs-on: ubuntu-latest 9 | defaults: 10 | run: 11 | working-directory: ./pawapay_node 12 | 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@v4 16 | 17 | - name: Set up Node.js 18 | uses: actions/setup-node@v4 19 | with: 20 | node-version: 20 21 | 22 | - name: Install dependencies 23 | run: yarn install 24 | 25 | - name: Format Code 26 | run: yarn format 27 | 28 | publish: 29 | needs: [ 'checkout' ] 30 | permissions: 31 | contents: write 32 | runs-on: ubuntu-latest 33 | defaults: 34 | run: 35 | working-directory: ./pawapay_node 36 | 37 | steps: 38 | - name: Checkout code 39 | uses: actions/checkout@v4 40 | 41 | - name: Set up Node.js 42 | uses: actions/setup-node@v4 43 | with: 44 | node-version: 20 45 | registry-url: 'https://registry.npmjs.org' 46 | 47 | - name: Install dependencies 48 | run: yarn install 49 | 50 | - name: Format Code 51 | run: yarn format 52 | 53 | - name: Build the package 54 | run: yarn build 55 | 56 | - name: Bump version & push 57 | run: | 58 | git config --global user.name 'JoelFickson CI USER' 59 | git config --global user.email 'joelfickson@users.noreply.github.com' 60 | 61 | npm version patch -m "Bump version to %s [skip ci]" 62 | git push && git push --tags 63 | 64 | 65 | - name: Commit changes 66 | run: | 67 | git config --global user.name 'CI User' 68 | git config --global user.email 'CI@users.noreply.github.com' 69 | git add . 70 | git commit -m "Bump package version [skip ci]" 71 | git push 72 | 73 | - name: Push to NPM Registry 74 | run: npm publish --tag latest 75 | env: 76 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 77 | 78 | -------------------------------------------------------------------------------- /pawapay_node/src/utils/pawapayBaseService.ts: -------------------------------------------------------------------------------- 1 | import { autoInjectable, singleton } from "tsyringe"; 2 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 3 | 4 | @autoInjectable() 5 | @singleton() 6 | export default class PawapayBaseService { 7 | 8 | formatPhoneNumber(phoneNumber: string): string { 9 | return phoneNumber.replace(/^([+0])/, ""); 10 | } 11 | 12 | /** 13 | * Checks if a given response is a PawaPayNetworkResponse. 14 | * 15 | * This function is a type guard that attempts to determine if an unknown input 16 | * conforms to the PawaPayNetworkResponse interface by checking for the presence 17 | * and type of specific properties. Specifically, it checks for the properties 18 | * `errorMessage`, `statusCode`, and `errorObject`, and verifies that these properties 19 | * are of the correct types (string for `errorMessage` and `errorObject`, and number 20 | * for `statusCode`). 21 | * 22 | * @param {unknown} response - The response object to check. Its type is unknown 23 | * to allow for any input, as the purpose of this function 24 | * is to perform runtime type checking. 25 | * @returns {response is PawaPayNetworkResponse} True if the input object matches 26 | * the PawaPayNetworkResponse interface, otherwise false. This return type 27 | * enables TypeScript's type narrowing, allowing the compiler to treat 28 | * validated objects as being of type PawaPayNetworkResponse within conditional blocks. 29 | */ 30 | isPawaPayErrorResponse(response: unknown): response is PawaPayNetworkResponse { 31 | 32 | if (typeof response === "object" && response !== null) { 33 | 34 | const hasErrorMessage = "errorMessage" in response && typeof (response as any).errorMessage === "string"; 35 | const hasStatusCode = "statusCode" in response && typeof (response as any).statusCode === "number"; 36 | const hasErrorObject = "errorObject" in response && typeof (response as any).errorObject === "string"; 37 | 38 | return hasErrorMessage && hasStatusCode && hasErrorObject; 39 | } 40 | 41 | return false; 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## PawaPay-API contribution guide 2 | 3 | Thank you for expressing interest in contributing to the project. Please make sure you read the guide thoroughly before contributing as it will lessen the chances of any issues arising during the process. 4 | 5 | ### Getting Started 6 | 7 | Before everything, please post an issue and check that it is a new issue by searching it up. This will prevent two peope working on the same issue and efforts being wasted. 8 | 9 | #### Prerequisites 10 | 11 | 1. [Git](https://git-scm.com/) 12 | 2. [NodeJS](https://nodejs.org/en/) 13 | 3. [Typescript](typescriptlang.org)/ Javascript 14 | 15 | ### First Time Contributer 16 | 17 | If you have never contributed to open-source and would love to start with this project, then we got you. [Follow this guide by freecodecamp](https://www.freecodecamp.org/news/how-to-contribute-to-open-source-projects-beginners-guide/) 18 | 19 | ## PawaPay NodeJs SDK 20 | 21 | ### Getting Started 22 | 23 | This assumes that you have already set up your account information found in 24 | the [PawaPay API documentation](https://docs.pawapay.co.uk/). 25 | 26 | ### Installation 27 | 28 | ```bash 29 | npm install pawapay_node 30 | ``` 31 | 32 | ### Payments Page 33 | 34 | ```javascript 35 | const { pawaPaymentsPage, pawapayBaseService } = require('pawapay_api'); 36 | 37 | const payment: PaymentData = { 38 | reason: `Buy Test Song`, 39 | deposit_id: "", 40 | price: song.price, 41 | title: so.title, 42 | artist_name: pricedMusic.artist_name, 43 | basePaymentCountryIso: pricedMusic.basePaymentCountryIso, 44 | currency: pricedMusic.currency, 45 | returnUrl: 'https://test.test.com/payments/success' 46 | }; 47 | 48 | try { 49 | 50 | const response = await pawaPaymentsPage.initiatePayment(paymentData); 51 | 52 | if (pawapayBaseService.isPawaPayErrorResponse(response)) { 53 | return { 54 | redirectUrl: '', 55 | error: true, 56 | message: response.errorMessage, 57 | }; 58 | } 59 | 60 | return { 61 | redirectUrl: response.redirectUrl, 62 | error: false, 63 | }; 64 | } catch (error: unknown) { 65 | 66 | // handle error 67 | } 68 | 69 | ``` 70 | 71 | ## Getting Help 72 | 73 | If you get any hiccups please feel free to contact the maintainers Or open up an issue. Good Luck!!! 🫂 74 | -------------------------------------------------------------------------------- /pawapay_node/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 | if (k2 === undefined) k2 = k; 4 | var desc = Object.getOwnPropertyDescriptor(m, k); 5 | if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 6 | desc = { enumerable: true, get: function() { return m[k]; } }; 7 | } 8 | Object.defineProperty(o, k2, desc); 9 | }) : (function(o, m, k, k2) { 10 | if (k2 === undefined) k2 = k; 11 | o[k2] = m[k]; 12 | })); 13 | var __exportStar = (this && this.__exportStar) || function(m, exports) { 14 | for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 15 | }; 16 | var __importDefault = (this && this.__importDefault) || function (mod) { 17 | return (mod && mod.__esModule) ? mod : { "default": mod }; 18 | }; 19 | Object.defineProperty(exports, "__esModule", { value: true }); 20 | exports.pawapayBaseService = exports.pawaPayDeposits = exports.pawaPayRefunds = exports.pawaPayPayouts = exports.pawaPaymentsPage = void 0; 21 | require("reflect-metadata"); 22 | const tsyringe_1 = require("tsyringe"); 23 | const payments_page_1 = __importDefault(require("./resources/payments_page")); 24 | const refunds_1 = __importDefault(require("./resources/refunds")); 25 | const deposits_1 = __importDefault(require("./resources/deposits")); 26 | const payouts_1 = __importDefault(require("./resources/payouts")); 27 | const pawapayBaseService_1 = __importDefault(require("./utils/pawapayBaseService")); 28 | const pawaPaymentsPage = tsyringe_1.container.resolve(payments_page_1.default); 29 | exports.pawaPaymentsPage = pawaPaymentsPage; 30 | const pawaPayRefunds = tsyringe_1.container.resolve(refunds_1.default); 31 | exports.pawaPayRefunds = pawaPayRefunds; 32 | const pawaPayDeposits = tsyringe_1.container.resolve(deposits_1.default); 33 | exports.pawaPayDeposits = pawaPayDeposits; 34 | const pawaPayPayouts = tsyringe_1.container.resolve(payouts_1.default); 35 | exports.pawaPayPayouts = pawaPayPayouts; 36 | const pawapayBaseService = tsyringe_1.container.resolve(pawapayBaseService_1.default); 37 | exports.pawapayBaseService = pawapayBaseService; 38 | __exportStar(require("./types/payments"), exports); 39 | __exportStar(require("./types/payout"), exports); 40 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /pawapay_node/src/config/networkManager.ts: -------------------------------------------------------------------------------- 1 | import axios, { AxiosInstance, AxiosRequestHeaders } from "axios"; 2 | import { autoInjectable, singleton } from "tsyringe"; 3 | import Constants from "@config/Constants"; 4 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 5 | import internalLogger from "@utils/internalLogger"; 6 | 7 | @autoInjectable() 8 | @singleton() 9 | class NetworkHandler { 10 | private readonly axiosInstance: AxiosInstance; 11 | 12 | constructor() { 13 | const pawaPayJwt = process.env.PAWAPAY_JWT; 14 | const environment = process.env.Node_ENV; 15 | 16 | const baseURL = environment === "production" ? 17 | Constants.URLs[Constants["_PAWA_PAY_PROD_URL"]] : 18 | Constants.URLs[Constants["_PAWA_PAY_SANDBOX_URL"]]; 19 | 20 | const headers = {} as AxiosRequestHeaders; 21 | 22 | if (pawaPayJwt) { 23 | headers.Authorization = `Bearer ${pawaPayJwt}`; 24 | } 25 | 26 | this.axiosInstance = axios.create({ 27 | baseURL, 28 | headers 29 | }); 30 | 31 | this.setupInterceptors(); 32 | } 33 | 34 | public getInstance(): AxiosInstance { 35 | return this.axiosInstance; 36 | } 37 | 38 | public handleErrors(error: unknown): PawaPayNetworkResponse { 39 | internalLogger.error("Error occurred " + error); 40 | 41 | let errorMessage = "An unknown error occurred"; 42 | let statusCode = 500; 43 | let errorObject = "{}"; 44 | 45 | if (axios.isAxiosError(error) && error.response) { 46 | statusCode = error.response.status; 47 | 48 | try { 49 | const data = error.response.data as { message?: string; error?: string; }; 50 | errorMessage = data.message || data.error || errorMessage; 51 | errorObject = JSON.stringify(data); 52 | } catch { 53 | errorMessage = "Failed to parse error response"; 54 | } 55 | } 56 | 57 | return { 58 | errorMessage, 59 | statusCode, 60 | errorObject 61 | }; 62 | } 63 | 64 | private setupInterceptors(): void { 65 | this.axiosInstance.interceptors.response.use( 66 | (response) => 67 | new Promise((resolve) => { 68 | resolve(response); 69 | }), 70 | (error) => { 71 | return new Promise((_, reject) => { 72 | reject(error); 73 | }); 74 | } 75 | ); 76 | } 77 | } 78 | 79 | export default NetworkHandler; 80 | -------------------------------------------------------------------------------- /pawapay_node/dist/resources/refunds/index.d.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "../../config/networkManager"; 2 | import { RefundResponse, RefundTransaction } from "../../types/payout"; 3 | import { PawaPayNetworkResponse } from "../../types/pawaPayErrorResponse"; 4 | export default class Refunds { 5 | protected networkHandler: NetworkHandler; 6 | private readonly baseEndpoint; 7 | constructor(networkHandler: NetworkHandler); 8 | /** 9 | * Asynchronously submits a request to create a refund for a specific transaction. This method sends the refund details, 10 | * including the unique identifiers for the refund and the original deposit, to a designated service endpoint for processing. 11 | * It is intended to initiate the refund process for transactions that meet the criteria for refunding. 12 | * 13 | * @param {any} refundData - An object containing the refund request details. The structure of this object includes 14 | * `refundId`, the unique identifier for the refund request, and `depositId`, the unique identifier of the original deposit transaction to be refunded. 15 | * 16 | * @returns {Promise} A promise that resolves to a `RefundResponse` object if the refund request is successfully processed. 17 | * The `RefundResponse` type should detail the outcome of the refund request. In case of an error during the request processing, 18 | * the promise resolves to an unknown type, with the error handled by the `networkHandler`'s error handling mechanism. 19 | */ 20 | createRefundRequest(refundData: any): Promise; 21 | /** 22 | * Asynchronously retrieves the status of a specific refund transaction by its unique identifier (refundId). 23 | * This method constructs the request URL using the refundId and makes a GET request to the service endpoint 24 | * to fetch the current status of the refund transaction. It provides a means to track the progress or outcome of refund requests. 25 | * 26 | * @param {string} refundId - The unique identifier for the refund transaction whose status is being queried. 27 | * 28 | * @returns {Promise} A promise that resolves to a `RefundTransaction` object if the refund status is successfully retrieved. 29 | * The `RefundTransaction` type is expected to contain comprehensive details about the refund transaction, including its current status. 30 | * If an error occurs during the retrieval process, the promise resolves to an unknown type. Errors are handled using the `networkHandler`'s error handling process. 31 | */ 32 | getRefundStatus(refundId: string): Promise; 33 | } 34 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/utils/pawapayBaseService.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"pawapayBaseService.js","sourceRoot":"","sources":["../../src/utils/pawapayBaseService.ts"],"names":[],"mappings":";;;;;;;;AAAA,uCAAqD;AAKtC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAErC,iBAAiB,CAAC,WAAmB;QACnC,OAAO,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,sBAAsB,CAAC,QAAiB;QAEtC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAEtD,MAAM,eAAe,GAAG,cAAc,IAAI,QAAQ,IAAI,OAAQ,QAAgB,CAAC,YAAY,KAAK,QAAQ,CAAC;YACzG,MAAM,aAAa,GAAG,YAAY,IAAI,QAAQ,IAAI,OAAQ,QAAgB,CAAC,UAAU,KAAK,QAAQ,CAAC;YACnG,MAAM,cAAc,GAAG,aAAa,IAAI,QAAQ,IAAI,OAAQ,QAAgB,CAAC,WAAW,KAAK,QAAQ,CAAC;YAEtG,OAAO,eAAe,IAAI,aAAa,IAAI,cAAc,CAAC;QAC5D,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CAEF,CAAA;AAtCoB,kBAAkB;IAFtC,IAAA,yBAAc,GAAE;IAChB,IAAA,oBAAS,GAAE;GACS,kBAAkB,CAsCtC;kBAtCoB,kBAAkB","sourcesContent":["import { autoInjectable, singleton } from \"tsyringe\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\n\n@autoInjectable()\n@singleton()\nexport default class PawapayBaseService {\n\n formatPhoneNumber(phoneNumber: string): string {\n return phoneNumber.replace(/^([+0])/, \"\");\n }\n\n /**\n * Checks if a given response is a PawaPayNetworkResponse.\n *\n * This function is a type guard that attempts to determine if an unknown input\n * conforms to the PawaPayNetworkResponse interface by checking for the presence\n * and type of specific properties. Specifically, it checks for the properties\n * `errorMessage`, `statusCode`, and `errorObject`, and verifies that these properties\n * are of the correct types (string for `errorMessage` and `errorObject`, and number\n * for `statusCode`).\n *\n * @param {unknown} response - The response object to check. Its type is unknown\n * to allow for any input, as the purpose of this function\n * is to perform runtime type checking.\n * @returns {response is PawaPayNetworkResponse} True if the input object matches\n * the PawaPayNetworkResponse interface, otherwise false. This return type\n * enables TypeScript's type narrowing, allowing the compiler to treat\n * validated objects as being of type PawaPayNetworkResponse within conditional blocks.\n */\n isPawaPayErrorResponse(response: unknown): response is PawaPayNetworkResponse {\n\n if (typeof response === \"object\" && response !== null) {\n\n const hasErrorMessage = \"errorMessage\" in response && typeof (response as any).errorMessage === \"string\";\n const hasStatusCode = \"statusCode\" in response && typeof (response as any).statusCode === \"number\";\n const hasErrorObject = \"errorObject\" in response && typeof (response as any).errorObject === \"string\";\n\n return hasErrorMessage && hasStatusCode && hasErrorObject;\n }\n\n return false;\n }\n\n}"]} -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 14 | 15 | 22 | 23 | 26 | 27 | 34 | 35 | 43 | 44 | 52 | 53 | 58 | 59 | -------------------------------------------------------------------------------- /pawapay_node/dist/utils/pawapayBaseService.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | Object.defineProperty(exports, "__esModule", { value: true }); 9 | const tsyringe_1 = require("tsyringe"); 10 | let PawapayBaseService = class PawapayBaseService { 11 | formatPhoneNumber(phoneNumber) { 12 | return phoneNumber.replace(/^([+0])/, ""); 13 | } 14 | /** 15 | * Checks if a given response is a PawaPayNetworkResponse. 16 | * 17 | * This function is a type guard that attempts to determine if an unknown input 18 | * conforms to the PawaPayNetworkResponse interface by checking for the presence 19 | * and type of specific properties. Specifically, it checks for the properties 20 | * `errorMessage`, `statusCode`, and `errorObject`, and verifies that these properties 21 | * are of the correct types (string for `errorMessage` and `errorObject`, and number 22 | * for `statusCode`). 23 | * 24 | * @param {unknown} response - The response object to check. Its type is unknown 25 | * to allow for any input, as the purpose of this function 26 | * is to perform runtime type checking. 27 | * @returns {response is PawaPayNetworkResponse} True if the input object matches 28 | * the PawaPayNetworkResponse interface, otherwise false. This return type 29 | * enables TypeScript's type narrowing, allowing the compiler to treat 30 | * validated objects as being of type PawaPayNetworkResponse within conditional blocks. 31 | */ 32 | isPawaPayErrorResponse(response) { 33 | if (typeof response === "object" && response !== null) { 34 | const hasErrorMessage = "errorMessage" in response && typeof response.errorMessage === "string"; 35 | const hasStatusCode = "statusCode" in response && typeof response.statusCode === "number"; 36 | const hasErrorObject = "errorObject" in response && typeof response.errorObject === "string"; 37 | return hasErrorMessage && hasStatusCode && hasErrorObject; 38 | } 39 | return false; 40 | } 41 | }; 42 | PawapayBaseService = __decorate([ 43 | (0, tsyringe_1.autoInjectable)(), 44 | (0, tsyringe_1.singleton)() 45 | ], PawapayBaseService); 46 | exports.default = PawapayBaseService; 47 | //# sourceMappingURL=pawapayBaseService.js.map -------------------------------------------------------------------------------- /pawapay_node/src/resources/payments_page/index.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "@config/networkManager"; 2 | import { autoInjectable, singleton } from "tsyringe"; 3 | import { InitiatePaymentResponse, PaymentData } from "types/payments"; 4 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 5 | import internalLogger from "@utils/internalLogger"; 6 | 7 | @autoInjectable() 8 | @singleton() 9 | export default class PaymentsPage { 10 | 11 | private readonly baseEndpoint; 12 | 13 | constructor(protected networkHandler: NetworkHandler) { 14 | this.baseEndpoint = "v1/widget/sessions"; 15 | } 16 | 17 | /** 18 | * Initiates a payment process by sending payment data to v1/widget/sessions. 19 | * This method constructs the payment request and handles the response, returning 20 | * a URL to which the user can be redirected to complete the payment process. 21 | * 22 | * @param {PaymentData} paymentData - An object containing all necessary data for initiating the payment. 23 | * The `PaymentData` object should include: 24 | * - `deposit_id`: The ID of the deposit. 25 | * - `price`: The amount of the payment. 26 | * - `returnUrl`: The URL to which the user will be redirected after payment completion (can be specified in `.env` as `RETURN_URL`). 27 | * - `basePaymentCountryIso`: ISO country code representing the base country for the payment. 28 | * - `reason`: A text description of the reason for the payment. 29 | * 30 | * @returns {Promise} A promise that resolves to an object containing 31 | * the `redirectUrl` for the payment completion if successful, and an `error` flag set to `false`. 32 | * In case of failure, the promise may resolve to an `unknown` type or be rejected with an error. 33 | * It's recommended to handle errors appropriately in the calling context. 34 | * 35 | * @throws {PawaPayNetworkResponse} Throws an error if the request fails for reasons such as network issues, 36 | * invalid payment data, or server errors. `. 37 | */ 38 | public async initiatePayment(paymentData: PaymentData): Promise { 39 | try { 40 | const response = await this.networkHandler.getInstance() 41 | .post(this.baseEndpoint, { 42 | depositId: paymentData.deposit_id, 43 | amount: paymentData.price.toString(), 44 | returnUrl: paymentData.returnUrl, 45 | country: paymentData.basePaymentCountryIso, 46 | reason: paymentData.reason 47 | }); 48 | 49 | internalLogger.info("Sending payment initiation request for deposit:", paymentData.deposit_id, "with amount:", paymentData.price); 50 | 51 | return { 52 | redirectUrl: response.data.redirectUrl, 53 | error: false 54 | } as InitiatePaymentResponse; 55 | } catch (error: unknown) { 56 | internalLogger.error("Payment initiation failed:", error); 57 | return this.networkHandler.handleErrors(error); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /pawapay_node/dist/types/payout.d.ts.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"payout.d.ts","sourceRoot":"","sources":["../../src/types/payout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,aAAa,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC5C,wBAAwB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACvD;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,aAAa,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC5C,wBAAwB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACvD;AAED,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG;IACtD,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC7B,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,0BAA0B,CAAC,GAChH;IACF,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC9B,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,0BAA0B,CAAC,GAChH;IACF,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,0BAA0B,CAAC;IAC7F,MAAM,EAAE,QAAQ,CAAC;IACjB,aAAa,EAAE;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE7E,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;CACxC;AAED,MAAM,MAAM,4BAA4B,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,4BAA4B,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,mBAAmB,CAAC;IACtD,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,eAAe,CAAC,EAAE;QAChB,aAAa,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,eAAe,GAAG,qBAAqB,GAAG,uCAAuC,CAAC;QACzQ,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,aAAa,CAAC,EAAE;QACd,WAAW,EAAE,sBAAsB,GAAG,qBAAqB,GAAG,kCAAkC,GAAG,aAAa,CAAC;QACjH,cAAc,EAAE,MAAM,CAAC;KACxB,CAAA;CACF"} -------------------------------------------------------------------------------- /pawapay_node/dist/config/networkManager.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const axios_1 = __importDefault(require("axios")); 16 | const tsyringe_1 = require("tsyringe"); 17 | const Constants_1 = __importDefault(require("./Constants")); 18 | const internalLogger_1 = __importDefault(require("../utils/internalLogger")); 19 | let NetworkHandler = class NetworkHandler { 20 | axiosInstance; 21 | constructor() { 22 | const pawaPayJwt = process.env.PAWAPAY_JWT; 23 | const environment = process.env.Node_ENV; 24 | const baseURL = environment === "production" ? 25 | Constants_1.default.URLs[Constants_1.default["_PAWA_PAY_PROD_URL"]] : 26 | Constants_1.default.URLs[Constants_1.default["_PAWA_PAY_SANDBOX_URL"]]; 27 | const headers = {}; 28 | if (pawaPayJwt) { 29 | headers.Authorization = `Bearer ${pawaPayJwt}`; 30 | } 31 | this.axiosInstance = axios_1.default.create({ 32 | baseURL, 33 | headers 34 | }); 35 | this.setupInterceptors(); 36 | } 37 | getInstance() { 38 | return this.axiosInstance; 39 | } 40 | handleErrors(error) { 41 | internalLogger_1.default.error("Error occurred " + error); 42 | let errorMessage = "An unknown error occurred"; 43 | let statusCode = 500; 44 | let errorObject = "{}"; 45 | if (axios_1.default.isAxiosError(error) && error.response) { 46 | statusCode = error.response.status; 47 | try { 48 | const data = error.response.data; 49 | errorMessage = data.message || data.error || errorMessage; 50 | errorObject = JSON.stringify(data); 51 | } 52 | catch { 53 | errorMessage = "Failed to parse error response"; 54 | } 55 | } 56 | return { 57 | errorMessage, 58 | statusCode, 59 | errorObject 60 | }; 61 | } 62 | setupInterceptors() { 63 | this.axiosInstance.interceptors.response.use((response) => new Promise((resolve) => { 64 | resolve(response); 65 | }), (error) => { 66 | return new Promise((_, reject) => { 67 | reject(error); 68 | }); 69 | }); 70 | } 71 | }; 72 | NetworkHandler = __decorate([ 73 | (0, tsyringe_1.autoInjectable)(), 74 | (0, tsyringe_1.singleton)(), 75 | __metadata("design:paramtypes", []) 76 | ], NetworkHandler); 77 | exports.default = NetworkHandler; 78 | //# sourceMappingURL=networkManager.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/config/networkManager.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"networkManager.js","sourceRoot":"","sources":["../../src/config/networkManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAAkE;AAClE,uCAAqD;AACrD,kEAA0C;AAE1C,2EAAmD;AAEnD,IAEM,cAAc,GAFpB,MAEM,cAAc;IACD,aAAa,CAAgB;IAE9C;QACE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QAEzC,MAAM,OAAO,GAAG,WAAW,KAAK,YAAY,CAAC,CAAC;YAC5C,mBAAS,CAAC,IAAI,CAAC,mBAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;YACjD,mBAAS,CAAC,IAAI,CAAC,mBAAS,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAErD,MAAM,OAAO,GAAG,EAAyB,CAAC;QAE1C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,aAAa,GAAG,UAAU,UAAU,EAAE,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;YAChC,OAAO;YACP,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAEM,YAAY,CAAC,KAAc;QAChC,wBAAc,CAAC,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;QAEhD,IAAI,YAAY,GAAG,2BAA2B,CAAC;QAC/C,IAAI,UAAU,GAAG,GAAG,CAAC;QACrB,IAAI,WAAW,GAAG,IAAI,CAAC;QAEvB,IAAI,eAAK,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YAEnC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAA6C,CAAC;gBAC1E,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC;gBAC1D,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACrC,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY,GAAG,gCAAgC,CAAC;YAClD,CAAC;QACH,CAAC;QAED,OAAO;YACL,YAAY;YACZ,UAAU;YACV,WAAW;SACZ,CAAC;IACJ,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAC1C,CAAC,QAAQ,EAAE,EAAE,CACX,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACtB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACpB,CAAC,CAAC,EACJ,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;gBAC/B,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AApEK,cAAc;IAFnB,IAAA,yBAAc,GAAE;IAChB,IAAA,oBAAS,GAAE;;GACN,cAAc,CAoEnB;AAED,kBAAe,cAAc,CAAC","sourcesContent":["import axios, { AxiosInstance, AxiosRequestHeaders } from \"axios\";\nimport { autoInjectable, singleton } from \"tsyringe\";\nimport Constants from \"@config/Constants\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\nimport internalLogger from \"@utils/internalLogger\";\n\n@autoInjectable()\n@singleton()\nclass NetworkHandler {\n private readonly axiosInstance: AxiosInstance;\n\n constructor() {\n const pawaPayJwt = process.env.PAWAPAY_JWT;\n const environment = process.env.Node_ENV;\n\n const baseURL = environment === \"production\" ?\n Constants.URLs[Constants[\"_PAWA_PAY_PROD_URL\"]] :\n Constants.URLs[Constants[\"_PAWA_PAY_SANDBOX_URL\"]];\n\n const headers = {} as AxiosRequestHeaders;\n\n if (pawaPayJwt) {\n headers.Authorization = `Bearer ${pawaPayJwt}`;\n }\n\n this.axiosInstance = axios.create({\n baseURL,\n headers\n });\n\n this.setupInterceptors();\n }\n\n public getInstance(): AxiosInstance {\n return this.axiosInstance;\n }\n\n public handleErrors(error: unknown): PawaPayNetworkResponse {\n internalLogger.error(\"Error occurred \" + error);\n\n let errorMessage = \"An unknown error occurred\";\n let statusCode = 500;\n let errorObject = \"{}\";\n\n if (axios.isAxiosError(error) && error.response) {\n statusCode = error.response.status;\n\n try {\n const data = error.response.data as { message?: string; error?: string; };\n errorMessage = data.message || data.error || errorMessage;\n errorObject = JSON.stringify(data);\n } catch {\n errorMessage = \"Failed to parse error response\";\n }\n }\n\n return {\n errorMessage,\n statusCode,\n errorObject\n };\n }\n\n private setupInterceptors(): void {\n this.axiosInstance.interceptors.response.use(\n (response) =>\n new Promise((resolve) => {\n resolve(response);\n }),\n (error) => {\n return new Promise((_, reject) => {\n reject(error);\n });\n }\n );\n }\n}\n\nexport default NetworkHandler;\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payments_page/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/payments_page/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4EAAoD;AACpD,uCAAqD;AAGrD,2EAAmD;AAIpC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAIT;IAFL,YAAY,CAAC;IAE9B,YAAsB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAClD,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAC;IAC3C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,KAAK,CAAC,eAAe,CAAC,WAAwB;QACnD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE;iBACrD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;gBACvB,SAAS,EAAE,WAAW,CAAC,UAAU;gBACjC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACpC,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,OAAO,EAAE,WAAW,CAAC,qBAAqB;gBAC1C,MAAM,EAAE,WAAW,CAAC,MAAM;aAC3B,CAAC,CAAC;YAEL,wBAAc,CAAC,IAAI,CAAC,iDAAiD,EAAE,WAAW,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;YAElI,OAAO;gBACL,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW;gBACtC,KAAK,EAAE,KAAK;aACc,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,wBAAc,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF,CAAA;AAnDoB,YAAY;IAFhC,IAAA,yBAAc,GAAE;IAChB,IAAA,oBAAS,GAAE;qCAK4B,wBAAc;GAJjC,YAAY,CAmDhC;kBAnDoB,YAAY","sourcesContent":["import NetworkHandler from \"@config/networkManager\";\nimport { autoInjectable, singleton } from \"tsyringe\";\nimport { InitiatePaymentResponse, PaymentData } from \"types/payments\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\nimport internalLogger from \"@utils/internalLogger\";\n\n@autoInjectable()\n@singleton()\nexport default class PaymentsPage {\n\n private readonly baseEndpoint;\n\n constructor(protected networkHandler: NetworkHandler) {\n this.baseEndpoint = \"v1/widget/sessions\";\n }\n\n /**\n * Initiates a payment process by sending payment data to v1/widget/sessions.\n * This method constructs the payment request and handles the response, returning\n * a URL to which the user can be redirected to complete the payment process.\n *\n * @param {PaymentData} paymentData - An object containing all necessary data for initiating the payment.\n * The `PaymentData` object should include:\n * - `deposit_id`: The ID of the deposit.\n * - `price`: The amount of the payment.\n * - `returnUrl`: The URL to which the user will be redirected after payment completion (can be specified in `.env` as `RETURN_URL`).\n * - `basePaymentCountryIso`: ISO country code representing the base country for the payment.\n * - `reason`: A text description of the reason for the payment.\n *\n * @returns {Promise} A promise that resolves to an object containing\n * the `redirectUrl` for the payment completion if successful, and an `error` flag set to `false`.\n * In case of failure, the promise may resolve to an `unknown` type or be rejected with an error.\n * It's recommended to handle errors appropriately in the calling context.\n *\n * @throws {PawaPayNetworkResponse} Throws an error if the request fails for reasons such as network issues,\n * invalid payment data, or server errors. `.\n */\n public async initiatePayment(paymentData: PaymentData): Promise {\n try {\n const response = await this.networkHandler.getInstance()\n .post(this.baseEndpoint, {\n depositId: paymentData.deposit_id,\n amount: paymentData.price.toString(),\n returnUrl: paymentData.returnUrl,\n country: paymentData.basePaymentCountryIso,\n reason: paymentData.reason\n });\n\n internalLogger.info(\"Sending payment initiation request for deposit:\", paymentData.deposit_id, \"with amount:\", paymentData.price);\n\n return {\n redirectUrl: response.data.redirectUrl,\n error: false\n } as InitiatePaymentResponse;\n } catch (error: unknown) {\n internalLogger.error(\"Payment initiation failed:\", error);\n return this.networkHandler.handleErrors(error);\n }\n }\n}\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/types/payout.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"payout.js","sourceRoot":"","sources":["../../src/types/payout.ts"],"names":[],"mappings":";;;AA0EA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,uDAAuC,CAAA;AACzC,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB","sourcesContent":["import { Correspondent, MoMoCurrency } from \"@utils/moMoOps\";\n\nexport interface PaymentTransaction {\n depositId: string;\n status: PaymentStatus;\n requestedAmount: string;\n depositedAmount: string;\n currency: MoMoCurrency;\n country: string;\n payer: Payer;\n correspondent: Correspondent;\n statementDescription: string;\n customerTimestamp: string;\n created: string;\n respondedByPayer: string;\n correspondentIds: { [key: string]: string };\n suspiciousActivityReport?: SuspiciousActivityReport[];\n}\n\nexport interface Payer {\n type: string;\n address: {\n value: string;\n };\n}\n\nexport interface SuspiciousActivityReport {\n activityType: string;\n comment: string;\n}\n\nexport interface PaymentTransaction {\n depositId: string;\n status: PaymentStatus;\n requestedAmount: string;\n depositedAmount: string;\n currency: MoMoCurrency;\n country: string;\n payer: Payer;\n correspondent: Correspondent;\n statementDescription: string;\n customerTimestamp: string;\n created: string;\n respondedByPayer: string;\n correspondentIds: { [key: string]: string };\n suspiciousActivityReport?: SuspiciousActivityReport[];\n}\n\nexport type CompletedTransaction = PaymentTransaction & {\n status: \"COMPLETED\";\n};\n\nexport type AcceptedTransaction =\n Omit\n & {\n status: \"ACCEPTED\";\n};\n\nexport type SubmittedTransaction =\n Omit\n & {\n status: \"SUBMITTED\";\n};\n\nexport interface FailedTransaction extends Omit {\n status: \"FAILED\";\n failureReason: {\n failureCode: string;\n failureMessage: string;\n };\n}\n\nexport type PaymentStatus = \"PENDING\" | \"COMPLETED\" | \"FAILED\" | \"CANCELLED\";\n\nexport enum PayoutStatus {\n ACCEPTED = \"ACCEPTED\",\n ENQUEUED = \"ENQUEUED\",\n REJECTED = \"REJECTED\",\n DUPLICATE_IGNORED = \"DUPLICATE_IGNORED\",\n}\n\nexport type ResendCallbackResponseStatus = \"ACCEPTED\" | \"REJECTED\" | \"FAILED\";\n\nexport interface PawaPayPayoutTransaction {\n payoutId: string;\n status: PayoutStatus;\n created: string;\n}\n\nexport interface PayoutTransaction {\n amount: string;\n phoneNumber: string;\n payoutId: string;\n currency: MoMoCurrency;\n correspondent: Correspondent;\n statementDescription: string;\n country: string;\n customerTimestamp?: string;\n}\n\nexport interface ResendCallbackResponse {\n payoutId: string;\n status: ResendCallbackResponseStatus;\n rejectionReason?: string;\n}\n\nexport interface RefundResponse {\n refundId: string;\n status: \"ACCEPTED\" | \"REJECTED\" | \"DUPLICATE_IGNORED\";\n created?: Date;\n rejectionReason?: {\n rejectionCode: \"DEPOSIT_NOT_FOUND\" | \"DEPOSIT_NOT_COMPLETED\" | \"ALREADY_REFUNDED\" | \"IN_PROGRESS\" | \"INVALID_AMOUNT\" | \"AMOUNT_TOO_SMALL\" | \"AMOUNT_TOO_LARGE\" | \"PARAMETER_INVALID\" | \"INVALID_INPUT\" | \"REFUNDS_NOT_ALLOWED\" | \"CORRESPONDENT_TEMPORARILY_UNAVAILABLE\";\n rejectionMessage: string;\n };\n}\n\nexport interface RefundTransaction {\n refundId: string;\n status: \"ACCEPTED\" | \"SUBMITTED\" | \"ENQUEUED\" | \"COMPLETED\" | \"FAILED\",\n amount: string;\n currency: MoMoCurrency;\n country: string;\n correspondent: Correspondent;\n recipient: Payer;\n customerTimestamp: string;\n statementDescription?: string;\n created: string;\n receivedByRecipient?: string;\n correspondentIds?: { [key: string]: string };\n failureReason?: {\n failureCode: \"BALANCE_INSUFFICIENT\" | \"RECIPIENT_NOT_FOUND\" | \"RECIPIENT_NOT_ALLOWED_TO_RECEIVE\" | \"OTHER_ERROR\",\n failureMessage: string;\n }\n}"]} -------------------------------------------------------------------------------- /pawapay_node/src/resources/refunds/index.ts: -------------------------------------------------------------------------------- 1 | import { autoInjectable, singleton } from "tsyringe"; 2 | import NetworkHandler from "@config/networkManager"; 3 | import { RefundResponse, RefundTransaction } from "types/payout"; 4 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 5 | import internalLogger from "@utils/internalLogger"; 6 | 7 | @singleton() 8 | @autoInjectable() 9 | export default class Refunds { 10 | 11 | private readonly baseEndpoint; 12 | 13 | constructor(protected networkHandler: NetworkHandler) { 14 | this.baseEndpoint = "/refunds"; 15 | } 16 | 17 | /** 18 | * Asynchronously submits a request to create a refund for a specific transaction. This method sends the refund details, 19 | * including the unique identifiers for the refund and the original deposit, to a designated service endpoint for processing. 20 | * It is intended to initiate the refund process for transactions that meet the criteria for refunding. 21 | * 22 | * @param {any} refundData - An object containing the refund request details. The structure of this object includes 23 | * `refundId`, the unique identifier for the refund request, and `depositId`, the unique identifier of the original deposit transaction to be refunded. 24 | * 25 | * @returns {Promise} A promise that resolves to a `RefundResponse` object if the refund request is successfully processed. 26 | * The `RefundResponse` type should detail the outcome of the refund request. In case of an error during the request processing, 27 | * the promise resolves to an unknown type, with the error handled by the `networkHandler`'s error handling mechanism. 28 | */ 29 | 30 | async createRefundRequest(refundData: any): Promise { 31 | try { 32 | 33 | const response = await this.networkHandler.getInstance().post( 34 | this.baseEndpoint, 35 | { 36 | refundId: refundData.refundId, 37 | depositId: refundData.depositId 38 | } 39 | ); 40 | 41 | internalLogger.info("Sending refund request for deposit: " + refundData.depositId + "with refundId: " + refundData.refundId); 42 | 43 | return response.data as RefundResponse; 44 | 45 | } catch (error: unknown) { 46 | internalLogger.error("Refund request failed: " + error); 47 | return this.networkHandler.handleErrors(error); 48 | } 49 | } 50 | 51 | /** 52 | * Asynchronously retrieves the status of a specific refund transaction by its unique identifier (refundId). 53 | * This method constructs the request URL using the refundId and makes a GET request to the service endpoint 54 | * to fetch the current status of the refund transaction. It provides a means to track the progress or outcome of refund requests. 55 | * 56 | * @param {string} refundId - The unique identifier for the refund transaction whose status is being queried. 57 | * 58 | * @returns {Promise} A promise that resolves to a `RefundTransaction` object if the refund status is successfully retrieved. 59 | * The `RefundTransaction` type is expected to contain comprehensive details about the refund transaction, including its current status. 60 | * If an error occurs during the retrieval process, the promise resolves to an unknown type. Errors are handled using the `networkHandler`'s error handling process. 61 | */ 62 | 63 | async getRefundStatus(refundId: string): Promise { 64 | try { 65 | const endPoint = this.baseEndpoint + `/${refundId}`; 66 | const response = await this.networkHandler.getInstance().get(endPoint); 67 | 68 | internalLogger.info("Refund details retrieved successfully: " + response.data); 69 | 70 | return response.data as RefundTransaction; 71 | } catch (error: unknown) { 72 | internalLogger.error("Refund transaction failed: " + error); 73 | return this.networkHandler.handleErrors(error); 74 | } 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /pawapay_rust/src/resources/deposits/deposits.rs: -------------------------------------------------------------------------------- 1 | use reqwest::{Error, StatusCode}; 2 | 3 | use crate::config::network_manager::NetworkManager; 4 | use crate::structs::pawapay::{PaymentTransaction, ResendCallbackResponseStatus}; 5 | 6 | 7 | /// Sends a payment transaction to a remote service. 8 | /// 9 | /// This asynchronous function takes a `PaymentTransaction` and a `NetworkManager` configuration, 10 | /// sends the transaction to the specified endpoint, and awaits the response. If the response status 11 | /// is OK, it attempts to deserialize the response body into a `PaymentTransaction` object and return it. 12 | /// Otherwise, it returns an error indicating the failure. 13 | /// 14 | /// # Parameters 15 | /// - `payment_transaction`: The `PaymentTransaction` object containing the transaction details to be sent. 16 | /// - `config`: A reference to a `NetworkManager` containing the configuration settings such as the base URL and API key. 17 | /// 18 | /// # Returns 19 | /// Returns a `Result` that is either: 20 | /// - Ok(`PaymentTransaction`): A `PaymentTransaction` object parsed from the response body if the request was successful. 21 | /// - Err(`Error`): An error occurred during the request or while parsing the response. 22 | /// 23 | /// # Errors 24 | /// This function can return an `Error` in several cases, including: 25 | /// - Network issues or server not responding. 26 | /// - The response status from the server is not OK. 27 | /// - Failure to parse the response body into a `PaymentTransaction` object. 28 | /// with appropriate parameters as per your implementation. 29 | pub async fn send_payment_transaction( 30 | payment_transaction: PaymentTransaction, 31 | config: &NetworkManager, 32 | ) -> Result { 33 | // Function implementation remains 34 | 35 | pub async fn send_payment_transaction( 36 | payment_transaction: PaymentTransaction, 37 | config: &NetworkManager, 38 | ) -> Result { 39 | let url = format!("{}/deposits", config.base_url); 40 | let client = reqwest::Client::new(); 41 | let response = client 42 | .post(&url) 43 | .header("Authorization", &config.api_key) 44 | .json(&payment_transaction) 45 | .send() 46 | .await?; 47 | 48 | let status = response.status(); 49 | let body = response.text().await?; 50 | 51 | match status { 52 | StatusCode::OK => { 53 | let payment_transaction: PaymentTransaction = serde_json::from_str(&body)?; 54 | Ok(payment_transaction) 55 | } 56 | _ => Err(Error::ApiError { 57 | status, 58 | message: body, 59 | }), 60 | } 61 | } 62 | 63 | pub async fn get_payment_transaction( 64 | deposit_id: &str, 65 | config: &NetworkManager, 66 | ) -> Result { 67 | let response = config.client().get("/deposits").send().await?; 68 | 69 | let status = response.status(); 70 | let body = response.text().await?; 71 | 72 | match status { 73 | StatusCode::OK => { 74 | let payment_transaction: PaymentTransaction = serde_json::from_str(&body)?; 75 | Ok(payment_transaction) 76 | } 77 | _ => Err(Error::ApiError { 78 | status, 79 | message: body, 80 | }), 81 | } 82 | } 83 | 84 | pub async fn resend_callback( 85 | deposit_id: &str, 86 | config: &NetworkManager, 87 | ) -> Result { 88 | let response = config.client().get("/deposits/resend-callback").send().await?; 89 | 90 | 91 | let status = response.status(); 92 | let body = response.text().await?; 93 | 94 | match status { 95 | StatusCode::OK => { 96 | let resend_callback_response_status: ResendCallbackResponseStatus = serde_json::from_str(&body)?; 97 | Ok(resend_callback_response_status) 98 | } 99 | _ => Err(Error::ApiError { 100 | status, 101 | message: body, 102 | }), 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payments_page/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const networkManager_1 = __importDefault(require("../../config/networkManager")); 16 | const tsyringe_1 = require("tsyringe"); 17 | const internalLogger_1 = __importDefault(require("../../utils/internalLogger")); 18 | let PaymentsPage = class PaymentsPage { 19 | networkHandler; 20 | baseEndpoint; 21 | constructor(networkHandler) { 22 | this.networkHandler = networkHandler; 23 | this.baseEndpoint = "v1/widget/sessions"; 24 | } 25 | /** 26 | * Initiates a payment process by sending payment data to v1/widget/sessions. 27 | * This method constructs the payment request and handles the response, returning 28 | * a URL to which the user can be redirected to complete the payment process. 29 | * 30 | * @param {PaymentData} paymentData - An object containing all necessary data for initiating the payment. 31 | * The `PaymentData` object should include: 32 | * - `deposit_id`: The ID of the deposit. 33 | * - `price`: The amount of the payment. 34 | * - `returnUrl`: The URL to which the user will be redirected after payment completion (can be specified in `.env` as `RETURN_URL`). 35 | * - `basePaymentCountryIso`: ISO country code representing the base country for the payment. 36 | * - `reason`: A text description of the reason for the payment. 37 | * 38 | * @returns {Promise} A promise that resolves to an object containing 39 | * the `redirectUrl` for the payment completion if successful, and an `error` flag set to `false`. 40 | * In case of failure, the promise may resolve to an `unknown` type or be rejected with an error. 41 | * It's recommended to handle errors appropriately in the calling context. 42 | * 43 | * @throws {PawaPayNetworkResponse} Throws an error if the request fails for reasons such as network issues, 44 | * invalid payment data, or server errors. `. 45 | */ 46 | async initiatePayment(paymentData) { 47 | try { 48 | const response = await this.networkHandler.getInstance() 49 | .post(this.baseEndpoint, { 50 | depositId: paymentData.deposit_id, 51 | amount: paymentData.price.toString(), 52 | returnUrl: paymentData.returnUrl, 53 | country: paymentData.basePaymentCountryIso, 54 | reason: paymentData.reason 55 | }); 56 | internalLogger_1.default.info("Sending payment initiation request for deposit:", paymentData.deposit_id, "with amount:", paymentData.price); 57 | return { 58 | redirectUrl: response.data.redirectUrl, 59 | error: false 60 | }; 61 | } 62 | catch (error) { 63 | internalLogger_1.default.error("Payment initiation failed:", error); 64 | return this.networkHandler.handleErrors(error); 65 | } 66 | } 67 | }; 68 | PaymentsPage = __decorate([ 69 | (0, tsyringe_1.autoInjectable)(), 70 | (0, tsyringe_1.singleton)(), 71 | __metadata("design:paramtypes", [networkManager_1.default]) 72 | ], PaymentsPage); 73 | exports.default = PaymentsPage; 74 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /pawapay_node/src/types/payout.ts: -------------------------------------------------------------------------------- 1 | import { Correspondent, MoMoCurrency } from "@utils/moMoOps"; 2 | 3 | export interface PaymentTransaction { 4 | depositId: string; 5 | status: PaymentStatus; 6 | requestedAmount: string; 7 | depositedAmount: string; 8 | currency: MoMoCurrency; 9 | country: string; 10 | payer: Payer; 11 | correspondent: Correspondent; 12 | statementDescription: string; 13 | customerTimestamp: string; 14 | created: string; 15 | respondedByPayer: string; 16 | correspondentIds: { [key: string]: string }; 17 | suspiciousActivityReport?: SuspiciousActivityReport[]; 18 | } 19 | 20 | export interface Payer { 21 | type: string; 22 | address: { 23 | value: string; 24 | }; 25 | } 26 | 27 | export interface SuspiciousActivityReport { 28 | activityType: string; 29 | comment: string; 30 | } 31 | 32 | export interface PaymentTransaction { 33 | depositId: string; 34 | status: PaymentStatus; 35 | requestedAmount: string; 36 | depositedAmount: string; 37 | currency: MoMoCurrency; 38 | country: string; 39 | payer: Payer; 40 | correspondent: Correspondent; 41 | statementDescription: string; 42 | customerTimestamp: string; 43 | created: string; 44 | respondedByPayer: string; 45 | correspondentIds: { [key: string]: string }; 46 | suspiciousActivityReport?: SuspiciousActivityReport[]; 47 | } 48 | 49 | export type CompletedTransaction = PaymentTransaction & { 50 | status: "COMPLETED"; 51 | }; 52 | 53 | export type AcceptedTransaction = 54 | Omit 55 | & { 56 | status: "ACCEPTED"; 57 | }; 58 | 59 | export type SubmittedTransaction = 60 | Omit 61 | & { 62 | status: "SUBMITTED"; 63 | }; 64 | 65 | export interface FailedTransaction extends Omit { 66 | status: "FAILED"; 67 | failureReason: { 68 | failureCode: string; 69 | failureMessage: string; 70 | }; 71 | } 72 | 73 | export type PaymentStatus = "PENDING" | "COMPLETED" | "FAILED" | "CANCELLED"; 74 | 75 | export enum PayoutStatus { 76 | ACCEPTED = "ACCEPTED", 77 | ENQUEUED = "ENQUEUED", 78 | REJECTED = "REJECTED", 79 | DUPLICATE_IGNORED = "DUPLICATE_IGNORED", 80 | } 81 | 82 | export type ResendCallbackResponseStatus = "ACCEPTED" | "REJECTED" | "FAILED"; 83 | 84 | export interface PawaPayPayoutTransaction { 85 | payoutId: string; 86 | status: PayoutStatus; 87 | created: string; 88 | } 89 | 90 | export interface PayoutTransaction { 91 | amount: string; 92 | phoneNumber: string; 93 | payoutId: string; 94 | currency: MoMoCurrency; 95 | correspondent: Correspondent; 96 | statementDescription: string; 97 | country: string; 98 | customerTimestamp?: string; 99 | } 100 | 101 | export interface ResendCallbackResponse { 102 | payoutId: string; 103 | status: ResendCallbackResponseStatus; 104 | rejectionReason?: string; 105 | } 106 | 107 | export interface RefundResponse { 108 | refundId: string; 109 | status: "ACCEPTED" | "REJECTED" | "DUPLICATE_IGNORED"; 110 | created?: Date; 111 | rejectionReason?: { 112 | rejectionCode: "DEPOSIT_NOT_FOUND" | "DEPOSIT_NOT_COMPLETED" | "ALREADY_REFUNDED" | "IN_PROGRESS" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "PARAMETER_INVALID" | "INVALID_INPUT" | "REFUNDS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE"; 113 | rejectionMessage: string; 114 | }; 115 | } 116 | 117 | export interface RefundTransaction { 118 | refundId: string; 119 | status: "ACCEPTED" | "SUBMITTED" | "ENQUEUED" | "COMPLETED" | "FAILED", 120 | amount: string; 121 | currency: MoMoCurrency; 122 | country: string; 123 | correspondent: Correspondent; 124 | recipient: Payer; 125 | customerTimestamp: string; 126 | statementDescription?: string; 127 | created: string; 128 | receivedByRecipient?: string; 129 | correspondentIds?: { [key: string]: string }; 130 | failureReason?: { 131 | failureCode: "BALANCE_INSUFFICIENT" | "RECIPIENT_NOT_FOUND" | "RECIPIENT_NOT_ALLOWED_TO_RECEIVE" | "OTHER_ERROR", 132 | failureMessage: string; 133 | } 134 | } -------------------------------------------------------------------------------- /pawapay_node/dist/types/payout.d.ts: -------------------------------------------------------------------------------- 1 | import { Correspondent, MoMoCurrency } from "../utils/moMoOps"; 2 | export interface PaymentTransaction { 3 | depositId: string; 4 | status: PaymentStatus; 5 | requestedAmount: string; 6 | depositedAmount: string; 7 | currency: MoMoCurrency; 8 | country: string; 9 | payer: Payer; 10 | correspondent: Correspondent; 11 | statementDescription: string; 12 | customerTimestamp: string; 13 | created: string; 14 | respondedByPayer: string; 15 | correspondentIds: { 16 | [key: string]: string; 17 | }; 18 | suspiciousActivityReport?: SuspiciousActivityReport[]; 19 | } 20 | export interface Payer { 21 | type: string; 22 | address: { 23 | value: string; 24 | }; 25 | } 26 | export interface SuspiciousActivityReport { 27 | activityType: string; 28 | comment: string; 29 | } 30 | export interface PaymentTransaction { 31 | depositId: string; 32 | status: PaymentStatus; 33 | requestedAmount: string; 34 | depositedAmount: string; 35 | currency: MoMoCurrency; 36 | country: string; 37 | payer: Payer; 38 | correspondent: Correspondent; 39 | statementDescription: string; 40 | customerTimestamp: string; 41 | created: string; 42 | respondedByPayer: string; 43 | correspondentIds: { 44 | [key: string]: string; 45 | }; 46 | suspiciousActivityReport?: SuspiciousActivityReport[]; 47 | } 48 | export type CompletedTransaction = PaymentTransaction & { 49 | status: "COMPLETED"; 50 | }; 51 | export type AcceptedTransaction = Omit & { 52 | status: "ACCEPTED"; 53 | }; 54 | export type SubmittedTransaction = Omit & { 55 | status: "SUBMITTED"; 56 | }; 57 | export interface FailedTransaction extends Omit { 58 | status: "FAILED"; 59 | failureReason: { 60 | failureCode: string; 61 | failureMessage: string; 62 | }; 63 | } 64 | export type PaymentStatus = "PENDING" | "COMPLETED" | "FAILED" | "CANCELLED"; 65 | export declare enum PayoutStatus { 66 | ACCEPTED = "ACCEPTED", 67 | ENQUEUED = "ENQUEUED", 68 | REJECTED = "REJECTED", 69 | DUPLICATE_IGNORED = "DUPLICATE_IGNORED" 70 | } 71 | export type ResendCallbackResponseStatus = "ACCEPTED" | "REJECTED" | "FAILED"; 72 | export interface PawaPayPayoutTransaction { 73 | payoutId: string; 74 | status: PayoutStatus; 75 | created: string; 76 | } 77 | export interface PayoutTransaction { 78 | amount: string; 79 | phoneNumber: string; 80 | payoutId: string; 81 | currency: MoMoCurrency; 82 | correspondent: Correspondent; 83 | statementDescription: string; 84 | country: string; 85 | customerTimestamp?: string; 86 | } 87 | export interface ResendCallbackResponse { 88 | payoutId: string; 89 | status: ResendCallbackResponseStatus; 90 | rejectionReason?: string; 91 | } 92 | export interface RefundResponse { 93 | refundId: string; 94 | status: "ACCEPTED" | "REJECTED" | "DUPLICATE_IGNORED"; 95 | created?: Date; 96 | rejectionReason?: { 97 | rejectionCode: "DEPOSIT_NOT_FOUND" | "DEPOSIT_NOT_COMPLETED" | "ALREADY_REFUNDED" | "IN_PROGRESS" | "INVALID_AMOUNT" | "AMOUNT_TOO_SMALL" | "AMOUNT_TOO_LARGE" | "PARAMETER_INVALID" | "INVALID_INPUT" | "REFUNDS_NOT_ALLOWED" | "CORRESPONDENT_TEMPORARILY_UNAVAILABLE"; 98 | rejectionMessage: string; 99 | }; 100 | } 101 | export interface RefundTransaction { 102 | refundId: string; 103 | status: "ACCEPTED" | "SUBMITTED" | "ENQUEUED" | "COMPLETED" | "FAILED"; 104 | amount: string; 105 | currency: MoMoCurrency; 106 | country: string; 107 | correspondent: Correspondent; 108 | recipient: Payer; 109 | customerTimestamp: string; 110 | statementDescription?: string; 111 | created: string; 112 | receivedByRecipient?: string; 113 | correspondentIds?: { 114 | [key: string]: string; 115 | }; 116 | failureReason?: { 117 | failureCode: "BALANCE_INSUFFICIENT" | "RECIPIENT_NOT_FOUND" | "RECIPIENT_NOT_ALLOWED_TO_RECEIVE" | "OTHER_ERROR"; 118 | failureMessage: string; 119 | }; 120 | } 121 | //# sourceMappingURL=payout.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payouts/index.d.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "../../config/networkManager"; 2 | import { PawaPayPayoutTransaction, PayoutTransaction } from "../../types/payout"; 3 | import PawapayBaseService from "../../utils/pawapayBaseService"; 4 | import { PawaPayNetworkResponse } from "../../types/pawaPayErrorResponse"; 5 | export default class Payouts { 6 | protected networkHandler: NetworkHandler; 7 | protected pawapayBaseService: PawapayBaseService; 8 | private readonly baseEndpoint; 9 | constructor(networkHandler: NetworkHandler, pawapayBaseService: PawapayBaseService); 10 | /** 11 | * Sends a payout transaction to the specified endpoint, processing the transaction 12 | * details provided in the `transaction` parameter. It formats the phone number, 13 | * logs the transaction details for debugging, and handles the server response. 14 | * 15 | * @param {PayoutTransaction} transaction - The payout transaction object containing all the necessary information 16 | * for processing the payout. This includes: 17 | * - `phoneNumber`: The recipient's phone number. 18 | * - `amount`: The payout amount. 19 | * - `payoutId`: A unique identifier for the payout. 20 | * - `currency`: The currency code for the amount (e.g., USD, GBP). 21 | * - `correspondent`: The correspondent code for the transaction. 22 | * - `statementDescription`: A description for the statement. 23 | * 24 | * @returns {Promise} A promise that resolves to the payout transaction response object 25 | * if the request is successful. The object includes all relevant details about the transaction response from the server. 26 | * In the case of an error, the promise resolves to an `unknown` type that represents the handled error response. 27 | * 28 | * @throws {PawaPayNetworkResponse} This method may throw an error if the request fails due to reasons such as network issues, 29 | * invalid transaction details, or server-side problems. Such errors are caught and handled by `networkHandler.handleErrors`. 30 | */ 31 | sendPayout(transaction: PayoutTransaction): Promise; 32 | /** 33 | * Asynchronously processes a bulk payout transaction request by sending multiple payout transactions to the PawaPay service. 34 | * Each transaction is formatted according to the requirements before sending. This method is useful for processing multiple 35 | * payouts in a single operation, improving efficiency and reducing the number of individual requests. 36 | * 37 | * @param {PayoutTransaction[]} transactions - An array of `PayoutTransaction` objects representing the individual transactions to be processed in bulk. 38 | * 39 | * @returns {Promise} A promise that resolves to an array of `PawaPayPayoutTransaction` objects if the bulk payout is successfully processed. 40 | * Each object in the array represents the response for the corresponding payout transaction. If an error occurs during the process, 41 | * the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 42 | */ 43 | sendBulkPayout(transactions: PayoutTransaction[]): Promise; 44 | /** 45 | * Asynchronously retrieves the details of a specific payout transaction by its unique identifier (depositId). 46 | * This method constructs the request URL using the depositId and makes a GET request to the PawaPay service endpoint 47 | * to obtain the transaction details. It is designed to fetch information for individual payout transactions. 48 | * 49 | * @param {string} depositId - The unique identifier for the payout transaction whose details are being retrieved. 50 | * 51 | * @returns {Promise} A promise that resolves to a `PawaPayPayoutTransaction` object if the payout details are successfully retrieved. 52 | * This object contains the details of the specified payout transaction. If an error occurs during the retrieval process, 53 | * the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 54 | */ 55 | getPayout(depositId: string): Promise; 56 | } 57 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/deposits/index.d.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "../../config/networkManager"; 2 | import PawapayBaseService from "../../utils/pawapayBaseService"; 3 | import { PawaPayPayoutTransaction, PaymentTransaction, PayoutTransaction, ResendCallbackResponse } from "../../types/payout"; 4 | import { PawaPayNetworkResponse } from "../../types/pawaPayErrorResponse"; 5 | export default class Deposits { 6 | protected networkHandler: NetworkHandler; 7 | protected pawapayBaseService: PawapayBaseService; 8 | private readonly baseEndpoint; 9 | constructor(networkHandler: NetworkHandler, pawapayBaseService: PawapayBaseService); 10 | /** 11 | * Asynchronously sends a payout transaction to a specified recipient using the PawaPay service. 12 | * This method formats the recipient's phone number, constructs the payout request payload, 13 | * and sends it to the PawaPay payout service endpoint. It logs the transaction details and 14 | * handles any potential errors during the transaction process. 15 | * 16 | * @param {PayoutTransaction} transaction - An object containing the details of the payout transaction, 17 | * including the recipient's phone number, payout amount, currency, payout ID, correspondent, and statement description. 18 | * 19 | * @returns {Promise} A promise that resolves to the response data 20 | * from the PawaPay service if the transaction is successfully processed. If an error occurs during 21 | * the process, the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 22 | * 23 | * @throws {PawaPayNetworkResponse} The method catches and handles any errors that occur during the execution of the transaction. 24 | * These errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 25 | * 26 | * sendDeposit(transactionDetails) 27 | * .then(response => console.log('Payout transaction successful:', response)) 28 | * .catch(error => console.error('Payout transaction failed:', error)); 29 | */ 30 | sendDeposit(transaction: PayoutTransaction): Promise; 31 | /** 32 | * Asynchronously retrieves details of a specific deposit transaction by its unique identifier. 33 | * This method constructs the request endpoint using the deposit ID, makes a GET request to the 34 | * PawaPay service endpoint, and aims to return the transaction details. 35 | * 36 | * @param {string} depositId - The unique identifier for the deposit transaction that is being retrieved. 37 | * 38 | * @returns {Promise} A promise that resolves to an array of `PaymentTransaction` objects 39 | * if the retrieval is successful. The array contains the details of the deposit transaction identified by the given depositId. 40 | * If an error occurs during the process, the promise resolves to an unknown type, and the error is handled by the 41 | * `networkHandler`'s error handling method. 42 | * 43 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the retrieval process. 44 | * The errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 45 | */ 46 | getDeposit(depositId: string): Promise; 47 | /** 48 | * Asynchronously requests the resend of a callback for a specific deposit transaction using its unique identifier. 49 | * This method sends a POST request to a specified endpoint dedicated to triggering the resend of callbacks for transactions. 50 | * The function is designed to facilitate situations where the initial callback from a transaction might have been missed or not received. 51 | * 52 | * @param {string} depositId - The unique identifier of the deposit transaction for which the callback resend is requested. 53 | * 54 | * @returns {Promise} A promise that resolves to the response from the service regarding the callback resend operation. 55 | * The `ResendCallbackResponse` type is expected to contain details about the success or specifics of the resend request. 56 | * If an error occurs during the operation, the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 57 | * 58 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the callback resend request. 59 | * These errors are processed by the `networkHandler.handleErrors` method, which may throw errors based on its implementation. 60 | */ 61 | resendCallback(depositId: string): Promise; 62 | } 63 | //# sourceMappingURL=index.d.ts.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/refunds/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const tsyringe_1 = require("tsyringe"); 16 | const networkManager_1 = __importDefault(require("../../config/networkManager")); 17 | const internalLogger_1 = __importDefault(require("../../utils/internalLogger")); 18 | let Refunds = class Refunds { 19 | networkHandler; 20 | baseEndpoint; 21 | constructor(networkHandler) { 22 | this.networkHandler = networkHandler; 23 | this.baseEndpoint = "/refunds"; 24 | } 25 | /** 26 | * Asynchronously submits a request to create a refund for a specific transaction. This method sends the refund details, 27 | * including the unique identifiers for the refund and the original deposit, to a designated service endpoint for processing. 28 | * It is intended to initiate the refund process for transactions that meet the criteria for refunding. 29 | * 30 | * @param {any} refundData - An object containing the refund request details. The structure of this object includes 31 | * `refundId`, the unique identifier for the refund request, and `depositId`, the unique identifier of the original deposit transaction to be refunded. 32 | * 33 | * @returns {Promise} A promise that resolves to a `RefundResponse` object if the refund request is successfully processed. 34 | * The `RefundResponse` type should detail the outcome of the refund request. In case of an error during the request processing, 35 | * the promise resolves to an unknown type, with the error handled by the `networkHandler`'s error handling mechanism. 36 | */ 37 | async createRefundRequest(refundData) { 38 | try { 39 | const response = await this.networkHandler.getInstance().post(this.baseEndpoint, { 40 | refundId: refundData.refundId, 41 | depositId: refundData.depositId 42 | }); 43 | internalLogger_1.default.info("Sending refund request for deposit: " + refundData.depositId + "with refundId: " + refundData.refundId); 44 | return response.data; 45 | } 46 | catch (error) { 47 | internalLogger_1.default.error("Refund request failed: " + error); 48 | return this.networkHandler.handleErrors(error); 49 | } 50 | } 51 | /** 52 | * Asynchronously retrieves the status of a specific refund transaction by its unique identifier (refundId). 53 | * This method constructs the request URL using the refundId and makes a GET request to the service endpoint 54 | * to fetch the current status of the refund transaction. It provides a means to track the progress or outcome of refund requests. 55 | * 56 | * @param {string} refundId - The unique identifier for the refund transaction whose status is being queried. 57 | * 58 | * @returns {Promise} A promise that resolves to a `RefundTransaction` object if the refund status is successfully retrieved. 59 | * The `RefundTransaction` type is expected to contain comprehensive details about the refund transaction, including its current status. 60 | * If an error occurs during the retrieval process, the promise resolves to an unknown type. Errors are handled using the `networkHandler`'s error handling process. 61 | */ 62 | async getRefundStatus(refundId) { 63 | try { 64 | const endPoint = this.baseEndpoint + `/${refundId}`; 65 | const response = await this.networkHandler.getInstance().get(endPoint); 66 | internalLogger_1.default.info("Refund details retrieved successfully: " + response.data); 67 | return response.data; 68 | } 69 | catch (error) { 70 | internalLogger_1.default.error("Refund transaction failed: " + error); 71 | return this.networkHandler.handleErrors(error); 72 | } 73 | } 74 | }; 75 | Refunds = __decorate([ 76 | (0, tsyringe_1.singleton)(), 77 | (0, tsyringe_1.autoInjectable)(), 78 | __metadata("design:paramtypes", [networkManager_1.default]) 79 | ], Refunds); 80 | exports.default = Refunds; 81 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/refunds/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/refunds/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uCAAqD;AACrD,4EAAoD;AAGpD,2EAAmD;AAIpC,IAAM,OAAO,GAAb,MAAM,OAAO;IAIJ;IAFL,YAAY,CAAC;IAE9B,YAAsB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAClD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;OAWG;IAEH,KAAK,CAAC,mBAAmB,CAAC,UAAe;QACvC,IAAI,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,CAC3D,IAAI,CAAC,YAAY,EACjB;gBACE,QAAQ,EAAE,UAAU,CAAC,QAAQ;gBAC7B,SAAS,EAAE,UAAU,CAAC,SAAS;aAChC,CACF,CAAC;YAEF,wBAAc,CAAC,IAAI,CAAC,sCAAsC,GAAG,UAAU,CAAC,SAAS,GAAG,iBAAiB,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;YAE7H,OAAO,QAAQ,CAAC,IAAsB,CAAC;QAEzC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,wBAAc,CAAC,KAAK,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IAEH,KAAK,CAAC,eAAe,CAAC,QAAgB;QACpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAEvE,wBAAc,CAAC,IAAI,CAAC,yCAAyC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAE/E,OAAO,QAAQ,CAAC,IAAyB,CAAC;QAC5C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,wBAAc,CAAC,KAAK,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;YAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CAEF,CAAA;AApEoB,OAAO;IAF3B,IAAA,oBAAS,GAAE;IACX,IAAA,yBAAc,GAAE;qCAKuB,wBAAc;GAJjC,OAAO,CAoE3B;kBApEoB,OAAO","sourcesContent":["import { autoInjectable, singleton } from \"tsyringe\";\nimport NetworkHandler from \"@config/networkManager\";\nimport { RefundResponse, RefundTransaction } from \"types/payout\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\nimport internalLogger from \"@utils/internalLogger\";\n\n@singleton()\n@autoInjectable()\nexport default class Refunds {\n\n private readonly baseEndpoint;\n\n constructor(protected networkHandler: NetworkHandler) {\n this.baseEndpoint = \"/refunds\";\n }\n\n /**\n * Asynchronously submits a request to create a refund for a specific transaction. This method sends the refund details,\n * including the unique identifiers for the refund and the original deposit, to a designated service endpoint for processing.\n * It is intended to initiate the refund process for transactions that meet the criteria for refunding.\n *\n * @param {any} refundData - An object containing the refund request details. The structure of this object includes\n * `refundId`, the unique identifier for the refund request, and `depositId`, the unique identifier of the original deposit transaction to be refunded.\n *\n * @returns {Promise} A promise that resolves to a `RefundResponse` object if the refund request is successfully processed.\n * The `RefundResponse` type should detail the outcome of the refund request. In case of an error during the request processing,\n * the promise resolves to an unknown type, with the error handled by the `networkHandler`'s error handling mechanism.\n */\n\n async createRefundRequest(refundData: any): Promise {\n try {\n\n const response = await this.networkHandler.getInstance().post(\n this.baseEndpoint,\n {\n refundId: refundData.refundId,\n depositId: refundData.depositId\n }\n );\n\n internalLogger.info(\"Sending refund request for deposit: \" + refundData.depositId + \"with refundId: \" + refundData.refundId);\n\n return response.data as RefundResponse;\n\n } catch (error: unknown) {\n internalLogger.error(\"Refund request failed: \" + error);\n return this.networkHandler.handleErrors(error);\n }\n }\n\n /**\n * Asynchronously retrieves the status of a specific refund transaction by its unique identifier (refundId).\n * This method constructs the request URL using the refundId and makes a GET request to the service endpoint\n * to fetch the current status of the refund transaction. It provides a means to track the progress or outcome of refund requests.\n *\n * @param {string} refundId - The unique identifier for the refund transaction whose status is being queried.\n *\n * @returns {Promise} A promise that resolves to a `RefundTransaction` object if the refund status is successfully retrieved.\n * The `RefundTransaction` type is expected to contain comprehensive details about the refund transaction, including its current status.\n * If an error occurs during the retrieval process, the promise resolves to an unknown type. Errors are handled using the `networkHandler`'s error handling process.\n */\n\n async getRefundStatus(refundId: string): Promise {\n try {\n const endPoint = this.baseEndpoint + `/${refundId}`;\n const response = await this.networkHandler.getInstance().get(endPoint);\n\n internalLogger.info(\"Refund details retrieved successfully: \" + response.data);\n\n return response.data as RefundTransaction;\n } catch (error: unknown) {\n internalLogger.error(\"Refund transaction failed: \" + error);\n return this.networkHandler.handleErrors(error);\n }\n }\n\n}\n"]} -------------------------------------------------------------------------------- /pawapay_rust/src/structs/pawapay.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Debug, Serialize, Deserialize)] 6 | pub enum MoMoCurrency { 7 | XOF, 8 | XAF, 9 | CDF, 10 | GHS, 11 | KES, 12 | MWK, 13 | MZN, 14 | NGN, 15 | RWF, 16 | SLE, 17 | TZS, 18 | UGX, 19 | ZMW, 20 | } 21 | 22 | 23 | #[derive(Debug, Serialize, Deserialize)] 24 | pub enum Correspondent { 25 | MTN_MOMO_BEN, 26 | MOOV_BEN, 27 | MTN_MOMO_CMR, 28 | ORANGE_CMR, 29 | MTN_MOMO_CIV, 30 | ORANGE_CIV, 31 | AIRTEL_COD, 32 | ORANGE_COD, 33 | MTN_MOMO_GHA, 34 | AIRTELTIGO_GHA, 35 | VODAFONE_GHA, 36 | MPESA_KEN, 37 | AIRTEL_MWI, 38 | TNM_MWI, 39 | VODACOM_MOZ, 40 | AIRTEL_NGA, 41 | MTN_MOMO_NGA, 42 | AIRTEL_RWA, 43 | MTN_MOMO_RWA, 44 | FREE_SEN, 45 | ORANGE_SEN, 46 | ORANGE_SLE, 47 | AIRTEL_TZA, 48 | VODACOM_TZA, 49 | TIGO_TZA, 50 | HALOTEL_TZA, 51 | AIRTEL_OAPI_UGA, 52 | MTN_MOMO_UGA, 53 | AIRTEL_OAPI_ZMB, 54 | MTN_MOMO_ZMB, 55 | ZAMTEL_ZMB, 56 | } 57 | 58 | #[derive(Debug, Serialize, Deserialize)] 59 | pub struct PayoutTransaction { 60 | pub amount: String, 61 | pub phone_number: String, 62 | pub payout_id: String, 63 | pub currency: MoMoCurrency, 64 | pub correspondent: Correspondent, 65 | pub statement_description: String, 66 | pub country: String, 67 | pub customer_timestamp: Option, 68 | } 69 | 70 | 71 | #[derive(Debug, Serialize, Deserialize)] 72 | pub enum PaymentStatus { 73 | PENDING, 74 | COMPLETED, 75 | FAILED, 76 | CANCELLED, 77 | } 78 | 79 | #[derive(Debug, Serialize, Deserialize)] 80 | pub enum PayoutStatus { 81 | ACCEPTED, 82 | ENQUEUED, 83 | REJECTED, 84 | DUPLICATE_IGNORED, 85 | } 86 | 87 | #[derive(Debug, Serialize, Deserialize)] 88 | pub enum ResendCallbackResponseStatus { 89 | ACCEPTED, 90 | REJECTED, 91 | FAILED, 92 | } 93 | 94 | 95 | #[derive(Debug, Serialize, Deserialize)] 96 | pub struct Payer { 97 | pub r#type: String, 98 | pub address: Address, 99 | } 100 | 101 | 102 | #[derive(Debug, Serialize, Deserialize)] 103 | pub struct SuspiciousActivityReport { 104 | pub activity_type: String, 105 | pub comment: String, 106 | } 107 | 108 | 109 | #[derive(Debug, Serialize, Deserialize)] 110 | pub struct PaymentTransaction { 111 | pub deposit_id: String, 112 | pub status: PaymentStatus, 113 | pub requested_amount: String, 114 | pub deposited_amount: String, 115 | pub currency: MoMoCurrency, 116 | pub country: String, 117 | pub payer: Payer, 118 | pub correspondent: Correspondent, 119 | pub statement_description: String, 120 | pub customer_timestamp: String, 121 | pub created: String, 122 | pub responded_by_payer: String, 123 | pub correspondent_ids: HashMap, 124 | pub suspicious_activity_report: Option>, 125 | } 126 | 127 | #[derive(Debug, Serialize, Deserialize)] 128 | pub struct PawaPayPayoutTransaction { 129 | pub payoutId: String, 130 | pub status: PayoutStatus, 131 | pub created: String, 132 | } 133 | 134 | #[derive(Debug, Serialize, Deserialize)] 135 | pub struct ResendCallbackResponse { 136 | pub payoutId: String, 137 | pub status: ResendCallbackResponseStatus, 138 | pub rejectionReason: Option, 139 | } 140 | 141 | 142 | #[derive(Debug, Serialize, Deserialize)] 143 | pub enum RejectionCode { 144 | DEPOSIT_NOT_FOUND, 145 | DEPOSIT_NOT_COMPLETED, 146 | ALREADY_REFUNDED, 147 | IN_PROGRESS, 148 | INVALID_AMOUNT, 149 | AMOUNT_TOO_SMALL, 150 | AMOUNT_TOO_LARGE, 151 | PARAMETER_INVALID, 152 | INVALID_INPUT, 153 | REFUNDS_NOT_ALLOWED, 154 | CORRESPONDENT_TEMPORARILY_UNAVAILABLE, 155 | 156 | } 157 | 158 | #[derive(Debug, Serialize, Deserialize)] 159 | pub struct RejectionReason { 160 | pub rejectionCode: RejectionCode, 161 | pub rejectionMessage: String, 162 | } 163 | 164 | #[derive(Debug, Serialize, Deserialize)] 165 | pub struct RefundResponse { 166 | pub refundId: String, 167 | pub status: String, 168 | pub created: String, 169 | pub rejectionReason: Option, 170 | } 171 | 172 | #[derive(Debug, Serialize, Deserialize)] 173 | pub enum FailureCode { 174 | BALANCE_INSUFFICIENT, 175 | RECIPIENT_NOT_FOUND, 176 | RECIPIENT_NOT_ALLOWED_TO_RECEIVE, 177 | OTHER_ERROR, 178 | } 179 | 180 | #[derive(Debug, Serialize, Deserialize)] 181 | pub struct FailureReason { 182 | pub failureCode: FailureCode, 183 | pub failureMessage: String, 184 | } 185 | 186 | #[derive(Debug, Serialize, Deserialize)] 187 | pub struct RefundTransaction { 188 | pub refundId: String, 189 | pub status: String, 190 | pub amount: String, 191 | pub currency: MoMoCurrency, 192 | pub country: String, 193 | pub correspondent: Correspondent, 194 | pub recipient: Payer, 195 | pub customerTimestamp: String, 196 | pub statementDescription: Option, 197 | pub created: String, 198 | pub receivedByRecipient: Option, 199 | pub correspondentIds: Option>, 200 | pub failureReason: Option, 201 | } 202 | 203 | 204 | 205 | -------------------------------------------------------------------------------- /pawapay_node/src/resources/deposits/index.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "@config/networkManager"; 2 | import { autoInjectable, singleton } from "tsyringe"; 3 | 4 | import PawapayBaseService from "@utils/pawapayBaseService"; 5 | import { PawaPayPayoutTransaction, PaymentTransaction, PayoutTransaction, ResendCallbackResponse } from "types/payout"; 6 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 7 | import internalLogger from "@utils/internalLogger"; 8 | 9 | @autoInjectable() 10 | @singleton() 11 | export default class Deposits { 12 | 13 | private readonly baseEndpoint; 14 | 15 | constructor(protected networkHandler: NetworkHandler, protected pawapayBaseService: PawapayBaseService) { 16 | this.baseEndpoint = "/deposits"; 17 | } 18 | 19 | /** 20 | * Asynchronously sends a payout transaction to a specified recipient using the PawaPay service. 21 | * This method formats the recipient's phone number, constructs the payout request payload, 22 | * and sends it to the PawaPay payout service endpoint. It logs the transaction details and 23 | * handles any potential errors during the transaction process. 24 | * 25 | * @param {PayoutTransaction} transaction - An object containing the details of the payout transaction, 26 | * including the recipient's phone number, payout amount, currency, payout ID, correspondent, and statement description. 27 | * 28 | * @returns {Promise} A promise that resolves to the response data 29 | * from the PawaPay service if the transaction is successfully processed. If an error occurs during 30 | * the process, the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 31 | * 32 | * @throws {PawaPayNetworkResponse} The method catches and handles any errors that occur during the execution of the transaction. 33 | * These errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 34 | * 35 | * sendDeposit(transactionDetails) 36 | * .then(response => console.log('Payout transaction successful:', response)) 37 | * .catch(error => console.error('Payout transaction failed:', error)); 38 | */ 39 | 40 | async sendDeposit(transaction: PayoutTransaction): Promise { 41 | try { 42 | 43 | const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber); 44 | 45 | internalLogger.info("Sending payout to", phoneNumber, "the amount of", transaction.amount, "with payoutId", transaction.payoutId, "and currency", transaction.currency); 46 | 47 | const response = await this.networkHandler.getInstance().post( 48 | this.baseEndpoint, 49 | { 50 | payoutId: transaction.payoutId, 51 | amount: transaction.amount.toString(), 52 | currency: transaction.currency, 53 | correspondent: transaction.correspondent, 54 | recipient: { 55 | type: "MSISDN", 56 | address: { value: phoneNumber } 57 | }, 58 | customerTimestamp: new Date().toISOString(), 59 | statementDescription: transaction.statementDescription 60 | } 61 | ); 62 | internalLogger.info("Payout transaction successful:", response.data); 63 | 64 | return response.data as PawaPayPayoutTransaction; 65 | } catch (error: unknown) { 66 | 67 | internalLogger.error("Payout transaction failed:", error); 68 | 69 | return this.networkHandler.handleErrors(error); 70 | 71 | } 72 | 73 | } 74 | 75 | /** 76 | * Asynchronously retrieves details of a specific deposit transaction by its unique identifier. 77 | * This method constructs the request endpoint using the deposit ID, makes a GET request to the 78 | * PawaPay service endpoint, and aims to return the transaction details. 79 | * 80 | * @param {string} depositId - The unique identifier for the deposit transaction that is being retrieved. 81 | * 82 | * @returns {Promise} A promise that resolves to an array of `PaymentTransaction` objects 83 | * if the retrieval is successful. The array contains the details of the deposit transaction identified by the given depositId. 84 | * If an error occurs during the process, the promise resolves to an unknown type, and the error is handled by the 85 | * `networkHandler`'s error handling method. 86 | * 87 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the retrieval process. 88 | * The errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 89 | */ 90 | async getDeposit(depositId: string): Promise { 91 | 92 | try { 93 | const endPoint = this.baseEndpoint + `/${depositId}`; 94 | const response = await this.networkHandler.getInstance().get(endPoint); 95 | 96 | internalLogger.info("Deposit details retrieved successfully:", response.data); 97 | 98 | return response.data as PaymentTransaction[]; 99 | } catch (error) { 100 | internalLogger.error("Payout transaction failed:", error); 101 | return this.networkHandler.handleErrors(error); 102 | } 103 | 104 | } 105 | 106 | /** 107 | * Asynchronously requests the resend of a callback for a specific deposit transaction using its unique identifier. 108 | * This method sends a POST request to a specified endpoint dedicated to triggering the resend of callbacks for transactions. 109 | * The function is designed to facilitate situations where the initial callback from a transaction might have been missed or not received. 110 | * 111 | * @param {string} depositId - The unique identifier of the deposit transaction for which the callback resend is requested. 112 | * 113 | * @returns {Promise} A promise that resolves to the response from the service regarding the callback resend operation. 114 | * The `ResendCallbackResponse` type is expected to contain details about the success or specifics of the resend request. 115 | * If an error occurs during the operation, the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 116 | * 117 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the callback resend request. 118 | * These errors are processed by the `networkHandler.handleErrors` method, which may throw errors based on its implementation. 119 | */ 120 | 121 | async resendCallback(depositId: string): Promise { 122 | try { 123 | 124 | const { data } = await this.networkHandler.getInstance().post(`/deposits/resend-callback`, { 125 | depositId: depositId 126 | }); 127 | 128 | internalLogger.info("RESPONSE", data); 129 | 130 | return data as ResendCallbackResponse; 131 | } catch (error: unknown) { 132 | internalLogger.error("ERROR", error); 133 | return this.networkHandler.handleErrors(error); 134 | } 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /pawapay_node/src/resources/payouts/index.ts: -------------------------------------------------------------------------------- 1 | import NetworkHandler from "@config/networkManager"; 2 | import { PawaPayPayoutTransaction, PayoutTransaction } from "types/payout"; 3 | import { autoInjectable, singleton } from "tsyringe"; 4 | import PawapayBaseService from "@utils/pawapayBaseService"; 5 | import { PawaPayNetworkResponse } from "types/pawaPayErrorResponse"; 6 | import internalLogger from "@utils/internalLogger"; 7 | 8 | @autoInjectable() 9 | @singleton() 10 | export default class Payouts { 11 | 12 | private readonly baseEndpoint; 13 | 14 | constructor(protected networkHandler: NetworkHandler, protected pawapayBaseService: PawapayBaseService) { 15 | this.baseEndpoint = "/payouts"; 16 | } 17 | 18 | /** 19 | * Sends a payout transaction to the specified endpoint, processing the transaction 20 | * details provided in the `transaction` parameter. It formats the phone number, 21 | * logs the transaction details for debugging, and handles the server response. 22 | * 23 | * @param {PayoutTransaction} transaction - The payout transaction object containing all the necessary information 24 | * for processing the payout. This includes: 25 | * - `phoneNumber`: The recipient's phone number. 26 | * - `amount`: The payout amount. 27 | * - `payoutId`: A unique identifier for the payout. 28 | * - `currency`: The currency code for the amount (e.g., USD, GBP). 29 | * - `correspondent`: The correspondent code for the transaction. 30 | * - `statementDescription`: A description for the statement. 31 | * 32 | * @returns {Promise} A promise that resolves to the payout transaction response object 33 | * if the request is successful. The object includes all relevant details about the transaction response from the server. 34 | * In the case of an error, the promise resolves to an `unknown` type that represents the handled error response. 35 | * 36 | * @throws {PawaPayNetworkResponse} This method may throw an error if the request fails due to reasons such as network issues, 37 | * invalid transaction details, or server-side problems. Such errors are caught and handled by `networkHandler.handleErrors`. 38 | */ 39 | async sendPayout(transaction: PayoutTransaction): Promise { 40 | 41 | try { 42 | const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber); 43 | 44 | internalLogger.info("Sending payout to" + phoneNumber + " the amount of" + transaction.amount + 45 | " with payoutId " + transaction.payoutId + "and currency" + transaction.currency); 46 | 47 | const response = await this.networkHandler.getInstance().post( 48 | this.baseEndpoint, 49 | { 50 | payoutId: transaction.payoutId, 51 | amount: transaction.amount.toString(), 52 | currency: transaction.currency, 53 | correspondent: transaction.correspondent, 54 | recipient: { 55 | type: "MSISDN", 56 | address: { value: phoneNumber } 57 | }, 58 | customerTimestamp: new Date().toISOString(), 59 | statementDescription: transaction.statementDescription 60 | } 61 | ); 62 | 63 | internalLogger.info("Payout transaction successful: " + response.data); 64 | 65 | return response.data as PawaPayPayoutTransaction; 66 | } catch (error) { 67 | 68 | internalLogger.error("Payout transaction failed: " + error); 69 | 70 | return this.networkHandler.handleErrors(error); 71 | } 72 | 73 | } 74 | 75 | /** 76 | * Asynchronously processes a bulk payout transaction request by sending multiple payout transactions to the PawaPay service. 77 | * Each transaction is formatted according to the requirements before sending. This method is useful for processing multiple 78 | * payouts in a single operation, improving efficiency and reducing the number of individual requests. 79 | * 80 | * @param {PayoutTransaction[]} transactions - An array of `PayoutTransaction` objects representing the individual transactions to be processed in bulk. 81 | * 82 | * @returns {Promise} A promise that resolves to an array of `PawaPayPayoutTransaction` objects if the bulk payout is successfully processed. 83 | * Each object in the array represents the response for the corresponding payout transaction. If an error occurs during the process, 84 | * the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 85 | */ 86 | 87 | async sendBulkPayout(transactions: PayoutTransaction[]): Promise { 88 | try { 89 | 90 | const formattedTransactions = transactions.map(transaction => { 91 | return { 92 | payoutId: transaction.payoutId, 93 | amount: transaction.amount.toString(), 94 | currency: transaction.currency, 95 | correspondent: transaction.correspondent, 96 | recipient: { 97 | type: "MSISDN", 98 | address: { value: this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber) } 99 | }, 100 | customerTimestamp: new Date().toISOString(), 101 | statementDescription: transaction.statementDescription 102 | }; 103 | }); 104 | 105 | const response = await this.networkHandler.getInstance().post( 106 | this.baseEndpoint, 107 | { formattedTransactions } 108 | ); 109 | 110 | console.log("Bulk payout transaction successful:", response.data); 111 | 112 | return response.data as PawaPayPayoutTransaction[]; 113 | } catch (error) { 114 | console.error("Bulk payout transaction failed:", error); 115 | return this.networkHandler.handleErrors(error); 116 | } 117 | } 118 | 119 | /** 120 | * Asynchronously retrieves the details of a specific payout transaction by its unique identifier (depositId). 121 | * This method constructs the request URL using the depositId and makes a GET request to the PawaPay service endpoint 122 | * to obtain the transaction details. It is designed to fetch information for individual payout transactions. 123 | * 124 | * @param {string} depositId - The unique identifier for the payout transaction whose details are being retrieved. 125 | * 126 | * @returns {Promise} A promise that resolves to a `PawaPayPayoutTransaction` object if the payout details are successfully retrieved. 127 | * This object contains the details of the specified payout transaction. If an error occurs during the retrieval process, 128 | * the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 129 | */ 130 | 131 | async getPayout(depositId: string): Promise { 132 | try { 133 | const response = await this.networkHandler.getInstance().get(`${this.baseEndpoint}/${depositId}`); 134 | 135 | console.log("Payout details retrieved successfully:", response.data); 136 | 137 | return response.data as PawaPayPayoutTransaction; 138 | } catch (error) { 139 | 140 | console.error("Payout transaction failed:", error); 141 | return this.networkHandler.handleErrors(error); 142 | } 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /pawapay_node/dist/resources/deposits/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const networkManager_1 = __importDefault(require("../../config/networkManager")); 16 | const tsyringe_1 = require("tsyringe"); 17 | const pawapayBaseService_1 = __importDefault(require("../../utils/pawapayBaseService")); 18 | const internalLogger_1 = __importDefault(require("../../utils/internalLogger")); 19 | let Deposits = class Deposits { 20 | networkHandler; 21 | pawapayBaseService; 22 | baseEndpoint; 23 | constructor(networkHandler, pawapayBaseService) { 24 | this.networkHandler = networkHandler; 25 | this.pawapayBaseService = pawapayBaseService; 26 | this.baseEndpoint = "/deposits"; 27 | } 28 | /** 29 | * Asynchronously sends a payout transaction to a specified recipient using the PawaPay service. 30 | * This method formats the recipient's phone number, constructs the payout request payload, 31 | * and sends it to the PawaPay payout service endpoint. It logs the transaction details and 32 | * handles any potential errors during the transaction process. 33 | * 34 | * @param {PayoutTransaction} transaction - An object containing the details of the payout transaction, 35 | * including the recipient's phone number, payout amount, currency, payout ID, correspondent, and statement description. 36 | * 37 | * @returns {Promise} A promise that resolves to the response data 38 | * from the PawaPay service if the transaction is successfully processed. If an error occurs during 39 | * the process, the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 40 | * 41 | * @throws {PawaPayNetworkResponse} The method catches and handles any errors that occur during the execution of the transaction. 42 | * These errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 43 | * 44 | * sendDeposit(transactionDetails) 45 | * .then(response => console.log('Payout transaction successful:', response)) 46 | * .catch(error => console.error('Payout transaction failed:', error)); 47 | */ 48 | async sendDeposit(transaction) { 49 | try { 50 | const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber); 51 | internalLogger_1.default.info("Sending payout to", phoneNumber, "the amount of", transaction.amount, "with payoutId", transaction.payoutId, "and currency", transaction.currency); 52 | const response = await this.networkHandler.getInstance().post(this.baseEndpoint, { 53 | payoutId: transaction.payoutId, 54 | amount: transaction.amount.toString(), 55 | currency: transaction.currency, 56 | correspondent: transaction.correspondent, 57 | recipient: { 58 | type: "MSISDN", 59 | address: { value: phoneNumber } 60 | }, 61 | customerTimestamp: new Date().toISOString(), 62 | statementDescription: transaction.statementDescription 63 | }); 64 | internalLogger_1.default.info("Payout transaction successful:", response.data); 65 | return response.data; 66 | } 67 | catch (error) { 68 | internalLogger_1.default.error("Payout transaction failed:", error); 69 | return this.networkHandler.handleErrors(error); 70 | } 71 | } 72 | /** 73 | * Asynchronously retrieves details of a specific deposit transaction by its unique identifier. 74 | * This method constructs the request endpoint using the deposit ID, makes a GET request to the 75 | * PawaPay service endpoint, and aims to return the transaction details. 76 | * 77 | * @param {string} depositId - The unique identifier for the deposit transaction that is being retrieved. 78 | * 79 | * @returns {Promise} A promise that resolves to an array of `PaymentTransaction` objects 80 | * if the retrieval is successful. The array contains the details of the deposit transaction identified by the given depositId. 81 | * If an error occurs during the process, the promise resolves to an unknown type, and the error is handled by the 82 | * `networkHandler`'s error handling method. 83 | * 84 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the retrieval process. 85 | * The errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation. 86 | */ 87 | async getDeposit(depositId) { 88 | try { 89 | const endPoint = this.baseEndpoint + `/${depositId}`; 90 | const response = await this.networkHandler.getInstance().get(endPoint); 91 | internalLogger_1.default.info("Deposit details retrieved successfully:", response.data); 92 | return response.data; 93 | } 94 | catch (error) { 95 | internalLogger_1.default.error("Payout transaction failed:", error); 96 | return this.networkHandler.handleErrors(error); 97 | } 98 | } 99 | /** 100 | * Asynchronously requests the resend of a callback for a specific deposit transaction using its unique identifier. 101 | * This method sends a POST request to a specified endpoint dedicated to triggering the resend of callbacks for transactions. 102 | * The function is designed to facilitate situations where the initial callback from a transaction might have been missed or not received. 103 | * 104 | * @param {string} depositId - The unique identifier of the deposit transaction for which the callback resend is requested. 105 | * 106 | * @returns {Promise} A promise that resolves to the response from the service regarding the callback resend operation. 107 | * The `ResendCallbackResponse` type is expected to contain details about the success or specifics of the resend request. 108 | * If an error occurs during the operation, the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 109 | * 110 | * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the callback resend request. 111 | * These errors are processed by the `networkHandler.handleErrors` method, which may throw errors based on its implementation. 112 | */ 113 | async resendCallback(depositId) { 114 | try { 115 | const { data } = await this.networkHandler.getInstance().post(`/deposits/resend-callback`, { 116 | depositId: depositId 117 | }); 118 | internalLogger_1.default.info("RESPONSE", data); 119 | return data; 120 | } 121 | catch (error) { 122 | internalLogger_1.default.error("ERROR", error); 123 | return this.networkHandler.handleErrors(error); 124 | } 125 | } 126 | }; 127 | Deposits = __decorate([ 128 | (0, tsyringe_1.autoInjectable)(), 129 | (0, tsyringe_1.singleton)(), 130 | __metadata("design:paramtypes", [networkManager_1.default, pawapayBaseService_1.default]) 131 | ], Deposits); 132 | exports.default = Deposits; 133 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payouts/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 6 | return c > 3 && r && Object.defineProperty(target, key, r), r; 7 | }; 8 | var __metadata = (this && this.__metadata) || function (k, v) { 9 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 10 | }; 11 | var __importDefault = (this && this.__importDefault) || function (mod) { 12 | return (mod && mod.__esModule) ? mod : { "default": mod }; 13 | }; 14 | Object.defineProperty(exports, "__esModule", { value: true }); 15 | const networkManager_1 = __importDefault(require("../../config/networkManager")); 16 | const tsyringe_1 = require("tsyringe"); 17 | const pawapayBaseService_1 = __importDefault(require("../../utils/pawapayBaseService")); 18 | const internalLogger_1 = __importDefault(require("../../utils/internalLogger")); 19 | let Payouts = class Payouts { 20 | networkHandler; 21 | pawapayBaseService; 22 | baseEndpoint; 23 | constructor(networkHandler, pawapayBaseService) { 24 | this.networkHandler = networkHandler; 25 | this.pawapayBaseService = pawapayBaseService; 26 | this.baseEndpoint = "/payouts"; 27 | } 28 | /** 29 | * Sends a payout transaction to the specified endpoint, processing the transaction 30 | * details provided in the `transaction` parameter. It formats the phone number, 31 | * logs the transaction details for debugging, and handles the server response. 32 | * 33 | * @param {PayoutTransaction} transaction - The payout transaction object containing all the necessary information 34 | * for processing the payout. This includes: 35 | * - `phoneNumber`: The recipient's phone number. 36 | * - `amount`: The payout amount. 37 | * - `payoutId`: A unique identifier for the payout. 38 | * - `currency`: The currency code for the amount (e.g., USD, GBP). 39 | * - `correspondent`: The correspondent code for the transaction. 40 | * - `statementDescription`: A description for the statement. 41 | * 42 | * @returns {Promise} A promise that resolves to the payout transaction response object 43 | * if the request is successful. The object includes all relevant details about the transaction response from the server. 44 | * In the case of an error, the promise resolves to an `unknown` type that represents the handled error response. 45 | * 46 | * @throws {PawaPayNetworkResponse} This method may throw an error if the request fails due to reasons such as network issues, 47 | * invalid transaction details, or server-side problems. Such errors are caught and handled by `networkHandler.handleErrors`. 48 | */ 49 | async sendPayout(transaction) { 50 | try { 51 | const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber); 52 | internalLogger_1.default.info("Sending payout to" + phoneNumber + " the amount of" + transaction.amount + 53 | " with payoutId " + transaction.payoutId + "and currency" + transaction.currency); 54 | const response = await this.networkHandler.getInstance().post(this.baseEndpoint, { 55 | payoutId: transaction.payoutId, 56 | amount: transaction.amount.toString(), 57 | currency: transaction.currency, 58 | correspondent: transaction.correspondent, 59 | recipient: { 60 | type: "MSISDN", 61 | address: { value: phoneNumber } 62 | }, 63 | customerTimestamp: new Date().toISOString(), 64 | statementDescription: transaction.statementDescription 65 | }); 66 | internalLogger_1.default.info("Payout transaction successful: " + response.data); 67 | return response.data; 68 | } 69 | catch (error) { 70 | internalLogger_1.default.error("Payout transaction failed: " + error); 71 | return this.networkHandler.handleErrors(error); 72 | } 73 | } 74 | /** 75 | * Asynchronously processes a bulk payout transaction request by sending multiple payout transactions to the PawaPay service. 76 | * Each transaction is formatted according to the requirements before sending. This method is useful for processing multiple 77 | * payouts in a single operation, improving efficiency and reducing the number of individual requests. 78 | * 79 | * @param {PayoutTransaction[]} transactions - An array of `PayoutTransaction` objects representing the individual transactions to be processed in bulk. 80 | * 81 | * @returns {Promise} A promise that resolves to an array of `PawaPayPayoutTransaction` objects if the bulk payout is successfully processed. 82 | * Each object in the array represents the response for the corresponding payout transaction. If an error occurs during the process, 83 | * the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method. 84 | */ 85 | async sendBulkPayout(transactions) { 86 | try { 87 | const formattedTransactions = transactions.map(transaction => { 88 | return { 89 | payoutId: transaction.payoutId, 90 | amount: transaction.amount.toString(), 91 | currency: transaction.currency, 92 | correspondent: transaction.correspondent, 93 | recipient: { 94 | type: "MSISDN", 95 | address: { value: this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber) } 96 | }, 97 | customerTimestamp: new Date().toISOString(), 98 | statementDescription: transaction.statementDescription 99 | }; 100 | }); 101 | const response = await this.networkHandler.getInstance().post(this.baseEndpoint, { formattedTransactions }); 102 | console.log("Bulk payout transaction successful:", response.data); 103 | return response.data; 104 | } 105 | catch (error) { 106 | console.error("Bulk payout transaction failed:", error); 107 | return this.networkHandler.handleErrors(error); 108 | } 109 | } 110 | /** 111 | * Asynchronously retrieves the details of a specific payout transaction by its unique identifier (depositId). 112 | * This method constructs the request URL using the depositId and makes a GET request to the PawaPay service endpoint 113 | * to obtain the transaction details. It is designed to fetch information for individual payout transactions. 114 | * 115 | * @param {string} depositId - The unique identifier for the payout transaction whose details are being retrieved. 116 | * 117 | * @returns {Promise} A promise that resolves to a `PawaPayPayoutTransaction` object if the payout details are successfully retrieved. 118 | * This object contains the details of the specified payout transaction. If an error occurs during the retrieval process, 119 | * the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism. 120 | */ 121 | async getPayout(depositId) { 122 | try { 123 | const response = await this.networkHandler.getInstance().get(`${this.baseEndpoint}/${depositId}`); 124 | console.log("Payout details retrieved successfully:", response.data); 125 | return response.data; 126 | } 127 | catch (error) { 128 | console.error("Payout transaction failed:", error); 129 | return this.networkHandler.handleErrors(error); 130 | } 131 | } 132 | }; 133 | Payouts = __decorate([ 134 | (0, tsyringe_1.autoInjectable)(), 135 | (0, tsyringe_1.singleton)(), 136 | __metadata("design:paramtypes", [networkManager_1.default, pawapayBaseService_1.default]) 137 | ], Payouts); 138 | exports.default = Payouts; 139 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /pawapay_node/dist/resources/deposits/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/deposits/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4EAAoD;AACpD,uCAAqD;AAErD,mFAA2D;AAG3D,2EAAmD;AAIpC,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAIL;IAA0C;IAF/C,YAAY,CAAC;IAE9B,YAAsB,cAA8B,EAAY,kBAAsC;QAAhF,mBAAc,GAAd,cAAc,CAAgB;QAAY,uBAAkB,GAAlB,kBAAkB,CAAoB;QACpG,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IAEH,KAAK,CAAC,WAAW,CAAC,WAA8B;QAC9C,IAAI,CAAC;YAEH,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAEvF,wBAAc,CAAC,IAAI,CAAC,mBAAmB,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,CAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;YAExK,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,CAC3D,IAAI,CAAC,YAAY,EACjB;gBACE,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACrC,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,aAAa,EAAE,WAAW,CAAC,aAAa;gBACxC,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;iBAChC;gBACD,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC3C,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;aACvD,CACF,CAAC;YACF,wBAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAErE,OAAO,QAAQ,CAAC,IAAgC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YAExB,wBAAc,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YAE1D,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAEjD,CAAC;IAEH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB;QAEhC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,SAAS,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAEvE,wBAAc,CAAC,IAAI,CAAC,yCAAyC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAE9E,OAAO,QAAQ,CAAC,IAA4B,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,wBAAc,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IAEH,CAAC;IAED;;;;;;;;;;;;;OAaG;IAEH,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,IAAI,CAAC;YAEH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE;gBACzF,SAAS,EAAE,SAAS;aACrB,CAAC,CAAC;YAEH,wBAAc,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAEtC,OAAO,IAA8B,CAAC;QACxC,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,wBAAc,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CAEF,CAAA;AA9HoB,QAAQ;IAF5B,IAAA,yBAAc,GAAE;IAChB,IAAA,oBAAS,GAAE;qCAK4B,wBAAc,EAAgC,4BAAkB;GAJnF,QAAQ,CA8H5B;kBA9HoB,QAAQ","sourcesContent":["import NetworkHandler from \"@config/networkManager\";\nimport { autoInjectable, singleton } from \"tsyringe\";\n\nimport PawapayBaseService from \"@utils/pawapayBaseService\";\nimport { PawaPayPayoutTransaction, PaymentTransaction, PayoutTransaction, ResendCallbackResponse } from \"types/payout\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\nimport internalLogger from \"@utils/internalLogger\";\n\n@autoInjectable()\n@singleton()\nexport default class Deposits {\n\n private readonly baseEndpoint;\n\n constructor(protected networkHandler: NetworkHandler, protected pawapayBaseService: PawapayBaseService) {\n this.baseEndpoint = \"/deposits\";\n }\n\n /**\n * Asynchronously sends a payout transaction to a specified recipient using the PawaPay service.\n * This method formats the recipient's phone number, constructs the payout request payload,\n * and sends it to the PawaPay payout service endpoint. It logs the transaction details and\n * handles any potential errors during the transaction process.\n *\n * @param {PayoutTransaction} transaction - An object containing the details of the payout transaction,\n * including the recipient's phone number, payout amount, currency, payout ID, correspondent, and statement description.\n *\n * @returns {Promise} A promise that resolves to the response data\n * from the PawaPay service if the transaction is successfully processed. If an error occurs during\n * the process, the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method.\n *\n * @throws {PawaPayNetworkResponse} The method catches and handles any errors that occur during the execution of the transaction.\n * These errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation.\n *\n * sendDeposit(transactionDetails)\n * .then(response => console.log('Payout transaction successful:', response))\n * .catch(error => console.error('Payout transaction failed:', error));\n */\n\n async sendDeposit(transaction: PayoutTransaction): Promise {\n try {\n\n const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber);\n\n internalLogger.info(\"Sending payout to\", phoneNumber, \"the amount of\", transaction.amount, \"with payoutId\", transaction.payoutId, \"and currency\", transaction.currency);\n\n const response = await this.networkHandler.getInstance().post(\n this.baseEndpoint,\n {\n payoutId: transaction.payoutId,\n amount: transaction.amount.toString(),\n currency: transaction.currency,\n correspondent: transaction.correspondent,\n recipient: {\n type: \"MSISDN\",\n address: { value: phoneNumber }\n },\n customerTimestamp: new Date().toISOString(),\n statementDescription: transaction.statementDescription\n }\n );\n internalLogger.info(\"Payout transaction successful:\", response.data);\n\n return response.data as PawaPayPayoutTransaction;\n } catch (error: unknown) {\n\n internalLogger.error(\"Payout transaction failed:\", error);\n\n return this.networkHandler.handleErrors(error);\n\n }\n\n }\n\n /**\n * Asynchronously retrieves details of a specific deposit transaction by its unique identifier.\n * This method constructs the request endpoint using the deposit ID, makes a GET request to the\n * PawaPay service endpoint, and aims to return the transaction details.\n *\n * @param {string} depositId - The unique identifier for the deposit transaction that is being retrieved.\n *\n * @returns {Promise} A promise that resolves to an array of `PaymentTransaction` objects\n * if the retrieval is successful. The array contains the details of the deposit transaction identified by the given depositId.\n * If an error occurs during the process, the promise resolves to an unknown type, and the error is handled by the\n * `networkHandler`'s error handling method.\n *\n * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the retrieval process.\n * The errors are processed by the `networkHandler.handleErrors` method, which might throw errors based on its implementation.\n */\n async getDeposit(depositId: string): Promise {\n\n try {\n const endPoint = this.baseEndpoint + `/${depositId}`;\n const response = await this.networkHandler.getInstance().get(endPoint);\n\n internalLogger.info(\"Deposit details retrieved successfully:\", response.data);\n\n return response.data as PaymentTransaction[];\n } catch (error) {\n internalLogger.error(\"Payout transaction failed:\", error);\n return this.networkHandler.handleErrors(error);\n }\n\n }\n\n /**\n * Asynchronously requests the resend of a callback for a specific deposit transaction using its unique identifier.\n * This method sends a POST request to a specified endpoint dedicated to triggering the resend of callbacks for transactions.\n * The function is designed to facilitate situations where the initial callback from a transaction might have been missed or not received.\n *\n * @param {string} depositId - The unique identifier of the deposit transaction for which the callback resend is requested.\n *\n * @returns {Promise} A promise that resolves to the response from the service regarding the callback resend operation.\n * The `ResendCallbackResponse` type is expected to contain details about the success or specifics of the resend request.\n * If an error occurs during the operation, the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism.\n *\n * @throws {PawaPayNetworkResponse} Catches and handles any errors that occur during the execution of the callback resend request.\n * These errors are processed by the `networkHandler.handleErrors` method, which may throw errors based on its implementation.\n */\n\n async resendCallback(depositId: string): Promise {\n try {\n\n const { data } = await this.networkHandler.getInstance().post(`/deposits/resend-callback`, {\n depositId: depositId\n });\n\n internalLogger.info(\"RESPONSE\", data);\n\n return data as ResendCallbackResponse;\n } catch (error: unknown) {\n internalLogger.error(\"ERROR\", error);\n return this.networkHandler.handleErrors(error);\n }\n }\n\n}\n"]} -------------------------------------------------------------------------------- /pawapay_node/dist/resources/payouts/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/payouts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4EAAoD;AAEpD,uCAAqD;AACrD,mFAA2D;AAE3D,2EAAmD;AAIpC,IAAM,OAAO,GAAb,MAAM,OAAO;IAIJ;IAA0C;IAF/C,YAAY,CAAC;IAE9B,YAAsB,cAA8B,EAAY,kBAAsC;QAAhF,mBAAc,GAAd,cAAc,CAAgB;QAAY,uBAAkB,GAAlB,kBAAkB,CAAoB;QACpG,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,UAAU,CAAC,WAA8B;QAE7C,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAEvF,wBAAc,CAAC,IAAI,CAAC,mBAAmB,GAAG,WAAW,GAAG,gBAAgB,GAAG,WAAW,CAAC,MAAM;gBAC3F,iBAAiB,GAAG,WAAW,CAAC,QAAQ,GAAG,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;YAEpF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,CAC3D,IAAI,CAAC,YAAY,EACjB;gBACE,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACrC,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,aAAa,EAAE,WAAW,CAAC,aAAa;gBACxC,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;iBAChC;gBACD,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC3C,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;aACvD,CACF,CAAC;YAEF,wBAAc,CAAC,IAAI,CAAC,iCAAiC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEvE,OAAO,QAAQ,CAAC,IAAgC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,wBAAc,CAAC,KAAK,CAAC,6BAA6B,GAAG,KAAK,CAAC,CAAC;YAE5D,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IAEH,CAAC;IAED;;;;;;;;;;OAUG;IAEH,KAAK,CAAC,cAAc,CAAC,YAAiC;QACpD,IAAI,CAAC;YAEH,MAAM,qBAAqB,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;gBAC3D,OAAO;oBACL,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;oBACrC,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,aAAa,EAAE,WAAW,CAAC,aAAa;oBACxC,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE;qBACvF;oBACD,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBAC3C,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;iBACvD,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,CAC3D,IAAI,CAAC,YAAY,EACjB,EAAE,qBAAqB,EAAE,CAC1B,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAElE,OAAO,QAAQ,CAAC,IAAkC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IAEH,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,SAAS,EAAE,CAAC,CAAC;YAElG,OAAO,CAAC,GAAG,CAAC,wCAAwC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YAErE,OAAO,QAAQ,CAAC,IAAgC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;YACnD,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CAEF,CAAA;AAvIoB,OAAO;IAF3B,IAAA,yBAAc,GAAE;IAChB,IAAA,oBAAS,GAAE;qCAK4B,wBAAc,EAAgC,4BAAkB;GAJnF,OAAO,CAuI3B;kBAvIoB,OAAO","sourcesContent":["import NetworkHandler from \"@config/networkManager\";\nimport { PawaPayPayoutTransaction, PayoutTransaction } from \"types/payout\";\nimport { autoInjectable, singleton } from \"tsyringe\";\nimport PawapayBaseService from \"@utils/pawapayBaseService\";\nimport { PawaPayNetworkResponse } from \"types/pawaPayErrorResponse\";\nimport internalLogger from \"@utils/internalLogger\";\n\n@autoInjectable()\n@singleton()\nexport default class Payouts {\n\n private readonly baseEndpoint;\n\n constructor(protected networkHandler: NetworkHandler, protected pawapayBaseService: PawapayBaseService) {\n this.baseEndpoint = \"/payouts\";\n }\n\n /**\n * Sends a payout transaction to the specified endpoint, processing the transaction\n * details provided in the `transaction` parameter. It formats the phone number,\n * logs the transaction details for debugging, and handles the server response.\n *\n * @param {PayoutTransaction} transaction - The payout transaction object containing all the necessary information\n * for processing the payout. This includes:\n * - `phoneNumber`: The recipient's phone number.\n * - `amount`: The payout amount.\n * - `payoutId`: A unique identifier for the payout.\n * - `currency`: The currency code for the amount (e.g., USD, GBP).\n * - `correspondent`: The correspondent code for the transaction.\n * - `statementDescription`: A description for the statement.\n *\n * @returns {Promise} A promise that resolves to the payout transaction response object\n * if the request is successful. The object includes all relevant details about the transaction response from the server.\n * In the case of an error, the promise resolves to an `unknown` type that represents the handled error response.\n *\n * @throws {PawaPayNetworkResponse} This method may throw an error if the request fails due to reasons such as network issues,\n * invalid transaction details, or server-side problems. Such errors are caught and handled by `networkHandler.handleErrors`.\n */\n async sendPayout(transaction: PayoutTransaction): Promise {\n\n try {\n const phoneNumber = this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber);\n\n internalLogger.info(\"Sending payout to\" + phoneNumber + \" the amount of\" + transaction.amount +\n \" with payoutId \" + transaction.payoutId + \"and currency\" + transaction.currency);\n\n const response = await this.networkHandler.getInstance().post(\n this.baseEndpoint,\n {\n payoutId: transaction.payoutId,\n amount: transaction.amount.toString(),\n currency: transaction.currency,\n correspondent: transaction.correspondent,\n recipient: {\n type: \"MSISDN\",\n address: { value: phoneNumber }\n },\n customerTimestamp: new Date().toISOString(),\n statementDescription: transaction.statementDescription\n }\n );\n\n internalLogger.info(\"Payout transaction successful: \" + response.data);\n\n return response.data as PawaPayPayoutTransaction;\n } catch (error) {\n\n internalLogger.error(\"Payout transaction failed: \" + error);\n\n return this.networkHandler.handleErrors(error);\n }\n\n }\n\n /**\n * Asynchronously processes a bulk payout transaction request by sending multiple payout transactions to the PawaPay service.\n * Each transaction is formatted according to the requirements before sending. This method is useful for processing multiple\n * payouts in a single operation, improving efficiency and reducing the number of individual requests.\n *\n * @param {PayoutTransaction[]} transactions - An array of `PayoutTransaction` objects representing the individual transactions to be processed in bulk.\n *\n * @returns {Promise} A promise that resolves to an array of `PawaPayPayoutTransaction` objects if the bulk payout is successfully processed.\n * Each object in the array represents the response for the corresponding payout transaction. If an error occurs during the process,\n * the promise resolves to an unknown type, and the error is handled by the `networkHandler`'s error handling method.\n */\n\n async sendBulkPayout(transactions: PayoutTransaction[]): Promise {\n try {\n\n const formattedTransactions = transactions.map(transaction => {\n return {\n payoutId: transaction.payoutId,\n amount: transaction.amount.toString(),\n currency: transaction.currency,\n correspondent: transaction.correspondent,\n recipient: {\n type: \"MSISDN\",\n address: { value: this.pawapayBaseService.formatPhoneNumber(transaction.phoneNumber) }\n },\n customerTimestamp: new Date().toISOString(),\n statementDescription: transaction.statementDescription\n };\n });\n\n const response = await this.networkHandler.getInstance().post(\n this.baseEndpoint,\n { formattedTransactions }\n );\n\n console.log(\"Bulk payout transaction successful:\", response.data);\n\n return response.data as PawaPayPayoutTransaction[];\n } catch (error) {\n console.error(\"Bulk payout transaction failed:\", error);\n return this.networkHandler.handleErrors(error);\n }\n }\n\n /**\n * Asynchronously retrieves the details of a specific payout transaction by its unique identifier (depositId).\n * This method constructs the request URL using the depositId and makes a GET request to the PawaPay service endpoint\n * to obtain the transaction details. It is designed to fetch information for individual payout transactions.\n *\n * @param {string} depositId - The unique identifier for the payout transaction whose details are being retrieved.\n *\n * @returns {Promise} A promise that resolves to a `PawaPayPayoutTransaction` object if the payout details are successfully retrieved.\n * This object contains the details of the specified payout transaction. If an error occurs during the retrieval process,\n * the promise resolves to an unknown type. The method includes error handling that processes the error using the `networkHandler`'s error handling mechanism.\n */\n\n async getPayout(depositId: string): Promise {\n try {\n const response = await this.networkHandler.getInstance().get(`${this.baseEndpoint}/${depositId}`);\n\n console.log(\"Payout details retrieved successfully:\", response.data);\n\n return response.data as PawaPayPayoutTransaction;\n } catch (error) {\n\n console.error(\"Payout transaction failed:\", error);\n return this.networkHandler.handleErrors(error);\n }\n }\n\n}\n"]} -------------------------------------------------------------------------------- /examples/nodejs/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | pawapay_api: 9 | specifier: ^0.0.15 10 | version: 0.0.15 11 | 12 | packages: 13 | 14 | /abort-controller@3.0.0: 15 | resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} 16 | engines: {node: '>=6.5'} 17 | dependencies: 18 | event-target-shim: 5.0.1 19 | dev: false 20 | 21 | /asynckit@0.4.0: 22 | resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} 23 | dev: false 24 | 25 | /atomic-sleep@1.0.0: 26 | resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} 27 | engines: {node: '>=8.0.0'} 28 | dev: false 29 | 30 | /axios@1.6.8: 31 | resolution: {integrity: sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==} 32 | dependencies: 33 | follow-redirects: 1.15.6 34 | form-data: 4.0.0 35 | proxy-from-env: 1.1.0 36 | transitivePeerDependencies: 37 | - debug 38 | dev: false 39 | 40 | /base64-js@1.5.1: 41 | resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} 42 | dev: false 43 | 44 | /buffer@6.0.3: 45 | resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} 46 | dependencies: 47 | base64-js: 1.5.1 48 | ieee754: 1.2.1 49 | dev: false 50 | 51 | /colorette@2.0.20: 52 | resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} 53 | dev: false 54 | 55 | /combined-stream@1.0.8: 56 | resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} 57 | engines: {node: '>= 0.8'} 58 | dependencies: 59 | delayed-stream: 1.0.0 60 | dev: false 61 | 62 | /dateformat@4.6.3: 63 | resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} 64 | dev: false 65 | 66 | /delayed-stream@1.0.0: 67 | resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} 68 | engines: {node: '>=0.4.0'} 69 | dev: false 70 | 71 | /end-of-stream@1.4.4: 72 | resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} 73 | dependencies: 74 | once: 1.4.0 75 | dev: false 76 | 77 | /event-target-shim@5.0.1: 78 | resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} 79 | engines: {node: '>=6'} 80 | dev: false 81 | 82 | /events@3.3.0: 83 | resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} 84 | engines: {node: '>=0.8.x'} 85 | dev: false 86 | 87 | /fast-copy@3.0.2: 88 | resolution: {integrity: sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==} 89 | dev: false 90 | 91 | /fast-redact@3.5.0: 92 | resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} 93 | engines: {node: '>=6'} 94 | dev: false 95 | 96 | /fast-safe-stringify@2.1.1: 97 | resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} 98 | dev: false 99 | 100 | /follow-redirects@1.15.6: 101 | resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} 102 | engines: {node: '>=4.0'} 103 | peerDependencies: 104 | debug: '*' 105 | peerDependenciesMeta: 106 | debug: 107 | optional: true 108 | dev: false 109 | 110 | /form-data@4.0.0: 111 | resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} 112 | engines: {node: '>= 6'} 113 | dependencies: 114 | asynckit: 0.4.0 115 | combined-stream: 1.0.8 116 | mime-types: 2.1.35 117 | dev: false 118 | 119 | /help-me@5.0.0: 120 | resolution: {integrity: sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==} 121 | dev: false 122 | 123 | /ieee754@1.2.1: 124 | resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} 125 | dev: false 126 | 127 | /joycon@3.1.1: 128 | resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} 129 | engines: {node: '>=10'} 130 | dev: false 131 | 132 | /mime-db@1.52.0: 133 | resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} 134 | engines: {node: '>= 0.6'} 135 | dev: false 136 | 137 | /mime-types@2.1.35: 138 | resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} 139 | engines: {node: '>= 0.6'} 140 | dependencies: 141 | mime-db: 1.52.0 142 | dev: false 143 | 144 | /minimist@1.2.8: 145 | resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} 146 | dev: false 147 | 148 | /on-exit-leak-free@2.1.2: 149 | resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} 150 | engines: {node: '>=14.0.0'} 151 | dev: false 152 | 153 | /once@1.4.0: 154 | resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} 155 | dependencies: 156 | wrappy: 1.0.2 157 | dev: false 158 | 159 | /pawapay_api@0.0.15: 160 | resolution: {integrity: sha512-sZpBh1DlqMPs+vUOS2ZPG0vWLEYTfX3VKRe1aBduMjxPvYyqsT7HfQTcW+nZ6vhiGYG9lh2kP6szWc5XM0t/Ww==} 161 | dependencies: 162 | axios: 1.6.8 163 | pino: 8.19.0 164 | pino-pretty: 11.0.0 165 | reflect-metadata: 0.1.14 166 | tsyringe: 4.8.0 167 | transitivePeerDependencies: 168 | - debug 169 | dev: false 170 | 171 | /pino-abstract-transport@1.1.0: 172 | resolution: {integrity: sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==} 173 | dependencies: 174 | readable-stream: 4.5.2 175 | split2: 4.2.0 176 | dev: false 177 | 178 | /pino-pretty@11.0.0: 179 | resolution: {integrity: sha512-YFJZqw59mHIY72wBnBs7XhLGG6qpJMa4pEQTRgEPEbjIYbng2LXEZZF1DoyDg9CfejEy8uZCyzpcBXXG0oOCwQ==} 180 | hasBin: true 181 | dependencies: 182 | colorette: 2.0.20 183 | dateformat: 4.6.3 184 | fast-copy: 3.0.2 185 | fast-safe-stringify: 2.1.1 186 | help-me: 5.0.0 187 | joycon: 3.1.1 188 | minimist: 1.2.8 189 | on-exit-leak-free: 2.1.2 190 | pino-abstract-transport: 1.1.0 191 | pump: 3.0.0 192 | readable-stream: 4.5.2 193 | secure-json-parse: 2.7.0 194 | sonic-boom: 3.8.0 195 | strip-json-comments: 3.1.1 196 | dev: false 197 | 198 | /pino-std-serializers@6.2.2: 199 | resolution: {integrity: sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==} 200 | dev: false 201 | 202 | /pino@8.19.0: 203 | resolution: {integrity: sha512-oswmokxkav9bADfJ2ifrvfHUwad6MLp73Uat0IkQWY3iAw5xTRoznXbXksZs8oaOUMpmhVWD+PZogNzllWpJaA==} 204 | hasBin: true 205 | dependencies: 206 | atomic-sleep: 1.0.0 207 | fast-redact: 3.5.0 208 | on-exit-leak-free: 2.1.2 209 | pino-abstract-transport: 1.1.0 210 | pino-std-serializers: 6.2.2 211 | process-warning: 3.0.0 212 | quick-format-unescaped: 4.0.4 213 | real-require: 0.2.0 214 | safe-stable-stringify: 2.4.3 215 | sonic-boom: 3.8.0 216 | thread-stream: 2.4.1 217 | dev: false 218 | 219 | /process-warning@3.0.0: 220 | resolution: {integrity: sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==} 221 | dev: false 222 | 223 | /process@0.11.10: 224 | resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} 225 | engines: {node: '>= 0.6.0'} 226 | dev: false 227 | 228 | /proxy-from-env@1.1.0: 229 | resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} 230 | dev: false 231 | 232 | /pump@3.0.0: 233 | resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} 234 | dependencies: 235 | end-of-stream: 1.4.4 236 | once: 1.4.0 237 | dev: false 238 | 239 | /quick-format-unescaped@4.0.4: 240 | resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} 241 | dev: false 242 | 243 | /readable-stream@4.5.2: 244 | resolution: {integrity: sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==} 245 | engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} 246 | dependencies: 247 | abort-controller: 3.0.0 248 | buffer: 6.0.3 249 | events: 3.3.0 250 | process: 0.11.10 251 | string_decoder: 1.3.0 252 | dev: false 253 | 254 | /real-require@0.2.0: 255 | resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} 256 | engines: {node: '>= 12.13.0'} 257 | dev: false 258 | 259 | /reflect-metadata@0.1.14: 260 | resolution: {integrity: sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==} 261 | dev: false 262 | 263 | /safe-buffer@5.2.1: 264 | resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} 265 | dev: false 266 | 267 | /safe-stable-stringify@2.4.3: 268 | resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==} 269 | engines: {node: '>=10'} 270 | dev: false 271 | 272 | /secure-json-parse@2.7.0: 273 | resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} 274 | dev: false 275 | 276 | /sonic-boom@3.8.0: 277 | resolution: {integrity: sha512-ybz6OYOUjoQQCQ/i4LU8kaToD8ACtYP+Cj5qd2AO36bwbdewxWJ3ArmJ2cr6AvxlL2o0PqnCcPGUgkILbfkaCA==} 278 | dependencies: 279 | atomic-sleep: 1.0.0 280 | dev: false 281 | 282 | /split2@4.2.0: 283 | resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} 284 | engines: {node: '>= 10.x'} 285 | dev: false 286 | 287 | /string_decoder@1.3.0: 288 | resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} 289 | dependencies: 290 | safe-buffer: 5.2.1 291 | dev: false 292 | 293 | /strip-json-comments@3.1.1: 294 | resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} 295 | engines: {node: '>=8'} 296 | dev: false 297 | 298 | /thread-stream@2.4.1: 299 | resolution: {integrity: sha512-d/Ex2iWd1whipbT681JmTINKw0ZwOUBZm7+Gjs64DHuX34mmw8vJL2bFAaNacaW72zYiTJxSHi5abUuOi5nsfg==} 300 | dependencies: 301 | real-require: 0.2.0 302 | dev: false 303 | 304 | /tslib@1.14.1: 305 | resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} 306 | dev: false 307 | 308 | /tsyringe@4.8.0: 309 | resolution: {integrity: sha512-YB1FG+axdxADa3ncEtRnQCFq/M0lALGLxSZeVNbTU8NqhOVc51nnv2CISTcvc1kyv6EGPtXVr0v6lWeDxiijOA==} 310 | engines: {node: '>= 6.0.0'} 311 | dependencies: 312 | tslib: 1.14.1 313 | dev: false 314 | 315 | /wrappy@1.0.2: 316 | resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} 317 | dev: false 318 | -------------------------------------------------------------------------------- /pawapay_node/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '6.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | dependencies: 8 | axios: 9 | specifier: ^1.6.8 10 | version: 1.6.8 11 | pino: 12 | specifier: ^8.19.0 13 | version: 8.19.0 14 | pino-pretty: 15 | specifier: ^11.0.0 16 | version: 11.0.0 17 | reflect-metadata: 18 | specifier: ^0.1.13 19 | version: 0.1.14 20 | tsyringe: 21 | specifier: ^4.8.0 22 | version: 4.8.0 23 | 24 | devDependencies: 25 | '@types/node': 26 | specifier: ^20.11.30 27 | version: 20.11.30 28 | prettier: 29 | specifier: ^3.0.3 30 | version: 3.2.5 31 | tsc-alias: 32 | specifier: ^1.8.8 33 | version: 1.8.8 34 | typescript: 35 | specifier: ^5.2.2 36 | version: 5.4.2 37 | 38 | packages: 39 | 40 | /@nodelib/fs.scandir@2.1.5: 41 | resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} 42 | engines: {node: '>= 8'} 43 | dependencies: 44 | '@nodelib/fs.stat': 2.0.5 45 | run-parallel: 1.2.0 46 | dev: true 47 | 48 | /@nodelib/fs.stat@2.0.5: 49 | resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} 50 | engines: {node: '>= 8'} 51 | dev: true 52 | 53 | /@nodelib/fs.walk@1.2.8: 54 | resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} 55 | engines: {node: '>= 8'} 56 | dependencies: 57 | '@nodelib/fs.scandir': 2.1.5 58 | fastq: 1.17.1 59 | dev: true 60 | 61 | /@types/node@20.11.30: 62 | resolution: {integrity: sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==} 63 | dependencies: 64 | undici-types: 5.26.5 65 | dev: true 66 | 67 | /abort-controller@3.0.0: 68 | resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} 69 | engines: {node: '>=6.5'} 70 | dependencies: 71 | event-target-shim: 5.0.1 72 | dev: false 73 | 74 | /anymatch@3.1.3: 75 | resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} 76 | engines: {node: '>= 8'} 77 | dependencies: 78 | normalize-path: 3.0.0 79 | picomatch: 2.3.1 80 | dev: true 81 | 82 | /array-union@2.1.0: 83 | resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} 84 | engines: {node: '>=8'} 85 | dev: true 86 | 87 | /asynckit@0.4.0: 88 | resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} 89 | dev: false 90 | 91 | /atomic-sleep@1.0.0: 92 | resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} 93 | engines: {node: '>=8.0.0'} 94 | dev: false 95 | 96 | /axios@1.6.8: 97 | resolution: {integrity: sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==} 98 | dependencies: 99 | follow-redirects: 1.15.6 100 | form-data: 4.0.0 101 | proxy-from-env: 1.1.0 102 | transitivePeerDependencies: 103 | - debug 104 | dev: false 105 | 106 | /base64-js@1.5.1: 107 | resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} 108 | dev: false 109 | 110 | /binary-extensions@2.3.0: 111 | resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} 112 | engines: {node: '>=8'} 113 | dev: true 114 | 115 | /braces@3.0.2: 116 | resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} 117 | engines: {node: '>=8'} 118 | dependencies: 119 | fill-range: 7.0.1 120 | dev: true 121 | 122 | /buffer@6.0.3: 123 | resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} 124 | dependencies: 125 | base64-js: 1.5.1 126 | ieee754: 1.2.1 127 | dev: false 128 | 129 | /chokidar@3.6.0: 130 | resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} 131 | engines: {node: '>= 8.10.0'} 132 | dependencies: 133 | anymatch: 3.1.3 134 | braces: 3.0.2 135 | glob-parent: 5.1.2 136 | is-binary-path: 2.1.0 137 | is-glob: 4.0.3 138 | normalize-path: 3.0.0 139 | readdirp: 3.6.0 140 | optionalDependencies: 141 | fsevents: 2.3.3 142 | dev: true 143 | 144 | /colorette@2.0.20: 145 | resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} 146 | dev: false 147 | 148 | /combined-stream@1.0.8: 149 | resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} 150 | engines: {node: '>= 0.8'} 151 | dependencies: 152 | delayed-stream: 1.0.0 153 | dev: false 154 | 155 | /commander@9.5.0: 156 | resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} 157 | engines: {node: ^12.20.0 || >=14} 158 | dev: true 159 | 160 | /dateformat@4.6.3: 161 | resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} 162 | dev: false 163 | 164 | /delayed-stream@1.0.0: 165 | resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} 166 | engines: {node: '>=0.4.0'} 167 | dev: false 168 | 169 | /dir-glob@3.0.1: 170 | resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} 171 | engines: {node: '>=8'} 172 | dependencies: 173 | path-type: 4.0.0 174 | dev: true 175 | 176 | /end-of-stream@1.4.4: 177 | resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} 178 | dependencies: 179 | once: 1.4.0 180 | dev: false 181 | 182 | /event-target-shim@5.0.1: 183 | resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==} 184 | engines: {node: '>=6'} 185 | dev: false 186 | 187 | /events@3.3.0: 188 | resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} 189 | engines: {node: '>=0.8.x'} 190 | dev: false 191 | 192 | /fast-copy@3.0.2: 193 | resolution: {integrity: sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==} 194 | dev: false 195 | 196 | /fast-glob@3.3.2: 197 | resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} 198 | engines: {node: '>=8.6.0'} 199 | dependencies: 200 | '@nodelib/fs.stat': 2.0.5 201 | '@nodelib/fs.walk': 1.2.8 202 | glob-parent: 5.1.2 203 | merge2: 1.4.1 204 | micromatch: 4.0.5 205 | dev: true 206 | 207 | /fast-redact@3.5.0: 208 | resolution: {integrity: sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==} 209 | engines: {node: '>=6'} 210 | dev: false 211 | 212 | /fast-safe-stringify@2.1.1: 213 | resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} 214 | dev: false 215 | 216 | /fastq@1.17.1: 217 | resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} 218 | dependencies: 219 | reusify: 1.0.4 220 | dev: true 221 | 222 | /fill-range@7.0.1: 223 | resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} 224 | engines: {node: '>=8'} 225 | dependencies: 226 | to-regex-range: 5.0.1 227 | dev: true 228 | 229 | /follow-redirects@1.15.6: 230 | resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} 231 | engines: {node: '>=4.0'} 232 | peerDependencies: 233 | debug: '*' 234 | peerDependenciesMeta: 235 | debug: 236 | optional: true 237 | dev: false 238 | 239 | /form-data@4.0.0: 240 | resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} 241 | engines: {node: '>= 6'} 242 | dependencies: 243 | asynckit: 0.4.0 244 | combined-stream: 1.0.8 245 | mime-types: 2.1.35 246 | dev: false 247 | 248 | /fsevents@2.3.3: 249 | resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} 250 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 251 | os: [darwin] 252 | requiresBuild: true 253 | dev: true 254 | optional: true 255 | 256 | /glob-parent@5.1.2: 257 | resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} 258 | engines: {node: '>= 6'} 259 | dependencies: 260 | is-glob: 4.0.3 261 | dev: true 262 | 263 | /globby@11.1.0: 264 | resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} 265 | engines: {node: '>=10'} 266 | dependencies: 267 | array-union: 2.1.0 268 | dir-glob: 3.0.1 269 | fast-glob: 3.3.2 270 | ignore: 5.3.1 271 | merge2: 1.4.1 272 | slash: 3.0.0 273 | dev: true 274 | 275 | /help-me@5.0.0: 276 | resolution: {integrity: sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==} 277 | dev: false 278 | 279 | /ieee754@1.2.1: 280 | resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} 281 | dev: false 282 | 283 | /ignore@5.3.1: 284 | resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} 285 | engines: {node: '>= 4'} 286 | dev: true 287 | 288 | /is-binary-path@2.1.0: 289 | resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} 290 | engines: {node: '>=8'} 291 | dependencies: 292 | binary-extensions: 2.3.0 293 | dev: true 294 | 295 | /is-extglob@2.1.1: 296 | resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} 297 | engines: {node: '>=0.10.0'} 298 | dev: true 299 | 300 | /is-glob@4.0.3: 301 | resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} 302 | engines: {node: '>=0.10.0'} 303 | dependencies: 304 | is-extglob: 2.1.1 305 | dev: true 306 | 307 | /is-number@7.0.0: 308 | resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} 309 | engines: {node: '>=0.12.0'} 310 | dev: true 311 | 312 | /joycon@3.1.1: 313 | resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} 314 | engines: {node: '>=10'} 315 | dev: false 316 | 317 | /merge2@1.4.1: 318 | resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} 319 | engines: {node: '>= 8'} 320 | dev: true 321 | 322 | /micromatch@4.0.5: 323 | resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} 324 | engines: {node: '>=8.6'} 325 | dependencies: 326 | braces: 3.0.2 327 | picomatch: 2.3.1 328 | dev: true 329 | 330 | /mime-db@1.52.0: 331 | resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} 332 | engines: {node: '>= 0.6'} 333 | dev: false 334 | 335 | /mime-types@2.1.35: 336 | resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} 337 | engines: {node: '>= 0.6'} 338 | dependencies: 339 | mime-db: 1.52.0 340 | dev: false 341 | 342 | /minimist@1.2.8: 343 | resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} 344 | dev: false 345 | 346 | /mylas@2.1.13: 347 | resolution: {integrity: sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==} 348 | engines: {node: '>=12.0.0'} 349 | dev: true 350 | 351 | /normalize-path@3.0.0: 352 | resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} 353 | engines: {node: '>=0.10.0'} 354 | dev: true 355 | 356 | /on-exit-leak-free@2.1.2: 357 | resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} 358 | engines: {node: '>=14.0.0'} 359 | dev: false 360 | 361 | /once@1.4.0: 362 | resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} 363 | dependencies: 364 | wrappy: 1.0.2 365 | dev: false 366 | 367 | /path-type@4.0.0: 368 | resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} 369 | engines: {node: '>=8'} 370 | dev: true 371 | 372 | /picomatch@2.3.1: 373 | resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} 374 | engines: {node: '>=8.6'} 375 | dev: true 376 | 377 | /pino-abstract-transport@1.1.0: 378 | resolution: {integrity: sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==} 379 | dependencies: 380 | readable-stream: 4.5.2 381 | split2: 4.2.0 382 | dev: false 383 | 384 | /pino-pretty@11.0.0: 385 | resolution: {integrity: sha512-YFJZqw59mHIY72wBnBs7XhLGG6qpJMa4pEQTRgEPEbjIYbng2LXEZZF1DoyDg9CfejEy8uZCyzpcBXXG0oOCwQ==} 386 | hasBin: true 387 | dependencies: 388 | colorette: 2.0.20 389 | dateformat: 4.6.3 390 | fast-copy: 3.0.2 391 | fast-safe-stringify: 2.1.1 392 | help-me: 5.0.0 393 | joycon: 3.1.1 394 | minimist: 1.2.8 395 | on-exit-leak-free: 2.1.2 396 | pino-abstract-transport: 1.1.0 397 | pump: 3.0.0 398 | readable-stream: 4.5.2 399 | secure-json-parse: 2.7.0 400 | sonic-boom: 3.8.0 401 | strip-json-comments: 3.1.1 402 | dev: false 403 | 404 | /pino-std-serializers@6.2.2: 405 | resolution: {integrity: sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==} 406 | dev: false 407 | 408 | /pino@8.19.0: 409 | resolution: {integrity: sha512-oswmokxkav9bADfJ2ifrvfHUwad6MLp73Uat0IkQWY3iAw5xTRoznXbXksZs8oaOUMpmhVWD+PZogNzllWpJaA==} 410 | hasBin: true 411 | dependencies: 412 | atomic-sleep: 1.0.0 413 | fast-redact: 3.5.0 414 | on-exit-leak-free: 2.1.2 415 | pino-abstract-transport: 1.1.0 416 | pino-std-serializers: 6.2.2 417 | process-warning: 3.0.0 418 | quick-format-unescaped: 4.0.4 419 | real-require: 0.2.0 420 | safe-stable-stringify: 2.4.3 421 | sonic-boom: 3.8.0 422 | thread-stream: 2.4.1 423 | dev: false 424 | 425 | /plimit-lit@1.6.1: 426 | resolution: {integrity: sha512-B7+VDyb8Tl6oMJT9oSO2CW8XC/T4UcJGrwOVoNGwOQsQYhlpfajmrMj5xeejqaASq3V/EqThyOeATEOMuSEXiA==} 427 | engines: {node: '>=12'} 428 | dependencies: 429 | queue-lit: 1.5.2 430 | dev: true 431 | 432 | /prettier@3.2.5: 433 | resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} 434 | engines: {node: '>=14'} 435 | hasBin: true 436 | dev: true 437 | 438 | /process-warning@3.0.0: 439 | resolution: {integrity: sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==} 440 | dev: false 441 | 442 | /process@0.11.10: 443 | resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==} 444 | engines: {node: '>= 0.6.0'} 445 | dev: false 446 | 447 | /proxy-from-env@1.1.0: 448 | resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} 449 | dev: false 450 | 451 | /pump@3.0.0: 452 | resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} 453 | dependencies: 454 | end-of-stream: 1.4.4 455 | once: 1.4.0 456 | dev: false 457 | 458 | /queue-lit@1.5.2: 459 | resolution: {integrity: sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==} 460 | engines: {node: '>=12'} 461 | dev: true 462 | 463 | /queue-microtask@1.2.3: 464 | resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} 465 | dev: true 466 | 467 | /quick-format-unescaped@4.0.4: 468 | resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} 469 | dev: false 470 | 471 | /readable-stream@4.5.2: 472 | resolution: {integrity: sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==} 473 | engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} 474 | dependencies: 475 | abort-controller: 3.0.0 476 | buffer: 6.0.3 477 | events: 3.3.0 478 | process: 0.11.10 479 | string_decoder: 1.3.0 480 | dev: false 481 | 482 | /readdirp@3.6.0: 483 | resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} 484 | engines: {node: '>=8.10.0'} 485 | dependencies: 486 | picomatch: 2.3.1 487 | dev: true 488 | 489 | /real-require@0.2.0: 490 | resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} 491 | engines: {node: '>= 12.13.0'} 492 | dev: false 493 | 494 | /reflect-metadata@0.1.14: 495 | resolution: {integrity: sha512-ZhYeb6nRaXCfhnndflDK8qI6ZQ/YcWZCISRAWICW9XYqMUwjZM9Z0DveWX/ABN01oxSHwVxKQmxeYZSsm0jh5A==} 496 | dev: false 497 | 498 | /reusify@1.0.4: 499 | resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} 500 | engines: {iojs: '>=1.0.0', node: '>=0.10.0'} 501 | dev: true 502 | 503 | /run-parallel@1.2.0: 504 | resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} 505 | dependencies: 506 | queue-microtask: 1.2.3 507 | dev: true 508 | 509 | /safe-buffer@5.2.1: 510 | resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} 511 | dev: false 512 | 513 | /safe-stable-stringify@2.4.3: 514 | resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==} 515 | engines: {node: '>=10'} 516 | dev: false 517 | 518 | /secure-json-parse@2.7.0: 519 | resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==} 520 | dev: false 521 | 522 | /slash@3.0.0: 523 | resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} 524 | engines: {node: '>=8'} 525 | dev: true 526 | 527 | /sonic-boom@3.8.0: 528 | resolution: {integrity: sha512-ybz6OYOUjoQQCQ/i4LU8kaToD8ACtYP+Cj5qd2AO36bwbdewxWJ3ArmJ2cr6AvxlL2o0PqnCcPGUgkILbfkaCA==} 529 | dependencies: 530 | atomic-sleep: 1.0.0 531 | dev: false 532 | 533 | /split2@4.2.0: 534 | resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} 535 | engines: {node: '>= 10.x'} 536 | dev: false 537 | 538 | /string_decoder@1.3.0: 539 | resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} 540 | dependencies: 541 | safe-buffer: 5.2.1 542 | dev: false 543 | 544 | /strip-json-comments@3.1.1: 545 | resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} 546 | engines: {node: '>=8'} 547 | dev: false 548 | 549 | /thread-stream@2.4.1: 550 | resolution: {integrity: sha512-d/Ex2iWd1whipbT681JmTINKw0ZwOUBZm7+Gjs64DHuX34mmw8vJL2bFAaNacaW72zYiTJxSHi5abUuOi5nsfg==} 551 | dependencies: 552 | real-require: 0.2.0 553 | dev: false 554 | 555 | /to-regex-range@5.0.1: 556 | resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} 557 | engines: {node: '>=8.0'} 558 | dependencies: 559 | is-number: 7.0.0 560 | dev: true 561 | 562 | /tsc-alias@1.8.8: 563 | resolution: {integrity: sha512-OYUOd2wl0H858NvABWr/BoSKNERw3N9GTi3rHPK8Iv4O1UyUXIrTTOAZNHsjlVpXFOhpJBVARI1s+rzwLivN3Q==} 564 | hasBin: true 565 | dependencies: 566 | chokidar: 3.6.0 567 | commander: 9.5.0 568 | globby: 11.1.0 569 | mylas: 2.1.13 570 | normalize-path: 3.0.0 571 | plimit-lit: 1.6.1 572 | dev: true 573 | 574 | /tslib@1.14.1: 575 | resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} 576 | dev: false 577 | 578 | /tsyringe@4.8.0: 579 | resolution: {integrity: sha512-YB1FG+axdxADa3ncEtRnQCFq/M0lALGLxSZeVNbTU8NqhOVc51nnv2CISTcvc1kyv6EGPtXVr0v6lWeDxiijOA==} 580 | engines: {node: '>= 6.0.0'} 581 | dependencies: 582 | tslib: 1.14.1 583 | dev: false 584 | 585 | /typescript@5.4.2: 586 | resolution: {integrity: sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==} 587 | engines: {node: '>=14.17'} 588 | hasBin: true 589 | dev: true 590 | 591 | /undici-types@5.26.5: 592 | resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} 593 | dev: true 594 | 595 | /wrappy@1.0.2: 596 | resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} 597 | dev: false 598 | --------------------------------------------------------------------------------