Problem
ConvertFrom-ReceiptFileName currently enforces that all non-Cash methods must include an account number:
if ($method -ne 'Cash' -and $account -eq '') {
return (& $fail "Could not parse filename")
}
This prevents valid filenames such as:
yyMMdd Vendor $Amount Card
from being parsed successfully, even though the ADR defines Method and Account as optional.
As a result:
- Users must use placeholders like
"----" for unknown accounts
- Parsing logic is enforcing a business rule that should instead be handled by flagging
- This creates inconsistency with how
Cash is handled
Proposed Solution
Remove the requirement that non-Cash methods must include an account number in ConvertFrom-ReceiptFileName.
Allow parsing of filenames where:
- A valid method is present
- The account is omitted
Update Get-ReceiptFlag to treat:
- Non-
Cash methods with empty account ("") as "Account unknown"
Cash with empty account as valid (no flag)
This preserves separation of concerns:
- Parsing validates structure and token correctness
- Flagging handles completeness and data quality
Acceptance Criteria
- Filenames like
yyMMdd Vendor $Amount Card parse successfully (OK = $true)
- Returned object includes:
Method = "Card"
Account = ""
Get-ReceiptFlag returns "Account unknown" for non-Cash methods with empty account
Cash with no account does not produce a flag
- Existing behavior for:
"xxxx" → "Account obfuscated"
"----" → "Account unknown"
remains unchanged
- No regression in parsing or validation for existing valid filenames
Problem
ConvertFrom-ReceiptFileNamecurrently enforces that all non-Cashmethods must include an account number:This prevents valid filenames such as:
from being parsed successfully, even though the ADR defines
MethodandAccountas optional.As a result:
"----"for unknown accountsCashis handledProposed Solution
Remove the requirement that non-
Cashmethods must include an account number inConvertFrom-ReceiptFileName.Allow parsing of filenames where:
Update
Get-ReceiptFlagto treat:Cashmethods with empty account ("") as"Account unknown"Cashwith empty account as valid (no flag)This preserves separation of concerns:
Acceptance Criteria
yyMMdd Vendor $Amount Cardparse successfully (OK = $true)Method = "Card"Account = ""Get-ReceiptFlagreturns"Account unknown"for non-Cashmethods with empty accountCashwith no account does not produce a flag"xxxx"→"Account obfuscated""----"→"Account unknown"remains unchanged