如何查找特定资产的交易是否已存在以及超级分类合成者的参与者?

时间:2018-04-06 12:42:06

标签: javascript transactions hyperledger hyperledger-composer

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");

});

1 个答案:

答案 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?