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.

52 lines (51 loc) 2.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "NOWPaymentsResolver", { enumerable: true, get: function() { return NOWPaymentsResolver; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _ts_metadata = require("@swc/helpers/_/_ts_metadata"); const _ts_param = require("@swc/helpers/_/_ts_param"); const _graphql = require("@nestjs/graphql"); const _core = require("@vendure/core"); const _nowpaymentsservice = require("./nowpayments.service"); let NOWPaymentsResolver = class NOWPaymentsResolver { async createNowPaymentsPaymentIntent(ctx) { if (!ctx.authorizedAsOwnerOnly) { throw new _core.UnauthorizedError(); } const sessionOrder = await this.activeOrderService.getActiveOrder(ctx, undefined); if (!sessionOrder) { throw new _core.UserInputError('No active order found for session'); } return this.nowPaymentsService.createPaymentIntent(ctx, sessionOrder); } constructor(nowPaymentsService, activeOrderService){ this.nowPaymentsService = nowPaymentsService; this.activeOrderService = activeOrderService; } }; _ts_decorate._([ (0, _graphql.Mutation)(), (0, _core.Allow)(_core.Permission.Owner), _ts_param._(0, (0, _core.Ctx)()), _ts_metadata._("design:type", Function), _ts_metadata._("design:paramtypes", [ typeof _core.RequestContext === "undefined" ? Object : _core.RequestContext ]), _ts_metadata._("design:returntype", Promise) ], NOWPaymentsResolver.prototype, "createNowPaymentsPaymentIntent", null); NOWPaymentsResolver = _ts_decorate._([ (0, _graphql.Resolver)(), _ts_metadata._("design:type", Function), _ts_metadata._("design:paramtypes", [ typeof _nowpaymentsservice.NOWPaymentsService === "undefined" ? Object : _nowpaymentsservice.NOWPaymentsService, typeof _core.ActiveOrderService === "undefined" ? Object : _core.ActiveOrderService ]) ], NOWPaymentsResolver); //# sourceMappingURL=nowpayments.resolver.js.map