purchaseorder

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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

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) AddNFT

func (p *PurchaseOrder) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error

AddNFT adds NFT to the Purchase Order.

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

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

type TaxItem

type TaxItem struct {
	ItemNumber              string
	PurchaseOrderItemNumber string
	TaxAmount               *documents.Decimal
	TaxRate                 *documents.Decimal
	TaxCode                 *documents.Decimal
	TaxBaseAmount           *documents.Decimal
}

TaxItem describes a single Purchase Order tax item.

Jump to

Keyboard shortcuts

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