WIP 1.51.11: money on v2 via v1 handlers (viaV1 adapter)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
2026-10-29 13:43:36 +02:00
co-authored by Claude Opus 5.5
parent a45417948d
commit 6ee1438e23
36 changed files with 10334 additions and 154 deletions
+4 -3
View File
@@ -3,8 +3,9 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
import { useParams } from "next/navigation";
import { Navbar } from "@/components/layout/Navbar";
import { Footer } from "@/components/layout/Footer";
import { apiFetch, ApiError } from "@/lib/api";
import { ApiError } from "@/lib/api";
import { CreditCard } from "lucide-react";
import { apiV2Data } from "@/lib/apiV2";
type ProviderForm = { action: string; fields: Record<string, string> };
type PayPage = {
@@ -40,7 +41,7 @@ export default function PayPage() {
useEffect(() => {
if (!id) return;
apiFetch<PayPage>(`/api/payments/pay/${encodeURIComponent(id)}`)
(apiV2Data("get", "/payment-links/{id}", { params: { id: id } }) as Promise<PayPage>)
.then(p => {
setPage(p);
if (p.status === "open") go(p);
@@ -56,7 +57,7 @@ export default function PayPage() {
setBusy(provider);
setError(null);
try {
go(await apiFetch<{ redirectUrl: string | null; form: ProviderForm | null }>(`/api/payments/pay/${encodeURIComponent(id)}`, { method: "POST", body: { provider } }));
go(await (apiV2Data("post", "/payment-links/{id}", { params: { id: id }, body: { provider } }) as Promise<{ redirectUrl: string | null; form: ProviderForm | null }>));
} catch (e) {
setError(e instanceof ApiError ? e.message : "Couldn't start the payment. Please try again.");
setBusy(null);