Repository navigation
feat(payments)!: replace frappe/payments with bwh_payments - #557
harshtandiya wants to merge 8 commits into
Conversation
Buzz now talks to bwh_payments' API instead of frappe/payments, and no longer names a payment provider anywhere in its code. - Payment links: bwh_payments.api.create_payment opens the checkout; the per-gateway branches (Razorpay/Paymob order creation, the payment id key per provider read from Integration Request data) are gone. A currency the gateway cannot charge is refused before a checkout opens, and a disabled gateway is never offered. Event Payment links the Gateway Payment Request. - Confirmation: on_payment_authorized marks the Event Payment received from the confirmed Gateway Payment Request (no more mid-request commit or in_test skip). - Refunds: work for every gateway bwh_payments runs, not only Razorpay. Event Booking Refund links the bwh_payments Gateway Refund; the new on_refund_update callback replaces the frappe/payments-fork handle_refund_notification hook and its Razorpay-shaped payload, and amounts are major units (no more /100). Refunds raised on a provider's dashboard are still recorded, with the tickets they cover. sync_refunds asks the provider about refunds still pending. - Desk refund messages no longer name Razorpay or assume rupees. - Links that pointed at frappe/payments' Payment Gateway now point at bwh_payments' Payment Gateway Profile. - Tests run the real payment and refund code on bwh_payments' in-memory test gateway instead of mocking a controller; the provider-bound factories are gone. - CI installs bwh_payments (v1-stable) instead of frappe/payments. BREAKING CHANGE: sites need bwh_payments installed; frappe/payments is no longer required.
…ents A post-model-sync patch gives every existing payment and refund a bwh_payments record, so old bookings stay refundable and their history stays readable. It keeps every existing field; rows only gain a link. - Gateways: bwh_payments imports each frappe/payments Payment Gateway as a Payment Gateway Profile with the same name (copying Razorpay/Stripe keys), so the gateway links on events, templates, settings and payments stay valid. A gateway no longer listed anywhere gets a disabled profile. - Event Payment: a Gateway Payment Request per row, Paid when received and Expired otherwise, keyed on order_id/payment_id, with payment_id as the transaction ref (old Razorpay payments refund against it). - Event Booking Refund: a Gateway Refund per row with its refund id, status and amount, referencing the refund. Nothing is settled again: no booking is resubmitted and no ticket is cancelled. - Idempotent, and a row that cannot move (e.g. its booking was deleted) is logged and skipped without stopping the migration. frappe/payments must still be installed when this runs; uninstall it in a later update.
…ce paid - Gateway logos now come from bwh_payments through the new guest endpoint buzz.api.payments.get_payment_gateway_logos. The dashboard's provider-keyed logo map (and its "Stripe-Main" name parsing) and buzz's copy of the Razorpay logos are gone, so any gateway bwh_payments runs shows its logo. - The booking confirmation page said "Booking Confirmed" and fired confetti for anyone who landed on it. It now confirms only a paid (or free) booking; otherwise it shows "Payment Pending" with a "Check again" button. - The sponsorship page celebrates a return from payment only once the enquiry is actually Paid, instead of on ?success=true alone.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
❌ UI Demo Check failedThis pull request changes the UI (9 file(s) under 🛠️ How to fix
Either one re-runs this check automatically. |
Backend test coverage: 92%Commit c025247. Test modules are excluded. Coverage by file
91 empty files skipped. |
The booking call returns the checkout URL before the gateway page loads, so the button came back while the browser was still navigating. Reset on a back-forward cache restore so going back does not leave it stuck.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
useCall runs onSuccess before it sets data, so the paid check read null and skipped the celebration. Check the response passed to onSuccess.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
…unds Each PaymentGatewayLogo made its own request; one shared call now serves every logo. sync_refunds returns only the pending count Desk reads.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
A pending refund after a settled partial one left the booking at Partially Refunded, so the Desk alert claimed the refund had settled.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
What changed
Buzz takes payments through bwh_payments (
v1-stable) instead of frappe/payments, and no longer names a payment provider in its code.bwh_payments.api. Refunds now work for every gateway bwh_payments runs (Stripe, Razorpay, Telr, Tabby), not only Razorpay. A refund raised on a provider's dashboard is still recorded with the tickets it covers.Decisions worth a look:
payment_requestlink.bwh_payments.testing) instead of mocking a controller.Demo
TODO: screenshot of the "Payment Pending" state on
/b/booking-success/<id>.Testing
bench run-tests --app buzz: 1126 tests. The 6 errors are in event-template and event-proposal tests and fail the same way ondevelop.sync_refunds, the history patch (idempotent, keeps old fields, skips orphan rows).yarn typecheck,yarn lint,yarn test:unitpass.Setup per site
bench get-app --branch v1-stable https://github.com/bwhtech/bwh_payments, theninstall-app bwh_paymentsbeforemigratehttps://<site>/api/method/bwh_payments.bwh_payments.webhook.handle?gateway=<profile name>payment_link.paid,refund.created,refund.processed,refund.failedcheckout.session.completed,refund.created,refund.updated,refund.failed<Gateway> Gateway Settings