refactor: 微信支付命名从 Native 改为 PC扫码,统一术语
- WxpayNativeOrderParams → WxpayPcOrderParams - createNativeOrder → createPcOrder - 文档注释统一为「PC扫码 / H5」
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import WxPay from 'wechatpay-node-v3';
|
||||
import { getEnv } from '@/lib/config';
|
||||
import type { WxpayNativeOrderParams, WxpayH5OrderParams, WxpayRefundParams } from './types';
|
||||
import type { WxpayPcOrderParams, WxpayH5OrderParams, WxpayRefundParams } from './types';
|
||||
|
||||
const BASE_URL = 'https://api.mch.weixin.qq.com';
|
||||
|
||||
@@ -76,7 +76,8 @@ async function request<T>(method: string, url: string, body?: Record<string, unk
|
||||
return data as T;
|
||||
}
|
||||
|
||||
export async function createNativeOrder(params: WxpayNativeOrderParams): Promise<string> {
|
||||
/** PC 扫码支付(微信官方 API: /v3/pay/transactions/native) */
|
||||
export async function createPcOrder(params: WxpayPcOrderParams): Promise<string> {
|
||||
const env = assertWxpayEnv(getEnv());
|
||||
const result = await request<{ code_url: string }>('POST', '/v3/pay/transactions/native', {
|
||||
appid: env.WXPAY_APP_ID,
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
RefundResponse,
|
||||
} from '@/lib/payment/types';
|
||||
import {
|
||||
createNativeOrder,
|
||||
createPcOrder,
|
||||
createH5Order,
|
||||
queryOrder,
|
||||
closeOrder,
|
||||
@@ -49,7 +49,7 @@ export class WxpayProvider implements PaymentProvider {
|
||||
return { tradeNo: request.orderId, payUrl: h5Url };
|
||||
}
|
||||
|
||||
const codeUrl = await createNativeOrder({
|
||||
const codeUrl = await createPcOrder({
|
||||
out_trade_no: request.orderId,
|
||||
description: request.subject,
|
||||
notify_url: notifyUrl,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export interface WxpayNativeOrderParams {
|
||||
export interface WxpayPcOrderParams {
|
||||
out_trade_no: string;
|
||||
description: string;
|
||||
notify_url: string;
|
||||
|
||||
Reference in New Issue
Block a user