sysone-api-mapper 1.0.85 → 1.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -589,57 +589,23 @@ const quotationModule = {
|
|
|
589
589
|
method: methods.GET,
|
|
590
590
|
requestMapper: (request) => ({
|
|
591
591
|
mappedParams: request,
|
|
592
|
-
responseType: "arraybuffer",
|
|
592
|
+
responseType: "arraybuffer",
|
|
593
593
|
headers: {
|
|
594
594
|
'Accept': 'application/pdf',
|
|
595
595
|
}
|
|
596
596
|
}),
|
|
597
|
-
responseMapper: (response) =>
|
|
598
|
-
console.log("🔧 ResponseMapper DEFAULT ejecutado");
|
|
599
|
-
console.log("📦 Response recibido:", response);
|
|
600
|
-
console.log("📊 Tipo:", typeof response);
|
|
601
|
-
console.log("🔍 Tiene .data?", !!response?.data);
|
|
602
|
-
console.log("🔍 Tipo de .data:", typeof response?.data);
|
|
603
|
-
|
|
604
|
-
// Si response.data es string, convertir a ArrayBuffer
|
|
605
|
-
if (typeof response?.data === 'string') {
|
|
606
|
-
console.log("⚠️ Convirtiendo string a ArrayBuffer");
|
|
607
|
-
const binaryString = response.data;
|
|
608
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
609
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
610
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
611
|
-
}
|
|
612
|
-
return bytes.buffer;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// Para default: devolver ArrayBuffer directo (PDF binario)
|
|
616
|
-
if (response?.data instanceof ArrayBuffer) {
|
|
617
|
-
console.log("✅ Retornando response.data (ArrayBuffer)");
|
|
618
|
-
return response.data;
|
|
619
|
-
}
|
|
620
|
-
if (response instanceof ArrayBuffer) {
|
|
621
|
-
console.log("✅ Retornando response directo (ArrayBuffer)");
|
|
622
|
-
return response;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
console.log("⚠️ Retornando response sin modificar");
|
|
626
|
-
return response;
|
|
627
|
-
}
|
|
597
|
+
responseMapper: (response) => response
|
|
628
598
|
},
|
|
629
599
|
cnp: {
|
|
630
600
|
url: '/quotation/v1/quotations/{0}/report',
|
|
631
601
|
method: methods.GET,
|
|
632
602
|
requestMapper: (request) => ({
|
|
633
603
|
mappedParams: request,
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
responseMapper: (response) => {
|
|
637
|
-
// Para CNP: devolver objeto JSON { content: "base64...", fileName: "..." }
|
|
638
|
-
if (response?.data) {
|
|
639
|
-
return response.data;
|
|
604
|
+
headers: {
|
|
605
|
+
'Accept': 'application/json',
|
|
640
606
|
}
|
|
641
|
-
|
|
642
|
-
|
|
607
|
+
}),
|
|
608
|
+
responseMapper: (response) => response
|
|
643
609
|
}
|
|
644
610
|
},
|
|
645
611
|
|