Skip to content

Commit

Permalink
feat: add sender and receiver cpf/cnpj to posting list xml
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrospoljaric-luizalabs committed Jun 7, 2022
1 parent 893490a commit bd814e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions correios/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions correios/models/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit bd814e9

Please sign in to comment.