From f8a714ddfe388f853dfe19ac03e2d4e54fe6d5ef Mon Sep 17 00:00:00 2001 From: scx1332 Date: Tue, 23 Jul 2024 11:57:37 +0200 Subject: [PATCH] feature: allow filter to ignore debit notes (for integration testing) --- src/payment/agreement_payment_process.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/payment/agreement_payment_process.ts b/src/payment/agreement_payment_process.ts index f91ae739c..8cc6a1347 100644 --- a/src/payment/agreement_payment_process.ts +++ b/src/payment/agreement_payment_process.ts @@ -136,7 +136,7 @@ export class AgreementPaymentProcess { this.debitNotes.set(debitNote.id, debitNote); - let acceptedByFilter = false; + let acceptedByFilter: boolean = false; try { acceptedByFilter = await this.options.debitNoteFilter(debitNote, { agreement: this.agreement, @@ -144,6 +144,10 @@ export class AgreementPaymentProcess { demand: this.agreement.demand, }); } catch (error) { + if (error == "ignore debit note") { + // This is a special case when the filter wants to ignore the debit note + return false; + } throw new GolemUserError("An error occurred in the debit note filter", error); }