Commit 91f5e1c
authored
refactor: update current account domain model for instrument-based quantities (#1213)
* refactor: update current account domain model for instrument-based quantities
- Add instrumentCode and dimension fields with accessors InstrumentCode(), Dimension()
- Rename accountIdentification to externalIdentifier; add ExternalIdentifier() accessor
- Keep AccountIdentification() as deprecated alias for backward compatibility
- Remove overdraft fields and methods (overdraftLimit, overdraftEnabled, overdraftRate,
SetOverdraftLimit, UpdateOverdraftSettings); overdraft is now product-type behavior
- Update NewCurrentAccount() constructor: currency string replaced by instrumentCode, dimension
- Add NewCurrentAccountWithDimension() for explicit dimension specification
- Update CurrentAccountBuilder with WithInstrumentCode(), WithDimension(), WithExternalIdentifier()
- Update persistence layer: toDomain/toEntity use new fields, zero-out legacy overdraft columns
- Update service layer: remove overdraft logic, use ExternalIdentifier() and InstrumentCode()
- Update all saga orchestrators to use account.ExternalIdentifier() in saga inputs
* fix: address CodeRabbit review findings in current account domain model
- Clarify NewCurrentAccountWithDimension docstring: CURRENCY-only constraint is
intentional for now (enforced by NewMoneyFromInstrument); non-currency support
is deferred pending Money type generalisation in later tasks
- Handle Compare error explicitly in PrepareForDebit and Withdraw instead of
discarding with blank identifier; error is unreachable (currency already verified)
but should not be silently swallowed
* fix: address second round of CodeRabbit review findings
- Fix NewCurrentAccount docblock: remove stale dimension parameter mention;
document that dimension defaults to CURRENCY
- Normalize dimension to uppercase in NewCurrentAccountWithDimension so
Dimension() always returns canonical form (e.g. "currency" → "CURRENCY")
- Normalize dimension to uppercase in CurrentAccountBuilder.WithDimension
for consistency
* docs: tighten current account domain comments to reflect CURRENCY-only constraint
Remove kWh/ELECTRICITY examples from InstrumentCode, Dimension, and WithDimension
docstrings; update inline docs to clearly state that only CURRENCY dimension is
currently supported, avoiding misleading callers about non-currency capabilities
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 45647e6 commit 91f5e1c
10 files changed
Lines changed: 298 additions & 596 deletions
File tree
- services/current-account
- adapters/persistence
- domain
- service
Lines changed: 10 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
664 | | - | |
665 | | - | |
| 664 | + | |
| 665 | + | |
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
682 | 681 | | |
683 | 682 | | |
684 | 683 | | |
| |||
695 | 694 | | |
696 | 695 | | |
697 | 696 | | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | 697 | | |
707 | 698 | | |
708 | 699 | | |
| |||
744 | 735 | | |
745 | 736 | | |
746 | 737 | | |
747 | | - | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
748 | 741 | | |
749 | 742 | | |
750 | 743 | | |
751 | 744 | | |
752 | 745 | | |
753 | 746 | | |
754 | 747 | | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | 748 | | |
759 | 749 | | |
760 | 750 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
| 210 | + | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
0 commit comments