- Prefijo v2: MCH - TRACEABILITY-MASTER.yml creado - Listo para integracion como submodulo Workspace: v2.0.0 | SIMCO: v4.0.0
164 lines
7.5 KiB
JavaScript
164 lines
7.5 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.CodiSpeiController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const jwt_auth_guard_1 = require("../auth/guards/jwt-auth.guard");
|
|
const codi_spei_service_1 = require("./codi-spei.service");
|
|
const generate_qr_dto_1 = require("./dto/generate-qr.dto");
|
|
let CodiSpeiController = class CodiSpeiController {
|
|
constructor(codiSpeiService) {
|
|
this.codiSpeiService = codiSpeiService;
|
|
}
|
|
generateQr(req, dto) {
|
|
return this.codiSpeiService.generateQr(req.user.tenantId, dto);
|
|
}
|
|
getCodiStatus(id) {
|
|
return this.codiSpeiService.getCodiStatus(id);
|
|
}
|
|
getCodiTransactions(req, limit) {
|
|
return this.codiSpeiService.getCodiTransactions(req.user.tenantId, limit);
|
|
}
|
|
async codiWebhook(payload) {
|
|
await this.codiSpeiService.handleCodiWebhook(payload);
|
|
return { success: true };
|
|
}
|
|
async getClabe(req) {
|
|
const account = await this.codiSpeiService.getVirtualAccount(req.user.tenantId);
|
|
if (!account) {
|
|
return { clabe: null, message: 'No tiene CLABE virtual configurada' };
|
|
}
|
|
return {
|
|
clabe: account.clabe,
|
|
beneficiaryName: account.beneficiaryName,
|
|
status: account.status,
|
|
};
|
|
}
|
|
createClabe(req, body) {
|
|
return this.codiSpeiService.createVirtualAccount(req.user.tenantId, body.beneficiaryName);
|
|
}
|
|
getSpeiTransactions(req, limit) {
|
|
return this.codiSpeiService.getSpeiTransactions(req.user.tenantId, limit);
|
|
}
|
|
async speiWebhook(payload) {
|
|
await this.codiSpeiService.handleSpeiWebhook(payload.clabe, payload);
|
|
return { success: true };
|
|
}
|
|
async getSummary(req, date) {
|
|
const targetDate = date ? new Date(date) : undefined;
|
|
return this.codiSpeiService.getSummary(req.user.tenantId, targetDate);
|
|
}
|
|
};
|
|
exports.CodiSpeiController = CodiSpeiController;
|
|
__decorate([
|
|
(0, common_1.Post)('codi/generate-qr'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Generar QR CoDi para cobro' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__param(1, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, generate_qr_dto_1.GenerateQrDto]),
|
|
__metadata("design:returntype", void 0)
|
|
], CodiSpeiController.prototype, "generateQr", null);
|
|
__decorate([
|
|
(0, common_1.Get)('codi/status/:id'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener estado de transaccion CoDi' }),
|
|
__param(0, (0, common_1.Param)('id')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [String]),
|
|
__metadata("design:returntype", void 0)
|
|
], CodiSpeiController.prototype, "getCodiStatus", null);
|
|
__decorate([
|
|
(0, common_1.Get)('codi/transactions'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Listar transacciones CoDi' }),
|
|
(0, swagger_1.ApiQuery)({ name: 'limit', required: false }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__param(1, (0, common_1.Query)('limit')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, Number]),
|
|
__metadata("design:returntype", void 0)
|
|
], CodiSpeiController.prototype, "getCodiTransactions", null);
|
|
__decorate([
|
|
(0, common_1.Post)('codi/webhook'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Webhook para confirmacion CoDi' }),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], CodiSpeiController.prototype, "codiWebhook", null);
|
|
__decorate([
|
|
(0, common_1.Get)('spei/clabe'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Obtener CLABE virtual del tenant' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], CodiSpeiController.prototype, "getClabe", null);
|
|
__decorate([
|
|
(0, common_1.Post)('spei/create-clabe'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Crear CLABE virtual para el tenant' }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__param(1, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, Object]),
|
|
__metadata("design:returntype", void 0)
|
|
], CodiSpeiController.prototype, "createClabe", null);
|
|
__decorate([
|
|
(0, common_1.Get)('spei/transactions'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Listar transacciones SPEI recibidas' }),
|
|
(0, swagger_1.ApiQuery)({ name: 'limit', required: false }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__param(1, (0, common_1.Query)('limit')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, Number]),
|
|
__metadata("design:returntype", void 0)
|
|
], CodiSpeiController.prototype, "getSpeiTransactions", null);
|
|
__decorate([
|
|
(0, common_1.Post)('spei/webhook'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Webhook para notificacion SPEI' }),
|
|
__param(0, (0, common_1.Body)()),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Promise)
|
|
], CodiSpeiController.prototype, "speiWebhook", null);
|
|
__decorate([
|
|
(0, common_1.Get)('payments/summary'),
|
|
(0, swagger_1.ApiBearerAuth)(),
|
|
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Resumen de pagos CoDi/SPEI del dia' }),
|
|
(0, swagger_1.ApiQuery)({ name: 'date', required: false }),
|
|
__param(0, (0, common_1.Request)()),
|
|
__param(1, (0, common_1.Query)('date')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, String]),
|
|
__metadata("design:returntype", Promise)
|
|
], CodiSpeiController.prototype, "getSummary", null);
|
|
exports.CodiSpeiController = CodiSpeiController = __decorate([
|
|
(0, swagger_1.ApiTags)('codi-spei'),
|
|
(0, common_1.Controller)('v1'),
|
|
__metadata("design:paramtypes", [codi_spei_service_1.CodiSpeiService])
|
|
], CodiSpeiController);
|
|
//# sourceMappingURL=codi-spei.controller.js.map
|