StuartApp / stuart-client-js

Stuart JavaScript client
MIT License
2 stars 6 forks source link

Problem with validate address #9

Closed Softweb-Adaptive-IT-Solutions closed 4 years ago

Softweb-Adaptive-IT-Solutions commented 5 years ago

I have the following structure in my node js app.

httpClient
    .performGet(
      "/v2/addresses/validate?address=" +
        encodeURIComponent(chef_precise_address) +
        "&type=picking&phone=" +
        chef_address.phone
    )
    .then(apiResponse => {
      console.log("address for chef", apiResponse);
      httpClient
        .performGet(
          "/v2/addresses/validate?address=" +
            encodeURIComponent(user_address) +
            "&type=delivering&phone=" +
            userID.phone
        )
        .then(apiResponse => {
          console.log("address for user", apiResponse);

          console.log("job", JSON.stringify(job));

          httpClient
            .performPost("/v2/jobs", JSON.stringify(job))
            .then(apiResponse => {
              console.log("apiResponse", apiResponse);
              console.log("apiResponse", apiResponse.statusCode);

              if (apiResponse.statusCode == 201) {
                var id = apiResponse.body.id;

              } else {
                console.log(
                  "apiResponse",
                  JSON.stringify(apiResponse.body.data.deliveries)
                );

              }
            })
            .catch(error => {
              console.log("error address for chef", error);
            });
        })
        .catch(error => {
          console.log("error address for user", error);
        });
    })
    .catch(error => {
      console.log("general error", error);
    });

But I have the following issue. When I execute the previous code it works half of the times. The nested call in /v2/addresses/validate does not executed. Ι cannot see any error. I have contact your support and they said the see only one call for me. There are no errors in the catch blocks. I am using the last version.

Lauren-Gill commented 5 years ago

Hello,

We have tested the code above on our side and everything is working as expected. We can see the response logging for both address validations and the job creation, whether these are valid or not. Therefore we should see any of your requests even if the addresses are not valid.

If you have any more details on your side let us know, but for now we cannot see any issue.

JoseHervas commented 4 years ago

As this issue has been inactive for a long time and we couldn't reproduce the issue, I'm closing it. If anybody else experiences the same problem this issue can be reopened.