This commit is contained in:
eric
2026-04-02 00:29:36 -05:00
parent de86a65293
commit 180e81e090
2 changed files with 9 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ export type XorPayStatusResult = {
status?: string;
error?: string;
url: string;
/** 网关返回的实付金额(元),有则用于换算分;无则由调用方回退默认金额 */
pay_price?: string | number | null;
};
function buildXorPaySign(orderId: string): string {
@@ -55,6 +57,7 @@ export async function queryXorPayOrderStatus(
status,
url: url.toString(),
error: res.ok ? undefined : `status=${res.status}`,
pay_price: data?.pay_price ?? data?.price ?? null,
};
} catch (error) {
return {

View File

@@ -12,6 +12,8 @@ export type ZPayStatusResult = {
status?: string;
error?: string;
url: string;
/** 网关返回的实付金额(元),字段名因接口而异 */
pay_price?: string | number | null;
};
export async function queryZPayOrderStatus(
@@ -38,6 +40,9 @@ export async function queryZPayOrderStatus(
const code = String(data?.code || "").trim();
const status = String(data?.status || "").trim();
const payPrice =
data?.pay_price ?? data?.money ?? data?.price ?? data?.amount ?? null;
return {
ok: res.ok,
paid: res.ok && code === "1" && status === "1",
@@ -47,6 +52,7 @@ export async function queryZPayOrderStatus(
res.ok && code === "1"
? undefined
: String(data?.msg || `status=${res.status}`),
pay_price: payPrice,
};
} catch (error) {
return {