微信SDK接通
This commit is contained in:
@@ -4,6 +4,9 @@ export interface AppConfig {
|
||||
mockPay: boolean;
|
||||
mockDeliveryAuto: boolean;
|
||||
autoApproveStore: boolean;
|
||||
wechatAuthEnabled: boolean;
|
||||
wechatPayEnabled: boolean;
|
||||
wxAppId: string;
|
||||
}
|
||||
|
||||
export function loadAppConfig(env?: Record<string, string | undefined>): AppConfig {
|
||||
@@ -17,5 +20,8 @@ export function loadAppConfig(env?: Record<string, string | undefined>): AppConf
|
||||
mockPay: e.MOCK_PAY !== 'false',
|
||||
mockDeliveryAuto: e.MOCK_DELIVERY_AUTO !== 'false',
|
||||
autoApproveStore: e.AUTO_APPROVE_STORE !== 'false',
|
||||
wechatAuthEnabled: e.WECHAT_AUTH_ENABLED === 'true',
|
||||
wechatPayEnabled: e.WECHAT_PAY_ENABLED === 'true' || e.MOCK_PAY === 'false',
|
||||
wxAppId: e.WX_APP_ID ?? '',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './enums';
|
||||
export * from './api';
|
||||
export * from './config';
|
||||
export * from './wechat';
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/** 微信 JSSDK 初始化参数(后端签名下发) */
|
||||
export interface WechatJssdkConfig {
|
||||
appId: string;
|
||||
timestamp: number;
|
||||
nonceStr: string;
|
||||
signature: string;
|
||||
jsApiList: string[];
|
||||
}
|
||||
|
||||
/** JSAPI 调起支付参数 */
|
||||
export interface WechatJsapiPrepayParams {
|
||||
appId: string;
|
||||
timeStamp: string;
|
||||
nonceStr: string;
|
||||
package: string;
|
||||
signType: 'RSA' | 'MD5';
|
||||
paySign: string;
|
||||
}
|
||||
|
||||
export type WechatPayOrderResult =
|
||||
| { mode: 'mock'; externalNo: string; order?: Record<string, unknown> }
|
||||
| { mode: 'jsapi'; prepay: WechatJsapiPrepayParams; orderId: string };
|
||||
|
||||
export interface WechatLoginResult {
|
||||
accessToken?: string;
|
||||
refreshToken?: string;
|
||||
deviceKey?: string;
|
||||
actorType?: string;
|
||||
actorId?: string;
|
||||
phoneVerified?: boolean;
|
||||
needBindPhone?: boolean;
|
||||
wxSessionKey?: string;
|
||||
user?: Record<string, unknown>;
|
||||
store?: Record<string, unknown>;
|
||||
partner?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export type WechatLoginPlatform = 'h5' | 'mini';
|
||||
|
||||
export interface WechatGpsLocation {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
speed?: number;
|
||||
accuracy?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user