Commit a99b8dd7 by lixinyi

新增拟报业务规则

parent 07be47b1
......@@ -53,7 +53,7 @@ export default [
name: "Settlement Method",
label: "Settlement Method",
tag: "sttlmMtd",
type: "Select#sttlmMtd",
type: "Select#sttlmMtd2",
status: "M",
},
{
......
......@@ -94,8 +94,25 @@ export default function validator(obj) {
if(!CBPR_Original_Instruction_Identification_FormalRule(obj.cxlDtls.txInfAndSts)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
......
......@@ -49,6 +49,9 @@ export default function validator(obj) {
}
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
......@@ -56,6 +59,19 @@ export default function validator(obj) {
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 如果在业务应用程序标头中使用了复制副本指示器,则它必须与业务文档中的复制副本指示器相同(如果存在后者)。
function CBPR_Copy_Duplicate_FormalRule(obj) {
......
......@@ -61,7 +61,9 @@ export default function validator(obj) {
}
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
......@@ -70,6 +72,20 @@ export default function validator(obj) {
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 如果在业务应用程序标头中使用了复制副本指示器,则它必须与业务文档中的复制副本指示器相同(如果存在后者)。
function CBPR_Copy_Duplicate_FormalRule(obj) {
const msg = "If Copy Duplicate indicator is used in the Business Application Header, it must be identical to the Copy Duplicate indicator in the business document (if the latter is present).";
......
......@@ -56,11 +56,27 @@ export default function validator(obj) {
}
}
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 如果在业务应用程序标头中使用了复制副本指示器,则它必须与业务文档中的复制副本指示器相同(如果存在后者)。
function CBPR_Copy_Duplicate_FormalRule(obj){
const msg = "If Copy Duplicate indicator is used in the Business Application Header, it must be identical to the Copy Duplicate indicator in the business document (if the latter is present).";
......
......@@ -65,8 +65,25 @@ export default function validator(obj) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
// OriginalRequestedExecutionDate或OriginalRequestedCollectionDate必须存在,但两者不能同时存在。
function CBPR_OriginalRequestedExecutionDate_OriginalRequestedCollectionDate_FormalRule(obj1,position){
const msg = "Either OriginalRequestedExecutionDate or OriginalRequestedCollectionDate must be present, but both can't be present.";
......
......@@ -75,10 +75,26 @@ export default function validator(obj) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
// r1 BAH "From" BIC必须匹配"Assigner" BIC,除非BAH CopyDuplicate = COPY或= CODU
// BAH "To" BIC必须与"Assignee" BIC匹配,除非BAH CopyDuplicate = COPY或= CODU
function CBPR_From_To_Assigner_Assignee_BIC_1_FormalRule(obj1, obj2, position) {
......
......@@ -198,10 +198,26 @@ export default function validator(obj) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
function Mandatory_Debtor_Rule(obj){
const msg = "Either Debtor must be present or Item/Debtor must be present but not both.";
var position = "Notification/Debtor | Notification/Item/Debtor";
......
......@@ -181,9 +181,24 @@ export default function validator(obj) {
}
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 有关该字段用法的进一步说明,请参阅CBPR Plus UHB。
function CBPR_Character_Set_Usage_TextualRule() {
......
......@@ -91,10 +91,26 @@ export default function validator(obj) {
if (!CBPR_Co_existence_Postal_Address_TextualRule(obj)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 有关该字段用法的进一步说明,请参阅CBPR Plus UHB。
function CBPR_Character_Set_Usage_TextualRule() {
......
......@@ -42,10 +42,26 @@ export default function validator(obj) {
if (!CBPR_Town_Name_And_Country_FormalRule(element.drwrAgt.finInstnId.pstlAdr, `Cheque/DrawerAgent/Financial Institution Identification`)) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 有关该字段用法的进一步说明,请参阅CBPR Plus UHB。
function CBPR_Character_Set_Usage_TextualRule() {
......
......@@ -50,10 +50,25 @@ export default function validator(obj) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1
function CBPR_From_To_Instructing_Instructed_Agent_BIC_1_FormalRule() {
......
......@@ -342,6 +342,10 @@ export default function validator(obj) {
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
......@@ -921,4 +925,18 @@ function ChargesInformationAndInstructedAmountRule(obj) {
}
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
\ No newline at end of file
......@@ -77,8 +77,222 @@ export default function validator(obj) {
return false;
}
if(!SettlementMethod_COVE(obj.grpHdr)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
if(!GroupHeaderInterbankSettlementDateRule(obj)){
return false;
}
if(!InstructingAgentRule(obj)){
return false;
}
if(!InstructedAgentRule(obj)){
return false;
}
if(!PaymentTypeInformationRule(obj)){
return false;
}
if(!AgentAccountRule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent1Rule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent2Rule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent3Rule(obj.cdtTrfTxInf)){
return false;
}
if(!PreviousInstructionAgent2Rule(obj.cdtTrfTxInf)){
return false;
}
if(!PreviousInstructionAgent3Rule(obj.cdtTrfTxInf)){
return false;
}
return true;
}
//Cross Element Complex Rule : Agent Account Rule
function AgentAccountRule(obj){
const msg = "If Agent Account is present, then Agent must be present.";
var cdtrAgtAcct = obj.cdtrAgtAcct;
var cdtrAgt = obj.cdtrAgt;
if(isNotEmpty(cdtrAgtAcct)&&isEmpty(cdtrAgt)){
message("Creditor Agent Account", msg);
return false;
}
var dbtrAgtAcct = obj.dbtrAgtAcct;
var dbtrAgt = obj.dbtrAgt;
if(isNotEmpty(dbtrAgtAcct)&&isEmpty(dbtrAgt)){
message("Debtor Agent Account", msg);
return false;
}
var intrmyAgt1Acct = obj.intrmyAgt1Acct;
var intrmyAgt1 = obj.intrmyAgt1;
if(isNotEmpty(intrmyAgt1Acct)&&isEmpty(intrmyAgt1)){
message("Intermediary Agent 1 Account", msg);
return false;
}
var intrmyAgt2Acct = obj.intrmyAgt2Acct;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt2Acct)&&isEmpty(intrmyAgt2)){
message("Intermediary Agent 2 Account", msg);
return false;
}
var intrmyAgt3Acct = obj.intrmyAgt3Acct;
var intrmyAgt3 = obj.intrmyAgt3;
if(isNotEmpty(intrmyAgt3Acct)&&isEmpty(intrmyAgt3)){
message("Intermediary Agent 3 Account", msg);
return false;
}
var prvsInstgAgt1Acct = obj.prvsInstgAgt1Acct;
var prvsInstgAgt1 = obj.prvsInstgAgt1;
if(isNotEmpty(prvsInstgAgt1Acct)&&isEmpty(prvsInstgAgt1)){
message("Previous Instructing Agent 1 Account", msg);
return false;
}
var prvsInstgAgt2Acct = obj.prvsInstgAgt2Acct;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt2Acct)&&isEmpty(prvsInstgAgt2)){
message("Previous Instructing Agent 2 Account", msg);
return false;
}
var prvsInstgAgt3Acct = obj.prvsInstgAgt3Acct;
var prvsInstgAgt3 = obj.prvsInstgAgt3;
if(isNotEmpty(prvsInstgAgt3Acct)&&isEmpty(prvsInstgAgt3)){
message("Previous Instructing Agent 3 Account", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 1Rule
function IntermediaryAgent1Rule(obj){
const msg = "If IntermediaryAgent1 is present, then CreditorAgent must be present.";
var intrmyAgt1 = obj.intrmyAgt1;
var cdtrAgt = obj.cdtrAgt;
if(isNotEmpty(intrmyAgt1)&&isEmpty(cdtrAgt)){
message("Creditor Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 2Rule
function IntermediaryAgent2Rule(obj){
const msg = "If IntermediaryAgent2 is present, then IntermediaryAgent1 must be present.";
var intrmyAgt1 = obj.intrmyAgt1;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt2)&&isEmpty(intrmyAgt1)){
message("Intermediary Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 3Rule
function IntermediaryAgent3Rule(obj){
const msg = "If IntermediaryAgent3 is present, then IntermediaryAgent2 must be present.";
var intrmyAgt3 = obj.intrmyAgt3;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt3)&&isEmpty(intrmyAgt2)){
message("Intermediary Agent 2", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Previous Instruction Agent 2Rule
function PreviousInstructionAgent2Rule(obj){
const msg = "If PreviousInstructingAgent2 is present, then PreviousInstructingAgent1 must be present.";
var prvsInstgAgt1 = obj.prvsInstgAgt1;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt2)&&isEmpty(prvsInstgAgt1)){
message("Previous Instruction Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Previous Instruction Agent 3Rule
function PreviousInstructionAgent3Rule(obj){
const msg = "If PreviousInstructingAgent3 is present, then PreviousInstructingAgent2 must be present.";
var prvsInstgAgt3 = obj.prvsInstgAgt3;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt3)&&isEmpty(prvsInstgAgt2)){
message("Previous Instruction Agent 2", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Group Header Interbank Settlement Date Rule
function GroupHeaderInterbankSettlementDateRule(obj){
const msg = "If GroupHeader/InterbankSettlementDate is present, then CreditTransferTransactionInformation/InterbankSettlementDate is not allowed.";
var gintrBkSttlmDt = obj.grpHdr.intrBkSttlmDt;
var cintrBkSttlmDt = obj.cdtTrfTxInf.intrBkSttlmDt;
if(isNotEmpty(gintrBkSttlmDt)){
if(isNotEmpty(cintrBkSttlmDt)){
message("CreditTransferTransactionInformation/Interbank Settlement Date", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Instructing Agent Rule
function InstructingAgentRule(obj){
const msg = "If GroupHeader/InstructingAgent is present, then CreditTransferTransactionInformation/InstructingAgent is not allowed.";
var ginstgAgt = obj.grpHdr.instgAgt;
var cinstgAgt = obj.cdtTrfTxInf.instgAgt;
if(isNotEmpty(ginstgAgt)){
if(isNotEmpty(cinstgAgt)){
message("CreditTransferTransactionInformation/Instructing Agent", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Instructed Agent Rule
function InstructedAgentRule(obj){
const msg = "If GroupHeader/InstructedAgent is present, then CreditTransferTransactionInformation/InstructedAgent is not allowed.";
var ginstdAgt = obj.grpHdr.instdAgt;
var cinstdAgt = obj.cdtTrfTxInf.instdAgt;
if(isNotEmpty(ginstdAgt)){
if(isNotEmpty(cinstdAgt)){
message("CreditTransferTransactionInformation/Instructed Agent", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Payment Type Information Rule
function PaymentTypeInformationRule(obj){
const msg = "If GroupHeader/PaymentTypeInformation is present, then CreditTransferTransactionInformation/PaymentTypeInformation is not allowed.";
var gpmtTpInf = obj.grpHdr.pmtTpInf;
var cpmtTpInf = obj.cdtTrfTxInf.pmtTpInf;
if(isNotEmpty(gpmtTpInf)){
if(isNotEmpty(cpmtTpInf)){
message("CreditTransferTransactionInformation/Payment Type Information", msg);
return false;
}
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 如果在pacs消息的BAH中使用了“优先级”,则该值应与“付款类型信息/指令优先级”中的值相同(如果存在)。
function CBPR_Priority_Instruction_Priority_FormalRule() {
......@@ -416,3 +630,19 @@ function CBPR_Instruction_Information_TextualRule(){
const msg = "If the pacs.009 is used to settle a pacs.009 Advice, the last available occurrence (of the element Instruction For Creditor Agent/Instruction Information) preceded by /UDLC/ must be used to capture the /UDLC/ (Underlying Creditor) provided in the pacs.009 Advice.";
return true;
}
//如果结算方式等于COVE,则指示报销代理或指示报销代理必须在场。
function SettlementMethod_COVE(obj){
const msg = "If SettlementMethod is equal to COVE, then InstructedReimbursementAgent or InstructingReimbursementAgent must be present.";
if('COVE' == obj.sttlmInf.sttlmMtd){
if(isEmpty(obj.sttlmInf.instdRmbrsmntAgt)){
if(isEmpty(obj.sttlmInf.instgRmbrsmntAgt)){
message("Instructed Reimbursement Agent", msg);
return false;
}
}
}
return true;
}
......@@ -96,10 +96,223 @@ export default function validator(obj) {
return false;
}
if(!SettlementMethod_COVE(obj.grpHdr)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
if(!GroupHeaderInterbankSettlementDateRule(obj)){
return false;
}
if(!InstructingAgentRule(obj)){
return false;
}
if(!InstructedAgentRule(obj)){
return false;
}
if(!PaymentTypeInformationRule(obj)){
return false;
}
if(!AgentAccountRule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent1Rule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent2Rule(obj.cdtTrfTxInf)){
return false;
}
if(!IntermediaryAgent3Rule(obj.cdtTrfTxInf)){
return false;
}
if(!PreviousInstructionAgent2Rule(obj.cdtTrfTxInf)){
return false;
}
if(!PreviousInstructionAgent3Rule(obj.cdtTrfTxInf)){
return false;
}
return true;
}
//Cross Element Complex Rule : Agent Account Rule
function AgentAccountRule(obj){
const msg = "If Agent Account is present, then Agent must be present.";
var cdtrAgtAcct = obj.cdtrAgtAcct;
var cdtrAgt = obj.cdtrAgt;
if(isNotEmpty(cdtrAgtAcct)&&isEmpty(cdtrAgt)){
message("Creditor Agent Account", msg);
return false;
}
var dbtrAgtAcct = obj.dbtrAgtAcct;
var dbtrAgt = obj.dbtrAgt;
if(isNotEmpty(dbtrAgtAcct)&&isEmpty(dbtrAgt)){
message("Debtor Agent Account", msg);
return false;
}
var intrmyAgt1Acct = obj.intrmyAgt1Acct;
var intrmyAgt1 = obj.intrmyAgt1;
if(isNotEmpty(intrmyAgt1Acct)&&isEmpty(intrmyAgt1)){
message("Intermediary Agent 1 Account", msg);
return false;
}
var intrmyAgt2Acct = obj.intrmyAgt2Acct;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt2Acct)&&isEmpty(intrmyAgt2)){
message("Intermediary Agent 2 Account", msg);
return false;
}
var intrmyAgt3Acct = obj.intrmyAgt3Acct;
var intrmyAgt3 = obj.intrmyAgt3;
if(isNotEmpty(intrmyAgt3Acct)&&isEmpty(intrmyAgt3)){
message("Intermediary Agent 3 Account", msg);
return false;
}
var prvsInstgAgt1Acct = obj.prvsInstgAgt1Acct;
var prvsInstgAgt1 = obj.prvsInstgAgt1;
if(isNotEmpty(prvsInstgAgt1Acct)&&isEmpty(prvsInstgAgt1)){
message("Previous Instructing Agent 1 Account", msg);
return false;
}
var prvsInstgAgt2Acct = obj.prvsInstgAgt2Acct;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt2Acct)&&isEmpty(prvsInstgAgt2)){
message("Previous Instructing Agent 2 Account", msg);
return false;
}
var prvsInstgAgt3Acct = obj.prvsInstgAgt3Acct;
var prvsInstgAgt3 = obj.prvsInstgAgt3;
if(isNotEmpty(prvsInstgAgt3Acct)&&isEmpty(prvsInstgAgt3)){
message("Previous Instructing Agent 3 Account", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 1Rule
function IntermediaryAgent1Rule(obj){
const msg = "If IntermediaryAgent1 is present, then CreditorAgent must be present.";
var intrmyAgt1 = obj.intrmyAgt1;
var cdtrAgt = obj.cdtrAgt;
if(isNotEmpty(intrmyAgt1)&&isEmpty(cdtrAgt)){
message("Creditor Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 2Rule
function IntermediaryAgent2Rule(obj){
const msg = "If IntermediaryAgent2 is present, then IntermediaryAgent1 must be present.";
var intrmyAgt1 = obj.intrmyAgt1;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt2)&&isEmpty(intrmyAgt1)){
message("Intermediary Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Intermediary Agent 3Rule
function IntermediaryAgent3Rule(obj){
const msg = "If IntermediaryAgent3 is present, then IntermediaryAgent2 must be present.";
var intrmyAgt3 = obj.intrmyAgt3;
var intrmyAgt2 = obj.intrmyAgt2;
if(isNotEmpty(intrmyAgt3)&&isEmpty(intrmyAgt2)){
message("Intermediary Agent 2", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Previous Instruction Agent 2Rule
function PreviousInstructionAgent2Rule(obj){
const msg = "If PreviousInstructingAgent2 is present, then PreviousInstructingAgent1 must be present.";
var prvsInstgAgt1 = obj.prvsInstgAgt1;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt2)&&isEmpty(prvsInstgAgt1)){
message("Previous Instruction Agent", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Previous Instruction Agent 3Rule
function PreviousInstructionAgent3Rule(obj){
const msg = "If PreviousInstructingAgent3 is present, then PreviousInstructingAgent2 must be present.";
var prvsInstgAgt3 = obj.prvsInstgAgt3;
var prvsInstgAgt2 = obj.prvsInstgAgt2;
if(isNotEmpty(prvsInstgAgt3)&&isEmpty(prvsInstgAgt2)){
message("Previous Instruction Agent 2", msg);
return false;
}
return true;
}
//Cross Element Complex Rule : Group Header Interbank Settlement Date Rule
function GroupHeaderInterbankSettlementDateRule(obj){
const msg = "If GroupHeader/InterbankSettlementDate is present, then CreditTransferTransactionInformation/InterbankSettlementDate is not allowed.";
var gintrBkSttlmDt = obj.grpHdr.intrBkSttlmDt;
var cintrBkSttlmDt = obj.cdtTrfTxInf.intrBkSttlmDt;
if(isNotEmpty(gintrBkSttlmDt)){
if(isNotEmpty(cintrBkSttlmDt)){
message("CreditTransferTransactionInformation/Interbank Settlement Date", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Instructing Agent Rule
function InstructingAgentRule(obj){
const msg = "If GroupHeader/InstructingAgent is present, then CreditTransferTransactionInformation/InstructingAgent is not allowed.";
var ginstgAgt = obj.grpHdr.instgAgt;
var cinstgAgt = obj.cdtTrfTxInf.instgAgt;
if(isNotEmpty(ginstgAgt)){
if(isNotEmpty(cinstgAgt)){
message("CreditTransferTransactionInformation/Instructing Agent", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Instructed Agent Rule
function InstructedAgentRule(obj){
const msg = "If GroupHeader/InstructedAgent is present, then CreditTransferTransactionInformation/InstructedAgent is not allowed.";
var ginstdAgt = obj.grpHdr.instdAgt;
var cinstdAgt = obj.cdtTrfTxInf.instdAgt;
if(isNotEmpty(ginstdAgt)){
if(isNotEmpty(cinstdAgt)){
message("CreditTransferTransactionInformation/Instructed Agent", msg);
return false;
}
}
return true;
}
//Cross Element Complex Rule : Payment Type Information Rule
function PaymentTypeInformationRule(obj){
const msg = "If GroupHeader/PaymentTypeInformation is present, then CreditTransferTransactionInformation/PaymentTypeInformation is not allowed.";
var gpmtTpInf = obj.grpHdr.pmtTpInf;
var cpmtTpInf = obj.cdtTrfTxInf.pmtTpInf;
if(isNotEmpty(gpmtTpInf)){
if(isNotEmpty(cpmtTpInf)){
message("CreditTransferTransactionInformation/Payment Type Information", msg);
return false;
}
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 如果在pacs消息的BAH中使用了“优先级”,则该值应与“付款类型信息/指令优先级”中的值相同(如果存在)。
function CBPR_Priority_Instruction_Priority_FormalRule() {
const msg = "If 'Priority' is used in the BAH for pacs messages, the value should be identical to the one in the “Payment Type Information/InstructionPriority” if present.";
......@@ -365,5 +578,21 @@ function CBPR_Purpose_Guideline() {
return true;
}
//如果结算方式等于COVE,则指示报销代理或指示报销代理必须在场。
function SettlementMethod_COVE(obj){
const msg = "If SettlementMethod is equal to COVE, then InstructedReimbursementAgent or InstructingReimbursementAgent must be present.";
if('COVE' == obj.sttlmInf.sttlmMtd){
if(isEmpty(obj.sttlmInf.instdRmbrsmntAgt)){
if(isEmpty(obj.sttlmInf.instgRmbrsmntAgt)){
message("Instructed Reimbursement Agent", msg);
return false;
}
}
}
return true;
}
......@@ -48,7 +48,9 @@ export default function validator(obj) {
!CBPR_Structured_vs_Unstructured_FormalRule(obj.cdtInstr.drctDbtTxInf.dbtrAgt.finInstnId.pstlAdr,"Direct Debit Transaction Information/Debtor Agent/Financial Institution Identification")){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
......@@ -56,6 +58,20 @@ export default function validator(obj) {
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 BAH“From”BIC必须与“Instructioning Agent”BIC匹配,除非BAH CopyDuplicate=COPY或=CODUBAH“To”BIC与“Instructed Agent”BIC匹配,除非BAH CopyDublicate=COPY或=CODU
function CBPR_From_To_Instructing_Instructed_Agent_BIC_1_FormalRule() {
const msg = "BAH 'From' BIC must match 'Instructing Agent' BIC, except where BAH CopyDuplicate = COPY or = CODUBAH 'To' BIC must match 'Instructed Agent' BIC, except where BAH CopyDuplicate = COPY or = CODU";
......
......@@ -79,13 +79,29 @@ export default function validator(obj) {
if (!CBPR_Instruction_for_Creditor_Agent2_TextualRule(obj.pmtInf.cdtTrfTxInf.instrForCdtrAgt)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 有关该字段用法的进一步说明,请参阅CBPR Plus UHB。
function CBPR_Character_Set_Usage_TextualRule() {
......
......@@ -32,12 +32,27 @@ export default function validator(obj) {
if (!CBPR_Town_Name_And_Country_FormalRule(obj.orgnlPmtInfAndSts.txInfAndSts.stsRsnInf.orgtr.pstlAdr)){
return false;
}
if(!RelatedPresentWhenCopyDupl(obj)){
return false;
}
return true;
}
// Cross Element Complex Rule : Related Present When Copy Dupl
function RelatedPresentWhenCopyDupl(obj) {
const msg = "If CopyDuplicate is present, then Related MUST be present.";
var cpyDplct = obj.appHdr.cpyDplct;
var rltd = obj.appHdr.rltd;
if(isNotEmpty(cpyDplct)){
if(isEmpty(rltd)){
message("Related", msg);
return false;
}
}
return true;
}
//r1 有关该字段用法的进一步说明,请参阅CBPR Plus UHB。
function CBPR_Character_Set_Usage_TextualRule() {
......
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.23ee7bd5.js"></script><script defer="defer" src="js/app.c9fac77d.js"></script><script defer="defer" src="js/main.59945214.js"></script><link href="css/chunk-vendors.77489a8d.css" rel="stylesheet"><link href="css/app.d2831041.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
<!doctype html><html lang=""><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><link rel="icon" href="favicon.ico"/><title>ISO手工拟报</title><script defer="defer" src="js/chunk-vendors.23ee7bd5.js"></script><script defer="defer" src="js/app.c92c0280.js"></script><script defer="defer" src="js/main.59945214.js"></script><link href="css/chunk-vendors.77489a8d.css" rel="stylesheet"><link href="css/app.d2831041.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but swiftiso-editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
\ No newline at end of file
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