Documentation
¶
Index ¶
Constants ¶
const ( OperationCreate = "Create" OperationUpdate = "Update" OperationDelete = "Delete" OperationMerge = "Merge" OperationVoid = "Void" )
EntityOperation constants
const ( EntityNamePayment = "Payment" EntityNameInvoice = "Invoice" EntityNameCustomer = "Customer" )
EntityName constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataChangeEvent ¶
type DataChangeEvent struct {
Entities []EntityChange `json:"entities"`
}
DataChangeEvent contains the entities that have changed
type EntityChange ¶
type EntityChange struct {
Name string `json:"name"` // Entity type: "Payment", "Invoice", "Customer", etc.
ID string `json:"id"` // Entity ID in QuickBooks
Operation string `json:"operation"` // "Create", "Update", "Delete", "Merge", "Void"
LastUpdated string `json:"lastUpdated"` // ISO 8601 timestamp
}
EntityChange represents a single entity change event
func (*EntityChange) IsCreateOperation ¶
func (e *EntityChange) IsCreateOperation() bool
IsCreateOperation checks if the operation is Create
func (*EntityChange) IsInvoiceEvent ¶
func (e *EntityChange) IsInvoiceEvent() bool
IsInvoiceEvent checks if the entity change is for an Invoice
func (*EntityChange) IsPaymentEvent ¶
func (e *EntityChange) IsPaymentEvent() bool
IsPaymentEvent checks if the entity change is for a Payment
func (*EntityChange) IsUpdateOperation ¶
func (e *EntityChange) IsUpdateOperation() bool
IsUpdateOperation checks if the operation is Update
type EventNotification ¶
type EventNotification struct {
RealmID string `json:"realmId"`
DataChangeEvent DataChangeEvent `json:"dataChangeEvent"`
}
EventNotification represents a single event notification in the webhook payload
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles QuickBooks webhook events
func NewHandler ¶
func NewHandler( client quickbooks.QuickBooksClient, paymentSvc quickbooks.QuickBooksPaymentService, connectionRepo connection.Repository, logger *logger.Logger, ) *Handler
NewHandler creates a new QuickBooks webhook handler
func (*Handler) HandleWebhook ¶
func (h *Handler) HandleWebhook(ctx context.Context, payload []byte, services *ServiceDependencies) error
HandleWebhook processes QuickBooks webhook events
func (*Handler) VerifyWebhookSignature ¶
func (h *Handler) VerifyWebhookSignature(ctx context.Context, payload []byte, signature string) error
VerifyWebhookSignature verifies the QuickBooks webhook signature QuickBooks uses HMAC-SHA256 with the verifier token as the key Reference: https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks/manage-webhooks-notifications
type QuickBooksWebhookPayload ¶
type QuickBooksWebhookPayload struct {
EventNotifications []EventNotification `json:"eventNotifications"`
}
QuickBooksWebhookPayload represents the top-level webhook payload from QuickBooks Reference: https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks
type ServiceDependencies ¶
type ServiceDependencies struct {
PaymentService interface{} // interfaces.PaymentService
InvoiceService interface{} // interfaces.InvoiceService
}
ServiceDependencies holds the services needed by the webhook handler