Closed liamgold closed 5 years ago
@liamgold you should post your code. I'm using below example code (with different endpoints/url's ) and it's posting ok.
const versionCheckData = await checkVersion('/3ds2/check3dsVersion', {
methodNotificationUrl: 'http://example.com/3ds2/methodNotification',
card: {
number: document.getElementById('card-number').value,
},
});
@footfish - sorry, here's the code. It's similar to yours apart from I'm targeting a .net generic handler (I'm assuming you're not), and the notification URL I'm using is on localhost.
const versionCheckData = await checkVersion('/sitefiles/handlers/Check3dsVersion.ashx', {
methodNotificationUrl:
'https://localhost/sitefiles/handlers/MethodNotification.ashx',
card: { number: document.querySelector('.js-card-number').value },
},
);
From the above code, the handler receives a GET request, but if I manually do a request via Postman it works as expected.
I have a playground setup you can inspect if you like. https://34.255.10.36//vendor/globalpayments/php-sdk/examples/3ds/
(check-version.php is POST from checkVersion)
thanks for you assistance @footfish - I think that will help greatly :)
@footfish - actually does your example ever hit the second console log?
console.log("checking version completed");
Whatever details I enter into your form, it doesn't actually hit this part, and it times out with:
timeout reached https://test.portal.gpwebpay.com/pay-sim-gpi/sim/acs
@footfish - actually does your example ever hit the second console log?
@liamgold - No, it doesn't, but that's a separate issue with iframe timing out (i'm investigating). Your question was regarding posts which are working on the example.
@liamgold Are you able to share a screenshot of your browser's network tab?
@footfish If you're unable to correct your timeout issue, would you mind opening a separate issue?
@slogsdon I'm getting the same issue where it times out.
@slogsdon - Thanks, posted a new issue https://github.com/globalpayments/globalpayments-3ds-js/issues/7
@liamgold This isn't something we've seen before. It appears the POST to your method notification URL succeeds with a 200 OK
, but your browser is still showing the request is loading. Are you able to share the source of your MethodNotification.ashx
handler for our review?
@slogsdon - sure, the latest version is currently:
/// <summary>
/// Summary description for MethodNotification
/// </summary>
public class MethodNotification : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
var threeDSMethodData = context.Request.Form["threeDSMethodData"];
try
{
var data = Convert.FromBase64String(threeDSMethodData);
var methodUrlResponseString = Encoding.UTF8.GetString(data);
var methodUrlResponse = JsonConvert.DeserializeObject<MethodUrlResponse>(methodUrlResponseString);
context.Response.Write($"<script src=\"/payment/globalpayments-3ds.min.js\"></script><script>GlobalPayments.ThreeDSecure.handleMethodNotification('{methodUrlResponse.ThreeDSServerTransID}');</script>");
context.Response.End();
}
catch (Exception ex)
{
var response = JsonConvert.SerializeObject(new
{
error = ex
});
context.Response.Write(response);
context.Response.End();
}
}
public bool IsReusable => false;
}
I've recently changed the context.Response.Write value to include globalpayments-3ds.min.js
and run the GlobalPayments.ThreeDSecure.handleMethodNotification
function. Although the methodnotification.ashx request is still pending, the initiateauthentication handler is now being called (I just need to finish this handler off so it no longer errors).
Would you expect to see anything different within the handler?
@liamgold see solution https://github.com/globalpayments/globalpayments-3ds-js/issues/7 , might help.
(Note if you're doing auth in separate block scope make sure you remove const
fromconst versionCheckData
when you add let versionCheckData;
)
Thanks @footfish and @slogsdon - all the above seems to be working fine now.
I'm now experiencing a new issue within the .NET SDK not being able to connect to the payment gateway, logged over there https://github.com/globalpayments/dotnet-sdk/issues/16
@liamgold Glad to see you got this sorted as well. I do see a slight bug within your handler's client-side script. Instead of:
var methodUrlResponse = JsonConvert.DeserializeObject<MethodUrlResponse>(methodUrlResponseString);
context.Response.Write($"<script src=\"/payment/globalpayments-3ds.min.js\"></script><script>GlobalPayments.ThreeDSecure.handleMethodNotification('{methodUrlResponse.ThreeDSServerTransID}');</script>");
you can use:
// remove: var methodUrlResponse = JsonConvert.DeserializeObject<MethodUrlResponse>(methodUrlResponseString);
context.Response.Write($"<script src=\"/payment/globalpayments-3ds.min.js\"></script><script>GlobalPayments.ThreeDSecure.handleMethodNotification({methodUrlResponseString});</script>");
handleMethodNotification
and handleChallengeNotification
expect the first parameter to be an object literal.
I'm testing setting up 3D secure V2 locally, but when the method notification URL is called, the js is doing a GET request instead of a POST. Is there something I'm doing wrong in the current set up that would cause this?