Merge branch 'dev' into release
This commit is contained in:
commit
117ce29b7f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ export default class AliPay extends AliPayDebug {
|
|||
const out_trade_no = compressTo32(pay.id);
|
||||
// 支付宝金额单位为元,需要转换
|
||||
const totalAmount = ToYuan(pay.price);
|
||||
const timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
switch (this.apProduct.type) {
|
||||
case 'native': {
|
||||
const method = this.apProduct.config?.prepayMethod || 'GET';
|
||||
|
|
@ -196,6 +197,7 @@ export default class AliPay extends AliPayDebug {
|
|||
notify_url: payNotifyUrl,
|
||||
qr_pay_mode: qrPayMode,
|
||||
qrcode_width: qrCodeWidth,
|
||||
time_expire: dayJs(timeoutAt).format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
notify_url: payNotifyUrl,
|
||||
needEncrypt: this.needEncrypt,
|
||||
|
|
@ -217,7 +219,7 @@ export default class AliPay extends AliPayDebug {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
async getState(pay) {
|
||||
const outTradeNo = compressTo32(pay.id);
|
||||
|
|
@ -280,10 +282,6 @@ export default class AliPay extends AliPayDebug {
|
|||
this.analyzeResult(result);
|
||||
}
|
||||
catch (e) {
|
||||
// 在电脑网站下单时,系统首先生成URL;用户扫码后才会创建交易订单。若未完成扫码而订单过期到了直接关闭,提示'交易不存在'。
|
||||
if (e.code === 'ACQ.TRADE_NOT_EXIST') {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ class AliPay extends AliPay_debug_1.default {
|
|||
const out_trade_no = (0, uuid_1.compressTo32)(pay.id);
|
||||
// 支付宝金额单位为元,需要转换
|
||||
const totalAmount = (0, money_1.ToYuan)(pay.price);
|
||||
const timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
switch (this.apProduct.type) {
|
||||
case 'native': {
|
||||
const method = this.apProduct.config?.prepayMethod || 'GET';
|
||||
|
|
@ -199,6 +200,7 @@ class AliPay extends AliPay_debug_1.default {
|
|||
notify_url: payNotifyUrl,
|
||||
qr_pay_mode: qrPayMode,
|
||||
qrcode_width: qrCodeWidth,
|
||||
time_expire: (0, dayjs_1.default)(timeoutAt).format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
notify_url: payNotifyUrl,
|
||||
needEncrypt: this.needEncrypt,
|
||||
|
|
@ -220,7 +222,7 @@ class AliPay extends AliPay_debug_1.default {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
async getState(pay) {
|
||||
const outTradeNo = (0, uuid_1.compressTo32)(pay.id);
|
||||
|
|
@ -283,10 +285,6 @@ class AliPay extends AliPay_debug_1.default {
|
|||
this.analyzeResult(result);
|
||||
}
|
||||
catch (e) {
|
||||
// 在电脑网站下单时,系统首先生成URL;用户扫码后才会创建交易订单。若未完成扫码而订单过期到了直接关闭,提示'交易不存在'。
|
||||
if (e.code === 'ACQ.TRADE_NOT_EXIST') {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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': {
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oak-pay-business",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"description": "",
|
||||
"files": [
|
||||
"lib/**/*",
|
||||
|
|
@ -31,10 +31,10 @@
|
|||
"alipay-sdk": "^4.14.0",
|
||||
"classnames": "^2.3.1",
|
||||
"dayjs": "^1.11.5",
|
||||
"oak-domain": "^5.1.26",
|
||||
"oak-external-sdk": "^2.3.8",
|
||||
"oak-frontend-base": "^5.3.33",
|
||||
"oak-general-business": "~5.7.6",
|
||||
"oak-domain": "^5.1.27",
|
||||
"oak-external-sdk": "^2.3.9",
|
||||
"oak-frontend-base": "^5.3.34",
|
||||
"oak-general-business": "~5.7.7",
|
||||
"react-markdown": "^9.0.3",
|
||||
"wechat-pay-nodejs": "^0.2.3"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ export default class AliPay extends AliPayDebug implements PayClazz {
|
|||
const out_trade_no = compressTo32(pay.id);
|
||||
// 支付宝金额单位为元,需要转换
|
||||
const totalAmount = ToYuan(pay.price);
|
||||
const timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
switch (this.apProduct.type!) {
|
||||
case 'native': {
|
||||
const method = this.apProduct.config?.prepayMethod || 'GET';
|
||||
|
|
@ -226,6 +227,7 @@ export default class AliPay extends AliPayDebug implements PayClazz {
|
|||
notify_url: payNotifyUrl,
|
||||
qr_pay_mode: qrPayMode,
|
||||
qrcode_width: qrCodeWidth,
|
||||
time_expire: dayJs(timeoutAt).format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
notify_url: payNotifyUrl,
|
||||
needEncrypt: this.needEncrypt,
|
||||
|
|
@ -249,7 +251,7 @@ export default class AliPay extends AliPayDebug implements PayClazz {
|
|||
}
|
||||
}
|
||||
// pay加一个过期时间,到期自动close
|
||||
data.timeoutAt = Date.now() + PREPAY_TIMEOUT;
|
||||
data.timeoutAt = timeoutAt + 1000 * 60;
|
||||
}
|
||||
|
||||
async getState(pay: OpPay): Promise<[EntityDict['pay']['OpSchema']['iState'], PayUpdateData]> {
|
||||
|
|
@ -320,10 +322,6 @@ export default class AliPay extends AliPayDebug implements PayClazz {
|
|||
this.analyzeResult(result);
|
||||
}
|
||||
catch (e: any) {
|
||||
// 在电脑网站下单时,系统首先生成URL;用户扫码后才会创建交易订单。若未完成扫码而订单过期到了直接关闭,提示'交易不存在'。
|
||||
if (e.code === 'ACQ.TRADE_NOT_EXIST') {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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