-
Notifications
You must be signed in to change notification settings - Fork 217
Fix address validation for manually entered orders #4576
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 address validation for manually entered orders #4576
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.
Pull Request Overview
This PR fixes address validation issues for manually entered orders by relaxing customer validation requirements on the "pay for order" page. Previously, strict validation prevented orders with minimal customer information (e.g., email only) from being processed.
- Refactors validation context parameters from boolean flags to string-based contexts
- Allows minimal customer details (email only) for both "add payment method" and "pay for order" pages
- Maintains backward compatibility with existing API callers
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
includes/class-wc-stripe-customer.php | Core changes to validation logic, adding context-aware customer field requirements and parameter normalization |
includes/payment-methods/class-wc-stripe-upe-payment-gateway.php | Updates customer creation call to pass "pay_for_order" context |
includes/class-wc-stripe-intent-controller.php | Updates setup intent creation to use new string-based context parameter |
readme.txt | Adds changelog entry for the fix |
changelog.txt | Adds changelog entry for the fix |
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 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.
Looks good and tests well
Co-authored-by: Malith Senaweera <[email protected]>
I've reviewed the E2E failures, and it looks like the Default failures are already being addressed in #4592, and the issues with the Optimized Checkout tests seem to be unrelated to this PR. |
* Allow minimal customer details on pay for order page * Changelog * Add normalization for existing boolean flag * Remove trailing quotes from changelog * Add constants for strings * Make constant public; update unit tests * Remove double period
I have been seeing this issue on a wp/woocommerce/civicrm instance. I have created a small plugin that solves the address issue for us and may be of use to someone while this issue is being resolved. |
Fixes STRIPE-659
Changes proposed in this Pull Request:
The underlying driver for this PR is that the original code that made customer validation stricter, #4464, always required all fields. We previously shipped #4489 to relax those restrictions when users are adding payment methods. This PR refactors some of the code from #4489 to be a bit more generic so we can identify specific contexts in which we expect a smaller set of customer details to be available. The PR also relaxes customer validation for the "Pay for order" page, making it possible for manually entered orders to be handled with limited customer information.
At a technical level, the changes in this PR are as follows:
$current_context
string parameter instead of a$is_add_payment_method_page
boolean parameter.WC_Stripe_Customer->get_create_customer_required_fields()
to require only an email address when we are on the pay for order page in addition to the case for adding a payment method.Testing instructions
Changelog entry
Changelog Entry Comment
Comment
Post merge