Skip to content

CONV-255/256: Test and implement monthly subscription credit grant#222

Merged
menvil merged 2 commits into
developfrom
feature/CONV-255-test-paid-invoice-grants-monthly-credits-once
Jun 2, 2026
Merged

CONV-255/256: Test and implement monthly subscription credit grant#222
menvil merged 2 commits into
developfrom
feature/CONV-255-test-paid-invoice-grants-monthly-credits-once

Conversation

@menvil

@menvil menvil commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • CONV-255: Added failing tests for handleInvoicePaid — idempotency, free plan skip, metadata storage
  • CONV-256: Implemented monthly credit grant via CreditLedger.grant() with idempotency
    • Free plan invoices are silently ignored
    • Duplicate invoices detected via json_extract(metadata_json, '$.stripe_invoice_id') query
    • Credit transaction reason = subscription_monthly_grant
    • Metadata includes stripe_invoice_id, plan, and raw payload
    • No direct balance mutation — all through CreditLedger

Test plan

  • Duplicate invoice grants credits only once (1 transaction created)
  • Free plan invoice creates no subscription_monthly_grant transaction
  • Invoice ID and plan stored in credit transaction metadata
  • composer test passes (459 tests)
  • composer lint passes
  • npm run build passes

🤖 Generated with Claude Code


Summary by cubic

Implements monthly credit grants when a paid subscription invoice is processed, with idempotency. Adds tests to ensure a single grant, skipping free plans, and metadata storage (CONV-255, CONV-256).

  • New Features
    • Paid plans only; free plan invoices are ignored.
    • One-time grant enforced by checking CreditTransaction metadata for stripe_invoice_id.
    • Uses CreditLedger->grant() with reason: subscription_monthly_grant; stores stripe_invoice_id, plan, and raw payload.

Written for commit 9c180e8. Summary will update on new commits.

Review in cubic

menvil and others added 2 commits June 2, 2026 17:50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@menvil menvil merged commit 1b61be1 into develop Jun 2, 2026
1 check was pending
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 59464cc7-725c-4998-adaa-549118c6847e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/CONV-255-test-paid-invoice-grants-monthly-credits-once

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 and usage tips.

@menvil menvil deleted the feature/CONV-255-test-paid-invoice-grants-monthly-credits-once branch June 2, 2026 14:52
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.

1 participant