adapters

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatewayFromPath

func GatewayFromPath(urlPath string) string

GatewayFromPath returns just the gateway name string.

Types

type Adapter

type Adapter interface {
	Name() string
	// BuildResponse turns an engine Result into an HTTP response body + status.
	BuildResponse(result *engine.Result, originalBody []byte) (statusCode int, body []byte, headers map[string]string)
	// BuildWebhookPayload returns the webhook payload for a given result.
	// requestBody is the decoded original charge request; adapters MUST echo any
	// relevant customer-supplied fields (Stripe: metadata, Razorpay: notes,
	// Agnostic: whole body) so callers can correlate incoming webhooks with
	// their own requests (e.g. order_id).
	BuildWebhookPayload(result *engine.Result, chargeID string, amount int64, currency string, requestBody map[string]any) map[string]any
}

Adapter translates between a gateway's wire format and TestPay internals.

type GatewayRequest

type GatewayRequest struct {
	ChargeID string
	Amount   int64
	Currency string
	RawBody  []byte
	Headers  http.Header
}

GatewayRequest is the parsed, gateway-agnostic form of an incoming mock request.

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) KnownGateways

func (r *Registry) KnownGateways() []string

KnownGateways returns the canonical gateway names (not URL aliases). Used by the dashboard to render per-gateway webhook configuration.

func (*Registry) Resolve

func (r *Registry) Resolve(urlPath string) (Adapter, error)

Resolve returns the adapter matching the URL prefix (e.g. /stripe/v1/... → stripe).

Directories

Path Synopsis
Package adyen mocks Adyen's payment API surface.
Package adyen mocks Adyen's payment API surface.
Package ecpay mocks ECPay (綠界 / Green World) — Taiwan's dominant acquiring gateway.
Package ecpay mocks ECPay (綠界 / Green World) — Taiwan's dominant acquiring gateway.
Package epay mocks Epay payment API.
Package epay mocks Epay payment API.
Package espay mocks ESPay (Indonesia) payment API.
Package espay mocks ESPay (Indonesia) payment API.
Package instamojo mocks Instamojo's (India) payment-request API.
Package instamojo mocks Instamojo's (India) payment-request API.
Package komoju mocks Komoju (Japan) payment API.
Package komoju mocks Komoju (Japan) payment API.
Package mastercard mocks the Mastercard Payment Gateway Services (MPGS) surface area.
Package mastercard mocks the Mastercard Payment Gateway Services (MPGS) surface area.
Package omise mocks Omise's charge API surface.
Package omise mocks Omise's charge API surface.
Package payletter mocks Payletter (KR) payment API.
Package payletter mocks Payletter (KR) payment API.
Package paynamics mocks Paynamics's (PH / SEA) payment API surface.
Package paynamics mocks Paynamics's (PH / SEA) payment API surface.
Package razorpay mocks Razorpay's payment API surface.
Package razorpay mocks Razorpay's payment API surface.
Package tappay mocks TapPay's payment API surface.
Package tappay mocks TapPay's payment API surface.
Package tillpay mocks the TillPayment acquirer API.
Package tillpay mocks the TillPayment acquirer API.

Jump to

Keyboard shortcuts

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