Screen - Waiting for a response

Screen - Waiting for a response

  

Anyone got any good ideas for the following challenge?

In our application we have a screen that lets the customer do a payment. This payment is handled by a external party in a popup. Once the user completed the payment, the 3rd party communicates that the payment is either successful or failed. This is done by a webservice. OutSystems can call this webservice and get the status of the payment back.

Now the original build process is that the screen is constantly polling this webservice every 5 seconds, and once there is a success status the next screen is loaded.

This however gives problems, as after a few minutes we run the risk of the connection between server and client (outsystems and screen in the browser) gets disconnected and/or timeout. Resulting in the screen going into error.

Now I'm aware that websockets might be a better option here, however for now this solution is rejected.

What is the next best option to handle this in the screen?

How to continuously poll the webservice to let the screen go to the next step based on the result?

Hi Paul,

How are you doing the web service pooling? In a looping Server side?

This will cause you a timeout, eventually.

An option would be doing the pooling through JavaScript client side.

Basically you would use JavaScript to hit a hidden button/link every 5 seconds that would ajax submit to an action that would perform the webservice check, executing the navigation in case positive.

I'm not seeing any other way, as to prevent timeout, the browser needs to make a request to the server.

A possibility, to improve security, would be the JavaScript in the screen just call an empty screen action with ajax submit, to keep the request resetting the time out, while the other action keeps pooling the webservice (but don't know how the platform will react in this case).

Cheers

Eduardo Jauch

> How are you doing the web service pooling? In a looping Server side?

It's indeed looping on the server side. Which is done in an action that included a 5 second wait.

Thanks for your thoughts.

Hi Paul,


I am wondering why you need to poll anyways?

"normal" flow of these kind of things:

0. user starts the payment

1. (popup) starts

2. outsystems in, for example in preparation, redirects to the payment-page.

3. user pays..

4. payment-provider redirects the user to a outsystems page.

5. user sees the outsystemspage in the popup

6. user closes the popup


so no polling needed?


Hi J.
You indeed understand the flow as it would normally be.

So on top of that we have:

7. underlying screen moves to next screen once payment is accepted.

So the question is, how can this screen know it can continue?

Paul,

1. The popup where the payment is done is an OutSystems popup? Or is a native browser popup?

2. The popup is closed only after the payment is already processed or the payment can be still in process after the popup is closed?

Paul Kruyt wrote:

Hi J.
You indeed understand the flow as it would normally be.

So on top of that we have:

7. underlying screen moves to next screen once payment is accepted.

So the question is, how can this screen know it can continue?

Hi Paul,

wouldn't that be step 4.? the payment system only redirects back to OutSystems (next screen) when the payment is concluded/accepted, no need for polling?...