Documentation ¶
Index ¶
- Constants
- type Address
- type BankPaymentMethod
- type Bootstrapper
- type Contact
- type CryptoPaymentMethod
- type Data
- type Entity
- func (e *Entity) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, ...) error
- func (e *Entity) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte, pad bool) error
- func (e *Entity) CalculateDocumentRoot() ([]byte, error)
- func (e *Entity) CalculateSigningRoot() ([]byte, error)
- func (e *Entity) CollaboratorCanUpdate(updated documents.Document, collaborator identity.DID) error
- func (e *Entity) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (prf *documents.DocumentProof, err error)
- func (e *Entity) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
- func (e *Entity) DeleteAttribute(key documents.AttrKey, prepareNewVersion bool) error
- func (e *Entity) DeriveFromClonePayload(_ context.Context, m documents.Document) error
- func (e *Entity) DeriveFromCreatePayload(_ context.Context, payload documents.CreatePayload) error
- func (e *Entity) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, error)
- func (*Entity) DocumentType() string
- func (e *Entity) FromJSON(jsonData []byte) error
- func (e *Entity) GetData() interface{}
- func (e *Entity) JSON() ([]byte, error)
- func (e *Entity) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (e *Entity) Patch(payload documents.UpdatePayload) error
- func (e *Entity) Scheme() string
- func (e *Entity) Type() reflect.Type
- func (e *Entity) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
- type OtherPaymentMethod
- type PaymentDetail
- type Service
Constants ¶
const ( // Scheme is entity scheme. Scheme = prefix // ErrMultiplePaymentMethodsSet is a sentinel error when multiple payment methods are set in a single payment detail. ErrMultiplePaymentMethodsSet = errors.Error("multiple payment methods are set") // ErrNoPaymentMethodSet is a sentinel error when no payment method is set in a single payment detail. ErrNoPaymentMethodSet = errors.Error("no payment method is set") // ErrEntityInvalidData sentinel error when data unmarshal is failed. ErrEntityInvalidData = errors.Error("invalid entity data") )
const ( // BootstrappedEntityService maps to the service for entities BootstrappedEntityService string = "BootstrappedEntityService" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶ added in v1.0.0
type Address struct { IsMain bool `json:"is_main"` IsRemitTo bool `json:"is_remit_to"` IsShipTo bool `json:"is_ship_to"` IsPayTo bool `json:"is_pay_to"` Label string `json:"label"` Zip string `json:"zip"` State string `json:"state"` Country string `json:"country"` AddressLine1 string `json:"address_line_1"` AddressLine2 string `json:"address_line_2"` ContactPerson string `json:"contact_person"` }
Address holds the address details of the entity.
type BankPaymentMethod ¶ added in v1.0.0
type BankPaymentMethod struct { Identifier byteutils.HexBytes `json:"identifier" swaggertype:"primitive,string"` Address Address `json:"address"` HolderName string `json:"holder_name"` BankKey string `json:"bank_key"` BankAccountNumber string `json:"bank_account_number"` SupportedCurrency string `json:"supported_currency"` }
BankPaymentMethod holds the bank details of the entity.
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (Bootstrapper) Bootstrap(ctx map[string]interface{}) error
Bootstrap sets the required storage and registers
type Contact ¶ added in v1.0.0
type Contact struct { Name string `json:"name"` Title string `json:"title"` Email string `json:"email"` Phone string `json:"phone"` Fax string `json:"fax"` }
Contact holds the entity contact details.
type CryptoPaymentMethod ¶ added in v1.0.0
type CryptoPaymentMethod struct { Identifier byteutils.HexBytes `json:"identifier" swaggertype:"primitive,string"` To string `json:"to"` ChainURI string `json:"chain_uri"` SupportedCurrency string `json:"supported_currency"` }
CryptoPaymentMethod holds the crypto details of the entity.
type Data ¶ added in v1.0.0
type Data struct { Identity *identity.DID `json:"identity" swaggertype:"primitive,string"` LegalName string `json:"legal_name"` Addresses []Address `json:"addresses"` PaymentDetails []PaymentDetail `json:"payment_details"` Contacts []Contact `json:"contacts"` }
Data represents the entity data.
type Entity ¶
type Entity struct { *documents.CoreDocument Data Data }
Entity implements the documents.Document keeps track of entity related fields and state
func (*Entity) AddAttributes ¶ added in v1.0.0
func (e *Entity) AddAttributes(ca documents.CollaboratorsAccess, prepareNewVersion bool, attrs ...documents.Attribute) error
AddAttributes adds attributes to the Entity model.
func (*Entity) AddNFT ¶
func (e *Entity) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte, pad bool) error
AddNFT adds NFT to the Entity.
func (*Entity) CalculateDocumentRoot ¶
CalculateDocumentRoot calculates the document root
func (*Entity) CalculateSigningRoot ¶
CalculateSigningRoot calculates the signing root of the document.
func (*Entity) CollaboratorCanUpdate ¶
CollaboratorCanUpdate checks if the collaborator can update the document.
func (*Entity) CreateNFTProofs ¶
func (e *Entity) CreateNFTProofs( account identity.DID, registry common.Address, tokenID []byte, nftUniqueProof, readAccessProof bool) (prf *documents.DocumentProof, err error)
CreateNFTProofs creates proofs specific to NFT minting.
func (*Entity) CreateProofs ¶
func (e *Entity) CreateProofs(fields []string) (prf *documents.DocumentProof, err error)
CreateProofs generates proofs for given fields.
func (*Entity) DeleteAttribute ¶ added in v1.0.0
DeleteAttribute deletes the attribute from the model.
func (*Entity) DeriveFromClonePayload ¶ added in v1.2.0
DeriveFromClonePayload unpacks the entity data from the Payload This method clones the transition rules and roles from a template document.
func (*Entity) DeriveFromCreatePayload ¶ added in v1.0.0
DeriveFromCreatePayload unpacks the entity data from the Payload.
func (*Entity) DeriveFromUpdatePayload ¶ added in v1.0.0
func (e *Entity) DeriveFromUpdatePayload(_ context.Context, payload documents.UpdatePayload) (documents.Document, error)
DeriveFromUpdatePayload unpacks the update payload and prepares a new version.
func (*Entity) DocumentType ¶
DocumentType returns the entity document type.
func (*Entity) GetData ¶ added in v1.0.0
func (e *Entity) GetData() interface{}
GetData returns entity data
func (*Entity) PackCoreDocument ¶
func (e *Entity) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
PackCoreDocument packs the Entity into a CoreDocument.
func (*Entity) Patch ¶ added in v1.0.0
func (e *Entity) Patch(payload documents.UpdatePayload) error
Patch merges payload data into model
func (*Entity) UnpackCoreDocument ¶
func (e *Entity) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
UnpackCoreDocument unpacks the core document into Entity.
type OtherPaymentMethod ¶ added in v1.0.0
type OtherPaymentMethod struct { Identifier byteutils.HexBytes `json:"identifier" swaggertype:"primitive,string"` Type string `json:"type"` PayTo string `json:"pay_to"` SupportedCurrency string `json:"supported_currency"` }
OtherPaymentMethod represents any other payment methods entity accepts.
type PaymentDetail ¶ added in v1.0.0
type PaymentDetail struct { Predefined bool `json:"predefined"` BankPaymentMethod *BankPaymentMethod `json:"bank_payment_method,omitempty"` CryptoPaymentMethod *CryptoPaymentMethod `json:"crypto_payment_method,omitempty"` OtherPaymentMethod *OtherPaymentMethod `json:"other_payment_method,omitempty"` }
PaymentDetail contains the payments receiving details of the entity. Note: only one of the payment methods has to be set for a given payment detail.
type Service ¶
type Service interface { documents.Service // GetEntityByRelationship returns the entity model from database or requests from granter GetEntityByRelationship(ctx context.Context, relationshipIdentifier []byte) (documents.Document, error) }
Service defines specific functions for entity
func DefaultService ¶
func DefaultService( srv documents.Service, repo documents.Repository, factory identity.Factory, erService entityrelationship.Service, anchorSrv anchors.Service, processor documents.DocumentRequestProcessor, receivedEntityValidator func() documents.ValidatorGroup, ) Service
DefaultService returns the default implementation of the service.