Need javascript equivalent code for java code


#1

Can some one provide javascript equivalent code of following java code, especially @Override callback

    service.startPaymentTransaction(this, true, true,
            new PaytmPaymentTransactionCallback() {
                @Override
                public void someUIErrorOccurred(String inErrorMessage) {
                    Log.e("LOG", "Error message: " + inErrorMessage);
                    Toast.makeText(getApplicationContext(), "Error message: " + inErrorMessage, Toast.LENGTH_LONG).show();
                }

                @Override
                public void onTransactionSuccess(Bundle inResponse) {
                    Log.d("LOG", "Payment Transaction is successful " + inResponse);
                    Toast.makeText(getApplicationContext(), "Payment Transaction is successful ", Toast.LENGTH_LONG).show();
                }
	 });

#2

@bradwaynemartin ping ping please?


#3

https://github.com/bradmartin/nativescript-audio/blob/master/src/android/player.ts#L52 event listener callbacks here might help with your translation of the code.


#4

Thanks. i set breakpoints on callback functions. but debugger not taking inside apk code.


#5

Can you paste what you have now?


#6

service.startPaymentTransaction(
utils.ad.getApplicationContext(), false, true,
new com.paytm.pgsdk.PaytmPaymentTransactionCallback({
onTransactionSuccess: (paramBundle) => {

            },

            onTransactionFailure: (paramString, paramBundle) =>{
            
            }

})
);

i am trying to debug com.paytm.pgsdk.PaytmPaymentTransactionCallback constructor and also set break points in call back functions. But debugger not taking to new com.paytm.pgsdk.PaytmPaymentTransactionCallback and not hitting breakpoints of call back methods.


#7

Unless you have SOME code in your callback functions you won’t be breaking there. Place some console.logs instead to make sure they are being called, or place debugger; statements to ensure breaking when debugging.