From f8a714ddfe388f853dfe19ac03e2d4e54fe6d5ef Mon Sep 17 00:00:00 2001 From: scx1332 Date: Tue, 23 Jul 2024 11:57:37 +0200 Subject: [PATCH 1/4] 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); } From 620b3556df197ec5128c229a028ace6bc589ed06 Mon Sep 17 00:00:00 2001 From: scx1332 Date: Tue, 23 Jul 2024 12:04:03 +0200 Subject: [PATCH 2/4] feature: allow filter to ignore debit notes (for integration testing) --- src/payment/agreement_payment_process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payment/agreement_payment_process.ts b/src/payment/agreement_payment_process.ts index 8cc6a1347..ca616ebc8 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: boolean = false; + let acceptedByFilter = false; try { acceptedByFilter = await this.options.debitNoteFilter(debitNote, { agreement: this.agreement, From 64284a7a264dcc9adde720d222d124e303fd6c3f Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 24 Jul 2024 12:14:42 +0200 Subject: [PATCH 3/4] feature: allow filter to ignore debit notes (for integration testing) --- src/payment/agreement_payment_process.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/payment/agreement_payment_process.ts b/src/payment/agreement_payment_process.ts index ca616ebc8..3f9a09be6 100644 --- a/src/payment/agreement_payment_process.ts +++ b/src/payment/agreement_payment_process.ts @@ -146,6 +146,10 @@ export class AgreementPaymentProcess { } catch (error) { if (error == "ignore debit note") { // This is a special case when the filter wants to ignore the debit note + this.logger.debug(`DebitNote ignored`, { + debitNoteId: debitNote.id, + agreementId: debitNote.agreementId, + }); return false; } throw new GolemUserError("An error occurred in the debit note filter", error); From 87dea34fb73f1b0ad4391ea8ea8ae9141697864a Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 24 Jul 2024 12:51:44 +0200 Subject: [PATCH 4/4] fix --- src/payment/agreement_payment_process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/payment/agreement_payment_process.ts b/src/payment/agreement_payment_process.ts index 3f9a09be6..ed5c0eebb 100644 --- a/src/payment/agreement_payment_process.ts +++ b/src/payment/agreement_payment_process.ts @@ -144,7 +144,7 @@ export class AgreementPaymentProcess { demand: this.agreement.demand, }); } catch (error) { - if (error == "ignore debit note") { + if (error === "ignore debit note") { // This is a special case when the filter wants to ignore the debit note this.logger.debug(`DebitNote ignored`, { debitNoteId: debitNote.id,