jumaallan / android-mpesa-api

Android MPESA SDK Library to provide smooth MPESA Experience in Android - Dubbed Daraja
https://androidstudy.com
MIT License
197 stars 186 forks source link

Unknown error during handshake #22

Closed malcolmmaima closed 5 years ago

malcolmmaima commented 5 years ago

I setup all the credentials as per the details provided on my daraja API account. I keep on getting the above named error in the console log. I am farely new to Daraja API so any assistance would be highly appreciated. Did I miss something? nothing happens when after I input the phone number and press 'Request MpesaExpress'

`//TODO :: REPLACE WITH YOUR OWN CREDENTIALS :: THIS IS SANDBOX DEMO daraja = Daraja.with("[I set my own from daraja api]", "[same here", new DarajaListener() { @Override public void onResult(@NonNull AccessToken accessToken) { Log.i(MPESAExpressActivity.this.getClass().getSimpleName(), accessToken.getAccess_token()); Toast.makeText(MPESAExpressActivity.this, "TOKEN : " + accessToken.getAccess_token(), Toast.LENGTH_SHORT).show(); }

        @Override
        public void onError(String error) {
            Log.e(MPESAExpressActivity.this.getClass().getSimpleName(), error);
        }
    });`

Set as well:

//TODO :: REPLACE WITH YOUR OWN CREDENTIALS :: THIS IS SANDBOX DEMO LNMExpress lnmExpress = new LNMExpress( "600616", "[set]", //https://developer.safaricom.co.ke/test_credentials TransactionType.CustomerBuyGoodsOnline, // TransactionType.CustomerPayBillOnline <- Apply any of these two "10", "254708374149", "174379", phoneNumber, "http://mycallbackurl.com/checkout.php", "001ABC", "Goods Payment" );

jumaallan commented 5 years ago

Hi @malcolmmaima

Are you testing it on Sandbox or Production?

malcolmmaima commented 5 years ago

Sandbox

jumaallan commented 5 years ago

Safaricom have massive issues with their sandbox servers, which is also happening frequently on production. Test using these credentials

screenshot 2019-02-14 at 14 07 55
gilokimu commented 5 years ago

I am now getting this error on any network request : javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

This is coming from okhttp

I wonder if its the same problem?

jumaallan commented 5 years ago

It's actually the same issue. Am no expert but this is what I have come across

Screenshot 2019-03-26 at 11 51 48

This is the cert from Safaricom

Screenshot 2019-03-26 at 11 51 15

I guess its an issue with the Sandbox SSL cert setup on Safaricom side.

Reference here : https://stackoverflow.com/questions/6825226/trust-anchor-not-found-for-android-ssl-connection

gilokimu commented 5 years ago

Yeah, it just stopped working all of a sudden, and I knew I hadn't touched any of the network classes. I am on break for the rest of the week, so I can take a look at it tomorrow.

EDIT Could we just raise this issue with Safaricom?

gilokimu commented 5 years ago

See this PR #27

jumaallan commented 5 years ago

Yeah, it just stopped working all of a sudden, and I knew I hadn't touched any of the network classes. I am on break for the rest of the week, so I can take a look at it tomorrow.

EDIT Could we just raise this issue with Safaricom?

I can talk to someone about this, and advice. Meanwhile, let me review and merge the PR #27

jumaallan commented 5 years ago

This has been sorted by PR #27

It's already merged into master. The next release should fix this issue. Good work @gilokimu. We might need to do a small patch to fix issues currently being experienced as we continue working on other issues.

To test current state on master and do a release