checker中异常精细处理处理
This commit is contained in:
parent
a107de3414
commit
ccd723b2d1
|
|
@ -44,8 +44,7 @@ const checkers = [
|
|||
const { price, paid, iState, allowPartialPay } = order;
|
||||
assert(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
|
||||
const { pay$order: pays } = data;
|
||||
assert(pays instanceof Array);
|
||||
if (!pays.length) {
|
||||
if (!(pays instanceof Array) || !pays.length) {
|
||||
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
|
||||
}
|
||||
let amount = 0;
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ const checkers = [
|
|||
const { price, paid, iState, allowPartialPay } = order;
|
||||
(0, assert_1.default)(['unpaid', 'partiallyRefunded'].includes(iState) && paid === 0);
|
||||
const { pay$order: pays } = data;
|
||||
(0, assert_1.default)(pays instanceof Array);
|
||||
if (!pays.length) {
|
||||
if (!(pays instanceof Array) || !pays.length) {
|
||||
throw new types_1.OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
|
||||
}
|
||||
let amount = 0;
|
||||
|
|
|
|||
|
|
@ -53,12 +53,11 @@ const checkers: Checker<EntityDict, 'order', RuntimeCxt>[] = [
|
|||
assert(['unpaid', 'partiallyRefunded'].includes(iState!) && paid === 0);
|
||||
|
||||
const { pay$order: pays } = data;
|
||||
assert(pays instanceof Array);
|
||||
if (!pays.length) {
|
||||
if (!(pays instanceof Array) || !pays.length) {
|
||||
throw new OakInputIllegalException('order', ['pay$order'], 'error::order.nonePay');
|
||||
}
|
||||
let amount = 0;
|
||||
pays.forEach(
|
||||
pays!.forEach(
|
||||
({ action, data }) => {
|
||||
assert(action === 'create');
|
||||
const { price } = data as EntityDict['pay']['CreateSingle']['data'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue