webhook

package
v0.0.0-...-a9d5d36 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

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 InvoiceLineItem struct {
	Description string
	MetadataID  string
}

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

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

Jump to

Keyboard shortcuts

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