-
Notifications
You must be signed in to change notification settings - Fork 39
Fix square verifying issue when using US as address type #2529
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 square verifying issue when using US as address type #2529
Conversation
WalkthroughExtends maybe_add_address_data to accept an address_field_id and use field metadata to determine country_code. get_billing_contact now passes the address field ID from settings. The function loads the address field, validates it, derives country_code ('US' for address_type 'us' or via FrmProAddressesController), and preserves behavior for incomplete addresses. Docblock updated. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Controller as FrmSquareLiteAppController
participant Field as FrmField
participant AddrCtrl as FrmProAddressesController
User->>Controller: get_billing_contact()
Controller->>Controller: maybe_add_address_data(address, (int) address_setting)
alt address_field_id provided
Controller->>Field: getOne(address_field_id)
alt valid address field
opt derive country_code
alt address_type == "us"
Controller->>Controller: country_code = "US"
else other address_type
Controller->>AddrCtrl: derive country code
AddrCtrl-->>Controller: country_code
end
end
else invalid/missing field
Note over Controller: Skip field-based country derivation
end
else no address_field_id
Note over Controller: Preserve existing behavior
end
Controller-->>User: billing contact (with possibly enriched address)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
square/controllers/FrmSquareLiteAppController.php(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
square/controllers/FrmSquareLiteAppController.php (2)
classes/models/FrmField.php (1)
FrmField(6-1501)stubs.php (2)
FrmProAddressesController(439-446)get_country_code(444-445)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Run PHP Syntax inspection (8.3)
🔇 Additional comments (2)
square/controllers/FrmSquareLiteAppController.php (2)
158-158: LGTM!The cast to
(int)is appropriate for passing the address field ID. The downstream logic correctly handles the case where the ID is 0 or invalid.
168-171: LGTM!The function signature update is correct. The new parameter is properly documented in the docblock and used appropriately within the function.
Pre-release
formidable-6.25b.zip