AddCompany

AddCompany is similar to how we added insuree at the Init step. Chaincode can register brokers and insurers through this function. The company type can be a broker or insurer, as follows:

func (c *ClaimContract) AddCompany(stub shim.ChaincodeStubInterface, args []string) pb.Response {
id := args[0]
name := args[1]
companyType := args[2]
companyData := Company{
Id: id,
Type: companyType,
Name: name}
companyBytes, _ := json.Marshal(companyData)
stub.PutState(id, companyBytes)
return shim.Success(companyBytes)
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset