feat(api): pending invoice items family + invoice read fidelity (lines.data, post-payment credit notes) - #73
Merged
Conversation
…ude/exclude, invoice subscription/days_until_due, lines.data and post_payment_credit_notes_amount - POST /v1/invoiceitems without invoice stores a pending item (nullable invoice_id via migration 022), optional subscription echo - POST /v1/invoices pending_invoice_items_behavior=include attaches the customer's same-currency pending items once at create and sums subtotal/total/amount_due; exclude/omit leaves them pending - POST /v1/invoices accepts subscription (customer match enforced) and days_until_due (due_date = created + days) - invoice responses populate lines.data reusing the /lines serialization (pricing/quantity included) - paid invoices report post_payment_credit_notes_amount from issued credit notes' credit amounts
The 150ms elapsed assertions flake on loaded CI runners. The receiver blocks until releaseWebhook closes at test end, so any response proves the handler did not wait on delivery; keep only a generous hang bound.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wave 2 of the Stripe 2025+ API surface program (follows #71, #72).
What
POST /v1/invoiceitemswithoutinvoicenow stores a customer-attached pending item (migration 022 makesinvoice_idnullable). Optionalsubscriptionparam validated and echoed.pending_invoice_items_behavioron invoice create is now applied, not just stored:includeattaches the customer's same-currency pending items once at create time and sums them into subtotal/total/amount_due;exclude/omit leaves them pending.subscription(customer match enforced) anddays_until_due→due_date.lines.databy reusing the existing/linessubresource serialization (pricing/quantity from feat(api): invoice item create accepts pricing[price] + quantity (newer Stripe SDK shape) #71); paid invoices reportpost_payment_credit_notes_amountfrom issued credit notes (feat(api): stripe surface wave 1 — trial_end preview/confirm parity, default-amount refunds, credit note memo/oob/refund_amount #72 CreditAmount).Tests
6 new contract subtests + storage migration/NULL-FK tests.
go build/vet/testgreen (api 132 / billing 11 / storage 14 top-level).