Documentation ¶
Index ¶
- Constants
- func CreateValidator() documents.ValidatorGroup
- func GRPCHandler(config config.Service, srv Service) clientpurchaseorderpb.DocumentServiceServer
- func UpdateValidator() documents.ValidatorGroup
- type Bootstrapper
- type PurchaseOrder
- func (p *PurchaseOrder) CreateProofs(fields []string) (coreDoc *coredocumentpb.CoreDocument, proofs []*proofspb.Proof, err error)
- func (p *PurchaseOrder) FromJSON(jsonData []byte) error
- func (p *PurchaseOrder) ID() ([]byte, error)
- func (p *PurchaseOrder) InitPurchaseOrderInput(payload *clientpurchaseorderpb.PurchaseOrderCreatePayload, self string) error
- func (p *PurchaseOrder) JSON() ([]byte, error)
- func (p *PurchaseOrder) PackCoreDocument() (*coredocumentpb.CoreDocument, error)
- func (p *PurchaseOrder) Type() reflect.Type
- func (p *PurchaseOrder) UnpackCoreDocument(coreDoc *coredocumentpb.CoreDocument) error
- type Service
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.DocumentServiceServer
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 PurchaseOrder ¶
type PurchaseOrder struct { Status string // status of the Purchase Order PoNumber string // purchase order number or reference number OrderName string // name of the ordering company OrderStreet string // street and address details of the ordering company OrderCity string OrderZipcode string OrderCountry string // country ISO code of the ordering company of this purchase order RecipientName string // name of the recipient company RecipientStreet string RecipientCity string RecipientZipcode string RecipientCountry string // country ISO code of the recipient of this purchase order Currency string // ISO currency code OrderAmount int64 // ordering gross amount including tax NetAmount int64 // invoice amount excluding tax TaxAmount int64 TaxRate int64 Recipient *identity.CentID Order []byte OrderContact string Comment string DeliveryDate *timestamp.Timestamp // requested delivery date DateCreated *timestamp.Timestamp // purchase order date ExtraData []byte PurchaseOrderSalt *purchaseorderpb.PurchaseOrderDataSalts CoreDocument *coredocumentpb.CoreDocument }
PurchaseOrder implements the documents.Model keeps track of purchase order related fields and state
func (*PurchaseOrder) CreateProofs ¶
func (p *PurchaseOrder) CreateProofs(fields []string) (coreDoc *coredocumentpb.CoreDocument, proofs []*proofspb.Proof, err error)
CreateProofs generates proofs for given fields
func (*PurchaseOrder) FromJSON ¶
func (p *PurchaseOrder) FromJSON(jsonData []byte) error
FromJSON unmarshals the json bytes into PurchaseOrder
func (*PurchaseOrder) ID ¶
func (p *PurchaseOrder) ID() ([]byte, error)
ID returns the DocumentIdentifier for this document Note: this is not same as VersionIdentifier
func (*PurchaseOrder) InitPurchaseOrderInput ¶
func (p *PurchaseOrder) InitPurchaseOrderInput(payload *clientpurchaseorderpb.PurchaseOrderCreatePayload, self string) 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() (*coredocumentpb.CoreDocument, error)
PackCoreDocument packs the PurchaseOrder into a Core Document If the, PurchaseOrder is new, it creates a valid identifiers
func (*PurchaseOrder) Type ¶
func (p *PurchaseOrder) Type() reflect.Type
Type gives the PurchaseOrder type
func (*PurchaseOrder) UnpackCoreDocument ¶
func (p *PurchaseOrder) UnpackCoreDocument(coreDoc *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, txService transactions.Service, ) Service
DefaultService returns the default implementation of the service