fix: revert to contato.obter.php to fetch seller phone
All checks were successful
Build and Deploy / build-and-push (push) Successful in 46s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 46s
This commit is contained in:
@@ -65,13 +65,13 @@ export const handleTinyOrderUpdate = async (req: Request, res: Response): Promis
|
|||||||
vendorParams.append('id', idVendedor);
|
vendorParams.append('id', idVendedor);
|
||||||
vendorParams.append('formato', 'JSON');
|
vendorParams.append('formato', 'JSON');
|
||||||
|
|
||||||
const vendorResponse = await axios.post('https://api.tiny.com.br/api2/vendedor.obter.php', vendorParams, {
|
const vendorResponse = await axios.post('https://api.tiny.com.br/api2/contato.obter.php', vendorParams, {
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (vendorResponse.data?.retorno?.status === 'OK') {
|
if (vendorResponse.data?.retorno?.status === 'OK') {
|
||||||
const vendedor = vendorResponse.data.retorno.vendedor;
|
const contato = vendorResponse.data.retorno.contato;
|
||||||
whatsappVendedor = vendedor?.celular || vendedor?.fone || vendedor?.telefone || "";
|
whatsappVendedor = contato?.celular || contato?.fone || contato?.telefone || "";
|
||||||
console.log(`Successfully fetched seller WhatsApp: ${whatsappVendedor || 'None'}`);
|
console.log(`Successfully fetched seller WhatsApp: ${whatsappVendedor || 'None'}`);
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed to fetch seller details:', JSON.stringify(vendorResponse.data?.retorno?.erros || 'Unknown API error'));
|
console.error('Failed to fetch seller details:', JSON.stringify(vendorResponse.data?.retorno?.erros || 'Unknown API error'));
|
||||||
|
|||||||
Reference in New Issue
Block a user