web 微信支付配置调整
This commit is contained in:
parent
263515c6f2
commit
c4823623ce
|
|
@ -83,8 +83,8 @@ const checkers = [
|
|||
}
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config;
|
||||
if (!wechat?.appId) {
|
||||
const { wechatPay } = config;
|
||||
if (!wechatPay?.appId) {
|
||||
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ export type WebConfig = {
|
|||
domain?: string;
|
||||
enable?: boolean;
|
||||
};
|
||||
wechatPay?: {
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
};
|
||||
passport?: Passport[];
|
||||
location: {
|
||||
protocol: "http:" | "https:";
|
||||
|
|
@ -36,14 +40,12 @@ export type WebConfig = {
|
|||
port: string;
|
||||
};
|
||||
};
|
||||
export type WechatPublicTemplateMsgsConfig = Record<string, string>;
|
||||
export type WechatPublicConfig = {
|
||||
type: "wechatPublic";
|
||||
isService: boolean;
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
originalId?: string;
|
||||
templateMsgs?: WechatPublicTemplateMsgsConfig;
|
||||
server?: {
|
||||
url?: string;
|
||||
token: string;
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ export default class AliPay extends AliPayDebug {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = timeoutAt + 1000 * 60 * 3;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
async getState(pay) {
|
||||
const outTradeNo = compressTo32(pay.id);
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ const PayClazzEntityDict = {
|
|||
assert(wpProduct.enabled && wpProduct.wpAccount?.enabled);
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config;
|
||||
assert(wechat);
|
||||
const appId = wechat.appId;
|
||||
const { wechatPay } = config;
|
||||
assert(wechatPay);
|
||||
const appId = wechatPay.appId;
|
||||
return new WechatPay(wpProduct, appId);
|
||||
}
|
||||
case 'wechatMp': {
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ const checkers = [
|
|||
}
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config;
|
||||
if (!wechat?.appId) {
|
||||
const { wechatPay } = config;
|
||||
if (!wechatPay?.appId) {
|
||||
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ export type WebConfig = {
|
|||
domain?: string;
|
||||
enable?: boolean;
|
||||
};
|
||||
wechatPay?: {
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
};
|
||||
passport?: Passport[];
|
||||
location: {
|
||||
protocol: "http:" | "https:";
|
||||
|
|
@ -36,14 +40,12 @@ export type WebConfig = {
|
|||
port: string;
|
||||
};
|
||||
};
|
||||
export type WechatPublicTemplateMsgsConfig = Record<string, string>;
|
||||
export type WechatPublicConfig = {
|
||||
type: "wechatPublic";
|
||||
isService: boolean;
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
originalId?: string;
|
||||
templateMsgs?: WechatPublicTemplateMsgsConfig;
|
||||
server?: {
|
||||
url?: string;
|
||||
token: string;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
|||
* @param context
|
||||
* @param refunds
|
||||
*/
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
|
||||
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
||||
export default triggers;
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ class AliPay extends AliPay_debug_1.default {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = timeoutAt + 1000 * 60 * 3;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
async getState(pay) {
|
||||
const outTradeNo = (0, uuid_1.compressTo32)(pay.id);
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ const PayClazzEntityDict = {
|
|||
(0, assert_1.default)(wpProduct.enabled && wpProduct.wpAccount?.enabled);
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config;
|
||||
(0, assert_1.default)(wechat);
|
||||
const appId = wechat.appId;
|
||||
const { wechatPay } = config;
|
||||
(0, assert_1.default)(wechatPay);
|
||||
const appId = wechatPay.appId;
|
||||
return new WechatPay_1.default(wpProduct, appId);
|
||||
}
|
||||
case 'wechatMp': {
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ const checkers: Checker<EntityDict, 'wpProduct', RuntimeCxt>[] = [
|
|||
}
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config as WebConfig;
|
||||
if (!wechat?.appId) {
|
||||
const { wechatPay } = config as WebConfig;
|
||||
if (!wechatPay?.appId) {
|
||||
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ export default class AliPay extends AliPayDebug implements PayClazz {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = timeoutAt + 1000 * 60 * 3;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
|
||||
async getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]> {
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ const PayClazzEntityDict: Record<string, {
|
|||
assert(wpProduct.enabled && wpProduct!.wpAccount?.enabled);
|
||||
switch (type) {
|
||||
case 'web': {
|
||||
const { wechat } = config as WebConfig;
|
||||
assert(wechat);
|
||||
const appId = wechat.appId;
|
||||
const { wechatPay } = config as WebConfig;
|
||||
assert(wechatPay);
|
||||
const appId = wechatPay.appId;
|
||||
return new WechatPay(wpProduct as EntityDict['wpProduct']['Schema'], appId);
|
||||
}
|
||||
case 'wechatMp': {
|
||||
|
|
|
|||
Loading…
Reference in New Issue