invoice

package
v0.0.0-...-412e20b Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	InvoiceCreateForContractV1 = "V1_INVOICE_CREATE_FOR_CONTRACT"
	InvoiceFillRequestedV1     = "V1_INVOICE_FILL_REQUESTED"
	InvoiceFillV1              = "V1_INVOICE_FILL"
	InvoicePdfRequestedV1      = "V1_INVOICE_PDF_REQUESTED"
	InvoicePdfGeneratedV1      = "V1_INVOICE_PDF_GENERATED"
	// Deprecated
	InvoiceUpdateV1             = "V1_INVOICE_UPDATE"
	InvoicePaidV1               = "V1_INVOICE_PAID"
	InvoicePayNotificationV1    = "V1_INVOICE_PAY_NOTIFICATION"
	InvoiceRemindNotificationV1 = "V1_INVOICE_REMIND_NOTIFICATION"
	InvoiceDeleteV1             = "V1_INVOICE_DELETE"
	InvoiceVoidV1               = "V1_INVOICE_VOID"
	// Deprecated
	InvoicePayV1 = "V1_INVOICE_PAY"
)
View Source
const (
	FieldMaskStatus      = "status"
	FieldMaskPaymentLink = "paymentLink"
)
View Source
const (
	InvoiceAggregateType eventstore.AggregateType = "invoice"
)
View Source
const (
	PARAM_INVOICE_NUMBER = "invoiceNumber"
)

Variables

This section is empty.

Functions

func GetInvoiceObjectID

func GetInvoiceObjectID(aggregateID string, tenant string) string

func NewInvoiceDeleteEvent

func NewInvoiceDeleteEvent(aggregate eventstore.Aggregate) (eventstore.Event, error)

func NewInvoiceFillEvent

func NewInvoiceFillEvent(aggregate eventstore.Aggregate, updatedAt time.Time, invoice Invoice,
	customerName, customerAddressLine1, customerAddressLine2, customerAddressZip, customerAddressLocality, customerAddressCountry, customerAddressRegion, customerEmail,
	providerLogoRepositoryFileId, providerName, providerEmail, providerAddressLine1, providerAddressLine2, providerAddressZip, providerAddressLocality, providerAddressCountry, providerAddressRegion,
	note, status, invoiceNumber string, amount, vat, totalAmount float64, invoiceLines []InvoiceLineEvent) (eventstore.Event, error)

func NewInvoiceFillRequestedEvent

func NewInvoiceFillRequestedEvent(aggregate eventstore.Aggregate, contractId string) (eventstore.Event, error)

func NewInvoiceForContractCreateEvent

func NewInvoiceForContractCreateEvent(aggregate eventstore.Aggregate, sourceFields common.Source, contractId, currency, note string, billingCycleInMonths int64, dryRun, offCycle, postpaid, preview bool, createdAt, periodStartDate, periodEndDate time.Time) (eventstore.Event, error)

func NewInvoicePaidEvent

func NewInvoicePaidEvent(aggregate eventstore.Aggregate) (eventstore.Event, error)

func NewInvoicePayNotificationEvent

func NewInvoicePayNotificationEvent(aggregate eventstore.Aggregate) (eventstore.Event, error)

func NewInvoicePdfGeneratedEvent

func NewInvoicePdfGeneratedEvent(aggregate eventstore.Aggregate, updatedAt time.Time, repositoryFileId string) (eventstore.Event, error)

func NewInvoicePdfRequestedEvent

func NewInvoicePdfRequestedEvent(aggregate eventstore.Aggregate) (eventstore.Event, error)

func NewInvoiceRemindNotificationEvent

func NewInvoiceRemindNotificationEvent(aggregate eventstore.Aggregate) (eventstore.Event, error)

func NewInvoiceVoidEvent

func NewInvoiceVoidEvent(aggregate eventstore.Aggregate, updatedAt time.Time) (eventstore.Event, error)

Types

type BilledType

type BilledType int32

