Skip to content

feat(convert-receipt): allow non-cash methods without account number #149

Description

@ndomako10

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions