Fix Pro payment recovery and wallet provider selection

This commit is contained in:
2569718930@qq.com
2026-03-21 12:19:53 +08:00
parent a19925fe7a
commit 4413b31396
7 changed files with 517 additions and 8 deletions
@@ -0,0 +1,39 @@
import { NextRequest, NextResponse } from "next/server";
import {
applyAuthResponseCookies,
buildBackendRequestHeaders,
} from "@/lib/backend-auth";
const API_BASE = process.env.POLYWEATHER_API_BASE_URL;
export async function POST(req: NextRequest) {
if (!API_BASE) {
return NextResponse.json(
{ error: "POLYWEATHER_API_BASE_URL is not configured" },
{ status: 500 },
);
}
try {
const auth = await buildBackendRequestHeaders(req);
const res = await fetch(`${API_BASE}/api/payments/reconcile-latest`, {
method: "POST",
headers: auth.headers,
cache: "no-store",
});
const raw = await res.text();
const response = new NextResponse(raw, {
status: res.status,
headers: {
"content-type":
res.headers.get("content-type") || "application/json; charset=utf-8",
},
});
return applyAuthResponseCookies(response, auth.response);
} catch (error) {
return NextResponse.json(
{ error: "Failed to reconcile latest payment", detail: String(error) },
{ status: 500 },
);
}
}