blockchain

package
v0.0.0-...-d75e47d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SDK           *fabsdk.FabricSDK          // sdk handler
	ChannelName   = "assetschannel"          // channel
	ChainCodeName = "insurance"              // chaincode name
	Org           = "org1"                   // org name
	User          = "Admin"                  // user
	ConfigPath    = "blockchain/config.yaml" // config
	EndPoint      = "peer1.org1.example.com" // client endpoint
)

settings

Functions

func ChannelExecute

func ChannelExecute(fcn string, args [][]byte) (channel.Response, error)

ChannelExecute invoke chaincode and update

func ChannelQuery

func ChannelQuery(fcn string, args [][]byte) (channel.Response, error)

ChannelQuery invoke chaincode and query

func Init

func Init()

Init fabric sdk

Types

type Claim

type Claim struct {
	ContractUUID  string      `json:"contract_uuid"`
	Date          time.Time   `json:"date"`
	Description   string      `json:"description"`
	IsTheft       bool        `json:"is_theft"`
	Status        ClaimStatus `json:"status"`
	Reimbursable  float32     `json:"reimbursable"`
	Repaired      bool        `json:"repaired"`
	FileReference string      `json:"file_reference"`
}

Key consists of prefix + UUID of the contract + UUID of the claim

type ClaimStatus

type ClaimStatus int8
const (
	// The claims status is unknown
	ClaimStatusUnknown ClaimStatus = iota
	// The claim is new
	ClaimStatusNew
	// The claim has been rejected (either by the insurer, or by authorities
	ClaimStatusRejected
	// The item is up for repairs, or has been repaired
	ClaimStatusRepair
	// The customer should be reimbursed, or has already been
	ClaimStatusReimbursement
	// The theft of the item has been confirmed by authorities
	ClaimStatusTheftConfirmed
)

func (ClaimStatus) MarshalJSON

func (s ClaimStatus) MarshalJSON() ([]byte, error)

func (*ClaimStatus) UnmarshalJSON

func (s *ClaimStatus) UnmarshalJSON(b []byte) error

type Contract

type Contract struct {
	Username         string    `json:"username"`
	Item             Item      `json:"item"`
	StartDate        time.Time `json:"start_date"`
	EndDate          time.Time `json:"end_date"`
	Void             bool      `json:"void"`
	ContractTypeUUID string    `json:"contract_type_uuid"`
	ClaimIndex       []string  `json:"claim_index,omitempty"`
}

Key consists of prefix + username + UUID of the contract

type ContractType

type ContractType struct {
	ShopType        string  `json:"shop_type"`
	FormulaPerDay   string  `json:"formula_per_day"`
	MaxSumInsured   float32 `json:"max_sum_insured"`
	TheftInsured    bool    `json:"theft_insured"`
	Description     string  `json:"description"`
	Conditions      string  `json:"conditions"`
	Active          bool    `json:"active"`
	MinDurationDays int32   `json:"min_duration_days"`
	MaxDurationDays int32   `json:"max_duration_days"`
}

Key consists of prefix + UUID of the contract type

type ContractTypeWithUUID

type ContractTypeWithUUID struct {
	UUID string `json:"uuid"`
	*ContractType
}

type ContractWithUUID

type ContractWithUUID struct {
	UUID string `json:"uuid"`
	*Contract
}

type Item

type Item struct {
	ID          int32   `json:"id"`
	Brand       string  `json:"brand"`
	Model       string  `json:"model"`
	Price       float32 `json:"price"`
	Description string  `json:"description"`
	SerialNo    string  `json:"serial_no"`
}

Entity not persisted on its own

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL