Documentation ¶
Index ¶
- Constants
- func CreateValidator() documents.ValidatorGroup
- func GRPCHandler(config config.Service, srv Service) clientinvoicepb.InvoiceServiceServer
- func UpdateValidator() documents.ValidatorGroup
- type Bootstrapper
- type Invoice
- func (i *Invoice) AddNFT(grantReadAccess bool, registry common.Address, tokenID []byte) error
- func (i *Invoice) CalculateDataRoot() ([]byte, error)
- func (i *Invoice) CalculateDocumentRoot() ([]byte, error)
- func (i *Invoice) CalculateSigningRoot() ([]byte, error)
- func (i *Invoice) CollaboratorCanUpdate(updated documents.Model, collaborator identity.DID) error
- func (i *Invoice) CreateNFTProofs(account identity.DID, registry common.Address, tokenID []byte, ...) (proofs []*proofspb.Proof, err error)
- func (i *Invoice) CreateProofs(fields []string) (proofs []*proofspb.Proof, err error)
- func (i *Invoice) DocumentRootTree() (tree *proofs.DocumentTree, err error)
- func (*Invoice) DocumentType() string
- func (i *Invoice) FromJSON(jsonData []byte) error
- func (i *Invoice) InitInvoiceInput(payload *clientinvoicepb.InvoiceCreatePayload, self identity.DID) error
- func (i *Invoice) JSON() ([]byte, error)
- func (i *Invoice) PackCoreDocument() (cd coredocumentpb.CoreDocument, err error)
- func (i *Invoice) PrepareNewVersion(old documents.Model, data *clientinvoicepb.InvoiceData, ...) error
- func (i *Invoice) Type() reflect.Type
- func (i *Invoice) UnpackCoreDocument(cd coredocumentpb.CoreDocument) error
- type LineItem
- type Service
- type TaxItem
Constants ¶
const ( // BootstrappedInvoiceHandler maps to grpc handler for invoices BootstrappedInvoiceHandler string = "BootstrappedInvoiceHandler" )
Variables ¶
This section is empty.
Functions ¶
func CreateValidator ¶
func CreateValidator() documents.ValidatorGroup
CreateValidator returns a validator group that should be run before creating the invoice and persisting it to DB
func GRPCHandler ¶
func GRPCHandler(config config.Service, srv Service) clientinvoicepb.InvoiceServiceServer
GRPCHandler returns an implementation of invoice.DocumentServiceServer
func UpdateValidator ¶
func UpdateValidator() documents.ValidatorGroup
UpdateValidator returns a validator group that should be run before updating the invoice
Types ¶
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 Invoice ¶
type Invoice struct { *documents.CoreDocument Number string // invoice number or reference number Status string // invoice status SenderInvoiceID string RecipientInvoiceID string SenderCompanyName string SenderContactPersonName string SenderStreet1 string // street and address details of the sender company SenderStreet2 string SenderCity string SenderZipcode string SenderState string SenderCountry string // country ISO code of the sender of this invoice BillToCompanyName string BillToContactPersonName string BillToStreet1 string BillToStreet2 string BillToCity string BillToZipcode string BillToState string BillToCountry string BillToVatNumber string BillToLocalTaxID string RemitToCompanyName string RemitToContactPersonName string RemitToStreet1 string RemitToStreet2 string RemitToCity string RemitToZipcode string RemitToState string RemitToCountry string RemitToVatNumber string RemitToLocalTaxID string RemitToTaxCountry string ShipToCompanyName string ShipToContactPersonName string ShipToStreet1 string ShipToStreet2 string ShipToCity string ShipToZipcode string ShipToState string ShipToCountry string Currency string // ISO currency code GrossAmount *documents.Decimal // invoice amount including tax NetAmount *documents.Decimal // invoice amount excluding tax TaxAmount *documents.Decimal TaxRate *documents.Decimal TaxOnLineLevel bool Recipient *identity.DID `json:"recipient,string"` // centrifuge ID of the recipient Sender *identity.DID `json:"sender,string"` // centrifuge ID of the sender Payee *identity.DID `json:"payee,string"` // centrifuge ID of the payee Comment string ShippingTerms string RequesterEmail string RequesterName string DeliveryNumber string // number of the delivery note IsCreditNote bool CreditNoteInvoiceNumber string CreditForInvoiceDate *timestamp.Timestamp DateDue *timestamp.Timestamp DatePaid *timestamp.Timestamp DateUpdated *timestamp.Timestamp DateCreated *timestamp.Timestamp Attachments []*documents.BinaryAttachment LineItems []*LineItem PaymentDetails []*documents.PaymentDetails TaxItems []*TaxItem }
Invoice implements the documents.Model keeps track of invoice related fields and state
func (*Invoice) CalculateDataRoot ¶
CalculateDataRoot calculates the data root and sets the root to core document.
func (*Invoice) CalculateDocumentRoot ¶
CalculateDocumentRoot calculates the document root
func (*Invoice) CalculateSigningRoot ¶
CalculateSigningRoot calculates the signing root of the document.
func (*Invoice) CollaboratorCanUpdate ¶
CollaboratorCanUpdate checks if the collaborator can update the document.
func (*Invoice) CreateNFTProofs ¶
func (i *Invoice) 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 (*Invoice) CreateProofs ¶
CreateProofs generates proofs for given fields.
func (*Invoice) DocumentRootTree ¶
func (i *Invoice) DocumentRootTree() (tree *proofs.DocumentTree, err error)
DocumentRootTree creates and returns the document root tree
func (*Invoice) DocumentType ¶
DocumentType returns the invoice document type.
func (*Invoice) InitInvoiceInput ¶
func (i *Invoice) InitInvoiceInput(payload *clientinvoicepb.InvoiceCreatePayload, self identity.DID) error
InitInvoiceInput initialize the model based on the received parameters from the rest api call
func (*Invoice) PackCoreDocument ¶
PackCoreDocument packs the Invoice into a CoreDocument.
func (*Invoice) PrepareNewVersion ¶
func (i *Invoice) PrepareNewVersion(old documents.Model, data *clientinvoicepb.InvoiceData, collaborators documents.CollaboratorsAccess) error
PrepareNewVersion prepares new version from the old invoice.
func (*Invoice) UnpackCoreDocument ¶
UnpackCoreDocument unpacks the core document into Invoice.
type LineItem ¶
type LineItem struct { ItemNumber string Description string SenderPartNo string PricePerUnit *documents.Decimal Quantity *documents.Decimal UnitOfMeasure string NetWeight *documents.Decimal TaxAmount *documents.Decimal TaxRate *documents.Decimal TaxCode *documents.Decimal TotalAmount *documents.Decimal // the total amount of the line item PurchaseOrderNumber string PurchaseOrderItemNumber string DeliveryNoteNumber string }
LineItem represents a single invoice line item.
type Service ¶
type Service interface { documents.Service // DeriverFromPayload derives Invoice from clientPayload DeriveFromCreatePayload(ctx context.Context, payload *clientinvoicepb.InvoiceCreatePayload) (documents.Model, error) // DeriveFromUpdatePayload derives invoice model from update payload DeriveFromUpdatePayload(ctx context.Context, payload *clientinvoicepb.InvoiceUpdatePayload) (documents.Model, error) // DeriveInvoiceData returns the invoice data as client data DeriveInvoiceData(inv documents.Model) (*clientinvoicepb.InvoiceData, error) // DeriveInvoiceResponse returns the invoice model in our standard client format DeriveInvoiceResponse(inv documents.Model) (*clientinvoicepb.InvoiceResponse, error) }
Service defines specific functions for invoice
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.