Add js validate class on square form submit#2515
Conversation
WalkthroughAdds a pre-validation step in handlePaymentMethodSubmission to assign the frm_js_validate class to the form before running validateFormSubmit. No other control flow or error handling changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant F as Form (DOM)
participant H as handlePaymentMethodSubmission
participant V as validateFormSubmit
participant T as Tokenization
participant P as Payment/Verification
U->>F: Submit
F->>H: handlePaymentMethodSubmission(event)
note right of H: New step
H->>F: Add class "frm_js_validate"
H->>V: validateFormSubmit(F)
alt Validation fails
V-->>H: false
H-->>F: Re-enable submit / show errors
else Validation passes
V-->>H: true
H->>T: Tokenize payment method
T-->>H: Token / error
alt Token OK
H->>P: Verify/Create payment
P-->>H: Result
H-->>F: Continue submission flow
else Token/Error
H-->>F: Handle error / re-enable submit
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)square/js/frontend.js (2)
⏰ 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). (6)
🔇 Additional comments (1)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
…are_form_submit Add js validate class on square form submit
We do this for Stripe. This should help to prevent issues with verifying the Square buyer when fields are not filled in.