|
|
@@ -10,6 +10,9 @@ type PayRequestBody = {
|
|
|
goodIds?: string[] | string;
|
|
|
payName?: string;
|
|
|
payPhone?: string;
|
|
|
+ amount?: number | string;
|
|
|
+ code?: string;
|
|
|
+ bankCode?: string;
|
|
|
};
|
|
|
|
|
|
type Params = {
|
|
|
@@ -32,11 +35,26 @@ export async function POST(
|
|
|
? [body.goodIds.trim()]
|
|
|
: [];
|
|
|
|
|
|
- const upstreamBody = {
|
|
|
+ const amountRaw = body.amount;
|
|
|
+ const amount =
|
|
|
+ typeof amountRaw === "number" && Number.isFinite(amountRaw)
|
|
|
+ ? amountRaw
|
|
|
+ : typeof amountRaw === "string" && amountRaw.trim()
|
|
|
+ ? Number(amountRaw)
|
|
|
+ : undefined;
|
|
|
+
|
|
|
+ const upstreamBody: Record<string, unknown> = {
|
|
|
goodIds,
|
|
|
payName: typeof body.payName === "string" ? body.payName : "",
|
|
|
payPhone: typeof body.payPhone === "string" ? body.payPhone : "",
|
|
|
};
|
|
|
+ if (amount !== undefined && Number.isFinite(amount)) {
|
|
|
+ upstreamBody.amount = amount;
|
|
|
+ }
|
|
|
+ if (typeof body.code === "string" && body.code.trim()) upstreamBody.code = body.code.trim();
|
|
|
+ if (typeof body.bankCode === "string" && body.bankCode.trim()) {
|
|
|
+ upstreamBody.bankCode = body.bankCode.trim();
|
|
|
+ }
|
|
|
|
|
|
const accessToken = request.headers.get("access-token");
|
|
|
const authorization = request.headers.get("authorization");
|