Thursday, January 21, 2021

Datatrans payment system with JSinterop

Hi,

I am trying to integrate the Datatrans payment system with JSinterop
The js script is https://pay.sandbox.datatrans.com/upp/payment/js/datatrans-2.0.0.js

the js code to be executed should be :

payButton.onclick = function() {
  Datatrans.startPayment({
    transactionId:  "{{transactionId}}",
    'opened': function() {console.log('payment-form opened');},
    'loaded': function() {console.log('payment-form loaded');},
    'closed': function() {console.log('payment-page closed');},
    'error': function() {console.log('error');}
  });
};

I created a Datatrans class :

@JsType(namespace = JsPackage.GLOBAL, isNative = true)
public class Datatrans {
public native static void startPayment(String transactionId);
}

When clicking on the payButton, the startPayment function from the js code is executed but no dialog from datastrans is shown.
I guess imy definition of my startPayment method doesnot include the functions callbacks for opened/loaded etc
How can I define these functions and change my  startPayment definition ?

Thanks in advance for any help
Pierre

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/e822ef6b-cc25-426d-837a-a01f42431979n%40googlegroups.com.

No comments:

Post a Comment