n8n-nodes-efibank
Version:
Nó personalizado para integração com as APIs Cobranças e Pix do Efibank, permitindo operações de pagamentos, recebimentos e gerenciamento de transações financeiras.
81 lines • 5.08 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.boletoService = void 0;
const criarBoletoOneStep_1 = require("../endpoints/Boleto/criarBoletoOneStep");
const criarTransacaoBoleto_1 = require("../endpoints/Boleto/criarTransacaoBoleto");
const associarFormaPagamentoBoleto_1 = require("../endpoints/Boleto/associarFormaPagamentoBoleto");
const retornarCobrancaBoleto_1 = require("../endpoints/Boleto/retornarCobrancaBoleto");
const retornarListaBoleto_1 = require("../endpoints/Boleto/retornarListaBoleto");
const incluirMetadataBoleto_1 = require("../endpoints/Boleto/incluirMetadataBoleto");
const alterarVencimento_1 = require("../endpoints/Boleto/alterarVencimento");
const cancelarTransacaoBoleto_1 = require("../endpoints/Boleto/cancelarTransacaoBoleto");
const reenviarEmailBoleto_1 = require("../endpoints/Boleto/reenviarEmailBoleto");
const acrescentarHistoricoBoleto_1 = require("../endpoints/Boleto/acrescentarHistoricoBoleto");
const definirBalancete_1 = require("../endpoints/Boleto/definirBalancete");
const marcarComoPago_1 = require("../endpoints/Boleto/marcarComoPago");
async function boletoService(endpoint, i, baseURL, access_token) {
var _a, _b;
let requestOptions;
switch (endpoint) {
case 'criarBoletoOneStep':
requestOptions = await (0, criarBoletoOneStep_1.criarBoletoOneStep)(this, i, baseURL, access_token);
break;
case 'criarTransacaoBoleto':
requestOptions = await (0, criarTransacaoBoleto_1.criarTransacaoBoleto)(this, i, baseURL, access_token);
break;
case 'associarFormaPagamentoBoleto':
const boletoIdAssociar = this.getNodeParameter('charge_id', i);
requestOptions = await (0, associarFormaPagamentoBoleto_1.associarFormaPagamentoBoleto)(this, i, baseURL, access_token, boletoIdAssociar);
break;
case 'retornarCobrancaBoleto':
const boletoIdRetornar = this.getNodeParameter('charge_id', i);
if (!boletoIdRetornar || typeof boletoIdRetornar !== 'string') {
throw new Error('Charge ID é obrigatório e deve ser uma string para retornar o carnê');
}
requestOptions = await (0, retornarCobrancaBoleto_1.retornarCobrancaBoleto)(baseURL, access_token, boletoIdRetornar);
break;
case 'retornarListaBoleto':
const begin_date = (_a = this.getNodeParameter('begin_date', i)) !== null && _a !== void 0 ? _a : '';
const end_date = (_b = this.getNodeParameter('end_date', i)) !== null && _b !== void 0 ? _b : '';
if (!begin_date || !end_date) {
throw new Error('As datas de início e fim são obrigatórias');
}
requestOptions = await (0, retornarListaBoleto_1.retornarListaBoleto)(baseURL, access_token, begin_date, end_date);
break;
case 'incluirMetadataBoleto':
const boletoIdMetadata = this.getNodeParameter('charge_id', i);
requestOptions = await (0, incluirMetadataBoleto_1.incluirMetadataBoleto)(this, i, baseURL, access_token, boletoIdMetadata);
break;
case 'alterarVencimento':
const boletoIdVencimento = this.getNodeParameter('charge_id', i);
const expire_at = this.getNodeParameter('expire_at', i);
requestOptions = await (0, alterarVencimento_1.alterarVencimento)(baseURL, access_token, boletoIdVencimento, expire_at);
break;
case 'cancelarTransacaoBoleto':
const boletoIdCancelar = this.getNodeParameter('charge_id', i);
requestOptions = await (0, cancelarTransacaoBoleto_1.cancelarTransacaoBoleto)(baseURL, access_token, boletoIdCancelar);
break;
case 'reenviarEmailBoleto':
const boletoIdReenvio = this.getNodeParameter('charge_id', i);
const emailReenvio = this.getNodeParameter('email', i);
requestOptions = await (0, reenviarEmailBoleto_1.reenviarEmailBoleto)(baseURL, access_token, boletoIdReenvio, emailReenvio);
break;
case 'acrescentarHistoricoBoleto':
const boletoIdHistorico = this.getNodeParameter('charge_id', i);
requestOptions = await (0, acrescentarHistoricoBoleto_1.acrescentarHistoricoBoleto)(this, i, baseURL, access_token, boletoIdHistorico);
break;
case 'definirBalancete':
const chargeIdBalancete = this.getNodeParameter('charge_id', i);
requestOptions = await (0, definirBalancete_1.definirBalancete)(this, i, baseURL, access_token, chargeIdBalancete);
break;
case 'marcarComoPago':
const boletoIdPagar = this.getNodeParameter('charge_id', i);
requestOptions = await (0, marcarComoPago_1.marcarComoPago)(baseURL, access_token, boletoIdPagar);
break;
default:
throw new Error(`Endpoint de Boleto não implementado`);
}
return requestOptions;
}
exports.boletoService = boletoService;
//# sourceMappingURL=boletoService.js.map