From 9f4d89a6a69e215a7415239ba7dbeab20014ed90 Mon Sep 17 00:00:00 2001 From: Nghia Tran Date: Fri, 19 Jul 2024 13:36:53 +0700 Subject: [PATCH] Fix: Always use default connector webhook --- processor/src/utils/map.utils.ts | 2 +- processor/tests/utils/map.utils.spec.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/processor/src/utils/map.utils.ts b/processor/src/utils/map.utils.ts index 197c3fc..f865ab2 100644 --- a/processor/src/utils/map.utils.ts +++ b/processor/src/utils/map.utils.ts @@ -95,7 +95,7 @@ export const createMollieCreatePaymentParams = (payment: Payment): PaymentCreate description: paymentRequest.description ?? '', amount: makeMollieAmount(amountPlanned), redirectUrl: paymentRequest.redirectUrl ?? null, - webhookUrl: paymentRequest.webhookUrl ?? defaultWebhookEndpoint, + webhookUrl: defaultWebhookEndpoint, billingAddress: paymentRequest.billingAddress ?? {}, shippingAddress: paymentRequest.shippingAddress ?? {}, locale: paymentRequest.locale ?? null, diff --git a/processor/tests/utils/map.utils.spec.ts b/processor/tests/utils/map.utils.spec.ts index e26d4c0..980aa98 100644 --- a/processor/tests/utils/map.utils.spec.ts +++ b/processor/tests/utils/map.utils.spec.ts @@ -139,6 +139,9 @@ describe('createMollieCreatePaymentParams', () => { }; const mollieCreatePaymentParams = createMollieCreatePaymentParams(CTPayment); + // Always use our default webhook endpoint + const defaultWebhookEndpoint = new URL(process.env.CONNECT_SERVICE_URL ?? '').origin + '/webhook'; + expect(mollieCreatePaymentParams).toEqual({ method: 'creditcard', amount: { @@ -147,7 +150,7 @@ describe('createMollieCreatePaymentParams', () => { }, locale: customFieldObject.locale, redirectUrl: customFieldObject.redirectUrl, - webhookUrl: customFieldObject.webhookUrl, + webhookUrl: defaultWebhookEndpoint, description: customFieldObject.description, applicationFee: {}, billingAddress: {},