Skip to content

feat(billing): use credit product title as overdraft invoice line item name#1753

Open
rohilsurana wants to merge 1 commit into
mainfrom
feat/overdraft-invoice-item-title
Open

feat(billing): use credit product title as overdraft invoice line item name#1753
rohilsurana wants to merge 1 commit into
mainfrom
feat/overdraft-invoice-item-title

Conversation

@rohilsurana

@rohilsurana rohilsurana commented Jul 13, 2026

Copy link
Copy Markdown
Member

What this changes

The monthly credit overdraft invoice shows a hardcoded line item text: "Credit Overdraft".

This PR changes it to use the title of the configured credit overdraft product. If the title is empty, it falls back to "Credit Overdraft" as before.

Why

The finance team wants a proper service description on the invoice line. The token purchase invoice already prints the product title (Stripe uses the product name as the line text). With this change, the overdraft invoice reads from the same field. Operators can then set the wording once, in the product config.

How it works

  • Init already loads the overdraft product for its price. It now also stores the product title.
  • GenerateForCredits uses that title as the invoice item name.
  • The item name becomes the Stripe line description in CreateInProvider.

Notes

  • No change if the product has no title: the line still says "Credit Overdraft".
  • Invoice reconciliation is not affected. It matches items by type, not by name.

Deploy order

A downstream consumer matches invoice line names against the literal string "Credit Overdraft", so it must be updated first:

  1. Merge and deploy pixxelhq/business-data-syncer#28. It makes the Planhat sales sync match overdraft items by type instead of name.
  2. Then merge and deploy this PR.
  3. Then update the token product title in configs.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Jul 13, 2026 3:15pm

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Improvements

    • Credit overdraft invoice items now use the configured product title when available.
    • Added a clear default description when no product title is configured.
    • Startup logging now shows the selected overdraft item name.
  • Tests

    • Added coverage for configured and fallback overdraft item names.

Walkthrough

Credit overdraft invoice item descriptions now derive from the configured product title, with a default fallback. The service stores this title during initialization, logs it, uses it during invoice generation, and tests both configured and fallback behavior.

Changes

Credit overdraft invoice naming

Layer / File(s) Summary
Resolve overdraft item names
billing/invoice/service.go
Adds the default item-name constant, stores the configured product title during initialization, logs the resolved name, and provides fallback resolution.
Apply and test invoice naming
billing/invoice/service.go, billing/invoice/service_test.go
Uses the resolved name for generated credit overdraft invoice items and tests configured and fallback values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: amangit07

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29261425709

Coverage increased (+0.005%) to 44.881%

Details

  • Coverage increased (+0.005%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (5 of 9 lines covered, 55.56%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
billing/invoice/service.go 9 5 55.56%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37651
Covered Lines: 16898
Line Coverage: 44.88%
Coverage Strength: 12.54 hits per line

💛 - Coveralls

@rohilsurana
rohilsurana marked this pull request as ready for review July 27, 2026 07:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
billing/invoice/service_test.go (1)

154-178: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the production wiring, not only the helper.

This test validates overdraftItemName() in isolation, so it would still pass if Service.Init stopped copying creditProduct.Title or GenerateForCredits stopped using the resolver. Add a focused test that verifies the generated credit-overdraft item receives both the configured title and the fallback name.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cf7a45a-f141-4fc3-9943-1648309e23a1

📥 Commits

Reviewing files that changed from the base of the PR and between cd6b070 and afe7000.

📒 Files selected for processing (2)
  • billing/invoice/service.go
  • billing/invoice/service_test.go

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants