Thanks Thomas,

I tried it but the compiler is complaining :
            [ERROR] Line 27: Native JsType method 'void 
DatatransOption.opened()' should be native or abstract.
As I would like to implement them myself, is there a workaround ?  

Pierre
Le jeudi 21 janvier 2021 à 18:51:57 UTC+1, [email protected] a écrit :

> You could probably also use a non-native type:
>
> public class DatatransOption {
>   @JsProperty
>   public String transactionId;
>   
>   @JsMethod
>   public void opened() {
>     Window.alert("payment form opened");
>   }
> }
>
> On Thursday, January 21, 2021 at 1:07:34 PM UTC+1 [email protected] 
> wrote:
>
>> I was able to make it work using a DatatransOption class for the config :
>> @JsType(namespace = JsPackage.GLOBAL, name = "Object", isNative = true)
>> public class DatatransOption {
>>
>>  @JsProperty
>> public String transactionId;
>> @JsProperty
>> public Func opened;
>> ...
>> @JsOverlay
>> public static DatatransOption create(String transactionId)
>> {
>> DatatransOption option = new DatatransOption();
>> option.transactionId = transactionId;
>> option.opened = new Func() {
>> @Override
>> public void call() {
>> Window.alert("payment-form opened ");
>> }
>> };
>> ...
>> return option;
>> }
>>
>>
>>
>>
>> The Func interface is from Gwt-Material
>> Le jeudi 21 janvier 2021 à 09:19:48 UTC+1, [email protected] a écrit :
>>
>>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/2ab3f84a-681a-45f0-9956-9779b82ac022n%40googlegroups.com.

Reply via email to