Skip to content

🐛 Stop counting card repayments twice in safe to spend - #1295

Merged
willscottuk merged 2 commits into
devfrom
claude/project-thread-xditjj
Nov 1, 2026
Merged

willscottuk merged 2 commits into
devfrom
claude/project-thread-xditjj

Conversation

@willscottuk

Copy link
Copy Markdown
Contributor

Requested by Will · project thread

Why

Safe to spend took off the American Express direct debit as a bill, on top of what card cover says the card owes. On 1 Nov that came to £4,886.62 owed on British Airways Premium Plus (spending since the 7 Oct statement). On top of that, the £9,621.74 "American Express" debit due 21 Nov was also taken off. The 21 Nov debit pays the statement that closes on 7 Nov, which is the same spending. So it was counted twice, and safe to spend read about £9,600 lower than it should.

What changes

  • Card payments come out of the bills. UpcomingBills leaves out any direct debit whose payee matches a credit card's issuer (metadata.provider) or name. These now go in a new card_payments list, which SafeToSpend passes through. upcoming_bills and amount no longer include them. Clients that don't read the new key are unaffected.
  • Names sent in capitals are title-cased for display. App\Support\MerchantName::display changes "AMERICAN EXPRESS" to "American Express" and "SAINSBURY'S S/MKTS" to "Sainsbury's S/Mkts".
    • Names that have any lower-case letters are left as they are, so "eBay" and "McDonald's" survive.
    • Short words with no vowels stay in capitals, so "TFL" and "LTD" are unchanged.
    • It is applied to spending merchants and bill payees. Stored titles are not changed, and budget matching already compares in lower case.

Testing

  • New tests:
    • SafeToSpendTest::a_direct_debit_that_pays_a_credit_card_is_not_counted_twice;
    • MerchantNameTest, which covers the casing rules.
  • Not run locally. composer install can't reach the private wire-elements-pro package host from this container. I checked the casing helper by hand, with the results above, and checked syntax with php -l. CI is the first full run.

Generated by Claude Code

A direct debit that pays one of the user's credit cards was taken off as
a bill on top of what card cover says the card owes, so the same money
came off twice. Such debits are now left out of the bills and listed in
card_payments instead.

Merchant and payee names sent in capitals are title-cased for display in
spending and bills, leaving names the merchant cased itself alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C1jkrANqELbkXC4ibM62v1
@willscottuk
willscottuk merged commit dfaf65c into dev Nov 1, 2026
3 checks passed
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0-dev.436 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

This branch was successfully deployed

1 active deployment
CI — 70ed12c8 Deployed Nov 1, 2026 by github-actions[bot] via ci #7940
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants