Customized Address Form for Brazil (BR)

For any of the following errors we have been advised to use this error message:
Os dados do seu cartão estão incorretos. Por favor verifique as informações e tente novamente 
- Incorrect customer data;
- Invalid card number;
- Invalid card type;
- Security code mismatch.
We need to add validation for CPF and Phone number fields as well. Refer to below tickets.
CPF validation:  DFSB-1193 - Getting issue details... STATUS
Phone validation:  DFSB-1270 - Getting issue details... STATUS

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

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


  • Correct Address Format:


Avenue or Street

Av. Paulista

R. Augusta

Number:house number

building number, floor and apartment

1024

1098, 1º andar, apto. 101

NeighbourhoodBela Vista
CitySão Paulo
State Code (States in Brazil have abbreviation codes)SP
CountryBrasil
Postal Code01310-000
NameLívia Amaral
Street/ Avenue Name + NumberAv. Paulista, 1098, 1º andar, apto. 101
NeighbourhoodBela Vista
City + State CodeSão Paulo - SP
CountryBrasil
Postal Code01310-000
  • Fields - translation:


EnglishFull NameStreet/ AvenueNumberUnitCityStateNeighbourhoodPostal CodeE-mail AddressPhone Number
Portuguese TitleNome CompletoRua/AvenidaNúmeroComplementoCidadeEstadoBairroCEPE-mailNúmero de telefone
  • Field form example:  Numero is separated from Rua
  • Put CEP first (for type ahead autofill purpose)



You can use this as a zip code lookup:

https://developers.ebanx.com/api-reference/full-api-documentation/ebanx-payment-2/payment-reference/reference-zipcode-operation/


  • Notes:
  • This field form is only an example. Do not copy that.


  • Use field translations from the table
  • Use CEP for postcode
  • CEP - 8 digits, use format ‘nnnnn-nnn’

Required fields: Full Name, Street/ Avenue, Number, Unit (optional),Neighbourhood (optional), City, State, Postal Code, E-mail Address, Phone Number (optional)

  • On mobile version - show numpad for postcode and phone number. Example:



Development ticket:  DFSB-198 - Getting issue details... STATUS


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

Submitting to CRM

One example: 
Av. Pedroso de Morais, 457
Sala 410
São Paulo, SP
05419-000
-
[Street Name], [House Number] - Address1
[Complement ] - Address2
[City], [State]
[Postal Code]
-
To submit that to CRM, please use the following format:
Address1 -> Street name, number
Address2 -> complement
============================================================================================================

Using Find CEP API

Development ticket:  DFSB-956 - Getting issue details... STATUS


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:
GET https://api.findcep.com/v1/cep/{postalCode}.json 
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
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

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

Submitting CPF field

We need to send the CPF value in the place order call for Brazil. Currently it's not sending it, so we are getting a decline from EBANX.

Current JSON:
"customer":

{ "email":"andre.thivierge@emanagecrm.com", "phoneNumber":"60455555555", "firstName":"Andre", "lastName":"Thivierge" }

,

Please add the following values in Customer:
"customerIdentificationValue":"698.868.809-96", //CPF value taken from CPF field
"customerIdentificationTypeId":1 //always 1


Updated JSON sample:

"customer":

{ "email":"andre.thivierge34324@emanagecrm.com", "phoneNumber":"6045555555", "firstName":"Andre", "lastName":"Thivierge", "customerIdentificationValue":"957.734.334-19", "customerIdentificationTypeId":1 }