-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fix fraud prevention token not showing up on checkout pages created via the site editor #8142
Changes from 15 commits
33fd274
caeb233
04db219
211683f
f32a3a1
5c39c6f
bca9e81
7737f56
b350554
0ef713e
6bbf898
adb5103
4975561
5778177
737d418
008817f
c6768c1
1eaa025
97eac27
e706cd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fix | ||
|
||
Fix fraud prevention token not showing up on site editor checkout page |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,7 @@ const getBillingDetails = ( billingData ) => { | |
}; | ||
|
||
const getFraudPreventionToken = () => { | ||
return document | ||
.querySelector( '#wcpay-fraud-prevention-token' ) | ||
?.getAttribute( 'value' ); | ||
return window.wcpayFraudPreventionToken ?? null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should fallback to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, this was the one that's causing 400 to be returned. Nice catch! Addressed in 008817f. |
||
}; | ||
|
||
const PaymentProcessor = ( { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,8 @@ export const SavedTokenHandler = ( { | |
|
||
useEffect( () => { | ||
return onPaymentSetup( () => { | ||
const fraudPreventionToken = document | ||
.querySelector( '#wcpay-fraud-prevention-token' ) | ||
?.getAttribute( 'value' ); | ||
const fraudPreventionToken = | ||
window.wcpayFraudPreventionToken ?? null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should fallback to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching this! It is being converted to an empty string when sending to the server. No changes needed on this one too. |
||
|
||
return { | ||
type: 'success', | ||
|
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 should fallback to
false
here instead ofnull
. I've included the reasoning in the main review comment.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.
Thanks for catching this! It is being converted to an empty string when sending to the server. No changes needed on this one.