-
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 incorrect payment intent status check in cancel authorization API endpoint. #7150
Fix incorrect payment intent status check in cancel authorization API endpoint. #7150
Conversation
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.
Change looks good @zmaglica, thanks for working on it and creating a separate issue. Do we have any tests associated with this change that you plan to add?
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.41 MB ℹ️ View Unchanged
|
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 working on this @zmaglica! Pre-approve this PR.
@eduardoumpierre - it would be great if you can test this issue in your site too to confirm it's working as expected. I am looking further in the code using this endpoint cancel_authorization
, it seems it's used together with the Fraud check to display the CancelAuthorizationButton
component in the transaction detail page.
woocommerce-payments/client/payment-details/summary/index.tsx
Lines 295 to 297 in 83f6905
{ ! isLoading && isFraudOutcomeReview && ( | |
<div className="payment-details-summary__fraud-outcome-action"> | |
<CancelAuthorizationButton |
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 followed the testing instructions and it worked as expected – it fixed the bad response. The change makes sense and it's covered by tests.
Thanks for working on this @zmaglica! LGTM
@htdat Regarding the CancelAuthorizationButton
logic, it is currently inaccessible for the merchants, as the review feature was removed from FRT phase 1. We can test it by forcing the application to understand the order as it is held for review, which can be done by applying the diff below.
diff --git a/client/utils/charge/index.ts b/client/utils/charge/index.ts
index 2690279e2..7c3e7ff7d 100755
--- a/client/utils/charge/index.ts
+++ b/client/utils/charge/index.ts
@@ -65,6 +65,8 @@ export const isOnHoldByFraudTools = (
charge?: Charge,
paymentIntent?: PaymentIntent
): boolean => {
+ return true;
+
const fraudMetaBoxType = getFraudMetaBoxType( charge, paymentIntent );
if ( ! fraudMetaBoxType ) {
Fixes #7149
Changes proposed in this Pull Request
The incorrect payment intent status was utilized, leading to an error response rather than a successful one.
Testing instructions
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge