Skip to content

feat: Add validation system#1634

Open
bthebladeprimer wants to merge 2 commits into
bn/feature/cc-04-domain-foundationfrom
bn/feature/cc-05-validation
Open

feat: Add validation system#1634
bthebladeprimer wants to merge 2 commits into
bn/feature/cc-04-domain-foundationfrom
bn/feature/cc-05-validation

Conversation

@bthebladeprimer
Copy link
Copy Markdown
Contributor

Summary

  • Adds ValidationRule protocol and ValidationResult types for composable field validation
  • Adds ValidationService that orchestrates rule evaluation for form fields
  • Adds card-specific validation rules (card number, CVV, expiry date, cardholder name)
  • Adds common validation rules (email, phone, address, city, state, postal code, country code, OTP)
  • Adds RulesFactory for creating validation rule sets per field type
  • Adds ExpiryDateInput model for structured expiry date handling
  • Includes 14 comprehensive test files covering all validation rules and edge cases

Context

PR 5 of 15 in the CheckoutComponents feature split. The validation system is used by the public API layer (PR 6) and all UI components. Depends on PR 4 (#1633).

Tracker: https://www.notion.so/32fca65dc30e81dabf66f33e2b58c3a1

Test plan

  • Verify all 14 validation test files pass
  • Confirm card number Luhn check works correctly
  • Confirm expiry date edge cases (month boundaries, year rollover) are handled
  • Verify RulesFactory returns correct rules for each field type
  • Run: xcodebuild -workspace PrimerSDK.xcworkspace -scheme PrimerSDKTests -destination "platform=iOS Simulator,name=iPhone 16" test

@bthebladeprimer bthebladeprimer requested a review from a team as a code owner March 26, 2026 15:39
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

Warnings
⚠️ > Pull Request size seems relatively large. If this Pull Request contains multiple changes, please split each into separate PR will helps faster, easier review.

Generated by 🚫 Danger Swift against bb4a39d

@bthebladeprimer bthebladeprimer self-assigned this Mar 26, 2026
@bthebladeprimer bthebladeprimer marked this pull request as draft March 26, 2026 16:31
@bthebladeprimer bthebladeprimer force-pushed the bn/feature/cc-04-domain-foundation branch from 8e4c043 to a9450d7 Compare March 31, 2026 14:06
@bthebladeprimer bthebladeprimer force-pushed the bn/feature/cc-05-validation branch from 70b5a50 to efa6da3 Compare March 31, 2026 14:06
@bthebladeprimer bthebladeprimer marked this pull request as ready for review April 3, 2026 18:09
@bthebladeprimer bthebladeprimer force-pushed the bn/feature/cc-04-domain-foundation branch from 708e244 to 0e73d61 Compare April 15, 2026 13:01
@bthebladeprimer bthebladeprimer requested a review from a team as a code owner April 15, 2026 13:01
@bthebladeprimer bthebladeprimer force-pushed the bn/feature/cc-05-validation branch from 3220d09 to bb4a39d Compare April 15, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant