Skip to content
Merged
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
3 changes: 2 additions & 1 deletion packages/backend/src/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ export const Config = {
false
),
cardServiceUrl: optional(envString, 'CARD_SERVICE_URL'),
posServiceUrl: optional(envString, 'POS_SERVICE_URL')
posServiceUrl: optional(envString, 'POS_SERVICE_URL'),
posWebhookServiceUrl: optional(envString, 'POS_WEBHOOK_SERVICE_URL')
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ describe('Incoming Payment Service', (): void => {
'Creates webhook event for POS service if card payment',
withConfigOverride(
() => config,
{ posServiceUrl: faker.internet.url() },
{ posWebhookServiceUrl: faker.internet.url() },
async (): Promise<void> => {
await expect(
IncomingPaymentEvent.query(knex).where({
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/webhook/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ describe('Webhook Service', (): void => {
'adds webhooks for POS service if event was for a card payment',
withConfigOverride(
() => config,
{ posServiceUrl: faker.internet.url() },
{ posWebhookServiceUrl: faker.internet.url() },
async (): Promise<void> => {
const tenantId = crypto.randomUUID()
expect(
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/webhook/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async function processNextWebhook(

if (webhook.metadata?.sendToPosService) {
await sendWebhook(deps, webhook, {
webhookUrl: `${deps.config.posServiceUrl}/webhook`
webhookUrl: deps.config.posWebhookServiceUrl
})
} else {
const settings = await deps_.tenantSettingService.get({
Expand Down Expand Up @@ -316,7 +316,7 @@ export function finalizeWebhookRecipients(

if (
initiationReason === IncomingPaymentInitiationReason.Card &&
config.posServiceUrl
config.posWebhookServiceUrl
) {
recipients = recipients.concat([
{
Expand All @@ -328,7 +328,7 @@ export function finalizeWebhookRecipients(
])
} else if (
initiationReason === IncomingPaymentInitiationReason.Card &&
!config.posServiceUrl
!config.posWebhookServiceUrl
) {
logger?.warn('Could not create webhook recipient for point of sale service')
}
Expand Down
Loading