Skip to content

feat(wallet-transactions): void a specific transaction [ING-429] - #6000

Open
aquinofb wants to merge 1 commit into
mainfrom
ing-429
Open

feat(wallet-transactions): void a specific transaction [ING-429]#6000
aquinofb wants to merge 1 commit into
mainfrom
ing-429

Conversation

@aquinofb

Copy link
Copy Markdown
Contributor

Context

Wallet transactions expose voided_credits, which voids an amount from the wallet pool in consumption order (priority, then granted-before-purchased, then oldest first). There was no way to target a single grant, so a customer granting pooled credits per source (for example free monthly credits) could not revoke one grant's unused remainder without disturbing the rest of the pool.

Changes

  • Add an optional voided_transaction_id to POST /api/v1/wallet_transactions. On its own it voids the targeted inbound grant's entire remaining balance; combined with voided_credits it voids that amount from the grant, capped at its remaining. voided_credits on its own keeps the existing pool-wide behavior, so nothing changes for current callers.
  • Targeting requires a traceable wallet and a settled inbound transaction that still has a remaining balance. The other cases are rejected with a clear 422: wallet_not_traceable, wallet_transaction_not_found, and no_remaining_amount.
  • The target is resolved and validated once, then reused; the existing VoidService already validates the amount against the grant's remaining balance and decrements only that grant's ledger row.

Pairs with the metadata filter (#5998), which is how a caller locates the grant to void. Targeted restore is intentionally left for a follow-up.

## Context

The only public way to remove credits was voided_credits, which voids an
amount from the wallet pool in consumption order, with no way to target a
specific grant. A customer granting pooled credits per source (for example
free monthly credits) needs to revoke one grant's unused remainder without
touching the rest of the pool.

## Description

Add an optional voided_transaction_id to POST /wallet_transactions. Given
alone it voids the targeted inbound grant's entire remaining balance; given
with voided_credits it voids that amount from the grant, capped at its
remaining. voided_credits alone keeps the pool-wide behavior. Targeting
requires a traceable wallet and a settled inbound that still has a remaining
balance; the underlying VoidService already validates and decrements only
that grant's ledger row.
@aquinofb
aquinofb requested review from a team, mariohd and vincent-pochet and removed request for a team July 22, 2026 16:28
@aquinofb aquinofb self-assigned this Jul 22, 2026
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