question

pavan avatar image
pavan asked dnalor commented

TaxRate creation using rest api working on Clover mobile and mini but not on Clover station

here is the code i am using to create TaxRate the exception we are getting is **

Received non ok status from server HTTP/1.1 401 Unauthorized

**

CloverAuth.AuthResult authResult = CloverAuth.authenticate(selectFunction.this,account);

                if (authResult.authToken != null && authResult.baseUrl != null) {

                    CustomHttpClient httpClient = CustomHttpClient.getHttpClient();


                    String req=  "{ \"isDefault\": false,\"rate\": \"0\", \"name\": \"NoGiftTax\", \"id\": \"\", \"items\": [ { \"id\": \"\"}]}\"";

                    String urlNew=authResult.baseUrl+"/v3/merchants/"+authResult.merchantId+"/tax_rates";
                    String str= httpClient.post(urlNew,req,authResult.authToken);
                    srResponse=authResult.merchantId+"\n"+str;
                    if(str!=null && str.trim().length()>0)
                    {
                        JSONObject jsob=new JSONObject(str);
                        if(jsob!=null && jsob.has("id")) {
                            taxid = jsob.getString("id");
                        }

                    }

                }

// post method for web call

public String post(String url, String body,String apiToken) throws IOException, HttpException {
            String result;
            HttpPost request = new HttpPost(url);
            HttpEntity bodyEntity = new StringEntity(body);
            request.setEntity(bodyEntity);
            request.addHeader("Authorization","Bearer "+apiToken);
            request.setHeader("content-type", "application/json");

            HttpResponse response = execute(request);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == HttpStatus.SC_OK) {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    result = EntityUtils.toString(entity);
                } else {
                    throw new HttpException("Received empty body from HTTP response");
                }
            } else {
                throw new HttpException("Received non-OK status from server: " + response.getStatusLine());
            }
            return result;
        }
8 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dnalor avatar image dnalor commented ·

Hi Pavan!

We also have the same problem when trying to post a payment on an open order. It is quite interesting because it works for us on the station and sandbox, but not on production mini.

I could get an error log out of it, for us it was this:

avax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6c4171c0: Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23GETSERVERHELLO:sslv3 alert handshake failure (external/openssl/ssl/s23clnt.c:744 0x684e2ce0:0x00000000)

Would be nice to get a solution for it.

0 Likes 0 ·
maninder avatar image maninder commented ·

hello Clover Team, My client is facing the same issue.

0 Likes 0 ·
maninder avatar image maninder commented ·

Hi @Dnalor. Is it happening randomly on any device or just the mini in your case ?

0 Likes 0 ·
dnalor avatar image dnalor commented ·

@maninder For me it's just the production Mini. It's working alright on prod Station and Sandbox Mini, so it's kind of strange.

0 Likes 0 ·
maninder avatar image maninder commented ·

@miguel, any idea about this issue ?

0 Likes 0 ·
Show more comments

1 Answer

dnalor avatar image
dnalor answered

Hi Pavan!

We also have the same problem when trying to post a payment on an open order. It is quite interesting because it works for us on the station and sandbox, but not on production mini.

I could get an error log out of it, for us it was this:

avax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x6c4171c0: Failure in SSL library, usually a protocol error error:14077410:SSL routines:SSL23GETSERVERHELLO:sslv3 alert handshake failure (external/openssl/ssl/s23clnt.c:744 0x684e2ce0:0x00000000)

Would be nice to get a solution for it.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community