diff --git a/es/aspects/withdraw.d.ts b/es/aspects/withdraw.d.ts index 5d27ce2e..2ea225ee 100644 --- a/es/aspects/withdraw.d.ts +++ b/es/aspects/withdraw.d.ts @@ -3,7 +3,7 @@ export declare function getWithdrawCreateData(params: { accountId: string; price: number; withdrawAccountId?: string; -}, context: BRC): Promise<(Partial> & { +}, context: BRC): Promise<(Partial> & { id: string; } & { accountId: string; @@ -17,7 +17,7 @@ export declare function getWithdrawCreateData(params: { modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; -}) | (Partial> & { +}) | (Partial> & { id: string; } & { accountId: string; @@ -31,7 +31,7 @@ export declare function getWithdrawCreateData(params: { modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; -}) | (Partial> & { +}) | (Partial> & { id: string; } & { account?: undefined; @@ -45,7 +45,7 @@ export declare function getWithdrawCreateData(params: { modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit[]> | import("oak-domain/lib/types").Operation<"create", Omit>[] | undefined; -}) | (Partial> & { +}) | (Partial> & { id: string; } & { account?: undefined; diff --git a/es/checkers/refund.js b/es/checkers/refund.js index f1126648..d58aad90 100644 --- a/es/checkers/refund.js +++ b/es/checkers/refund.js @@ -15,6 +15,7 @@ const checkers = [ }, }, action: 'create', + errMsg: 'error::refund.create.hasAnotherRefunding', }, { entity: 'refund', diff --git a/es/components/AbstractComponents.d.ts b/es/components/AbstractComponents.d.ts index babd279e..5e6212ed 100644 --- a/es/components/AbstractComponents.d.ts +++ b/es/components/AbstractComponents.d.ts @@ -20,7 +20,7 @@ declare const List: (props: ReactComponentProps(props: { tablePagination?: any; rowSelection?: any; disableSerialNumber?: boolean | undefined; - size?: "large" | "middle" | "small" | undefined; + size?: "small" | "middle" | "large" | undefined; scroll?: any; locale?: any; opWidth?: number | undefined; diff --git a/es/context/BackendRuntimeContext.d.ts b/es/context/BackendRuntimeContext.d.ts index 11c2072c..e8536354 100644 --- a/es/context/BackendRuntimeContext.d.ts +++ b/es/context/BackendRuntimeContext.d.ts @@ -15,7 +15,7 @@ export declare class BackendRuntimeContext | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/es/data/i18n.js b/es/data/i18n.js index 07753e27..9ba42081 100644 --- a/es/data/i18n.js +++ b/es/data/i18n.js @@ -753,6 +753,11 @@ const i18ns = [ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } }, diff --git a/es/locales/error/zh-CN.json b/es/locales/error/zh-CN.json index f620482e..e4205661 100644 --- a/es/locales/error/zh-CN.json +++ b/es/locales/error/zh-CN.json @@ -16,5 +16,10 @@ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } diff --git a/es/oak-app-domain/System/Storage.js b/es/oak-app-domain/System/Storage.js index c61a6659..2395d60b 100644 --- a/es/oak-app-domain/System/Storage.js +++ b/es/oak-app-domain/System/Storage.js @@ -34,8 +34,7 @@ export const desc = { : { type: "object" }, - entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款) - : { + entity: { type: "varchar", params: { length: 32 diff --git a/es/triggers/refund.js b/es/triggers/refund.js index c85ae619..bd78fdf1 100644 --- a/es/triggers/refund.js +++ b/es/triggers/refund.js @@ -24,6 +24,9 @@ async function startRefunding(context, data) { settled: 1, } }, + filter: { + id: data.payId, + } }, { dontCollect: true }); const { paid, refunded, deposit, order } = pay; assert(paid - refunded >= data.price); diff --git a/es/triggers/withdraw.d.ts b/es/triggers/withdraw.d.ts index e69f8d6e..979a44c8 100644 --- a/es/triggers/withdraw.d.ts +++ b/es/triggers/withdraw.d.ts @@ -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[]; export default triggers; diff --git a/es/utils/application.d.ts b/es/utils/application.d.ts index e7c4620e..260f0950 100644 --- a/es/utils/application.d.ts +++ b/es/utils/application.d.ts @@ -14,7 +14,7 @@ export declare const mergedProjection: { type?: number | undefined; systemId?: number | undefined; system?: import("../oak-app-domain/System/Schema").Projection | undefined; - config?: number | import("oak-domain/lib/types").JsonProjection | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/lib/checkers/refund.js b/lib/checkers/refund.js index 4f50bbb5..c6044b69 100644 --- a/lib/checkers/refund.js +++ b/lib/checkers/refund.js @@ -17,6 +17,7 @@ const checkers = [ }, }, action: 'create', + errMsg: 'error::refund.create.hasAnotherRefunding', }, { entity: 'refund', diff --git a/lib/context/BackendRuntimeContext.d.ts b/lib/context/BackendRuntimeContext.d.ts index 11c2072c..e8536354 100644 --- a/lib/context/BackendRuntimeContext.d.ts +++ b/lib/context/BackendRuntimeContext.d.ts @@ -15,7 +15,7 @@ export declare class BackendRuntimeContext | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/lib/data/i18n.js b/lib/data/i18n.js index 2102d961..5ee04a4b 100644 --- a/lib/data/i18n.js +++ b/lib/data/i18n.js @@ -755,6 +755,11 @@ const i18ns = [ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } }, diff --git a/lib/locales/error/zh-CN.json b/lib/locales/error/zh-CN.json index f620482e..e4205661 100644 --- a/lib/locales/error/zh-CN.json +++ b/lib/locales/error/zh-CN.json @@ -16,5 +16,10 @@ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } diff --git a/lib/oak-app-domain/System/Storage.js b/lib/oak-app-domain/System/Storage.js index 283bc886..f6979722 100644 --- a/lib/oak-app-domain/System/Storage.js +++ b/lib/oak-app-domain/System/Storage.js @@ -37,8 +37,7 @@ exports.desc = { : { type: "object" }, - entity // 如果为true,则按照渠道taxLossRatio和refundCompensateRatio进行扣取(如果因为depositLossRatio已经大于taxLossRatio,则全额退款) - : { + entity: { type: "varchar", params: { length: 32 diff --git a/lib/triggers/refund.js b/lib/triggers/refund.js index d99afb75..4a4902da 100644 --- a/lib/triggers/refund.js +++ b/lib/triggers/refund.js @@ -27,6 +27,9 @@ async function startRefunding(context, data) { settled: 1, } }, + filter: { + id: data.payId, + } }, { dontCollect: true }); const { paid, refunded, deposit, order } = pay; (0, assert_1.default)(paid - refunded >= data.price); diff --git a/lib/utils/application.d.ts b/lib/utils/application.d.ts index e7c4620e..260f0950 100644 --- a/lib/utils/application.d.ts +++ b/lib/utils/application.d.ts @@ -14,7 +14,7 @@ export declare const mergedProjection: { type?: number | undefined; systemId?: number | undefined; system?: import("../oak-app-domain/System/Schema").Projection | undefined; - config?: number | import("oak-domain/lib/types").JsonProjection | undefined; + config?: number | import("oak-domain/lib/types").JsonProjection | undefined; style?: number | import("oak-domain/lib/types").JsonProjection | undefined; domainId?: number | undefined; domain?: import("../oak-app-domain/Domain/Schema").Projection | undefined; diff --git a/src/checkers/refund.ts b/src/checkers/refund.ts index af1ce904..029ba3b0 100644 --- a/src/checkers/refund.ts +++ b/src/checkers/refund.ts @@ -21,6 +21,7 @@ const checkers: Checker[] = [ }, }, action: 'create', + errMsg: 'error::refund.create.hasAnotherRefunding', }, { entity: 'refund', diff --git a/src/data/i18n.ts b/src/data/i18n.ts index 9eda0818..e19caf34 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -755,6 +755,11 @@ const i18ns: I18n[] = [ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } }, diff --git a/src/locales/error/zh-CN.json b/src/locales/error/zh-CN.json index 745dc913..6598a357 100644 --- a/src/locales/error/zh-CN.json +++ b/src/locales/error/zh-CN.json @@ -16,5 +16,10 @@ "order": { "payAmountNotEnough": "支付的额度总和不足", "nonePay": "没有传入支付信息" + }, + "refund": { + "create": { + "hasAnotherRefunding": "您有一笔退款正在进行中" + } } } \ No newline at end of file diff --git a/src/triggers/refund.ts b/src/triggers/refund.ts index ebc69958..15ee6e38 100644 --- a/src/triggers/refund.ts +++ b/src/triggers/refund.ts @@ -30,6 +30,9 @@ async function startRefunding(context: BRC, data: EntityDict['refund']['CreateSi settled: 1, } }, + filter: { + id: data.payId, + } }, { dontCollect: true }); const { paid, refunded, deposit, order } = pay; @@ -43,7 +46,7 @@ async function startRefunding(context: BRC, data: EntityDict['refund']['CreateSi if (order.settled) { // 如果已经分账,退款的钱要有明确的来源account const { accountOper$entity: opers } = data; - + assert(opers && opers instanceof Array, '订单退款一定要有相应的account来源'); let amount = 0; opers.forEach( @@ -340,7 +343,7 @@ const triggers: Trigger[] = [ id: ids[0], }, }, {}); - + const { id, price, pay } = refund; const { price: payPrice, refunded, entity, entityId, applicationId } = pay!;