mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
30 lines
1.4 KiB
Go
30 lines
1.4 KiB
Go
// Package mercury provides types and utilities for integrating with the
|
|
// Mercury bank API and webhook events.
|
|
package mercury
|
|
|
|
// BaseURL is the Mercury API base URL.
|
|
const BaseURL = "https://backend.mercury.com/api/v1"
|
|
|
|
// Transaction represents a Mercury transaction from a webhook or API response.
|
|
type Transaction struct {
|
|
ID string `json:"id"`
|
|
Amount float64 `json:"amount"`
|
|
Status string `json:"status"`
|
|
Kind string `json:"kind"` // "externalTransfer", "internalTransfer", etc.
|
|
Method string `json:"method,omitempty"` // "wire", "ach", "check", etc.
|
|
CounterpartyName string `json:"counterpartyName,omitempty"`
|
|
Note string `json:"note,omitempty"`
|
|
ExternalMemo string `json:"externalMemo,omitempty"`
|
|
CreatedAt string `json:"createdAt"`
|
|
AccountID string `json:"accountId,omitempty"`
|
|
Direction string `json:"direction,omitempty"` // "credit" or "debit"
|
|
}
|
|
|
|
// WebhookPayload is the Mercury webhook event structure.
|
|
type WebhookPayload struct {
|
|
EventType string `json:"eventType"` // "transaction.created", "transaction.updated"
|
|
ResourceID string `json:"resourceId"` // transaction ID
|
|
MergePatch interface{} `json:"mergePatch,omitempty"` // JSON Merge Patch for updates
|
|
Data Transaction `json:"data,omitempty"`
|
|
}
|