's'
This commit is contained in:
@@ -15,6 +15,8 @@ export type XorPayStatusResult = {
|
|||||||
status?: string;
|
status?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
/** 网关返回的实付金额(元),有则用于换算分;无则由调用方回退默认金额 */
|
||||||
|
pay_price?: string | number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
function buildXorPaySign(orderId: string): string {
|
function buildXorPaySign(orderId: string): string {
|
||||||
@@ -55,6 +57,7 @@ export async function queryXorPayOrderStatus(
|
|||||||
status,
|
status,
|
||||||
url: url.toString(),
|
url: url.toString(),
|
||||||
error: res.ok ? undefined : `status=${res.status}`,
|
error: res.ok ? undefined : `status=${res.status}`,
|
||||||
|
pay_price: data?.pay_price ?? data?.price ?? null,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export type ZPayStatusResult = {
|
|||||||
status?: string;
|
status?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
/** 网关返回的实付金额(元),字段名因接口而异 */
|
||||||
|
pay_price?: string | number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function queryZPayOrderStatus(
|
export async function queryZPayOrderStatus(
|
||||||
@@ -38,6 +40,9 @@ export async function queryZPayOrderStatus(
|
|||||||
const code = String(data?.code || "").trim();
|
const code = String(data?.code || "").trim();
|
||||||
const status = String(data?.status || "").trim();
|
const status = String(data?.status || "").trim();
|
||||||
|
|
||||||
|
const payPrice =
|
||||||
|
data?.pay_price ?? data?.money ?? data?.price ?? data?.amount ?? null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ok: res.ok,
|
ok: res.ok,
|
||||||
paid: res.ok && code === "1" && status === "1",
|
paid: res.ok && code === "1" && status === "1",
|
||||||
@@ -47,6 +52,7 @@ export async function queryZPayOrderStatus(
|
|||||||
res.ok && code === "1"
|
res.ok && code === "1"
|
||||||
? undefined
|
? undefined
|
||||||
: String(data?.msg || `status=${res.status}`),
|
: String(data?.msg || `status=${res.status}`),
|
||||||
|
pay_price: payPrice,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user