service

package
v0.0.0-...-af7f365 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 20

Documentation

Index

Constants

View Source
const CalComHeader = "x-cal-signature-256"

Variables

This section is empty.

Functions

func SignatureCheck

func SignatureCheck(hSignature string, body []byte, personalIntegrationRepository postgresRepository.PersonalIntegrationRepository, tenant, email, integration string) error

Types

type ContractService

type ContractService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.ContractEntity, error)
}

func NewContractService

func NewContractService(log logger.Logger, services *Services) ContractService

type Integration

type Integration string
const (
	CALCOM Integration = "calcom"
)

type InvoiceService

type InvoiceService interface {
	GenerateNewRandomInvoiceNumber() string

	GetById(ctx context.Context, invoiceId string) (*neo4jentity.InvoiceEntity, error)
	GetInvoiceLinesForInvoices(ctx context.Context, invoiceIds []string) (*neo4jentity.InvoiceLineEntities, error)
	GetInvoicesForContracts(ctx context.Context, contractIds []string) (*neo4jentity.InvoiceEntities, error)
	SimulateInvoice(ctx context.Context, invoiceData *SimulateInvoiceRequestData) ([]*SimulateInvoiceResponseData, error)
	NextInvoiceDryRun(ctx context.Context, contractId, appSource string) (string, error)
	PayInvoice(ctx context.Context, invoiceId, appSource string) error
	VoidInvoice(ctx context.Context, invoiceId, appSource string) error

	FillCycleInvoice(ctx context.Context, invoiceEntity *neo4jentity.InvoiceEntity, sliEntities neo4jentity.ServiceLineItemEntities) (*neo4jentity.InvoiceEntity, []*invoicepb.InvoiceLine, error)
	FillOffCyclePrepaidInvoice(ctx context.Context, invoiceEntity *neo4jentity.InvoiceEntity, sliEntities neo4jentity.ServiceLineItemEntities) (*neo4jentity.InvoiceEntity, []*invoicepb.InvoiceLine, error)
}

func NewInvoiceService

func NewInvoiceService(log logger.Logger, services *Services) InvoiceService

type ServiceLineItemService

type ServiceLineItemService interface {
	GetById(ctx context.Context, id string) (*neo4jentity.ServiceLineItemEntity, error)
	GetServiceLineItemsByParentId(ctx context.Context, sliParentId string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForContract(ctx context.Context, contractId string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForContracts(ctx context.Context, contractIds []string) (*neo4jentity.ServiceLineItemEntities, error)
	GetServiceLineItemsForInvoiceLines(ctx context.Context, invoiceLineIds []string) (*neo4jentity.ServiceLineItemEntities, error)
}

func NewServiceLineItemService

func NewServiceLineItemService(log logger.Logger, services *Services) ServiceLineItemService

type Services

type Services struct {
	PostgresRepositories *postgresRepository.Repositories
	Neo4jRepositories    *neo4jRepository.Repositories

	GrpcClients *grpc_client.Clients

	TenantService          TenantService
	ContractService        ContractService
	ServiceLineItemService ServiceLineItemService
	InvoiceService         InvoiceService
	SlackChannelService    SlackChannelService
}

func InitServices

func InitServices(db *gorm.DB, driver *neo4j.DriverWithContext, neo4jDatabase string, grpcClients *grpc_client.Clients) *Services

type SimulateInvoiceLine

type SimulateInvoiceLine struct {
	Key               string
	ServiceLineItemID string
	ParentID          string
	Name              string
	Price             float64
	Quantity          int64
	Amount            float64
	TotalAmount       float64
}

type SimulateInvoiceRequestData

type SimulateInvoiceRequestData struct {
	ContractId   string
	ServiceLines []SimulateInvoiceRequestServiceLineData
}

type SimulateInvoiceRequestServiceLineData

type SimulateInvoiceRequestServiceLineData struct {
	Key               string
	ServiceLineItemID *string
	ParentID          *string
	Description       string
	Comments          string
	BillingCycle      enum.BilledType
	Price             float64
	Quantity          int64
	ServiceStarted    time.Time
	TaxRate           *float64
}

type SimulateInvoiceResponseData

type SimulateInvoiceResponseData struct {
	Invoice *neo4jentity.InvoiceEntity
	Lines   []*neo4jentity.InvoiceLineEntity
}

type SimulateInvoices

type SimulateInvoices struct {
	ContractId         string
	IssueDate          time.Time
	DueDate            time.Time
	InvoicePeriodStart time.Time
	InvoicePeriodEnd   time.Time
	InvoiceNumber      string
	InvoiceLines       []*SimulateInvoiceLine
}

type SlackChannelService

type SlackChannelService interface {
	GetSlackChannels(ctx context.Context, tenant string) ([]*postgresEntity.SlackChannel, error)
	GetPaginatedSlackChannels(ctx context.Context, tenant string, page, limit int) ([]*postgresEntity.SlackChannel, int64, error)

	StoreSlackChannel(ctx context.Context, tenant, source, channelId, channelName string, organizationId *string) error
}

func NewSlackChannelService

func NewSlackChannelService(repositories *postgresRepository.Repositories) SlackChannelService

type TenantService

type TenantService interface {
	GetTenantSettings(ctx context.Context) (*neo4jentity.TenantSettingsEntity, error)
}

func NewTenantService

func NewTenantService(log logger.Logger, services *Services) TenantService

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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