-
Notifications
You must be signed in to change notification settings - Fork 4
Pl 1537 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Pl 1537 #23
Conversation
|
||
// Define what happens on successful data submission | ||
XHR.addEventListener("load", function(event) { | ||
window.location.replace(event.target.responseURL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are using the redirect flow here, but you can keep working with the popup, check merchant-demo code: https://github.com/tokenio/merchant-demo/blob/master/src/components/TokenEnablerButton/index.js#L74 it can take the token request url instead of terms, let me know if you need my help :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to demonstrate plain redirect since that's what our documentation shows. I originally tried using the bindButton set up but it caused all sorts of problems and confusion, so figured for the sample we're giving to devs we should keep it as plain as can be, and show that all Token specific stuff can be kept to the backend 😀
|
||
XHR.setRequestHeader("Content-Type", "application/json; charset=utf-8"); | ||
|
||
var data = $.param({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you are relying on jQuery for this, why not use $.post instead of native XMLHttpRequest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were problems with the redirect part when I was using $.post, ended up with preflight response errors from the web app. This way didn't cause those errors, could be worth playing with to make it consistent though.
I created a new branch from this one with styles for the token button and did some refactoring of script.js, let me know if it works for you and I'll create a PR to merge into this branch :-D https://github.com/tokenio/merchant-sample-java/tree/style-token-button |
Uses the new Token Request Flow. Could use some suggestions and help cleaning this up (basically adding back in the token style for the button without bindbutton, which does other things I don't want).