fix(financeiro): forca download de recibo pdf local ao inves da url do asaas
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 2m6s Details

This commit is contained in:
Sidney 2026-06-07 15:38:14 -03:00
parent e79b472279
commit 14d3d7c17f
2 changed files with 26 additions and 0 deletions

View File

@ -62,6 +62,19 @@ const Finance: React.FC<FinanceProps> = ({ data, updateData }) => {
const handleOpenPaymentLink = async (id: string, type: 'boleto' | 'recibo' | 'carne') => {
try {
if (type === 'recibo') {
const fullPayment = currentPayments.find(p => p.asaasPaymentId === id || p.id === id);
if (fullPayment) {
const student = data.students.find(s => s.id === fullPayment.studentId);
if (student) {
await pdfService.generatePaymentReceiptPDF(fullPayment, student, data);
return;
}
}
showAlert('Erro', 'Não foi possível encontrar os dados da parcela para gerar o recibo.', 'error');
return;
}
showAlert('Aguarde', `Buscando ${type}...`, 'info');
if (type === 'carne') {

View File

@ -542,6 +542,19 @@ const Students: React.FC<StudentsProps> = ({ data, updateData, deepLinkStudentId
const handleOpenPaymentLink = async (asaasPaymentId: string, type: 'boleto' | 'recibo') => {
try {
if (type === 'recibo') {
const fullPayment = data.payments.find(p => p.asaasPaymentId === asaasPaymentId || p.id === asaasPaymentId);
if (fullPayment) {
const student = data.students.find(s => s.id === fullPayment.studentId);
if (student) {
await pdfService.generatePaymentReceiptPDF(fullPayment, student, data);
return;
}
}
showAlert('Erro', 'Não foi possível encontrar os dados da parcela para gerar o recibo.', 'error');
return;
}
showAlert('Aguarde', `Buscando ${type}...`, 'info');
const response = await fetch(`/api/cobrancas/${asaasPaymentId}/link`);
const result = await response.json();