Skip to content

Expose the credit card merchant as a separate field - #590

Open
jwtue wants to merge 1 commit into
nemiah:masterfrom
jwtue:feature/creditcard-merchant-accessor
Open

Expose the credit card merchant as a separate field#590
jwtue wants to merge 1 commit into
nemiah:masterfrom
jwtue:feature/creditcard-merchant-accessor

Conversation

@jwtue

@jwtue jwtue commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #574. GetCreditCardStatement exposes the Verwendungszweck only through
getPurpose(), which joins all lines into a single string: the merchant name together with the
merchant location and the masked card number, e.g. EXAMPLE SHOP BERLIN 555500******2233.

That string is a poor counterparty name. The same merchant yields a different purpose per location
and per card, so anything that groups by counterparty — for instance naming an expense account in a
bookkeeping tool — fragments one merchant into many.

$statement = $getTransactions->getStatement();
foreach ($statement->getTransactions() as $tx) {
    $tx->getMerchant();      // "EXAMPLE SHOP"
    $tx->getPurpose();       // "EXAMPLE SHOP BERLIN 555500******2233"
    $tx->getPurposeLines();  // ["EXAMPLE SHOP", "BERLIN 555500******2233"]
}

Changes:

  • Keep the individual Verwendungszweck lines on CreditCardTransaction instead of discarding them
    after joining
  • Add getPurposeLines() (the lines) and getMerchant() (the first line, usually the merchant)
  • getPurpose() is unchanged, so this is backwards compatible

getMerchant() returns the first line verbatim. For bookings without a merchant, such as the monthly
settlement, that is the descriptive text the bank places there (e.g. Ausgleich Kreditkartenabrechnung); it is null only when the record carries no Verwendungszweck at all. The
existing testMapsToModel fixture is extended to cover both the merchant and the settlement case.

Developed with the assistance of Claude Code. The field semantics above were checked against the
DKKKU test fixtures introduced in #574, which mirror real BW-Bank/LBBW responses.

GetCreditCardStatement so far exposed the Verwendungszweck only as a single
joined string via getPurpose(), which concatenates the merchant name with the
merchant location and the masked card number. That string is unsuitable as a
counterparty name, because the same merchant yields a different purpose per
location and per card.

Keep the individual Verwendungszweck lines on CreditCardTransaction and add
getPurposeLines() plus getMerchant() (the first line, usually the merchant).
getPurpose() is unchanged.
@jwtue
jwtue marked this pull request as ready for review September 7, 2026 11:16
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