Commit 6aeeb14f by pengbao666

修改AmountCips类型校验bug

parent 22d07e25
...@@ -2,8 +2,8 @@ import { isEmptyMsg } from "./MsgJson/MsgHander"; ...@@ -2,8 +2,8 @@ import { isEmptyMsg } from "./MsgJson/MsgHander";
export function amountValidator(isM, desc, sca) { export function amountValidator(isM, desc, sca) {
return (rule, value, callback) => { return (rule, value, callback) => {
const amtValue = value.value + ""; const amtValue = value.amount + "";
const amtCcy = value.ccy; const amtCcy = value.Ccy;
if (amtValue === undefined || amtValue === null || amtValue.trim() === "") { if (amtValue === undefined || amtValue === null || amtValue.trim() === "") {
if (isM) { if (isM) {
callback(new Error(desc + " Cannot be null")); callback(new Error(desc + " Cannot be null"));
...@@ -43,15 +43,20 @@ export function amountValidator(isM, desc, sca) { ...@@ -43,15 +43,20 @@ export function amountValidator(isM, desc, sca) {
export function amountCIPSValidator(isM, desc, sca) { export function amountCIPSValidator(isM, desc, sca) {
return (rule, value, callback) => { return (rule, value, callback) => {
const amtValue = value.amount + ""; const amtValue = value.amount;
const amtCcy = value.ccy; const amtCcy = value.Ccy;
var flag = false;
if(amtCcy === undefined || amtCcy === null || amtCcy.trim() === ""){
flag = true;
if (isM) {
callback(new Error(desc + " Cannot be null"));
}
}
if (amtValue === undefined || amtValue === null || amtValue.trim() === "") { if (amtValue === undefined || amtValue === null || amtValue.trim() === "") {
if (isM) { if (isM) {
callback(new Error(desc + " Cannot be null")); callback(new Error(desc + " Cannot be null"));
} else if(amtCcy != ''){ }else if(!flag){
callback(new Error("Amount Cannot be null")); callback(new Error("Amount Cannot be null"));
}else{
callback();
} }
} else if (sca.length === 2) { } else if (sca.length === 2) {
const totalDig = sca[0]; const totalDig = sca[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment