Skip to content

Conversation

@domenicofalco
Copy link
Contributor

@domenicofalco domenicofalco commented Dec 16, 2025

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.

  • Add payment method selection: PaymentMethodsInvoiceSettings section in CreateInvoice and PaymentMethodComboBox in overdue payment form; wire selected method into form state
  • Extend invoice form/types: InvoiceFormInput gains paymentMethod and invoiceCustomSection; submit passes paymentMethod and invoiceCustomSection (via toInvoiceCustomSectionReference) to createInvoice
  • GraphQL updates: include invoiceCustomSection in CreateInvoiceInput and FetchDraftInvoiceTaxesInput; fetch customer.externalId; adjust credit note types; regenerate graphql.tsx
  • Payment methods hook: usePaymentMethodsList accepts optional externalCustomerId, skips query when absent/empty; tests added/updated for undefined/empty handling and combobox behavior
  • UI/behavior tweaks: require at least one fee to enable Create button; spacing tweaks when multi-payment section is shown
  • Translations: add keys for one-off invoice and payment method labels/instructions

Written by Cursor Bugbot for commit 2671f31. This will update automatically on new commits. Configure here.

## Context

This PR aims to include the new multiple payment architecture over the CreateInvoice flow

<!-- Linear link -->
Fixes LAGO-988
@domenicofalco domenicofalco self-assigned this Dec 16, 2025
@domenicofalco domenicofalco added the 🛠 feature New feature or request label Dec 16, 2025
@domenicofalco domenicofalco marked this pull request as ready for review December 22, 2025 13:07
domenicofalco and others added 2 commits December 23, 2025 11:02
Co-authored-by: Allan Michay <allan.michay@gmail.com>
domenicofalco and others added 2 commits December 23, 2025 18:58
…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,
Copy link
Contributor Author

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
27.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link

@cursor cursor bot left a 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,
},
Copy link

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)

Fix in Cursor Fix in Web

}),
enableReinitialize: true,
validateOnMount: true,
onSubmit: async ({ fees, ...values }) => {
Copy link

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠 feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants