Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Erro na validação. #20

Description

@rodriguesabner

Opa, tudo bem? Eu estava tentando implementar a API, fazendo os testes de criação de Cliente e Pedido, na primeira tentativa eu consegui, mas depois acabou não funcionando. Eu apenas mudei os nomes e dados dos "clientes", mas acabou que deu erro.

[ Erro: Process: intelizze.com.parkedclient, PID: 1884
br.com.moip.exception.ValidationException
at br.com.moip.api.request.RequestMaker.responseBodyTreatment(RequestMaker.java:244)
at br.com.moip.api.request.RequestMaker.doRequest(RequestMaker.java:118)
at br.com.moip.models.Customers.create(Customers.java:37)
at intelizze.com.parkedclient.ParkedActivity.createClient(ParkedActivity.java:154)
at intelizze.com.parkedclient.ParkedActivity$1.onClick(ParkedActivity.java:103)....]

Método:

   public void createClient(){
    String token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //Aqui está o meu token correto
    String key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; //E a key correta também
    Authentication authBasic = new BasicAuth(token, key);

    String oauth = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX_v2"; // oAuth está correto tbm
    Authentication auth = new OAuth(oauth);
    Setup setup = new Setup().setAuthentication(authBasic).setEnvironment(Setup.Environment.SANDBOX); //Usei a autenticação básica mesmo

    Map<String, Object> taxDocument = payloadFactory(
            value("type", "CPF"),
            value("number", "12345678900")
    );

    Map<String, Object> phone = payloadFactory(
            value("countryCode", "55"),
            value("areaCode", "11"),
            value("number", "982743910")
    );

    Map<String, Object> shippingAddress = payloadFactory(
            value("city", "Sao Paulo"),
            value("district", "Caieiras"),
            value("street", "Rua de Algum Lugar"),
            value("streetNumber", "31"),
            value("state", "SP"),
            value("country", "BRA"),
            value("zipCode", "07700-000")
    );

    Map<String, Object> customerRequestBody = payloadFactory(
            value("ownId", "customer_own_id"),
            value("fullname", "João Rodrigues"),
            value("email", "email@gmail.com"),
            value("birthDate", "1999-10-07"),
            value("taxDocument", taxDocument),
            value("phone", phone),
            value("shippingAddress", shippingAddress)
    );

    Map<String, Object> responseCreation = Moip.API.customers().create(customerRequestBody, setup);
    System.out.println(responseCreation);
}

Obrigado desde já :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions