UNPKG

culqi-node

Version:

Typescript wrapper for Culqi web services developed for Node.js with 0 runtime dependencies

38 lines (37 loc) 1.54 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const vars_1 = __importDefault(require("./vars")); const tokens_1 = require("./tokens"); const charges_1 = require("./charges"); const refunds_1 = require("./refunds"); const customers_1 = require("./customers"); const cards_1 = require("./cards"); const plans_1 = require("./plans"); const subscriptions_1 = require("./subscriptions"); const orders_1 = require("./orders"); const events_1 = require("./events"); module.exports = class Culqi { tokens = tokens_1.tokens; charges = charges_1.charges; refunds = refunds_1.refunds; customers = customers_1.customers; cards = cards_1.cards; plans = plans_1.plans; subscriptions = subscriptions_1.subscriptions; orders = orders_1.orders; events = events_1.events; constructor(options = {}) { if (!options.privateKey) throw new Error("Provide 'privateKey' property"); if (options.pciCompliant && !options.publicKey) throw new Error("Provide 'publicKey' property"); if (!options.pciCompliant && options.publicKey) throw new Error("Provide 'pciCompliant' options as true. " + 'It means you acknowledge that you are PCI-compliant in order to execute certain operations.'); vars_1.default.privateKey = options.privateKey; if (options.publicKey) vars_1.default.publicKey = options.publicKey; } };