我在IBM Hyperledger Composer中定义了以下业务网络
========================================
namespace org.india.invoicefinance
enum InvoiceState {
o SUBMITTED
o APPROVED
o REJECTED
o FINANCED
}
asset InvoiceLedger identified by invoiceNumber {
o String invoiceNumber
o DateTime invoiceDt
o Double amount
o Integer creditPeriod
o String poNumber
o InvoiceState invoiceStatus
--> Buyer buyer
--> Seller seller
}
participant Buyer identified by buyerId {
o String buyerId
o String orgName
o String contactName
}
participant Seller identified by sellerId {
o String sellerId
o String orgName
o String contactName
}
transaction Invoice {
o String invoiceNumber
o DateTime invoiceDt
o Double amount
o Integer creditPeriod
o String poNumber
--> Buyer buyer
--> Seller seller
}
========================================
在交易处理功能期间,我想执行以下验证:
买方存在于买方,卖方存在于卖方,invoicenumber不存在于invoiceledger
任何人都可以帮助或指导我实现这一目标吗?
非常感谢... Umesh制作
答案 0 :(得分:0)
您可以在这里查看比较运营商的智能合约 - > https://github.com/hyperledger/composer-sample-networks/blob/master/packages/animaltracking-network/lib/model.cto.js您可以查看
请注意,如果您根据您的模型传递了对买方,卖方和invoiceNumber(所有这些都可能是交易Invoice
中的关系)的引用,那么您将拥有相关的CURRENT买方,卖方和Invoicenumber 。显然,您可以连接到这些单独的注册表,以检查其他记录(正如您所提到的)。这里查找的示例 - > (更简单的模型,事务具有多个关系)https://github.com/hyperledger/composer-sample-networks/tree/master/packages/trade-network/models(更复杂的模型)https://github.com/hyperledger/composer-sample-networks/blob/master/packages/perishable-network/models/perishable.cto和txn逻辑 - > https://github.com/hyperledger/composer-sample-networks/blob/master/packages/perishable-network/lib/logic.js