callbacks

package
v1.21.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package callbacks implements the payment gateway callback subdomain of the billing module: it authenticates gateway notifications, verifies them against the order's immutable payment expectation, re-confirms with the gateway and settles the payment. The gateway-specific protocol lives in the gateway package; this is the one flow every gateway goes through. Only the module facade may reach it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.21.0

type Option func(*Service)

Option configures a Service.

func WithUnmatchedPaymentLog added in v1.21.0

func WithUnmatchedPaymentLog(logs UnmatchedPaymentLog) Option

WithUnmatchedPaymentLog records the payments the flow cannot settle in logs; without it they are only reported in the process log.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(orders settle.Orders, queue settle.Queue, gateways *gateway.Registry, opts ...Option) *Service

NewService builds the callback flow; a nil registry selects the production gateways.

func (*Service) Notify added in v1.21.0

func (s *Service) Notify(ctx context.Context, n gateway.Notification) error

Notify authenticates and settles a callback delivered to the notify URL of the payment method the notify middleware put in ctx. A rejection wraps gateway.ErrInvalidCallback when redelivery cannot succeed (see there); the log names the order and trade of an authenticated callback, so a payment refused after its order closed can be found at the gateway.

type UnmatchedPaymentLog added in v1.21.0

type UnmatchedPaymentLog interface {
	Insert(ctx context.Context, data *logEntity.SystemLog) error
	FilterSystemLog(ctx context.Context, filter *logEntity.FilterParams) ([]*logEntity.SystemLog, int64, error)
}

UnmatchedPaymentLog keeps the durable record of a gateway-confirmed payment that could not settle its order, and finds the record already kept for the same payment so a redelivered callback does not write it twice. The system log repository provides it.

Jump to

Keyboard shortcuts

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