Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DispatchWebhook ¶
func DispatchWebhook(ctx context.Context, tenant string, event WebhookEvent, payload *InvoicePayload, postgresRepositories *postgresRepository.Repositories, cfg config.Config) error
Types ¶
type InvoiceLineItem ¶
type InvoicePayload ¶
type InvoicePayload struct { Data struct { AmountDue float64 `json:"amountDue"` AmountDueInSmallestUnit int64 `json:"amountDueInSmallestUnit"` AmountPaid float64 `json:"amountPaid"` AmountRemaining float64 `json:"amountRemaining"` Currency string `json:"currency"` Due time.Time `json:"due"` InvoiceNumber string `json:"invoiceNumber"` InvoicePeriodEnd time.Time `json:"invoicePeriodEnd"` InvoicePeriodStart time.Time `json:"invoicePeriodStart"` InvoiceUrl string `json:"invoiceUrl"` Note string `json:"note"` Paid bool `json:"paid"` Status string `json:"status"` Subtotal float64 `json:"subtotal"` TaxDue float64 `json:"taxDue"` Contract struct { ContractName string `json:"contractName"` ContractStatus string `json:"contractStatus"` Metadata struct { ID string `json:"id"` } `json:"metadata"` } `json:"contract"` InvoiceLineItems []struct { Description string `json:"description"` Metadata struct { ID string `json:"id"` } `json:"metadata"` } `json:"invoiceLineItems"` Metadata struct { Created time.Time `json:"created"` ID string `json:"id"` } `json:"metadata"` Organization struct { CustomerOsID string `json:"customerOsId"` Metadata struct { ID string `json:"id"` } `json:"metadata"` Name string `json:"name"` } `json:"organization"` } `json:"data"` Event string `json:"event"` }
source: https://docs.customeros.ai/en/api/invoice-events#example-event
func PopulateInvoicePayload ¶
func PopulateInvoicePayload(invoice *neo4jentity.InvoiceEntity, org *neo4jentity.OrganizationEntity, contract *neo4jentity.ContractEntity, ils []*neo4jentity.InvoiceLineEntity) *InvoicePayload
type WebhookEvent ¶
type WebhookEvent string
const ( // WebhookEventInvoiceFinalized is the event name for invoice finalized WebhookEventInvoiceFinalized WebhookEvent = "invoice.finalized" WebhookEventInvoiceStatusPaid WebhookEvent = "invoice.status.paid" )
func (WebhookEvent) String ¶
func (e WebhookEvent) String() string
Click to show internal directories.
Click to hide internal directories.