feat(MED-85): update webhook url to have public path in test env

This commit is contained in:
2025-07-31 12:02:01 +03:00
parent 23a07658c9
commit 2caf847296
3 changed files with 10 additions and 6 deletions

View File

@@ -8,14 +8,14 @@ import { StoreCartLineItem, StoreProductVariant } from '@medusajs/types';
import { MontonioOrderHandlerService } from '@/packages/billing/montonio/src';
import { requireUserInServerComponent } from '../server/require-user-in-server-component';
const medusaBackendUrl = process.env.MEDUSA_BACKEND_URL!;
const medusaBackendPublicUrl = process.env.MEDUSA_BACKEND_PUBLIC_URL!;
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL!;
const env = z
.object({
medusaBackendUrl: z
medusaBackendPublicUrl: z
.string({
required_error: 'MEDUSA_BACKEND_URL is required',
required_error: 'MEDUSA_BACKEND_PUBLIC_URL is required',
})
.min(1),
siteUrl: z
@@ -25,7 +25,7 @@ const env = z
.min(1),
})
.parse({
medusaBackendUrl,
medusaBackendPublicUrl,
siteUrl,
});
@@ -81,7 +81,7 @@ export async function handleNavigateToPayment({ language, paymentSessionId }: {
}
const paymentLink = await new MontonioOrderHandlerService().getMontonioPaymentLink({
notificationUrl: `${env.medusaBackendUrl}/api/billing/webhook`,
notificationUrl: `${env.medusaBackendPublicUrl}/hooks/payment/montonio_montonio`,
returnUrl: `${env.siteUrl}/home/cart/montonio-callback`,
amount: cart.total,
currency: cart.currency_code.toUpperCase(),