UNPKG

vendure-plugin-nowpayments

Version:

A cryptocurrency payment gateway plugin for Vendure that integrates with NOWPayments.io, enabling your store to accept payments in Bitcoin, Ethereum, and 100+ other cryptocurrencies.

93 lines (92 loc) 3.38 kB
/** * NOWPayments cryptocurrency payment gateway plugin for Vendure. * * This plugin integrates with NOWPayments.io to enable cryptocurrency payments * in your Vendure store. It supports Bitcoin, Ethereum, and 100+ other cryptocurrencies. * * @category Plugin */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "NowpaymentsPlugin", { enumerable: true, get: function() { return NowpaymentsPlugin; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _core = require("@vendure/core"); const _graphqltag = require("graphql-tag"); const _nowpaymentsservice = require("./nowpayments.service"); const _nowpaymentscontroller = require("./nowpayments.controller"); const _nowpaymentsresolver = require("./nowpayments.resolver"); const _nowpaymentspaymenthandler = require("./nowpayments-payment.handler"); const _constants = require("./constants"); let NowpaymentsPlugin = class NowpaymentsPlugin { /** * Initialize the NOWPayments plugin with the required configuration options. * * @example * ```ts * NowpaymentsPlugin.init({ * apiKey: process.env.NOWPAYMENTS_API_KEY || '', * ipnSecret: process.env.NOWPAYMENTS_IPN_SECRET || '', * host: process.env.VENDURE_HOST || 'http://localhost:3000', * getSuccessUrl: (order, host) => `${host}/order/confirmation/${order.code}`, * getCancelUrl: (order, host) => `${host}/checkout`, * sandbox: process.env.NOWPAYMENTS_SANDBOX === 'true', * useInvoices: false, * invoicePrefix: 'VC-', * simpleTotal: false, * allowZeroConfirm: true, * formSubmissionMethod: true, * debugEmail: process.env.NOWPAYMENTS_DEBUG_EMAIL || '', * debugPostUrl: process.env.NOWPAYMENTS_DEBUG_POST_URL || '', * is_fixed_rate: false, * is_fee_paid_by_user: false, * }), * ``` */ static init(options) { this.options = options; return NowpaymentsPlugin; } }; NowpaymentsPlugin = _ts_decorate._([ (0, _core.VendurePlugin)({ imports: [ _core.PluginCommonModule ], providers: [ { provide: _constants.NOWPAYMENTS_PLUGIN_OPTIONS, useFactory: ()=>NowpaymentsPlugin.options }, _nowpaymentsservice.NOWPaymentsService ], controllers: [ _nowpaymentscontroller.NOWPaymentsController ], configuration: (config)=>{ // Register the payment method handler config.paymentOptions.paymentMethodHandlers.push(_nowpaymentspaymenthandler.nowPaymentsPaymentHandler); // Plugin-specific configuration // such as custom fields, custom permissions, // strategies etc. can be configured here by // modifying the `config` object. return config; }, shopApiExtensions: { schema: (0, _graphqltag.gql)` extend type Mutation { createNowPaymentsPaymentIntent: String! } `, resolvers: [ _nowpaymentsresolver.NOWPaymentsResolver ] }, compatibility: '^3.0.0' }) ], NowpaymentsPlugin); //# sourceMappingURL=nowpayments.plugin.js.map