Documentation ¶
Index ¶
- Constants
- func CreateValidator() documents.ValidatorGroup
- func GRPCHandler(config config.Service, srv Service) clientpurchaseorderpb.PurchaseOrderServiceServer
- func UpdateValidator() documents.ValidatorGroup
- type Bootstrapper
- type LineItem
- type LineItemActivity
- type PurchaseOrder
- func (p *PurchaseOrder) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
- func (p *PurchaseOrder) CalculateDataRoot() ([]byte, error)
- func (p *PurchaseOrder) CalculateDocumentRoot() ([]byte, error)
- func (p *PurchaseOrder) CalculateSigningRoot() ([]byte, error)
- func (p *PurchaseOrder) CollaboratorCanUpdate(updated documents.Model, collaborator identity.DID) error
- func (p *PurchaseOrder) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proofs []*proofspb.Proof, err error)
- func (p *PurchaseOrder) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
- func (p *PurchaseOrder) DocumentRootTree() (tree *proofs.DocumentTree, err error)
- func (*PurchaseOrder) DocumentType() string
- func (p *PurchaseOrder) FromJSON(jsonData []byte) error
- func (p *PurchaseOrder) InitPurchaseOrderInput(payload *clientpurchaseorderpb.PurchaseOrderCreatePayload, self identity.DID) error
- func (p *PurchaseOrder) JSON() ([]byte, error)
- func (p *PurchaseOrder) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (p *PurchaseOrder) PrepareNewVersion(old documents.Model, data *clientpurchaseorderpb.PurchaseOrderData, ...) error
- func (p *PurchaseOrder) Type() reflect.Type
- func (p *PurchaseOrder) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
- type Service
- type TaxItem
Constants ¶
const (
// BootstrappedPOHandler maps to grc handler for PO
BootstrappedPOHandler = "BootstrappedPOHandler"
)
Variables ¶
This section is empty.
Functions ¶
func CreateValidator ¶
func CreateValidator() documents.ValidatorGroup
CreateValidator returns a validator group that should be run before creating the purchase order and persisting it to DB
func GRPCHandler ¶
func GRPCHandler(config config.Service, srv Service) clientpurchaseorderpb.PurchaseOrderServiceServer
GRPCHandler returns an implementation of the purchaseorder DocumentServiceServer
func UpdateValidator ¶
func UpdateValidator() documents.ValidatorGroup
UpdateValidator returns a validator group that should be run before updating the purchase order
Types ¶
type Bootstrapper ¶
type Bootstrapper struct{}
Bootstrapper implements bootstrap.Bootstrapper.
func (Bootstrapper) Bootstrap ¶
func (Bootstrapper) Bootstrap(ctx map[string]interface{}) error
Bootstrap initialises required services for purchaseorder.
type LineItem ¶
type LineItem struct { Status string ItemNumber string Description string AmountInvoiced *documents.Decimal AmountTotal *documents.Decimal RequisitionNumber string RequisitionItem string PartNumber string PricePerUnit *documents.Decimal UnitOfMeasure *documents.Decimal Quantity *documents.Decimal ReceivedQuantity *documents.Decimal DateUpdated *timestamp.Timestamp DateCreated *timestamp.Timestamp RevisionNumber int64 Activities []*LineItemActivity TaxItems []*TaxItem }
LineItem describes a single LineItem Activity
type LineItemActivity ¶
type LineItemActivity struct { ItemNumber string Status string Quantity *documents.Decimal Amount *documents.Decimal ReferenceDocumentID string ReferenceDocumentItem string Date *timestamp.Timestamp }
LineItemActivity describes a single line item activity.
type PurchaseOrder ¶
type PurchaseOrder struct { *documents.CoreDocument Status string // status of the Purchase Order Number string // purchase order number or reference number SenderOrderID string RecipientOrderID string RequisitionID string RequesterName string RequesterEmail string ShipToCompanyName string ShipToContactPersonName string ShipToStreet1 string ShipToStreet2 string ShipToCity string ShipToZipcode string ShipToState string ShipToCountry string PaymentTerms string Currency string TotalAmount *documents.Decimal Recipient *identity.DID Sender *identity.DID Comment string DateSent *timestamp.Timestamp DateConfirmed *timestamp.Timestamp DateUpdated *timestamp.Timestamp DateCreated *timestamp.Timestamp Attachments []*documents.BinaryAttachment LineItems []*LineItem PaymentDetails []*documents.PaymentDetails }
PurchaseOrder implements the documents.Model keeps track of purchase order related fields and state
func (*PurchaseOrder) CalculateDataRoot ¶
func (p *PurchaseOrder) CalculateDataRoot() ([]byte, error)
CalculateDataRoot calculates the data root and sets the root to core document
func (*PurchaseOrder) CalculateDocumentRoot ¶
func (p *PurchaseOrder) CalculateDocumentRoot() ([]byte, error)
CalculateDocumentRoot calculates the document root
func (*PurchaseOrder) CalculateSigningRoot ¶
func (p *PurchaseOrder) CalculateSigningRoot() ([]byte, error)
CalculateSigningRoot returns the signing root of the document. Calculates it if not generated yet.
func (*PurchaseOrder) CollaboratorCanUpdate ¶
func (p *PurchaseOrder) CollaboratorCanUpdate(updated documents.Model, collaborator identity.DID) error
CollaboratorCanUpdate checks if the account can update the document.
func (*PurchaseOrder) CreateNFTProofs ¶
func (p *PurchaseOrder) CreateNFTProofs( account identity.DID, registry common.Address, tokenID []byte, nftUniqueProof, readAccessProof bool) (proofs []*proofspb.Proof, err error)
CreateNFTProofs creates proofs specific to NFT minting.
func (*PurchaseOrder) CreateProofs ¶
func (p *PurchaseOrder) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
CreateProofs generates proofs for given fields.
func (*PurchaseOrder) DocumentRootTree ¶
func (p *PurchaseOrder) DocumentRootTree() (tree *proofs.DocumentTree, err error)
DocumentRootTree creates and returns the document root tree
func (*PurchaseOrder) DocumentType ¶
func (*PurchaseOrder) DocumentType() string
DocumentType returns the po document type.
func (*PurchaseOrder) FromJSON ¶
func (p *PurchaseOrder) FromJSON(jsonData []byte) error
FromJSON unmarshals the json bytes into PurchaseOrder
func (*PurchaseOrder) InitPurchaseOrderInput ¶
func (p *PurchaseOrder) InitPurchaseOrderInput(payload *clientpurchaseorderpb.PurchaseOrderCreatePayload, self identity.DID) error
InitPurchaseOrderInput initialize the model based on the received parameters from the rest api call
func (*PurchaseOrder) JSON ¶
func (p *PurchaseOrder) JSON() ([]byte, error)
JSON marshals PurchaseOrder into a json bytes
func (*PurchaseOrder) PackCoreDocument ¶
func (p *PurchaseOrder) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
PackCoreDocument packs the PurchaseOrder into a Core Document
func (*PurchaseOrder) PrepareNewVersion ¶
func (p *PurchaseOrder) PrepareNewVersion(old documents.Model, data *clientpurchaseorderpb.PurchaseOrderData, collaborators documents.CollaboratorsAccess) error
PrepareNewVersion prepares new version from the old invoice.
func (*PurchaseOrder) Type ¶
func (p *PurchaseOrder) Type() reflect.Type
Type gives the PurchaseOrder type
func (*PurchaseOrder) UnpackCoreDocument ¶
func (p *PurchaseOrder) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
UnpackCoreDocument unpacks the core document into PurchaseOrder
type Service ¶
type Service interface { documents.Service // DeriverFromPayload derives purchase order from clientPayload DeriveFromCreatePayload(ctx context.Context, payload *clientpopb.PurchaseOrderCreatePayload) (documents.Model, error) // DeriveFromUpdatePayload derives purchase order from update payload DeriveFromUpdatePayload(ctx context.Context, payload *clientpopb.PurchaseOrderUpdatePayload) (documents.Model, error) // DerivePurchaseOrderData returns the purchase order data as client data DerivePurchaseOrderData(po documents.Model) (*clientpopb.PurchaseOrderData, error) // DerivePurchaseOrderResponse returns the purchase order in our standard client format DerivePurchaseOrderResponse(po documents.Model) (*clientpopb.PurchaseOrderResponse, error) }
Service defines specific functions for purchase order
func DefaultService ¶
func DefaultService( srv documents.Service, repo documents.Repository, queueSrv queue.TaskQueuer, jobManager jobs.Manager, tokenRegFinder func() documents.TokenRegistry, ) Service
DefaultService returns the default implementation of the service