feat: add invoice v3 list endpoint#4613
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a ChangesBilling invoices list flow
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR adds the v3 invoice list endpoint and generated client support. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (6): Last reviewed commit: "fix: linter" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
e2e/billinginvoices_v3_test.go (1)
442-460: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winHeads up: this status-filter subtest can pass even if status filtering breaks.
It only checks that returned invoices have status
draft/issued, but never asserts anything was actually returned. If thefilter[status][oeq]path regressed and returned an empty page, the loop body never runs and the test still passes green. A quickrequire.NotEmpty(t, resp.Data, ...)(the invoice advances to a draft-family status, so it should be present) would make this actually guard the behavior.♻️ Suggested tweak
require.Equal(t, http.StatusOK, status, "problem: %+v", problem) require.NotNil(t, resp) + require.NotEmpty(t, resp.Data, "expected the customer's invoice to match the status filter") for _, inv := range resp.Data {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/billinginvoices_v3_test.go` around lines 442 - 460, The status-filter subtest in billinginvoices_v3_test.go only validates the status of returned items and can still pass if ListBillingInvoices returns an empty page. Update the t.Run block around ListBillingInvoices and resp.Data to assert that at least one invoice is returned before iterating, using the existing customerID/status filter setup so the test actually verifies filter[status][oeq] behavior.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/skills/api-filters/SKILL.md:
- Around line 345-360: The `InvoiceShortStatus.Values()` example is missing the
exclusion of `StandardInvoiceStatusGathering`, so it incorrectly treats
`gathering` as a valid filter value. Update the `Values()` example to mirror the
real `InvoiceShortStatus.Values()` behavior from `stdinvoice.go` by filtering
`validStatuses` with `lo.Without(..., StandardInvoiceStatusGathering)` before
mapping to `InvoiceShortStatus`, so `Validate()` continues to reject `gathering`
consistently.
In `@api/v3/handlers/billinginvoices/list.go`:
- Around line 53-56: The default sort in the billing invoices list handler does
not match the published contract, since `list.go` currently sets
`api.InvoiceOrderByCreatedAt` with `sortx.OrderDesc` when `sort` is omitted.
Update the defaulting logic in the `List` handler so the default order matches
the SDK/spec expectation of `created_at` ascending, and make sure any special
handling of an explicit `sort=created_at` still uses the same ordering as the
omitted case.
---
Nitpick comments:
In `@e2e/billinginvoices_v3_test.go`:
- Around line 442-460: The status-filter subtest in billinginvoices_v3_test.go
only validates the status of returned items and can still pass if
ListBillingInvoices returns an empty page. Update the t.Run block around
ListBillingInvoices and resp.Data to assert that at least one invoice is
returned before iterating, using the existing customerID/status filter setup so
the test actually verifies filter[status][oeq] behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 071720da-ec75-43fa-8f82-9985b92dd1af
⛔ Files ignored due to path filters (1)
api/v3/openapi.yamlis excluded by!**/openapi.yaml
📒 Files selected for processing (30)
.agents/skills/api-filters/SKILL.md.agents/skills/api/SKILL.mdapi/spec/packages/aip-client-javascript/README.mdapi/spec/packages/aip-client-javascript/src/funcs/invoices.tsapi/spec/packages/aip-client-javascript/src/index.tsapi/spec/packages/aip-client-javascript/src/models/operations/invoices.tsapi/spec/packages/aip-client-javascript/src/models/schemas.tsapi/spec/packages/aip-client-javascript/src/models/types.tsapi/spec/packages/aip-client-javascript/src/sdk/invoices.tsapi/spec/packages/aip/src/invoices/operations.tspapi/v3/api.gen.goapi/v3/handlers/billinginvoices/convert.goapi/v3/handlers/billinginvoices/handler.goapi/v3/handlers/billinginvoices/list.goapi/v3/server/routes.goe2e/billinginvoices_v3_test.goe2e/v3helpers_test.goopenmeter/billing/adapter/invoice.goopenmeter/billing/charges/service/gathering_preview_test.goopenmeter/billing/httpdriver/invoice.goopenmeter/billing/invoice.goopenmeter/billing/service/invoice.goopenmeter/billing/stdinvoice.goopenmeter/billing/validators/customer/customer.goopenmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.goopenmeter/billing/worker/subscriptionsync/service/sync_test.gopkg/filter/filter.gotest/billing/invoice_test.gotest/billing/lineengine_test.gotest/subscription/scenario_firstofmonth_test.go
bc7134f to
50d9678
Compare
0a8cb81 to
f6665e0
Compare
Overview
Notes for reviewer
Summary by CodeRabbit
New Features
Bug Fixes