Documentation
¶
Index ¶
- Constants
- func ChargeWorkflowID(input ChargeInput) string
- func Router(c client.Client, logger *slog.Logger) http.Handler
- func RunWorker(ctx context.Context, config config.AppConfig, client client.Client) error
- type Activities
- type ChargeCustomerInput
- type ChargeCustomerResult
- type ChargeInput
- type ChargeResult
- type GenerateInvoiceInput
- type GenerateInvoiceResult
- type Item
Constants ¶
const TaskQueue = "billing"
TaskQueue is the default task queue for the Billing system.
Variables ¶
This section is empty.
Functions ¶
func ChargeWorkflowID ¶
func ChargeWorkflowID(input ChargeInput) string
ChargeWorkflowID returns the workflow ID for a Charge workflow.
Types ¶
type Activities ¶
type Activities struct {
FraudCheckURL string
}
Activities implements the billing package's Activities. Any state shared by the worker among the activities is stored here.
func (*Activities) ChargeCustomer ¶
func (a *Activities) ChargeCustomer(ctx context.Context, input *ChargeCustomerInput) (*ChargeCustomerResult, error)
ChargeCustomer activity charges a customer for a fulfillment.
func (*Activities) GenerateInvoice ¶
func (a *Activities) GenerateInvoice(ctx context.Context, input *GenerateInvoiceInput) (*GenerateInvoiceResult, error)
GenerateInvoice activity creates an invoice for a fulfillment.
type ChargeCustomerInput ¶
type ChargeCustomerInput struct { CustomerID string `json:"customerId"` Reference string `json:"reference"` Charge int32 `json:"charge"` }
ChargeCustomerInput is the input for the ChargeCustomer activity.
type ChargeCustomerResult ¶
type ChargeCustomerResult struct { Success bool `json:"success"` AuthCode string `json:"authCode"` }
ChargeCustomerResult is the result for the GenerateInvoice activity.
type ChargeInput ¶
type ChargeInput struct { CustomerID string `json:"customerId"` Reference string `json:"orderReference"` Items []Item `json:"items"` IdempotencyKey string `json:"idempotencyKey,omitempty"` }
ChargeInput is the input for the Charge workflow.
type ChargeResult ¶
type ChargeResult struct { InvoiceReference string `json:"invoiceReference"` SubTotal int32 `json:"subTotal"` Shipping int32 `json:"shipping"` Tax int32 `json:"tax"` Total int32 `json:"total"` Success bool `json:"success"` AuthCode string `json:"authCode"` }
ChargeResult is the result for the Charge workflow.
func Charge ¶
func Charge(ctx workflow.Context, input *ChargeInput) (*ChargeResult, error)
Charge Workflow invoices and processes payment for a fulfillment.
type GenerateInvoiceInput ¶
type GenerateInvoiceInput struct { CustomerID string `json:"customerId"` Reference string `json:"orderReference"` Items []Item `json:"items"` }
GenerateInvoiceInput is the input for the GenerateInvoice activity.
type GenerateInvoiceResult ¶
type GenerateInvoiceResult struct { InvoiceReference string `json:"invoiceReference"` SubTotal int32 `json:"subTotal"` Shipping int32 `json:"shipping"` Tax int32 `json:"tax"` Total int32 `json:"total"` }
GenerateInvoiceResult is the result for the GenerateInvoice activity.