UNPKG

@spreeloop/mtn_momo

Version:
32 lines 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MtnMomoPayment = void 0; const constants_1 = require("../utils/constants"); const fake_1 = require("./implementations/fake"); const live_1 = require("./implementations/live"); const sandbox_1 = require("./implementations/sandbox"); /** * Creates an MTN MOMO payment instance based on the target environment. */ class MtnMomoPayment { /** * Creates a new payment instance using the provided configuration. * * @param {MtnMomoPaymentConfigs} config - The payment configuration * @returns {MtnMomoInterface} The created payment instance */ static createPayment(config) { switch (config.targetEnvironment) { case constants_1.TargetEnvironment.prod: return new live_1.MtnMomoPaymentLive(config); case constants_1.TargetEnvironment.sandbox: return new sandbox_1.MtnMomoPaymentSandbox(config); case constants_1.TargetEnvironment.fake: return new fake_1.MtnMomoPaymentFake(config); default: throw new Error(`Invalid target environment: ${config.targetEnvironment}`); } } } exports.MtnMomoPayment = MtnMomoPayment; //# sourceMappingURL=payments.js.map