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