BilledType enum represents the billing type for a service line item.

const (
	NoneBilled BilledType = iota
	MonthlyBilled
	AnnuallyBilled
	OnceBilled  // For One-Time
	UsageBilled // For Usage-Based
	QuarterlyBilled
)

func (BilledType) String

func (bt BilledType) String() string

type DryRunServiceLineItem

type DryRunServiceLineItem struct {
	ServiceLineItemId string  `json:"serviceLineItemId"`
	Name              string  `json:"name"`
	Billed            string  `json:"billed"`
	Price             float64 `json:"price"`
	Quantity          int64   `json:"quantity"`
}

type Invoice

type Invoice struct {
	ID                    string                  `json:"id"`
	Tenant                string                  `json:"tenant"`
	ContractId            string                  `json:"contractId"`
	CreatedAt             time.Time               `json:"createdAt"`
	UpdatedAt             time.Time               `json:"updatedAt"`
	SourceFields          common.Source           `json:"source"`
	DryRun                bool                    `json:"dryRun"`
	OffCycle              bool                    `json:"offCycle"`
	Preview               bool                    `json:"preview"`
	Postpaid              bool                    `json:"postpaid"`
	InvoiceNumber         string                  `json:"invoiceNumber"`
	Currency              string                  `json:"currency"`
	PeriodStartDate       time.Time               `json:"periodStartDate"`
	PeriodEndDate         time.Time               `json:"periodEndDate"`
	Amount                float64                 `json:"amount"`
	VAT                   float64                 `json:"vat"`
	TotalAmount           float64                 `json:"totalAmount"`
	InvoiceLines          []InvoiceLine           `json:"invoiceLines"`
	RepositoryFileId      string                  `json:"repositoryFileId"`
	DryRunLines           []DryRunServiceLineItem `json:"dryRunLines"`
	Status                string                  `json:"status"`
	Note                  string                  `json:"note"`
	PaymentLink           string                  `json:"paymentLink"`
	PaymentLinkValidUntil *time.Time              `json:"paymentLinkValidUntil"`
	BillingCycleInMonths  int64                   `json:"billingCycleInMonths"`
}

type InvoiceAggregate

type InvoiceAggregate struct {
	*eventstore.CommonTenantIdAggregate
	Invoice *Invoice
}

func NewInvoiceAggregateWithTenantAndID

func NewInvoiceAggregateWithTenantAndID(tenant, id string) *InvoiceAggregate

func (*InvoiceAggregate) CreateFillRequestedEvent

func (a *InvoiceAggregate) CreateFillRequestedEvent(ctx context.Context, r *invoicepb.RequestFillInvoiceRequest) error

func (*InvoiceAggregate) CreateNewInvoiceForContract

func (a *InvoiceAggregate) CreateNewInvoiceForContract(ctx context.Context, request *invoicepb.NewInvoiceForContractRequest) error

func (*InvoiceAggregate) CreatePayInvoiceNotificationEvent

func (a *InvoiceAggregate) CreatePayInvoiceNotificationEvent(ctx context.Context, r *invoicepb.PayInvoiceNotificationRequest) error

func (*InvoiceAggregate) CreatePdfGeneratedEvent

func (a *InvoiceAggregate) CreatePdfGeneratedEvent(ctx context.Context, request *invoicepb.PdfGeneratedInvoiceRequest) error

func (*InvoiceAggregate) CreatePdfRequestedEvent

func (a *InvoiceAggregate) CreatePdfRequestedEvent(ctx context.Context, r *invoicepb.GenerateInvoicePdfRequest) error

func (*InvoiceAggregate) CreateRemindInvoiceNotificationEvent

func (a *InvoiceAggregate) CreateRemindInvoiceNotificationEvent(ctx context.Context, r *invoicepb.RemindInvoiceNotificationRequest) error

func (*InvoiceAggregate) FillInvoice

