Merge branch 'dev' into release

This commit is contained in:
Xu Chang 2025-02-05 14:49:21 +08:00
commit 7f14d095e7
52 changed files with 217 additions and 104 deletions

View File

@ -28,7 +28,7 @@ export async function getWithdrawCreateData(params, context) {
const { system } = context.getApplication();
const withdrawLoss = system?.payConfig?.withdrawLoss;
if (!withdrawLoss || (!withdrawLoss.conservative && typeof withdrawLoss.ratio !== 'number')) {
throw new OakException('error::system.withdrawLossUnSet');
throw new OakException('error::system.withdrawLossUnSet', 'oak-pay-business');
}
const { accountId, price: totalPrice, withdrawAccountId } = params;
const [account] = await context.select('account', {
@ -46,7 +46,7 @@ export async function getWithdrawCreateData(params, context) {
// throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.overflow');
// }
if (totalPrice > refundable && !withdrawAccountId) {
throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId');
throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId', 'oak-pay-business');
}
const data = {
id: await generateNewIdAsync(),

View File

@ -14,7 +14,7 @@ function checkAttributes(data) {
case 'wechat':
case 'alipay': {
if (!name && !qrCode) {
throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull');
throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull', 'oak-pay-business');
}
break;
}
@ -29,13 +29,13 @@ function checkAttributes(data) {
}
const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data;
if (typeof refundGapDays !== 'number' || refundGapDays < 0) {
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative');
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative', 'oak-pay-business');
}
if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) {
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal');
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal', 'oak-pay-business');
}
if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) {
throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative');
throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative', 'oak-pay-business');
}
}
const checkers = [

View File

@ -45,7 +45,7 @@ const checkers = [
assert(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
const { pay$order: pays } = data;
if (!(pays instanceof Array) || !pays.length) {
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay', 'oak-pay-business');
}
let amount = 0;
pays.forEach(({ action, data }) => {
@ -54,7 +54,7 @@ const checkers = [
amount += price;
});
if (!allowPartialPay && amount !== price) {
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough', 'oak-pay-business');
}
});
}

View File

@ -74,7 +74,7 @@ const checkers = [
let pricePaying = 0;
pays.forEach((pay) => pricePaying += pay.price);
if (pricePaying + price > orderPrice) {
throw new OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
throw new OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
}
};
if (order instanceof Promise) {

View File

@ -79,27 +79,27 @@ const checkers = [
}, { dontCollect: true }), (applications) => {
const { type, config } = applications[0];
if (!getAppTypeFromProductType(data.type).includes(type)) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict', 'oak-pay-business');
}
switch (type) {
case 'web': {
const { wechat } = config;
if (!wechat?.appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatMp': {
const { appId } = config;
if (!appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatPublic': {
const { appId } = config;
if (!appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}

View File

@ -21,7 +21,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
rowSelection?: any;
hideHeader?: boolean | undefined;
disableSerialNumber?: boolean | undefined;
size?: "large" | "middle" | "small" | undefined;
size?: "small" | "middle" | "large" | undefined;
scroll?: any;
empty?: React.ReactNode;
opWidth?: number | undefined;
@ -43,7 +43,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
tablePagination?: any;
rowSelection?: any;
disableSerialNumber?: boolean | undefined;
size?: "large" | "middle" | "small" | undefined;
size?: "small" | "middle" | "large" | undefined;
scroll?: any;
empty?: any;
opWidth?: number | undefined;

View File

@ -804,7 +804,8 @@ const i18ns = [
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}
},

View File

@ -16,6 +16,7 @@ export const entityDesc = {
entityId: '关联对象id',
accounts: '关联账户',
withdrawAccounts: '关联提现账户',
oldestVersion: '支持app最低版本',
},
},
}

View File

@ -25,6 +25,7 @@
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}

View File

@ -28,6 +28,21 @@ export const desc = {
style: {
type: "object"
},
dangerousVersions: {
notNull: true,
type: "object"
},
warningVersions: {
notNull: true,
type: "object"
},
soaVersion: {
notNull: true,
type: "varchar",
params: {
length: 12
}
},
domainId: {
type: "ref",
ref: "domain"

View File

@ -75,6 +75,7 @@ export type NativeConfig = {
port: string;
};
};
type Versions = string[];
export type OpSchema = EntityShape & {
name: String<32>;
description?: Text | null;
@ -82,6 +83,9 @@ export type OpSchema = EntityShape & {
systemId: ForeignKey<"system">;
config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
style?: Style | null;
dangerousVersions: Versions;
warningVersions: Versions;
soaVersion: String<12>;
domainId?: ForeignKey<"domain"> | null;
} & {
[A in ExpressionKey]?: any;
@ -98,6 +102,9 @@ export type OpFilter = {
systemId: Q_StringValue;
config: JsonFilter<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
style: JsonFilter<Style>;
dangerousVersions: JsonFilter<Versions>;
warningVersions: JsonFilter<Versions>;
soaVersion: Q_StringValue;
domainId: Q_StringValue;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
@ -113,6 +120,9 @@ export type OpProjection = {
systemId?: number;
config?: number | JsonProjection<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
style?: number | JsonProjection<Style>;
dangerousVersions?: number | JsonProjection<Versions>;
warningVersions?: number | JsonProjection<Versions>;
soaVersion?: number;
domainId?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
@ -124,7 +134,11 @@ export type OpSortAttr = Partial<{
description: number;
type: number;
style: number;
dangerousVersions: number;
warningVersions: number;
soaVersion: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;
export type OpUpdateAction = "update" | string;
export {};

View File

@ -8,7 +8,10 @@
"config": "设置",
"style": "样式",
"sessions": "会话",
"domain": "域名"
"domain": "域名",
"dangerousVersions": "强制升级版本",
"warningVersions": "建议升级版本",
"soaVersion": "最新发布版本"
},
"v": {
"type": {

View File

@ -15,6 +15,12 @@ export const desc = {
notNull: true,
type: "object"
},
oldestVersion: {
type: "varchar",
params: {
length: 32
}
},
style: {
type: "object"
},

View File

@ -9,6 +9,7 @@ export type OpSchema = EntityShape & {
name: String<32>;
description?: Text | null;
config: Config;
oldestVersion?: String<32> | null;
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
@ -24,6 +25,7 @@ export type OpFilter = {
name: Q_StringValue;
description: Q_StringValue;
config: JsonFilter<Config>;
oldestVersion: Q_StringValue;
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
@ -38,6 +40,7 @@ export type OpProjection = {
name?: number;
description?: number;
config?: number | JsonProjection<Config>;
oldestVersion?: number;
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
@ -50,6 +53,7 @@ export type OpSortAttr = Partial<{
name: number;
description: number;
config: number;
oldestVersion: number;
style: number;
entity: number;
entityId: number;

View File

@ -6,7 +6,8 @@
"config": "设置",
"style": "样式",
"entity": "关联对象",
"entityId": "关联对象id"
"entityId": "关联对象id",
"oldestVersion": "支持app最低版本"
},
"r": {
"owner": "拥有者",

View File

@ -25,15 +25,20 @@ export const desc = {
length: 16
}
},
super: {
oldestVersion: {
type: "varchar",
params: {
length: 32
}
},
super // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
type: "boolean"
},
style // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
style: {
type: "object"
},
entity // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
entity: {
type: "varchar",
params: {
length: 32

View File

@ -25,6 +25,7 @@ export type OpSchema = EntityShape & {
config: Config;
platformId?: ForeignKey<"platform"> | null;
folder?: String<16> | null;
oldestVersion?: String<32> | null;
super?: Boolean | null;
style?: Style | null;
entity?: String<32> | null;
@ -44,6 +45,7 @@ export type OpFilter = {
config: JsonFilter<Config>;
platformId: Q_StringValue;
folder: Q_StringValue;
oldestVersion: Q_StringValue;
super: Q_BooleanValue;
style: JsonFilter<Style>;
entity: Q_StringValue;
@ -62,6 +64,7 @@ export type OpProjection = {
config?: number | JsonProjection<Config>;
platformId?: number;
folder?: number;
oldestVersion?: number;
super?: number;
style?: number | JsonProjection<Style>;
entity?: number;
@ -77,6 +80,7 @@ export type OpSortAttr = Partial<{
description: number;
config: number;
folder: number;
oldestVersion: number;
super: number;
style: number;
entity: number;

View File

@ -12,6 +12,7 @@
"entity": "关联对象",
"entityId": "关联对象id",
"accounts": "关联账户",
"withdrawAccounts": "关联提现账户"
"withdrawAccounts": "关联提现账户",
"oldestVersion": "支持app最低版本"
}
}

View File

@ -2,12 +2,12 @@ import { OakException, OpRecord } from 'oak-domain/lib/types';
import { EntityDict } from '../oak-app-domain/index';
export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
reason: any;
constructor(reason: any, message?: string, module?: string, params?: Record<string, any>);
constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
getSerialData(): {
reason: any;
name: string;
message: string;
module: string | undefined;
_module: string | undefined;
opRecords: OpRecord<ED>[];
tag1: string | undefined;
tag2: boolean | undefined;
@ -15,10 +15,10 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
};
}
export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
constructor(message: string);

View File

@ -2,8 +2,8 @@ import { OakException } from 'oak-domain/lib/types';
import makeDepedentException from './DependentExceptions';
export class ExternalPayUtilException extends OakException {
reason;
constructor(reason, message, module, params) {
super(message || 'error::pay.externalException', module || 'oak-pay-business', params);
constructor(reason, message, _module, params) {
super(message || 'error::pay.externalException', _module || 'oak-pay-business', params);
this.reason = reason;
}
getSerialData() {
@ -15,12 +15,12 @@ export class ExternalPayUtilException extends OakException {
}
}
export class RefundExceedMax extends OakException {
constructor(message, module, params) {
super(message || 'error::refund.create.exceedMax', module || 'oak-pay-business', params);
constructor(message, _module, params) {
super(message || 'error::refund.create.exceedMax', _module || 'oak-pay-business', params);
}
}
export class PayUnRefundable extends OakException {
constructor(message, module, params) {
constructor(message, _module, params) {
super(message || 'error::refund.create.payUnrefundable');
}
}

View File

@ -1,4 +1,4 @@
import WechatPay from './WechatPay';
import WechatPayDebug from './WechatPay.debug';
declare const _default: typeof WechatPay | typeof WechatPayDebug;
declare const _default: typeof WechatPayDebug | typeof WechatPay;
export default _default;

View File

@ -32,7 +32,7 @@ async function getWithdrawCreateData(params, context) {
const { system } = context.getApplication();
const withdrawLoss = system?.payConfig?.withdrawLoss;
if (!withdrawLoss || (!withdrawLoss.conservative && typeof withdrawLoss.ratio !== 'number')) {
throw new types_1.OakException('error::system.withdrawLossUnSet');
throw new types_1.OakException('error::system.withdrawLossUnSet', 'oak-pay-business');
}
const { accountId, price: totalPrice, withdrawAccountId } = params;
const [account] = await context.select('account', {
@ -50,7 +50,7 @@ async function getWithdrawCreateData(params, context) {
// throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.overflow');
// }
if (totalPrice > refundable && !withdrawAccountId) {
throw new types_1.OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId');
throw new types_1.OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId', 'oak-pay-business');
}
const data = {
id: await (0, uuid_1.generateNewIdAsync)(),

View File

@ -17,7 +17,7 @@ function checkAttributes(data) {
case 'wechat':
case 'alipay': {
if (!name && !qrCode) {
throw new types_1.OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull');
throw new types_1.OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull', 'oak-pay-business');
}
break;
}
@ -32,13 +32,13 @@ function checkAttributes(data) {
}
const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data;
if (typeof refundGapDays !== 'number' || refundGapDays < 0) {
throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative');
throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative', 'oak-pay-business');
}
if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) {
throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal');
throw new types_1.OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal', 'oak-pay-business');
}
if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) {
throw new types_1.OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative');
throw new types_1.OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative', 'oak-pay-business');
}
}
const checkers = [

View File

@ -48,7 +48,7 @@ const checkers = [
(0, assert_1.default)(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
const { pay$order: pays } = data;
if (!(pays instanceof Array) || !pays.length) {
throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay', 'oak-pay-business');
}
let amount = 0;
pays.forEach(({ action, data }) => {
@ -57,7 +57,7 @@ const checkers = [
amount += price;
});
if (!allowPartialPay && amount !== price) {
throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough', 'oak-pay-business');
}
});
}

View File

@ -77,7 +77,7 @@ const checkers = [
let pricePaying = 0;
pays.forEach((pay) => pricePaying += pay.price);
if (pricePaying + price > orderPrice) {
throw new types_1.OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
throw new types_1.OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
}
};
if (order instanceof Promise) {

View File

@ -82,27 +82,27 @@ const checkers = [
}, { dontCollect: true }), (applications) => {
const { type, config } = applications[0];
if (!(0, wpProduct_1.getAppTypeFromProductType)(data.type).includes(type)) {
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict');
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict', 'oak-pay-business');
}
switch (type) {
case 'web': {
const { wechat } = config;
if (!wechat?.appId) {
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatMp': {
const { appId } = config;
if (!appId) {
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatPublic': {
const { appId } = config;
if (!appId) {
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new types_1.OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}

View File

@ -806,7 +806,8 @@ const i18ns = [
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}
},

View File

@ -19,6 +19,7 @@ exports.entityDesc = {
entityId: '关联对象id',
accounts: '关联账户',
withdrawAccounts: '关联提现账户',
oldestVersion: '支持app最低版本',
},
},
}

View File

@ -25,6 +25,7 @@
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}

View File

@ -31,6 +31,21 @@ exports.desc = {
style: {
type: "object"
},
dangerousVersions: {
notNull: true,
type: "object"
},
warningVersions: {
notNull: true,
type: "object"
},
soaVersion: {
notNull: true,
type: "varchar",
params: {
length: 12
}
},
domainId: {
type: "ref",
ref: "domain"

View File

@ -75,6 +75,7 @@ export type NativeConfig = {
port: string;
};
};
type Versions = string[];
export type OpSchema = EntityShape & {
name: String<32>;
description?: Text | null;
@ -82,6 +83,9 @@ export type OpSchema = EntityShape & {
systemId: ForeignKey<"system">;
config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
style?: Style | null;
dangerousVersions: Versions;
warningVersions: Versions;
soaVersion: String<12>;
domainId?: ForeignKey<"domain"> | null;
} & {
[A in ExpressionKey]?: any;
@ -98,6 +102,9 @@ export type OpFilter = {
systemId: Q_StringValue;
config: JsonFilter<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
style: JsonFilter<Style>;
dangerousVersions: JsonFilter<Versions>;
warningVersions: JsonFilter<Versions>;
soaVersion: Q_StringValue;
domainId: Q_StringValue;
} & ExprOp<OpAttr | string>;
export type OpProjection = {
@ -113,6 +120,9 @@ export type OpProjection = {
systemId?: number;
config?: number | JsonProjection<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
style?: number | JsonProjection<Style>;
dangerousVersions?: number | JsonProjection<Versions>;
warningVersions?: number | JsonProjection<Versions>;
soaVersion?: number;
domainId?: number;
} & Partial<ExprOp<OpAttr | string>>;
export type OpSortAttr = Partial<{
@ -124,7 +134,11 @@ export type OpSortAttr = Partial<{
description: number;
type: number;
style: number;
dangerousVersions: number;
warningVersions: number;
soaVersion: number;
[k: string]: any;
} | ExprOp<OpAttr | string>>;
export type OpAction = OakMakeAction<GenericAction | string>;
export type OpUpdateAction = "update" | string;
export {};

View File

@ -8,7 +8,10 @@
"config": "设置",
"style": "样式",
"sessions": "会话",
"domain": "域名"
"domain": "域名",
"dangerousVersions": "强制升级版本",
"warningVersions": "建议升级版本",
"soaVersion": "最新发布版本"
},
"v": {
"type": {

View File

@ -18,6 +18,12 @@ exports.desc = {
notNull: true,
type: "object"
},
oldestVersion: {
type: "varchar",
params: {
length: 32
}
},
style: {
type: "object"
},

View File

@ -9,6 +9,7 @@ export type OpSchema = EntityShape & {
name: String<32>;
description?: Text | null;
config: Config;
oldestVersion?: String<32> | null;
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
@ -24,6 +25,7 @@ export type OpFilter = {
name: Q_StringValue;
description: Q_StringValue;
config: JsonFilter<Config>;
oldestVersion: Q_StringValue;
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
@ -38,6 +40,7 @@ export type OpProjection = {
name?: number;
description?: number;
config?: number | JsonProjection<Config>;
oldestVersion?: number;
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
@ -50,6 +53,7 @@ export type OpSortAttr = Partial<{
name: number;
description: number;
config: number;
oldestVersion: number;
style: number;
entity: number;
entityId: number;

View File

@ -6,7 +6,8 @@
"config": "设置",
"style": "样式",
"entity": "关联对象",
"entityId": "关联对象id"
"entityId": "关联对象id",
"oldestVersion": "支持app最低版本"
},
"r": {
"owner": "拥有者",

View File

@ -28,15 +28,20 @@ exports.desc = {
length: 16
}
},
super: {
oldestVersion: {
type: "varchar",
params: {
length: 32
}
},
super // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
type: "boolean"
},
style // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
style: {
type: "object"
},
entity // 如果为true则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio则全额退款)
: {
entity: {
type: "varchar",
params: {
length: 32

View File

@ -25,6 +25,7 @@ export type OpSchema = EntityShape & {
config: Config;
platformId?: ForeignKey<"platform"> | null;
folder?: String<16> | null;
oldestVersion?: String<32> | null;
super?: Boolean | null;
style?: Style | null;
entity?: String<32> | null;
@ -44,6 +45,7 @@ export type OpFilter = {
config: JsonFilter<Config>;
platformId: Q_StringValue;
folder: Q_StringValue;
oldestVersion: Q_StringValue;
super: Q_BooleanValue;
style: JsonFilter<Style>;
entity: Q_StringValue;
@ -62,6 +64,7 @@ export type OpProjection = {
config?: number | JsonProjection<Config>;
platformId?: number;
folder?: number;
oldestVersion?: number;
super?: number;
style?: number | JsonProjection<Style>;
entity?: number;
@ -77,6 +80,7 @@ export type OpSortAttr = Partial<{
description: number;
config: number;
folder: number;
oldestVersion: number;
super: number;
style: number;
entity: number;

View File

@ -12,6 +12,7 @@
"entity": "关联对象",
"entityId": "关联对象id",
"accounts": "关联账户",
"withdrawAccounts": "关联提现账户"
"withdrawAccounts": "关联提现账户",
"oldestVersion": "支持app最低版本"
}
}

View File

@ -2,12 +2,12 @@ import { OakException, OpRecord } from 'oak-domain/lib/types';
import { EntityDict } from '../oak-app-domain/index';
export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
reason: any;
constructor(reason: any, message?: string, module?: string, params?: Record<string, any>);
constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
getSerialData(): {
reason: any;
name: string;
message: string;
module: string | undefined;
_module: string | undefined;
opRecords: OpRecord<ED>[];
tag1: string | undefined;
tag2: boolean | undefined;
@ -15,10 +15,10 @@ export declare class ExternalPayUtilException<ED extends EntityDict> extends Oak
};
}
export declare class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
export declare class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>);
constructor(message?: string, _module?: string, params?: Record<string, any>);
}
export declare class StartPayFailure<ED extends EntityDict> extends OakException<ED> {
constructor(message: string);

View File

@ -6,8 +6,8 @@ const types_1 = require("oak-domain/lib/types");
const DependentExceptions_1 = tslib_1.__importDefault(require("./DependentExceptions"));
class ExternalPayUtilException extends types_1.OakException {
reason;
constructor(reason, message, module, params) {
super(message || 'error::pay.externalException', module || 'oak-pay-business', params);
constructor(reason, message, _module, params) {
super(message || 'error::pay.externalException', _module || 'oak-pay-business', params);
this.reason = reason;
}
getSerialData() {
@ -20,13 +20,13 @@ class ExternalPayUtilException extends types_1.OakException {
}
exports.ExternalPayUtilException = ExternalPayUtilException;
class RefundExceedMax extends types_1.OakException {
constructor(message, module, params) {
super(message || 'error::refund.create.exceedMax', module || 'oak-pay-business', params);
constructor(message, _module, params) {
super(message || 'error::refund.create.exceedMax', _module || 'oak-pay-business', params);
}
}
exports.RefundExceedMax = RefundExceedMax;
class PayUnRefundable extends types_1.OakException {
constructor(message, module, params) {
constructor(message, _module, params) {
super(message || 'error::refund.create.payUnrefundable');
}
}

View File

@ -1,4 +1,4 @@
import WechatPay from './WechatPay';
import WechatPayDebug from './WechatPay.debug';
declare const _default: typeof WechatPay | typeof WechatPayDebug;
declare const _default: typeof WechatPayDebug | typeof WechatPay;
export default _default;

View File

@ -1,6 +1,6 @@
{
"name": "oak-pay-business",
"version": "2.6.2",
"version": "2.7.0",
"description": "",
"files": [
"lib/**/*",
@ -30,9 +30,9 @@
"dependencies": {
"classnames": "^2.3.1",
"dayjs": "^1.11.5",
"oak-domain": "file:../oak-domain",
"oak-frontend-base": "file:../oak-frontend-base",
"oak-general-business": "file:../oak-general-business",
"oak-domain": "^5.1.19",
"oak-frontend-base": "^5.3.27",
"oak-general-business": "~5.7.0",
"wechat-pay-nodejs": "^0.2.3"
},
"peerDependencies": {

View File

@ -40,7 +40,7 @@ export async function getWithdrawCreateData(
const { system } = context.getApplication()!;
const withdrawLoss = system?.payConfig?.withdrawLoss;
if (!withdrawLoss || (!withdrawLoss.conservative && typeof withdrawLoss.ratio !== 'number')) {
throw new OakException('error::system.withdrawLossUnSet');
throw new OakException('error::system.withdrawLossUnSet', 'oak-pay-business');
}
const { accountId, price: totalPrice, withdrawAccountId } = params;
@ -61,7 +61,7 @@ export async function getWithdrawCreateData(
// throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.overflow');
// }
if (totalPrice > refundable! && !withdrawAccountId) {
throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId');
throw new OakInputIllegalException('withdraw', ['price'], 'error::withdraw.needWithdrawAccountId', 'oak-pay-business');
}
const data: EntityDict['withdraw']['CreateOperationData'] = {
id: await generateNewIdAsync(),

View File

@ -7,10 +7,10 @@ import { pipeline } from 'oak-domain/lib/utils/executor';
function checkAttributes(data: EntityDict['offlineAccount']['CreateOperationData'] | EntityDict['offlineAccount']['Update']['data']) {
const { type, channel, name, qrCode } = data;
switch (type) {
case 'bank': {
if (!channel || !name || !qrCode ) {
if (!channel || !name || !qrCode) {
throw new OakAttrNotNullException('offlineAccount', ['channel', 'name', 'qrCode'].filter(ele => !data[ele as 'name']));
}
break;
@ -19,7 +19,7 @@ function checkAttributes(data: EntityDict['offlineAccount']['CreateOperationData
case 'wechat':
case 'alipay': {
if (!name && !qrCode) {
throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull');
throw new OakInputIllegalException('offlineAccount', ['name', 'qrCode'], 'offlineAccount::error.nameQrCodeBothNull', 'oak-pay-business');
}
break;
}
@ -35,13 +35,13 @@ function checkAttributes(data: EntityDict['offlineAccount']['CreateOperationData
const { refundCompensateRatio, refundGapDays, withdrawTransferLossRatio } = data;
if (typeof refundGapDays !== 'number' || refundGapDays < 0) {
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative');
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundGapDaysNotNegative', 'oak-pay-business');
}
if (typeof refundCompensateRatio !== 'number' || refundCompensateRatio < 0 || refundCompensateRatio > 100) {
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal');
throw new OakInputIllegalException('offlineAccount', ['refundGapDays'], 'offlineAccount::error.refundCompensateIllegal', 'oak-pay-business');
}
if (typeof withdrawTransferLossRatio !== 'number' || withdrawTransferLossRatio < 0) {
throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative');
throw new OakInputIllegalException('offlineAccount', ['withdrawTransferLossRatio'], 'offlineAccount::error.withdrawTransferLossRatioNotNegative', 'oak-pay-business');
}
}
@ -84,7 +84,7 @@ const checkers: Checker<EntityDict, 'offlineAccount', RuntimeCxt>[] = [
(accounts: EntityDict['offlineAccount']['Update']['data'][]) => {
accounts.forEach(
(ele) => checkAttributes(Object.assign(ele, data))
)
)
}
);
}

View File

@ -54,7 +54,7 @@ const checkers: Checker<EntityDict, 'order', RuntimeCxt>[] = [
const { pay$order: pays } = data;
if (!(pays instanceof Array) || !pays.length) {
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay', 'oak-pay-business');
}
let amount = 0;
pays!.forEach(
@ -65,7 +65,7 @@ const checkers: Checker<EntityDict, 'order', RuntimeCxt>[] = [
}
);
if (!allowPartialPay && amount !== price) {
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough');
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.payAmountNotEnough', 'oak-pay-business');
}
}
);

View File

@ -85,7 +85,7 @@ const checkers: Checker<EntityDict, 'pay', RuntimeCxt>[] = [
(pay) => pricePaying += pay.price!
);
if (pricePaying + price! > orderPrice!) {
throw new OakInputIllegalException('pay', ['price'], 'pay.create.priceOverflow');
throw new OakInputIllegalException('pay', ['price'], 'error::pay.priceOverflow', 'oak-pay-business');
}
};
if (order instanceof Promise) {

View File

@ -16,7 +16,7 @@ const checkers: Checker<EntityDict, 'wpProduct', RuntimeCxt>[] = [
const { data } = operation as EntityDict['wpProduct']['CreateSingle'];
if (data) {
const { type, enabled } = data;
if (enabled) {
return {
application: {
@ -34,7 +34,7 @@ const checkers: Checker<EntityDict, 'wpProduct', RuntimeCxt>[] = [
},
{
entity: 'wpProduct',
action: 'update',
action: 'update',
type: 'row',
filter(operation, context) {
const { data, filter } = operation as EntityDict['wpProduct']['Update'];
@ -50,7 +50,7 @@ const checkers: Checker<EntityDict, 'wpProduct', RuntimeCxt>[] = [
filter,
}, { dontCollect: true }),
(wpProducts: EntityDict['wpProduct']['OpSchema'][]) => {
const [ wpProduct ] = wpProducts;
const [wpProduct] = wpProducts;
const { type } = wpProduct;
return {
application: {
@ -88,31 +88,31 @@ const checkers: Checker<EntityDict, 'wpProduct', RuntimeCxt>[] = [
id: applicationId,
}
}, { dontCollect: true }),
(applications: EntityDict['application']['OpSchema'][]) => {
(applications: EntityDict['application']['OpSchema'][]) => {
const { type, config } = applications[0];
if (!getAppTypeFromProductType(data.type!).includes(type)) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.TypeConflict', 'oak-pay-business');
}
switch (type) {
case 'web': {
const { wechat } = config as WebConfig;
if (!wechat?.appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatMp': {
const { appId } = config as WechatMpConfig;
const { appId } = config as WechatMpConfig;
if (!appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}
case 'wechatPublic': {
const { appId } = config as WechatPublicConfig;
const { appId } = config as WechatPublicConfig;
if (!appId) {
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp');
throw new OakInputIllegalException('wpProduct', ['applicationId'], 'error::wpProduct.NoWechatInfoOnApp', 'oak-pay-business');
}
break;
}

View File

@ -3,8 +3,6 @@
* by Xc 20230807
*/
// @ts-nocheck
import React from 'react';
import { EntityDict } from '../oak-app-domain';

View File

@ -806,7 +806,8 @@ const i18ns: I18n[] = [
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}
},

View File

@ -44,6 +44,7 @@ export const entityDesc: EntityDesc<Schema> = {
entityId: '关联对象id',
accounts: '关联账户',
withdrawAccounts: '关联提现账户',
oldestVersion: '支持app最低版本',
},
},
}

View File

@ -25,6 +25,7 @@
}
},
"pay": {
"externalException": "外部支付渠道异常"
"externalException": "外部支付渠道异常",
"priceOverflow": "支付金额总和大于订单金额"
}
}

View File

@ -4,8 +4,8 @@ import makeDepedentException from './DependentExceptions';
export class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
reason: any;
constructor(reason: any, message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::pay.externalException', module || 'oak-pay-business', params);
constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::pay.externalException', _module || 'oak-pay-business', params);
this.reason = reason;
}
@ -19,13 +19,13 @@ export class ExternalPayUtilException<ED extends EntityDict> extends OakExceptio
}
export class RefundExceedMax<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
super(message || 'error::refund.create.exceedMax', module || 'oak-pay-business', params);
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::refund.create.exceedMax', _module || 'oak-pay-business', params);
}
}
export class PayUnRefundable<ED extends EntityDict> extends OakException<ED> {
constructor(message?: string, module?: string, params?: Record<string, any>) {
constructor(message?: string, _module?: string, params?: Record<string, any>) {
super(message || 'error::refund.create.payUnrefundable');
}
}