feat: pluggable pay driver for "Pay and Submit"#53
Conversation
Backends can now register a pay driver keyed by integration_doctype to swap what "Pay and Submit" does, without touching the button, label, checkbox toggle, or dialogs. No driver registered keeps the current RazorpayX behaviour (savesubmit on the form, OTP + bulk_pay_and_submit on the list). The form primary action and the list bulk action resolve the driver from the registry; the list also merges each driver's add_fields and routes a mixed selection per integration_doctype. The primary action now also flips live when make_bank_online_payment is toggled, not only on reload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
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 |
|
Tick the box to add this pull request to the merge queue (same as
|
Confidence Score: 5/5Safe to merge — the change is purely additive client-side JS; existing RazorpayX behaviour is untouched when no driver is registered The change is purely additive client-side JS with no server modifications. The two observations in payment_entry_list.js are non-breaking in the current codebase and can be addressed before or alongside the first real driver landing. payment_entry_list.js — the driver routing and add_fields timing deserve a second look before the bankbridge companion PR merges
|
| Filename | Overview |
|---|---|
| payment_integration_utils/public/js/pay_drivers.js | New driver registry — clean, minimal, idiomatic Frappe namespace extension with safe initialization and clear API surface |
| payment_integration_utils/public/js/payment_integration_utils.bundle.js | Adds pay_drivers import to the bundle — straightforward, no issues |
| payment_integration_utils/payment_integration_utils/client_overrides/form/payment_entry.js | Adds live checkbox toggle handler and driver-aware primary action lookup; guards are consistent with pre-existing conditions |
| payment_integration_utils/payment_integration_utils/client_overrides/list/payment_entry_list.js | Routing is well-structured; driver bulk receives unfiltered docs (eligibility not checked before dispatch), and add_fields is computed at definition time rather than lazily |
Reviews (3): Last reviewed commit: "fix(payment-entry): alert on a mixed bul..." | Re-trigger Greptile
Routing a mixed selection ran every matching driver's bulk (and the default flow) in the same tick, stacking their confirm/OTP dialogs and starting two money-moving batches at once. Refuse a selection that spans more than one flow and ask the user to narrow it; run the single flow otherwise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address review on #53: - Mixed selection now alerts and runs one payment flow, rather than refusing the whole selection (per @vorasmit). - Count the default path as a flow only when it has a payable doc, so a batch that merely includes ineligible rows no longer trips the alert (per greptile); ineligible rows still surface in the default confirm. - Warn when a driver registers a form handler but no bulk handler, which would otherwise pay via the wrong default path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Addressed the review in
The empty-selection case needs nothing — Frappe keeps the bulk action disabled until a row is checked. |
…ix/pr-53 feat: pluggable pay driver for "Pay and Submit" (backport #53)
What
Make the "Pay and Submit" action pluggable so a payment backend can change what it does without touching the button, label, checkbox toggle, or dialogs.
Today the flow is hard-wired: a checked
make_bank_online_paymentrelabels the primary action to Pay and Submit →frm.savesubmit(), and the payout runs as the backend'son_submitside effect (submit-first). A backend that needs pay-first (e.g. an interactive bank OTP ceremony) had to fight this UX at runtime.How
public/js/pay_drivers.js: a client registry keyed byintegration_doctype—register_pay_driver(doctype, driver)/get_pay_driver(doctype). A driver is{ form(frm), bulk(list_view, docs), add_fields }.formhandler; default staysfrm.savesubmit(). The action now also flips live whenmake_bank_online_paymentis toggled, not only on reload.add_fields, and routes a selection perintegration_doctype— driver-owned docs go to the driver'sbulk, the rest run the existing OTP +bulk_pay_and_submitpath. RazorpayX and another backend can coexist on one site.Backward compatibility
No driver registered = exactly today's behaviour. RazorpayX is untouched. No server change.
Testing
Pure client JS. Bundle builds clean (
bench build --app payment_integration_utils); all touched files passnode --check. Companion PR (bankbridge) registers the first real driver.🤖 Generated with Claude Code