feat(contractor): migrate PaymentMethod to useContractorPaymentMethodForm hook#2293
Draft
serikjensen wants to merge 2 commits into
Draft
feat(contractor): migrate PaymentMethod to useContractorPaymentMethodForm hook#2293serikjensen wants to merge 2 commits into
serikjensen wants to merge 2 commits into
Conversation
…Form hook Migrate the Contractor PaymentMethod component from its monolithic inline-form pattern to the hook-based architecture. - Add useContractorPaymentMethodForm: a single headless hook for the combined payment-type + bank-account form, with value-aware excludeFields (Check hides and de-requires the bank fields) per the useContractorDetailsForm precedent. - Rewrite PaymentMethod.tsx to BaseBoundaries + thin Root + SDKFormProvider, preserving the event surface (CREATED / UPDATED / DONE) and masked-account behavior. - Harden pre-migration test coverage and add hook unit tests. - Export the hook, schema, error codes, and fields from src/index.ts. - Remove the now-unused PaymentTypeForm/BankAccountForm and inline schema. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Contractor PaymentMethod component from its monolithic inline-form pattern to the hook-based architecture (following
/migrate-sdk-component-to-hooks). Single screen, single hook.useContractorPaymentMethodForm— one headless hook for the combined payment-type + bank-account form. Uses a value-awareexcludeFieldsfunction so the bank fields stay inrequiredFieldsConfig(promotable) but are dropped from required validation whentype === 'Check', mirroring theuseContractorDetailsFormprecedent.PaymentMethod.tsxtoBaseBoundaries+ thinRoot+SDKFormProvider, preserving the event surface (contractor/bankAccount/created,contractor/paymentMethod/updated,contractor/paymentMethod/done) and the masked-account-number behavior.PaymentMethod.test.tsx) and adds hook/schema unit tests.src/index.ts.PaymentTypeForm/BankAccountFormand the inline schema.Notes
gws-flows(drop the redundantPUT /payment_methodsince the bank-account POST already updates the payment method) and optionally gating the POST on actual field changes.Test plan
npm run test -- --run(full suite green)npm run lint:check(0 errors)Made with Cursor