Skip to content

Commit 6489005

Browse files
vitorrggclaude
andcommitted
fix(tiny-erp): add cpf_cnpj and tipo_pessoa to endereco_entrega
The delivery address (endereco_entrega) was missing cpf_cnpj and tipo_pessoa fields required by the Tiny ERP API v2 for NF issuance. These fields were only being sent in the cliente (billing) object, causing NF generation errors when Tiny stopped inferring the document number from the customer record for the delivery address. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6047e8d commit 6489005

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/apps/tiny-erp/src/integration/parsers/order-to-tiny.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ export default async (order: Orders, appData) => {
8383
if (shippingAddress.name) {
8484
tinyOrder.endereco_entrega.nome_destinatario = shippingAddress.name.substring(0, 60);
8585
}
86+
if (buyer && buyer.doc_number && buyer.doc_number.length <= 18) {
87+
tinyOrder.endereco_entrega.cpf_cnpj = buyer.doc_number;
88+
tinyOrder.endereco_entrega.tipo_pessoa = buyer.registry_type === 'j' ? 'J' : 'F';
89+
}
8690
}
8791

8892
if (order.items) {

0 commit comments

Comments
 (0)