Skip to content

0.3.2: approval card totals invoices like CoinPay; never shows a discount value as the amount - #6

Merged
ralyodio merged 1 commit into
mainfrom
fix-invoice-card-amount
Nov 23, 2026
Merged

ralyodio merged 1 commit into
mainfrom
fix-invoice-card-amount

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

The c0mpute CLI live check showed a CoinPay invoice_create_draft card reading Amount 10 for 2 x 150 with a 10% discount: pick() fell back to the nested discount.value.

  • pick() skips discount/tax/fee-like objects when it looks one level down.
  • Itemised invoices show Subtotal, Discount (percent or fixed), Tax (per-line tax_rate on the discounted share) and Amount = total, computed in integer cents with the same rounding as CoinPay's computeInvoiceTotals. The new invoiceTotals is exported.
  • Ambiguous input shows Amount: see details plus the raw line items or arguments, never a guessed number. That covers unusable items or discount, a discount bigger than the subtotal, an amount that disagrees with the items, and an amount next to a discount or tax when there are no line items.

Tests cover percent discounts, fixed discounts, tax, no line items, nested adjustment values and the ambiguous cases. All 44 pass.

🤖 Generated with Claude Code

…ount value as the amount

describeAction for a CoinPay draft invoice with lineItems [{quantity: 2,
unit_price: 150}] and discount {type: percent, value: 10} printed
"Amount 10": pick() fell through to the nested discount.value.

- pick() no longer descends into discount/tax/fee-like objects.
- Itemised invoices: subtotal, discount (percent or fixed), per-line tax
  on the discounted share, and the total, in integer cents with CoinPay's
  rounding (invoiceTotals, exported).
- When the amount cannot be pinned down (unusable items or discount, a
  discount over the subtotal, an amount that disagrees with the items, or
  an amount next to a discount/tax with no items) the card says
  "see details" and shows the raw line items or arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

0 finding(s)

No findings.

@ralyodio
ralyodio merged commit ac650b0 into main Nov 23, 2026
3 checks passed
ralyodio added a commit to InfernetProtocol/infernet-protocol that referenced this pull request Nov 23, 2026
…otal discount and tax (#256)

0.2.1 backports the 0.3.2 fix (profullstack/chat-plugins#6): a CoinPay
draft invoice with a 10% discount showed the discount value (10) as the
Amount. The card now shows Subtotal, Discount, Tax and the total, or
"see details" with the raw line items when the amount is ambiguous.

Co-authored-by: riotcoder <riotcoder@profullstack.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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