UNPKG

modem-pay

Version:

A TypeScript SDK for integrating with the Modem Pay payment gateway, enabling seamless payment processing and financial services in your applications.

106 lines (105 loc) 3.92 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const transfer_1 = __importDefault(require("../resources/transfer")); const coupon_1 = __importDefault(require("../resources/coupon")); const customer_1 = __importDefault(require("../resources/customer")); const mandate_1 = __importDefault(require("../resources/mandate")); const payment_intent_1 = __importDefault(require("../resources/payment-intent")); const payment_link_1 = __importDefault(require("../resources/payment-link")); const session_1 = __importDefault(require("../resources/session")); const transaction_1 = __importDefault(require("../resources/transaction")); const webhook_1 = __importDefault(require("../resources/webhook")); class ModemPay { constructor(apiKey, config = { maxRetries: 3, timeout: 60 }) { var _a, _b; this._customers = null; this._sessions = null; this._paymentLinks = null; this._paymentIntents = null; this._paymentMethods = null; this._transfers = null; this._coupons = null; this._transactions = null; this._webhooks = null; this._mandates = null; this.apiKey = apiKey; this.maxRetries = (_a = config.maxRetries) !== null && _a !== void 0 ? _a : 3; this.timeout = (_b = config.timeout) !== null && _b !== void 0 ? _b : 60; } get webhooks() { if (!this._webhooks) { this._webhooks = new webhook_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._webhooks; } get transactions() { if (!this._transactions) { this._transactions = new transaction_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._transactions; } get transfers() { if (!this._transfers) { this._transfers = new transfer_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._transfers; } get customers() { if (!this._customers) { this._customers = new customer_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._customers; } get coupons() { if (!this._coupons) { this._coupons = new coupon_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._coupons; } // get promotionCodes(): PromotionCodeResource { // if (!this._promotionCodes) { // this._promotionCodes = new PromotionCodeResource( // this.apiKey, // this.maxRetries // ); // } // return this._promotionCodes; // } get sessions() { if (!this._sessions) { this._sessions = new session_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._sessions; } get paymentLinks() { if (!this._paymentLinks) { this._paymentLinks = new payment_link_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._paymentLinks; } get paymentIntents() { if (!this._paymentIntents) { this._paymentIntents = new payment_intent_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._paymentIntents; } // get paymentMethods(): PaymentMethodsResource { // if (!this._paymentMethods) { // this._paymentMethods = new PaymentMethodsResource( // this.apiKey, // this.maxRetries // ); // } // return this._paymentMethods; // } get mandates() { if (!this._mandates) { this._mandates = new mandate_1.default(this.apiKey, this.maxRetries, this.timeout); } return this._mandates; } } exports.default = ModemPay;