Compare commits
No commits in common. "develop" and "main" have entirely different histories.
@ -94,6 +94,12 @@ const submitUpload = () => {
|
|||||||
console.log('UUID agregado:', uploadForm.cfdi_uuid);
|
console.log('UUID agregado:', uploadForm.cfdi_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug: mostrar todo lo que hay en FormData
|
||||||
|
console.log('=== FormData a enviar ===');
|
||||||
|
for (let pair of formData.entries()) {
|
||||||
|
console.log(pair[0] + ':', pair[1]);
|
||||||
|
}
|
||||||
|
|
||||||
// Enviar con axios directamente
|
// Enviar con axios directamente
|
||||||
window.axios({
|
window.axios({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@ -158,11 +158,11 @@ const sendInvoiceByWhatsapp = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const ticket = request.sale?.invoice_number || `SOL-${request.id}`;
|
const ticket = request.sale?.invoice_number || `SOL-${request.id}`;
|
||||||
await whatsappService.sendInvoice({
|
await whatsappService.sendDocument({
|
||||||
phone_number: request.client.phone,
|
phone_number: request.client.phone,
|
||||||
invoice_number: ticket,
|
document_url: request.invoice_pdf_url,
|
||||||
pdf_url: request.invoice_pdf_url,
|
filename: `${ticket}.pdf`,
|
||||||
xml_url: request.invoice_xml_url ?? null,
|
ticket,
|
||||||
customer_name: request.client.name
|
customer_name: request.client.name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -6,18 +6,19 @@ import axios from 'axios';
|
|||||||
*/
|
*/
|
||||||
const whatsappService = {
|
const whatsappService = {
|
||||||
/**
|
/**
|
||||||
* Enviar factura completa (PDF y XML)
|
* Enviar documento por WhatsApp
|
||||||
* @param {Object} data - Datos de la factura
|
* @param {Object} data - Datos del documento
|
||||||
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
async sendInvoice({ phone_number, invoice_number, pdf_url, xml_url, customer_name }) {
|
async sendDocument({ phone_number, document_url, filename, ticket, customer_name }) {
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
apiURL('whatsapp/send-invoice'),
|
apiURL('whatsapp/send-document'),
|
||||||
{
|
{
|
||||||
phone_number,
|
phone_number,
|
||||||
invoice_number,
|
document_url,
|
||||||
pdf_url,
|
filename,
|
||||||
xml_url, // Enviamos ambos links
|
ticket,
|
||||||
customer_name
|
customer_name
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -31,10 +32,11 @@ const whatsappService = {
|
|||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorData = error.response?.data?.data || error.response?.data;
|
const errorData = error.response?.data?.data || error.response?.data;
|
||||||
console.error('WhatsApp Invoice Error:', errorData);
|
console.error('WhatsApp Error Detail:', errorData);
|
||||||
throw errorData;
|
throw errorData;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default whatsappService;
|
export default whatsappService;
|
||||||
Loading…
x
Reference in New Issue
Block a user