ePay / android-sdk

0 stars 1 forks source link

Two times callback in PaymentResultListener for android lollipop os #1

Open rahul-dhanuka opened 8 years ago

rahul-dhanuka commented 8 years ago

I have used ePay in one of my android app, and the issue i am facing is that it is returning two times in PaymentResultListener callback after successful payment. This issue is facing in android lollipop os, for other os it is working fine.

Here is my ePay start method for loading window:-

private void startePay() { String md5Json = md5(getJsonStringHash()); Map<String, String> data = new HashMap<String, String>(); data.put("merchantnumber", /My sandbox text number/); data.put("currency", "NOK");

    data.put("amount", "1");

    // data.put("orderid", "1234567890");
    data.put("windowid", "1");
    data.put("windowstate", "2");
    data.put("paymentcollection", "1");
    data.put("lockpaymentcollection", "0");
    data.put("language", "0");
    data.put("encoding", "UTF-8");
    data.put("instantcapture", "0");
    data.put("instantcallback", "1");
    data.put("ordertext", "Order Text");
    data.put("description", "Order Description");
    data.put("hash", md5Json);
    data.put("subscription", "1");
    data.put("subscriptionname", "test:);

    data.put("mailreceipt", "test@myapp.com");
    data.put("backgroundcolor", "A7A7A7");
    data.put("declinetext", "decline text");
    data.put("mobile", "1");

    EpayWebView paymentView = new EpayWebView(resultListener, webView,
            true, "/*My app secret key*/);
    webView = paymentView.LoadPaymentWindow(data);
    webView.setVisibility(View.VISIBLE);
}

PaymentResultListener resultListener = new PaymentResultListener() { @Override public void PaymentAccepted(final Map<String, String> map) { Log.e("PaymentMethodFragment", "PaymentAccepted"); //Issue // On successful payment accepted it is coming here two times.

                   //Doing something after successful payment accepted
    }

    @Override
    public void PaymentWindowLoaded() {
        Log.e("PaymentMethodFragment", "PaymentWindowLoaded");
    }

    @Override
    public void PaymentWindowCancelled() {
        Log.e("PaymentMethodFragment", "PaymentWindowCancelled");
    }

    @Override
    public void PaymentWindowLoading() {
        Log.e("PaymentMethodFragment", "PaymentWindowLoading");
    }

    @Override
    public void Debug(String arg0) {
        Log.e("PaymentMethodFragment", "Debug");
    }

    @Override
    public void ErrorOccurred(int arg0, String arg1, String arg2) {
        Log.e("PaymentMethodFragment", "ErrorOccurred");
    }

    @Override
    public void PaymentLoadingAcceptPage() {
        Log.e("PaymentMethodFragment", "PaymentLoadingAcceptPage");
    }
};

What wrong i am doing, please help me out.

1 more issue i am facing is my ePay Window is not getting closed after successful payment done, previously it was closing whenever i came PaymentAccepted result callback.

DovydasGirsvaldas commented 8 years ago

Hi, im facing same problem as PaymentAccepted is getting called twice on devices api>19. did you came up with any solution to this?

rahul-dhanuka commented 8 years ago

Hi Vierchas, I didn't get any official solution from ePay, but I managed it from mine side.