Skip to content

Commit ff64215

Browse files
ezefrd-mdkEzequiel Fridman
authored andcommitted
MDK-424: app-health dashboard surface — banner, settings card, test-ping (#822)
* MDK-424-S5: dashboard healthcheck * MDK-424:fixing rebase issues * MDK-424: ci exemption for app.mode * MDK-424: fix banner when apps it's in sandbox without failed webhook checks * MDK-424: added e2e missed from PR 3 and for current PR 5 * MDK-424:fixes, removed CI check over app.mode and fix integration tests * MDK-424: adding more e2e * MDK-424: fix for some e2e --------- Co-authored-by: Ezequiel Fridman <ezefridman@Ezequiels-MacBook-Pro.local>
1 parent 4249161 commit ff64215

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { createCheckout, type CreateCheckoutParams } from '@moneydevkit/core';
2+
import { NextRequest, NextResponse } from 'next/server';
3+
4+
function isEnabled() {
5+
return process.env.MDK_DEMO_E2E_ENABLED === 'true';
6+
}
7+
8+
function notFound() {
9+
return new Response(null, { status: 404 });
10+
}
11+
12+
export async function POST(request: NextRequest) {
13+
if (!isEnabled()) return notFound();
14+
15+
const body = (await request.json()) as CreateCheckoutParams;
16+
const result = await createCheckout({
17+
...body,
18+
checkoutPath: body.checkoutPath ?? '/checkout',
19+
});
20+
21+
if (result.error) {
22+
return NextResponse.json({ error: result.error }, { status: result.error.status ?? 400 });
23+
}
24+
25+
return NextResponse.json({ checkout: result.data.checkout });
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { getCheckout } from '@moneydevkit/core';
2+
import { NextRequest, NextResponse } from 'next/server';
3+
4+
function isEnabled() {
5+
return process.env.MDK_DEMO_E2E_ENABLED === 'true';
6+
}
7+
8+
function notFound() {
9+
return new Response(null, { status: 404 });
10+
}
11+
12+
export async function GET(request: NextRequest) {
13+
if (!isEnabled()) return notFound();
14+
15+
const checkoutId = request.nextUrl.searchParams.get('id') ?? request.nextUrl.searchParams.get('checkoutId');
16+
if (!checkoutId) {
17+
return NextResponse.json({ error: 'checkoutId is required' }, { status: 400 });
18+
}
19+
20+
try {
21+
const checkout = await getCheckout(checkoutId);
22+
return NextResponse.json({ checkout });
23+
} catch (error) {
24+
const message = error instanceof Error ? error.message : 'Failed to fetch checkout';
25+
return NextResponse.json({ error: message }, { status: 500 });
26+
}
27+
}

0 commit comments

Comments
 (0)