Skip to content

Conversation

@Crabcyborg
Copy link
Contributor

@Crabcyborg Crabcyborg commented Oct 3, 2025

Pre-release
formidable-6.25b.zip

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Extends 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

Cohort / File(s) Summary of Changes
Square Lite app controller
square/controllers/FrmSquareLiteAppController.php
- get_billing_contact now calls maybe_add_address_data with (int) $address_setting
- maybe_add_address_data signature extended with $address_field_id parameter
- Loads FrmField::getOne for provided ID; validates field and derives country_code: 'US' if address_type is 'us', else via FrmProAddressesController
- Retains existing behavior for incomplete addresses
- Updated docblock to include new parameter

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request lacks any description, providing no information about the change’s context, purpose, or implementation details, which leaves reviewers without guidance. Please add a brief description explaining the intent of this fix, how it resolves the US address type verification issue, and any relevant details to help reviewers understand the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title directly reflects the primary change by specifying that it fixes the Square verification issue when using “US” as the address type, making it clear and concise for reviewers to understand the focus of the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_square_verifying_issue_when_using_us_as_address_type

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3f887e4 and becfaec.

📒 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.

@Crabcyborg Crabcyborg merged commit 4265bb1 into master Oct 3, 2025
35 of 36 checks passed
@Crabcyborg Crabcyborg deleted the fix_square_verifying_issue_when_using_us_as_address_type branch October 3, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants