ReportLost

In this step, the insuree reports the lost item to the broker with all the claim information. This function also records the current system process time at the processAt field. currentts.Format(2006-01-02 15:04:05) is a Go custom format; it will convert the current time into YYYY-MM-dd hh:mm:ss format, as shown in the following example:

func (c *ClaimContract) ReportLost(stub shim.ChaincodeStubInterface, args []string) pb.Response {
claimId := args[0]
desc := args[1]
insureeId := args[2]
brokerId := args[3]
currentts := time.Now()
processAt := currentts.Format("2006-01-02 15:04:05")
//initialized claim
claimData := Claim{
Id: claimId,
Desc: desc,
Status: "ReportLost",
InsureeId: insureeId,
BrokerId: brokerId,
InsurerId: "",
Comment: "",
ProcessAt: processAt}
claimBytes, _ := json.Marshal(claimData)
stub.PutState(claimId, claimBytes)
return shim.Success(claimBytes)
}

..................Content has been hidden....................

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