This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Accounts
Matheus B. Nakaya edited this page Aug 21, 2018
·
20 revisions
TO DO
TO DO
authorization | able |
---|---|
Basic Auth | ❌ |
OAuth | ✅ |
Map<String, Object> hasAccount = Moip.API.accounts().checkExistence("ARGUMENT", setup);
The search argument can be a tax document number (with punctuation) or an e-mail.
response | account |
---|---|
200 | exist |
400 | invalid |
404 | does not exist |
authorization | able |
---|---|
Basic Auth | ❌ |
OAuth | ✅ |
Map<String, Object> email = new HashMap<>();
email.put("address", "[email protected]");
Map<String, Object> taxDocument = new HashMap<>();
taxDocument.put("type", "CPF");
taxDocument.put("number", "123.456.789-00");
Map<String, Object> identityDocument = new HashMap<>();
identityDocument.put("type", "RG");
identityDocument.put("number", "434322344");
identityDocument.put("issuer", "SSP");
identityDocument.put("issueDate", "2010-01-01");
Map<String, Object> phone = new HashMap<>();
phone.put("countryCode", "55");
phone.put("areaCode", "11");
phone.put("number", "43215678");
Map<String, Object> address = new HashMap<>();
address.put("street", "Av. Brigadeiro Faria Lima");
address.put("streetNumber", "2927");
address.put("district", "Itaim Bibi");
address.put("city", "São Paulo");
address.put("state", "SP"); // UF
address.put("country", "BRA");
address.put("zipCode", "01234-000");
Map<String, Object> person = new HashMap<>();
person.put("name", "Name");
person.put("lastName", "Last Name");
person.put("taxDocument", taxDocument);
person.put("identityDocument", identityDocument);
person.put("birthDate", "2000-01-01");
person.put("phone", phone);
person.put("address", address);
Map<String, Object> body = new HashMap<>();
body.put("email", email);
body.put("person", person);
body.put("type", "MERCHANT");
Map<String, Object> hasAccount = Moip.API.accounts().create(body, setup);
To create a company account you have to create the same structure of the previous example and add the fallow object in the request body.
Map<String, Object> taxDocument = new HashMap<>();
taxDocument.put("type", "CNPJ");
taxDocument.put("number", "25.789.340/0001-74");
Map<String, Object> mainActivity = new HashMap<>();
mainActivity.put("cnae", "82.91-1/00");
mainActivity.put("description", "Description of main activity");
Map<String, Object> phone = new HashMap<>();
phone.put("countryCode", "55");
phone.put("areaCode", "11");
phone.put("number", "56784321");
Map<String, Object> address = new HashMap<>();
address.put("street", "Av. Company");
address.put("streetNumber", "123");
address.put("complement", "Address complement");
address.put("district", "The District");
address.put("city", "New City");
address.put("state", "SP");
address.put("country", "BRA");
address.put("zipCode", "43210-01");
Map<String, Object> company = new HashMap<>();
company.put("name", "Name INC.");
company.put("businessName", "Business Name");
company.put("openingDate", "2018-08-21");
company.put("taxDocument", taxDocument);
company.put("mainActivity", mainActivity);
company.put("phone", phone);
company.put("address", address);