-
Notifications
You must be signed in to change notification settings - Fork 87
feat: Add multiple payment feature in create invoice flow #2880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
## Context This PR aims to include the new multiple payment architecture over the CreateInvoice flow <!-- Linear link --> Fixes LAGO-988
Co-authored-by: Allan Michay <allan.michay@gmail.com>
…nt requests (#2896) ## Context This PR adds the ability to select payment methods when requesting overdue payments, as part of the multi-payment flow feature. ## Description - **Overdue Payment Requests**: Added `PaymentMethodComboBox` to select payment method for overdue invoices - **Form Integration**: Updated form submissions to include payment method data <!-- Linear link --> Fixes [LAGO-980](https://linear.app/getlago/issue/LAGO-980)
| email: values.emails.replaceAll(' ', ''), | ||
| lagoInvoiceIds: invoices?.collection?.map((invoice) => invoice.id), | ||
| // TODO: Uncomment when backend is ready | ||
| // paymentMethod: values.paymentMethod, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting for BE to clarify the input
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on January 25
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| paymentMethod: { | ||
| paymentMethodId: undefined, | ||
| paymentMethodType: undefined, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Payment method selection value not sent to backend
High Severity
The paymentMethod field is added to the form's initial values (line 145-148) and rendered with a PaymentMethodComboBox in RequestPaymentForm.tsx, but the onSubmit handler only sends email, externalCustomerId, and lagoInvoiceIds to the mutation. The user-selected paymentMethod value in values.paymentMethod is never included in the mutation input, meaning users can select a payment method in the UI but the selection is silently discarded when submitting.
Additional Locations (1)
| }), | ||
| enableReinitialize: true, | ||
| validateOnMount: true, | ||
| onSubmit: async ({ fees, ...values }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing form initial values cause selection loss on reinitialization
Medium Severity
The form has enableReinitialize: true but the new paymentMethod and invoiceCustomSection fields are not included in initialValues. When the voided invoice query completes (which changes prefillFees), the form reinitializes and any payment method or custom section the user has already selected will be silently reset to undefined. This affects the void invoice flow where the user could interact with the payment methods UI before the prefill data finishes loading.


Context
This PR aims to include the new multiple payment architecture over the Create Invoice and Request Payment views
Fixes LAGO-988
Fixes LAGO-980
Note
Introduces multi-payment flow (behind
FeatureFlags.MULTI_PAYMENT_FLOW) across invoice creation and overdue payment requests.PaymentMethodsInvoiceSettingssection inCreateInvoiceandPaymentMethodComboBoxin overdue payment form; wire selected method into form stateInvoiceFormInputgainspaymentMethodandinvoiceCustomSection; submit passespaymentMethodandinvoiceCustomSection(viatoInvoiceCustomSectionReference) tocreateInvoiceinvoiceCustomSectioninCreateInvoiceInputandFetchDraftInvoiceTaxesInput; fetchcustomer.externalId; adjust credit note types; regenerategraphql.tsxusePaymentMethodsListaccepts optionalexternalCustomerId, skips query when absent/empty; tests added/updated for undefined/empty handling and combobox behaviorWritten by Cursor Bugbot for commit 2671f31. This will update automatically on new commits. Configure here.