globalpayments / rxp-js

Global Payments Ecommerce JavaScript Library
MIT License
34 stars 70 forks source link

Error in embedded/lightbox HPP causes JSON parser error #22

Open slogsdon opened 5 years ago

slogsdon commented 5 years ago

From @globalpayments/php-sdk#2:

@slogsdon thanks, I'll see if I can provide you with a demo page sometime this week, in the meantime I've adapted my code to work with the redirect (still using the lightbox but I'm now handling the response in the redirect, unfortunately the customer, if the payment fails, has to restart the checkout from the beginning which will cause a bad user experience).

I'm now experiencing another problem with the lightbox, if I use one of the test cards provided in your documentation, the lightbox freezes and there is an error in the chrome console of an invalid JSON, in fact I see that with successful payments the response from the iframe is a JSON but with this test card the response is just a string. The error is coming from rxp-js and it is causing the iframe to freeze and nothing to happen on the page, not even the redirect.

I am using the latest version of rxp-js (1.3.1). The test card I used is 4009830000001985

screenshot 2018-12-18 at 10 59 41 screenshot 2018-12-18 at 10 59 51 screenshot 2018-12-18 at 11 00 10

Current implementation code expects the postMessage event data to always be JSON encoded, but in some cases, this data can be a simple string. The receive message handler would need to be updated to handle this here: https://github.com/globalpayments/rxp-js/blob/master/lib/rxp-hpp.js#L295-L299.

TomSteer commented 5 years ago

Hey. Is there any timeline for a fix for this as it currently breaks the lightbox mode workflow if it's a declined transaction. Thanks

patricia-atenea commented 5 years ago

I'm also experiencing this same error with some declined cards, Master Cards mostly. Any date for a fix? Thanks

Jas0n-os commented 5 years ago

Any update on this? I'm also experiencing the same issue. Thanks