Merge branch 'develop' into MED-97
This commit is contained in:
@@ -34,8 +34,15 @@ export default function MontonioCallbackClient({
|
||||
setHasProcessed(true);
|
||||
|
||||
try {
|
||||
const { orderId } = await processMontonioCallback(orderToken);
|
||||
router.push(`/home/order/${orderId}/confirmed`);
|
||||
const result = await processMontonioCallback(orderToken);
|
||||
if (result.success) {
|
||||
return router.push(`/home/order/${result.orderId}/confirmed`);
|
||||
}
|
||||
if (result.failedServiceBookings?.length) {
|
||||
router.push(
|
||||
`/home/cart/montonio-callback/error?reasonFailed=${result.failedServiceBookings.map(({ reason }) => reason).join(',')}`,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to place order', error);
|
||||
router.push('/home/cart/montonio-callback/error');
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { use } from 'react';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
import { createI18nServerInstance } from '@/lib/i18n/i18n.server';
|
||||
import { PageBody, PageHeader } from '@/packages/ui/src/makerkit/page';
|
||||
|
||||
import { toArray } from '@kit/shared/utils';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { Alert, AlertDescription } from '@kit/ui/shadcn/alert';
|
||||
import { AlertTitle } from '@kit/ui/shadcn/alert';
|
||||
@@ -16,7 +19,15 @@ export async function generateMetadata() {
|
||||
};
|
||||
}
|
||||
|
||||
export default async function MontonioCheckoutCallbackErrorPage() {
|
||||
export default async function MontonioCheckoutCallbackErrorPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ reasonFailed: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
|
||||
const failedBookingData: string[] = toArray(params.reasonFailed?.split(','));
|
||||
|
||||
return (
|
||||
<div className={'flex h-full flex-1 flex-col'}>
|
||||
<PageHeader title={<Trans i18nKey="cart:montonioCallback.title" />} />
|
||||
@@ -28,9 +39,15 @@ export default async function MontonioCheckoutCallbackErrorPage() {
|
||||
</AlertTitle>
|
||||
|
||||
<AlertDescription>
|
||||
<p>
|
||||
{failedBookingData.length ? (
|
||||
failedBookingData.map((failureReason, index) => (
|
||||
<p key={index}>
|
||||
<Trans i18nKey={`checkout.error.${failureReason}`} />
|
||||
</p>
|
||||
))
|
||||
) : (
|
||||
<Trans i18nKey={'checkout.error.description'} />
|
||||
</p>
|
||||
)}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user