Skip to content

Commit

Permalink
Grab payee name for Abanca gocardless integration (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
daca11 authored Jun 8, 2024
1 parent aa22e69 commit 1af5ab0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/app-gocardless/bank-factory.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import AbancaCaglesmm from './banks/abanca-caglesmm.js';
import AmericanExpressAesudef1 from './banks/american-express-aesudef1.js';
import BankinterBkbkesmm from './banks/bankinter-bkbkesmm.js';
import Belfius from './banks/belfius_gkccbebb.js';
Expand All @@ -16,6 +17,7 @@ import SpkMarburgBiedenkopfHeladef1mar from './banks/spk-marburg-biedenkopf-hela
import SpkKarlsruhekarsde66 from './banks/spk-karlsruhe-karsde66.js';

export const banks = [
AbancaCaglesmm,
AmericanExpressAesudef1,
BankinterBkbkesmm,
Belfius,
Expand Down
20 changes: 20 additions & 0 deletions src/app-gocardless/banks/abanca-caglesmm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Fallback from './integration-bank.js';

/** @type {import('./bank.interface.js').IBank} */
export default {
...Fallback,

institutionIds: ['ABANCA_CAGLESMM'],

accessValidForDays: 180,

// Abanca transactions doesn't get the creditorName/debtorName properly
normalizeTransaction(transaction, _booked) {
return {
...transaction,
creditorName: transaction.remittanceInformationStructured,
debtorName: transaction.remittanceInformationStructured,
date: transaction.bookingDate || transaction.valueDate,
};
},
};
25 changes: 25 additions & 0 deletions src/app-gocardless/banks/tests/abanca-caglesmm.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Abanca from '../abanca-caglesmm.js';
import { mockTransactionAmount } from '../../services/tests/fixtures.js';

describe('Abanca', () => {
describe('#normalizeTransaction', () => {
it('returns the creditorName and debtorName as remittanceInformationStructured', () => {
const transaction = {
transactionId: 'non-unique-id',
internalTransactionId: 'D202301180000003',
transactionAmount: mockTransactionAmount,
remittanceInformationStructured: 'some-creditor-name',
};
const normalizedTransaction = Abanca.normalizeTransaction(
transaction,
true,
);
expect(normalizedTransaction.creditorName).toEqual(
transaction.remittanceInformationStructured,
);
expect(normalizedTransaction.debtorName).toEqual(
transaction.remittanceInformationStructured,
);
});
});
});
6 changes: 6 additions & 0 deletions upcoming-release-notes/359.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [daca11]
---

Get creditorName and debtorName from remittanceInformationStructured for ABANCA_CAGLESMM

0 comments on commit 1af5ab0

Please sign in to comment.