Participant
IDFC
Participant
TATA , MRF
Asset
FINANCEPROGRAM
Transaction
(Data need to submit)
participant(TATA) ,Asset (FINANCEPROGRAM ) ,loanAmount , loantenure
我需要检查FINANCEPROGRAM和TATA的交易是否已经存在。
如果存在,我需要拒绝交易。
var query1 = query('SELECT com.ett.blockchain.Programmeben WHERE (beneficiary == _$beneficiary AND bankprogramme == _$bank program) ');
return query('query1',{beneficiary : 'resource:com.ett.blockchain.Beneficiary #'+pgben.beneficiary .customerid,bankprogram: 'resource:com.ett.blockchain.Bankprogramme#'+pgben.bankprogramme.programmeid})
.then(function (transactions1) {
transactions1.forEach(function (trans1) {
console.log("transaction exist " );
});
throw Error("Transaction already exist");
});
答案 0 :(得分:1)
您错过了buildQuery
声明。
例如
var query1 = buildQuery('SELECT com.ett.blockchain.Programmeben WHERE (beneficiary == _$beneficiary AND bankprogramme == _$bank program) ');
return query(query1, { beneficiary : 'resource:com.ett.blockchain.Beneficiary#' + pgben.beneficiary.customerid, bankprogram: 'resource:com.ett.blockchain.Bankprogramme#' + pgben.bankprogramme.programmeid } )
请参阅此处的示例(具体来说,'Javascript code js'部分) - > Why are the following added assets not persisted in the hyperledger registry?