UNPKG

afrimomo-sdk

Version:

A unified SDK for African payment providers

82 lines 3.03 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PawaPay = void 0; const deposits_1 = require("./deposits"); const payments_1 = require("./payments"); const payouts_1 = require("./payouts"); const refunds_1 = require("./refunds"); const wallets_1 = require("./wallets"); const providerClients_1 = require("../../utils/providerClients"); const logger_1 = require("../../utils/logger"); __exportStar(require("./types"), exports); class PawaPay { network; _deposits; _payments; _payouts; _refunds; _wallets; constructor(jwt, environment = "DEVELOPMENT", sandboxUrl, productionUrl) { this.network = (0, providerClients_1.createPawapayClient)(jwt, environment, sandboxUrl, productionUrl); this._deposits = new deposits_1.PawapayDeposits(this.network); this._payments = new payments_1.PawapayPayments(this.network); this._payouts = new payouts_1.PawapayPayouts(this.network); this._refunds = new refunds_1.PawapayRefunds(this.network); this._wallets = new wallets_1.PawapayWallets(this.network); } get deposits() { return this._deposits; } get payments() { return this._payments; } get payouts() { return this._payouts; } get refunds() { return this._refunds; } get wallets() { return this._wallets; } async getAvailability() { try { logger_1.logger.info("Getting PawaPay correspondent availability"); return await this.network.get("/availability", "retrieving correspondent availability"); } catch (error) { if (error.errorMessage) { return error; } return this.network.handleApiError(error, "retrieving correspondent availability"); } } async getActiveConfiguration() { try { logger_1.logger.info("Getting PawaPay active configuration"); return await this.network.get("/active-conf", "retrieving active configuration"); } catch (error) { if (error.errorMessage) { return error; } return this.network.handleApiError(error, "retrieving active configuration"); } } } exports.PawaPay = PawaPay; //# sourceMappingURL=index.js.map