func (a *InvoiceAggregate) FillInvoice(ctx context.Context, request *invoicepb.FillInvoiceRequest, invoiceNumber string) error

func (*InvoiceAggregate) HandleGRPCRequest

func (a *InvoiceAggregate) HandleGRPCRequest(ctx context.Context, request any, params map[string]any) (any, error)

func (*InvoiceAggregate) IsTemporal

func (a *InvoiceAggregate) IsTemporal() bool

func (*InvoiceAggregate) PermanentlyDeleteInitializedInvoice

func (a *InvoiceAggregate) PermanentlyDeleteInitializedInvoice(ctx context.Context, request *invoicepb.PermanentlyDeleteInitializedInvoiceRequest) error

func (*InvoiceAggregate) PrepareStreamMetadata

func (a *InvoiceAggregate) PrepareStreamMetadata() esdb.StreamMetadata

func (*InvoiceAggregate) VoidInvoice

func (a *InvoiceAggregate) VoidInvoice(ctx context.Context, request *invoicepb.VoidInvoiceRequest) error

func (*InvoiceAggregate) When

func (a *InvoiceAggregate) When(evt eventstore.Event) error

type InvoiceDeleteEvent

type InvoiceDeleteEvent struct {
	Tenant string `json:"tenant" validate:"required"`
}

type InvoiceFillCustomerEvent

type InvoiceFillCustomerEvent struct {
	Name         string `json:"name"`
	AddressLine1 string `json:"addressLine1"`
	AddressLine2 string `json:"addressLine2"`
	Zip          string `json:"zip"`
	Locality     string `json:"locality"`
	Country      string `json:"country"`
	Region       string `json:"region"`
	Email        string `json:"email"`
}

type InvoiceFillEvent

type InvoiceFillEvent struct {
	Tenant               string                   `json:"tenant" validate:"required"`
	UpdatedAt            time.Time                `json:"updatedAt"`
	Amount               float64                  `json:"amount"`
	VAT                  float64                  `json:"vat"`
	SubtotalAmount       float64                  `json:"subtotalAmount" `
	TotalAmount          float64                  `json:"totalAmount" `
	InvoiceLines         []InvoiceLineEvent       `json:"invoiceLines"`
	ContractId           string                   `json:"contractId"`
	DryRun               bool                     `json:"dryRun"`
	OffCycle             bool                     `json:"offCycle"`
	Preview              bool                     `json:"preview"`
	Postpaid             bool                     `json:"postpaid"`
	InvoiceNumber        string                   `json:"invoiceNumber"`
	Currency             string                   `json:"currency"`
	PeriodStartDate      time.Time                `json:"periodStartDate"`
	PeriodEndDate        time.Time                `json:"periodEndDate"`
	BillingCycle         string                   `json:"billingCycle"` //Deprecated: Use BillingCycleInMonths instead
	BillingCycleInMonths int64                    `json:"billingCycleInMonths"`
	Status               string                   `json:"status"`
	Note                 string                   `json:"note"`
	Customer             InvoiceFillCustomerEvent `json:"customer"`
	Provider             InvoiceFillProviderEvent `json:"provider"`
}

type InvoiceFillProviderEvent

type InvoiceFillProviderEvent struct {
	Name                 string `json:"name"`
	Email                string `json:"email"`
	AddressLine1         string `json:"addressLine1"`
	AddressLine2         string `json:"addressLine2"`
	Zip                  string `json:"zip"`
	Locality             string `json:"locality"`
	Country              string `json:"country"`
	Region               string `json:"region"`
	LogoRepositoryFileId string `json:"logoRepositoryFileId"`
}

type InvoiceFillRequestedEvent

type InvoiceFillRequestedEvent struct {
	Tenant     string `json:"tenant" validate:"required"`
	ContractId string `json:"contractId" validate:"required"`
}

type InvoiceForContractCreateEvent

