简体   繁体   中英

Spring controller is getting called twice at test environment

I have been facing an issue with spring controller for a long time. Even after a lot of research over this spring controller redirection issues that didn't give any solution.

Issue: We are doing some payment integrations such as Sofort, AliPay and PayPal using Spring. Everything working fine in local machine(PC desktop) whereas it causes the issue with PayPal at test enviroments(Cloud deployment servers);however, remaining all other payment types are working fine.

There is the PayPal response handler url(Controller) at merchant server where it handles the paypal payment response, the handler url is getting called twice. Therefore, its not giving appriopriate results as it should get called only once.

PayPal Response Handler URL: us/en-us/checkout/payment/paypal/handleResponse?token=EC-XXXXXXXXXXXX&PayerID=XXXXXX

Observations:

a) Whenever we have such kind of issues that is url getting called twice. At network tab of chrome, JS could be the issue. But, we haven't found such kind of history at there.

b) We use load balancer at our test environments. At sometimes, load balancer would make the url to get called twice. But, we didn't find a such kind of calls at loadbalancer.

c) Spring Handler method as below.

@RequestMapping(path = "/handleResponse", method = RequestMethod.GET)
public String handleResponse(@RequestParam(name = "token")
final String token, @RequestParam(name = "PayerID")
final String payerId)

d) There is no issue with PayPal configurations or PayPal servers. If I would hit the browser with the sample url below it is getting called twice, eventhough its not sending from PayPal. Hence, there is no issue with PayPal.

https://ABCDMERCHANT.com/us/en-us/checkout/payment/paypal/handleResponse?token=EC-XXXXXXXXXXX&PayerID=XXXXXXXXXXX

Guys, If could you give any suggestions to trace it down the root cause of it. that will be helpful for me.

Thanks InAdvance!!

We had given fixes to handle the second call however, during further tests even still it was failed and found the root cause and given the fix.

Root Cause: PayPal test environment, takes more than 45 seconds to complete set, get, authorize/capture and place order requests but the Application server time out is 10 seconds there its failed hence it makes second call.

Fix: we have increased the server time out to 50 seconds and its stopped making second request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM