From bd814e91f2e91c46e2e940cbffafa4118689edb0 Mon Sep 17 00:00:00 2001 From: Pedro Spoljaric Gomes Date: Tue, 7 Jun 2022 14:53:18 -0300 Subject: [PATCH] feat: add sender and receiver cpf/cnpj to posting list xml --- correios/client.py | 2 ++ correios/models/address.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/correios/client.py b/correios/client.py index ed4ffb2..ae96d17 100644 --- a/correios/client.py +++ b/correios/client.py @@ -432,6 +432,7 @@ def _get_sender_info_element(self, posting_list): xml_utils.SubElement(sender_info, "telefone_remetente", cdata=sender.phone.short) xml_utils.SubElement(sender_info, "fax_remetente", cdata="") xml_utils.SubElement(sender_info, "email_remetente", cdata=str(sender.email)) + xml_utils.SubElement(sender_info, "cpf_cnpj_remetente", cdata=str(sender.cpf_cnpj)) return sender_info def _get_shipping_label_element(self, shipping_label: ShippingLabel): @@ -453,6 +454,7 @@ def _get_shipping_label_element(self, shipping_label: ShippingLabel): xml_utils.SubElement(address, "logradouro_destinatario", cdata=str(receiver.street)) xml_utils.SubElement(address, "complemento_destinatario", cdata=str(receiver.complement)) xml_utils.SubElement(address, "numero_end_destinatario", text=str(receiver.number) or 'S/n') + xml_utils.SubElement(address, "cpf_cnpj_destinatario", cdata=str(receiver.cpf_cnpj)) national = xml_utils.SubElement(item, "nacional") xml_utils.SubElement(national, "bairro_destinatario", cdata=str(receiver.neighborhood)) diff --git a/correios/models/address.py b/correios/models/address.py index e60987c..baa5054 100644 --- a/correios/models/address.py +++ b/correios/models/address.py @@ -245,6 +245,7 @@ def __init__(self, email: str = "", latitude: Union[Decimal, str] = "0.0", longitude: Union[Decimal, str] = "0.0", + cpf_cnpj: str = "", ) -> None: self.name = name self.street = street @@ -253,6 +254,7 @@ def __init__(self, self.neighborhood = neighborhood self.email = email self.raw_number = str(number) + self.cpf_cnpj = cpf_cnpj if not isinstance(state, State): state = State(state)