Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

We need to collect address details in local format. It helps us ensure correct addresses are recorded.

...


============================================================================================================

Submitting to CRM

One example: 
Av. Pedroso de Morais, 457
Sala 410
São Paulo, SP
05419-000
-

...

============================================================================================================

...

Using Find CEP API

...

Even better, is to have a simple integration with an API that simply finds the address through the zip code. That is how our major websites work in Brazil.
The first step is to collect the zip code (CEP):
Image Removed
After inputting the information, call the CEP API (details at the end of the email), and auto-fill the address found, making sure that the customer fills the house number (has to be mandatory), and complement as optional.
Image Removed
In case that there is no address found, we can use the Google API to help the customer with the address, but as an exception. The CEP API should be very reliable.

...

Simple GET call and you will have a Json as response.


Please use the example below as reference on how exactly it should be. You may use the postal code 13087-430, which will return valid data, and 13087-400 will be invalid.
In the file that I am sending you, you may see some changes in the following functions (Please make sure to use the ones that I updated): 
  • getAddressFormBR: function(data){...} 
  • submitAddressFormBR: function(){...}
And a new function called: $("#cep").blur(function(){...}
Once someone types their CEP (ZipCode), you will call the following API:
postmon.brPostal Code Number
postalCode}.json 
Example: https://api.
postmon.br13087-430
Please use the postal code without any special characters, only numbers.
In case that there is no match for the postal code, it will return a 404 (Not Found), and you may give an alert to the customer: "CEP não encontrado!", but we should still allow the customer to confirm that this CEP is valid and input the address manually. Sometimes the database might not have the postal code for new neighborhoods.
When there is a match for the postal code, the return will be as following:
{
    "logradouro": "Rua das Orquídeas",
    "status": "completo",
    "bairro": "Chácara Primavera",
    "codigo_ibge": "3509502",
    "nome": "",
    "tipo": "cep_logradouro",
    "complemento": "",
    "cep": "13087430",
    "uf": "SP",
    "cidade": "Campinas"
}
You should use the response as follows:
address1 =  logradouro
address2 =  bairro
state = uf
city = cidade
If there is a response from the API, the fields Rua/Avenida, Bairro, Cidade, Estado, Pais should be as read-only
Image Added
For the fields "Numero" and "Complemtento", you should do as following:
  • Numero -> That is the house number. This field should be mandatory, and we expect the customer to input that data. You will concatenate this field in the "address1" with a comma. example: Rua das Orquideas, 587
  • Complemtento -> Not mandatory. Only when someone leaves in apartments or any kind of complex with unit number.  You will concatenate this field in the "address2" with a dash.example: Chacara Primavera - unidade 22