UNPKG

@sourceloop/ctrl-plane-subscription-service

Version:

Subscription management microservice for SaaS control plane.

108 lines 4.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BillingPaymentSourceController = void 0; const tslib_1 = require("tslib"); const core_1 = require("@loopback/core"); const rest_1 = require("@loopback/rest"); const core_2 = require("@sourceloop/core"); const loopback4_authentication_1 = require("loopback4-authentication"); const loopback4_authorization_1 = require("loopback4-authorization"); const payment_dto_model_1 = require("../models/dto/payment-dto.model"); const permissions_1 = require("../permissions"); const billing_payment_source_service_1 = require("../services/billing-payment-source.service"); const basePath = '/billing-payment-source'; let BillingPaymentSourceController = class BillingPaymentSourceController { constructor(billingPaymentSourceService) { this.billingPaymentSourceService = billingPaymentSourceService; } async create(paymentSourceDto) { return this.billingPaymentSourceService.createPaymentSource(paymentSourceDto); } async getPaymentSource(paymentSourceId) { return this.billingPaymentSourceService.getPaymentSource(paymentSourceId); } async deleteById(paymentSourceId) { return this.billingPaymentSourceService.deletePaymentSource(paymentSourceId); } }; exports.BillingPaymentSourceController = BillingPaymentSourceController; tslib_1.__decorate([ (0, loopback4_authorization_1.authorize)({ permissions: [permissions_1.PermissionKey.CreateBillingPaymentSource], }), (0, loopback4_authentication_1.authenticate)("bearer" /* STRATEGY.BEARER */, { passReqToCallback: true, }), (0, rest_1.post)(basePath, { security: core_2.OPERATION_SECURITY_SPEC, responses: { [200 /* STATUS_CODE.OK */]: { description: 'Payment model instance', content: { 'application/json': { schema: (0, core_2.getModelSchemaRefSF)(payment_dto_model_1.PaymentSourceDto) }, }, }, }, }), tslib_1.__param(0, (0, rest_1.requestBody)({ content: { 'application/json': { schema: (0, core_2.getModelSchemaRefSF)(payment_dto_model_1.PaymentSourceDto, { title: 'NewPaymentSource', exclude: ['id'], }), }, }, })), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [payment_dto_model_1.PaymentSourceDto]), tslib_1.__metadata("design:returntype", Promise) ], BillingPaymentSourceController.prototype, "create", null); tslib_1.__decorate([ (0, loopback4_authorization_1.authorize)({ permissions: [permissions_1.PermissionKey.GetBillingPaymentSource], }), (0, loopback4_authentication_1.authenticate)("bearer" /* STRATEGY.BEARER */, { passReqToCallback: true, }), (0, rest_1.get)(basePath, { security: core_2.OPERATION_SECURITY_SPEC, responses: { [200 /* STATUS_CODE.OK */]: { description: 'get payment source', content: { 'application/json': { schema: (0, core_2.getModelSchemaRefSF)(payment_dto_model_1.PaymentSourceDto) }, }, }, }, }), tslib_1.__param(0, rest_1.param.path.string('paymentSourceId')), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [String]), tslib_1.__metadata("design:returntype", Promise) ], BillingPaymentSourceController.prototype, "getPaymentSource", null); tslib_1.__decorate([ (0, loopback4_authorization_1.authorize)({ permissions: [permissions_1.PermissionKey.DeleteBillingPaymentSource], }), (0, loopback4_authentication_1.authenticate)("bearer" /* STRATEGY.BEARER */, { passReqToCallback: true, }), (0, rest_1.del)(`${basePath}/{paymentSourceId}`, { security: core_2.OPERATION_SECURITY_SPEC, responses: { [204 /* STATUS_CODE.NO_CONTENT */]: { description: 'Billing Payment Source DELETE success', }, }, }), tslib_1.__param(0, rest_1.param.path.string('paymentSourceId')), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", [String]), tslib_1.__metadata("design:returntype", Promise) ], BillingPaymentSourceController.prototype, "deleteById", null); exports.BillingPaymentSourceController = BillingPaymentSourceController = tslib_1.__decorate([ tslib_1.__param(0, (0, core_1.inject)('services.BillingPaymentSourceService')), tslib_1.__metadata("design:paramtypes", [billing_payment_source_service_1.BillingPaymentSourceService]) ], BillingPaymentSourceController); //# sourceMappingURL=billing-payment-source.controller.js.map