type InvoiceForContractCreateEvent struct {
	Tenant               string        `json:"tenant" validate:"required"`
	ContractId           string        `json:"contractId" validate:"required"`
	CreatedAt            time.Time     `json:"createdAt"`
	SourceFields         common.Source `json:"sourceFields"`
	DryRun               bool          `json:"dryRun"`
	Currency             string        `json:"currency"`
	PeriodStartDate      time.Time     `json:"periodStartDate"`
	PeriodEndDate        time.Time     `json:"periodEndDate"`
	BillingCycle         string        `json:"billingCycle"` // Deprecated: Use BillingCycleInMonths instead
	BillingCycleInMonths int64         `json:"billingCycleInMonths" validate:"required_if=OffCycle false"`
	Note                 string        `json:"note"`
	OffCycle             bool          `json:"offCycle,omitempty"`
	Postpaid             bool          `json:"postpaid"`
	Preview              bool          `json:"preview"`
}

type InvoiceLine

type InvoiceLine struct {
	ID                      string        `json:"id"`
	CreatedAt               time.Time     `json:"createdAt"`
	UpdatedAt               time.Time     `json:"updatedAt"`
	SourceFields            common.Source `json:"source"`
	Name                    string        `json:"name"`
	Price                   float64       `json:"price"`
	Quantity                int64         `json:"quantity"`
	Amount                  float64       `json:"amount"`
	VAT                     float64       `json:"vat"`
	TotalAmount             float64       `json:"totalAmount"`
	ServiceLineItemId       string        `json:"serviceLineItemId"`
	ServiceLineItemParentId string        `json:"serviceLineItemParentId"`
	BilledType              string        `json:"billedType"`
}

type InvoiceLineEvent

type InvoiceLineEvent struct {
	Id                      string        `json:"id" validate:"required"`
	CreatedAt               time.Time     `json:"createdAt" validate:"required"`
	SourceFields            common.Source `json:"sourceFields"`
	Name                    string        `json:"name" validate:"required"`
	Price                   float64       `json:"price" validate:"required"`
	Quantity                int64         `json:"quantity" validate:"required"`
	Amount                  float64       `json:"amount" validate:"required"`
	VAT                     float64       `json:"vat" validate:"required"`
	TotalAmount             float64       `json:"totalAmount" validate:"required"`
	ServiceLineItemId       string        `json:"serviceLineItemId"`
	ServiceLineItemParentId string        `json:"serviceLineItemParentId"`
	BilledType              string        `json:"billedType" validate:"required"`
}

type InvoicePaidEvent

type InvoicePaidEvent struct {
	Tenant string `json:"tenant" validate:"required"`
}

type InvoicePayNotificationEvent

type InvoicePayNotificationEvent struct {
	Tenant string `json:"tenant" validate:"required"`
}

type InvoicePdfGeneratedEvent

type InvoicePdfGeneratedEvent struct {
	Tenant           string    `json:"tenant" validate:"required"`
	UpdatedAt        time.Time `json:"updatedAt"`
	RepositoryFileId string    `json:"repositoryFileId" validate:"required"`
}

type InvoicePdfRequestedEvent

type InvoicePdfRequestedEvent struct {
	Tenant string `json:"tenant" validate:"required"`
}

type InvoiceRemindNotificationEvent

type InvoiceRemindNotificationEvent struct {
	Tenant string `json:"tenant" validate:"required"`
}

type InvoiceStatus

type InvoiceStatus int32
const (
	NoneInvoiceStatus InvoiceStatus = iota
	InitializedInvoiceStatus
	DueInvoiceStatus
	PaidInvoiceStatus
	VoidInvoiceStatus
	ScheduledInvoiceStatus
	OverdueInvoiceStatus
	OnHoldInvoiceStatus
	EmptyInvoiceStatus
)

func (InvoiceStatus) String

func (is InvoiceStatus) String() string

This function provides a string representation of the BillingCyckle enum.

type InvoiceVoidEvent

type InvoiceVoidEvent struct {
	Tenant    string    `json:"tenant" validate:"required"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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