Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

[WIP] Attempt to improve ABN parsing #540

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app-gocardless/banks/abnamro_abnanl2a.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
// Remove clutter to extract the payee from remittanceInformationUnstructured ...
// ... when not otherwise provided.
const payeeName = transaction.remittanceInformationUnstructuredArray
.map((el) => el.match(/^(?:.*\*)?(.+),PAS\d+$/))
.map((el) => el.match(/^(?:((Google|Apple) Pay)?.*\*)?(.+),PAS\d+$/))
.find((match) => match)?.[1];
transaction.debtorName = transaction.debtorName || payeeName;
transaction.creditorName = transaction.creditorName || payeeName;
Expand Down
28 changes: 28 additions & 0 deletions src/app-gocardless/banks/tests/abnamro_abnanl2a.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,33 @@
);
expect(normalizedTransaction.payeeName).toEqual('Other Payee Name');
});
it('correctly extracts the payee for Apple Pay without CCV*', () => {
const transaction = {
transactionId: '0123456789012345',
bookingDate: '2023-12-11',
valueDateTime: '2023-12-09T15:43:37.950',
transactionAmount: {
amount: '-10.00',
currency: 'EUR',
},
remittanceInformationUnstructuredArray: [
'BEA, Apple Pay',
'Other payee name,PAS123',
'NR:123A4B, 09.12.23/15:43',
'CITY',
],
};

const normalizedTransaction = AbnamroAbnanl2a.normalizeTransaction(
transaction,
false,
);

expect(normalizedTransaction.remittanceInformationUnstructured).toEqual(
'BEA, Apple Pay, Other payee name,PAS123, NR:123A4B, 09.12.23/15:43, CITY',
);
expect(normalizedTransaction.payeeName).toEqual('Other Payee Name');
});

Check failure on line 87 in src/app-gocardless/banks/tests/abnamro_abnanl2a.spec.js

View workflow job for this annotation

GitHub Actions / lint

Delete `⏎`
});
});
Loading