Documentation
¶
Index ¶
- Constants
- Variables
- type AccountsClient
- type CircuitBreakerConfig
- type Client
- type Config
- type Environment
- type Error
- type ErrorType
- type MarketplaceClient
- type Option
- func WithAPIVersion(version string) Option
- func WithAccessBaseURL(url string) Option
- func WithCircuitBreaker(cfg CircuitBreakerConfig) Option
- func WithCredentials(username, password string) Option
- func WithEnvironment(env Environment) Option
- func WithHTTPClient(hc *http.Client) Option
- func WithRetryCount(n int) Option
- func WithTLSConfig(tc *tls.Config) Option
- func WithTelemetry(hook shared.TelemetryHook) Option
- func WithTimeout(d time.Duration) Option
- func WithWPGBaseURL(url string) Option
- func WithWPGCredentials(merchantCode, username, password string) Option
- type PartnerClient
- type PayoutsClient
- type RiskClient
- type TokenizationClient
- type TransfersClient
- type WebhooksClient
Constants ¶
const ( ErrorTypeAPI = shared.ErrorTypeAPI ErrorTypeNetwork = shared.ErrorTypeNetwork ErrorTypeDecode = shared.ErrorTypeDecode ErrorTypeValidation = shared.ErrorTypeValidation ErrorTypeCircuitOpen = shared.ErrorTypeCircuitOpen ErrorTypeTimeout = shared.ErrorTypeTimeout )
Re-exported ErrorType values for convenience at the facade level.
Variables ¶
var ErrCircuitOpen = shared.ErrCircuitOpen
ErrCircuitOpen is wrapped inside an *Error with Type ErrorTypeCircuitOpen when a circuit breaker rejects a call outright.
Functions ¶
This section is empty.
Types ¶
type AccountsClient ¶
type AccountsClient struct {
Balances *accounts.BalancesService
Statements *accounts.StatementsService
}
AccountsClient groups the Accounts bounded context's services.
type CircuitBreakerConfig ¶
type CircuitBreakerConfig = transport.CircuitBreakerConfig
CircuitBreakerConfig configures the failure threshold and cool-down for the Access API circuit breaker. See WithCircuitBreaker.
type Client ¶
type Client struct {
Payments *payments.Service
Payouts PayoutsClient
Transfers TransfersClient
Accounts AccountsClient
Queries *queries.PaymentsService
Risk RiskClient
Tokenization TokenizationClient
APM *apm.Service
Partner PartnerClient
Marketplace MarketplaceClient
Webhooks WebhooksClient
// contains filtered or unexported fields
}
Client is the Access Worldpay facade: the composition root that wires the shared transport.Doer into every bounded-context domain service. Construct one with NewClient. A Client is safe for concurrent use and holds no per-request mutable state.
Each field groups a bounded context, matching the module layout under domain/: Payments handles the full authorize→settle/cancel/refund lifecycle, Payouts covers card and account payouts, Transfers covers money/account transfers and FX, Accounts covers balances and statements, Risk covers FraudSight/3DS/exemptions/BIN lookup, Tokenization covers network tokens and related services, and so on.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config carries credentials, environment selection, and cross-cutting HTTP behavior for Access Worldpay, and the shared settings (TLS, WPG credentials) consumed by the gateway packages (wpg, cnp, raft, express, reporting). Config is immutable after construction and safe for concurrent use — build one with NewConfig and share it across the facade Client and any gateway clients.
func (*Config) AccessBaseURL ¶
AccessBaseURL returns the Access Worldpay base URL in use.
func (*Config) Environment ¶
func (c *Config) Environment() Environment
Environment returns the configured Environment.
func (*Config) WPGBaseURL ¶
WPGBaseURL returns the WPG endpoint URL in use.
type Environment ¶
type Environment int
Environment selects which Worldpay environment a Config talks to.
const ( // Try is Worldpay's sandbox / test environment. Try Environment = iota // Live is Worldpay's production environment. Live )
func (Environment) String ¶
func (e Environment) String() string
type Error ¶
Error is an alias for shared.Error, the error type returned by every Worldpay SDK call regardless of which bounded context issued it. Using errors.As(err, &werr) with *worldpay.Error works transparently across domain and gateway package boundaries since this is a true type alias.
type ErrorType ¶
ErrorType classifies an Error for programmatic handling. See shared.ErrorType for the full set of values (ErrorTypeAPI/Network/Decode/Validation/CircuitOpen/Timeout).
type MarketplaceClient ¶
type MarketplaceClient struct {
Parties *marketplace.PartiesService
SplitPayments *marketplace.SplitPaymentsService
}
MarketplaceClient groups the Marketplace bounded context's services.
type Option ¶
type Option func(*Config)
Option configures a Config. Options are applied in order, so later options override earlier ones.
func WithAPIVersion ¶
WithAPIVersion overrides the WP-Api-Version header sent on Access requests.
func WithAccessBaseURL ¶
WithAccessBaseURL overrides the Access Worldpay base URL (useful for testing against a local mock server).
func WithCircuitBreaker ¶
func WithCircuitBreaker(cfg CircuitBreakerConfig) Option
WithCircuitBreaker enables a per-API circuit breaker: after repeated failures it fails fast for a cool-down period instead of hammering a downed endpoint. Disabled by default.
func WithCredentials ¶
WithCredentials sets the Access Worldpay Basic Auth credentials.
func WithEnvironment ¶
func WithEnvironment(env Environment) Option
WithEnvironment selects Try (sandbox) or Live.
func WithHTTPClient ¶
WithHTTPClient overrides the underlying *http.Client. The client's Timeout, if zero, is set to the Config's timeout.
func WithRetryCount ¶
WithRetryCount sets how many times a failed request is retried for retryable errors (network errors, 429, and 5xx). Default is 2.
func WithTLSConfig ¶
WithTLSConfig overrides the TLS configuration used for RAFT's raw TCP/TLS socket and the HTTP transport's TLS settings.
func WithTelemetry ¶
func WithTelemetry(hook shared.TelemetryHook) Option
WithTelemetry installs a hook invoked around every outbound request. See shared.TelemetryHook.
func WithTimeout ¶
WithTimeout sets the per-request timeout (default 30s).
func WithWPGBaseURL ¶
WithWPGBaseURL overrides the WPG endpoint URL.
func WithWPGCredentials ¶
WithWPGCredentials sets the WPG merchant code and XML admin credentials.
type PartnerClient ¶
type PartnerClient struct {
Notifications *partner.NotificationsService
TerminalLease *partner.TerminalLeaseService
}
PartnerClient groups the Partner bounded context's services.
type PayoutsClient ¶
type PayoutsClient struct {
Card *payouts.CardService
Account *payouts.AccountService
}
PayoutsClient groups the Payouts bounded context's services.
type RiskClient ¶
type RiskClient struct {
FraudSight *risk.FraudSightService
ThreeDS *risk.ThreeDSService
Exemptions *risk.ExemptionsService
CardBIN *risk.CardBINService
}
RiskClient groups the Risk bounded context's services.
type TokenizationClient ¶
type TokenizationClient struct {
Tokens *tokenization.TokensService
CustomerEvents *tokenization.CustomerEventsService
SecurityTokens *tokenization.SecurityTokenService
ForwardAPI *tokenization.ForwardAPIService
TokenImport *tokenization.TokenImportService
}
TokenizationClient groups the Tokenization bounded context's services.
type TransfersClient ¶
type TransfersClient struct {
Money *transfers.MoneyService
Account *transfers.AccountService
FX *transfers.FXService
}
TransfersClient groups the Transfers bounded context's services.
type WebhooksClient ¶
type WebhooksClient struct{}
WebhooksClient exposes webhook parsing/dispatch. It performs no I/O.
Directories
¶
| Path | Synopsis |
|---|---|
|
domain
|
|
|
accounts
Package accounts is the Accounts bounded context: balance and statement visibility for embedded-finance accounts.
|
Package accounts is the Accounts bounded context: balance and statement visibility for embedded-finance accounts. |
|
apm
Package apm is the Alternative Payment Methods bounded context (PayPal, Klarna, iDEAL, Sofort, Alipay, WeChat Pay, and others).
|
Package apm is the Alternative Payment Methods bounded context (PayPal, Klarna, iDEAL, Sofort, Alipay, WeChat Pay, and others). |
|
marketplace
Package marketplace is the Marketplace bounded context: onboarding sub-merchant "parties" and distributing a single payment's funds across them (split payments).
|
Package marketplace is the Marketplace bounded context: onboarding sub-merchant "parties" and distributing a single payment's funds across them (split payments). |
|
partner
Package partner is the Partner bounded context: parsing partner transaction notifications and terminal lease notifications pushed by Worldpay to ISO/reseller partner endpoints.
|
Package partner is the Partner bounded context: parsing partner transaction notifications and terminal lease notifications pushed by Worldpay to ISO/reseller partner endpoints. |
|
payments
Package payments is the Payments bounded context: card payment authorization and the settle/cancel/refund actions that follow it.
|
Package payments is the Payments bounded context: card payment authorization and the settle/cancel/refund actions that follow it. |
|
payouts
Package payouts is the Payouts bounded context: pushing funds to a card (Original Credit Transaction) or bank account.
|
Package payouts is the Payouts bounded context: pushing funds to a card (Original Credit Transaction) or bank account. |
|
queries
Package queries is the Queries bounded context: historical payment status lookups.
|
Package queries is the Queries bounded context: historical payment status lookups. |
|
risk
Package risk is the Risk bounded context: fraud scoring, Strong Customer Authentication (3DS), SCA exemptions, and card BIN lookup.
|
Package risk is the Risk bounded context: fraud scoring, Strong Customer Authentication (3DS), SCA exemptions, and card BIN lookup. |
|
tokenization
Package tokenization is the Tokenization bounded context: network payment tokens, customer/account update events, short-lived security tokens, PCI-scope-reducing request forwarding, and bulk token import.
|
Package tokenization is the Tokenization bounded context: network payment tokens, customer/account update events, short-lived security tokens, PCI-scope-reducing request forwarding, and bulk token import. |
|
transfers
Package transfers is the Transfers bounded context: moving funds between Worldpay-held accounts (money transfers), a merchant's own accounts (account transfers), and currency conversion (FX).
|
Package transfers is the Transfers bounded context: moving funds between Worldpay-held accounts (money transfers), a merchant's own accounts (account transfers), and currency conversion (FX). |
|
webhooks
Package webhooks is the Webhooks bounded context: parsing and dispatching Access Worldpay webhook notifications.
|
Package webhooks is the Webhooks bounded context: parsing and dispatching Access Worldpay webhook notifications. |
|
examples
|
|
|
basic
command
Command basic demonstrates authorizing and settling a card payment against Worldpay's Try (sandbox) environment.
|
Command basic demonstrates authorizing and settling a card payment against Worldpay's Try (sandbox) environment. |
|
gateway
|
|
|
cnp
Package cnp implements Worldpay's cnpAPI (Vantiv) XML integration: sale, authorization, capture, credit, and void, plus response parsing.
|
Package cnp implements Worldpay's cnpAPI (Vantiv) XML integration: sale, authorization, capture, credit, and void, plus response parsing. |
|
express
Package express implements Worldpay's Element Express JSON API: credit-card and check authorization, capture, reversal, and recurring transactions.
|
Package express implements Worldpay's Element Express JSON API: credit-card and check authorization, capture, reversal, and recurring transactions. |
|
raft
Package raft implements Worldpay's RAFT 610 interface: ISO 8583 card-present processing (credit, debit, EBT, gift card, fleet, check/ACH, WIC) over TCP/TLS.
|
Package raft implements Worldpay's RAFT 610 interface: ISO 8583 card-present processing (credit, debit, EBT, gift card, fleet, check/ACH, WIC) over TCP/TLS. |
|
reporting
Package reporting parses Worldpay's offline report formats: eMAF (electronic Merchant Activity File) fixed-format records, and cnpAPI account-updater / funding-report XML batches.
|
Package reporting parses Worldpay's offline report formats: eMAF (electronic Merchant Activity File) fixed-format records, and cnpAPI account-updater / funding-report XML batches. |
|
wpg
Package wpg implements Worldpay's WPG (Worldpay Payment Gateway) XML Direct integration: order authorization, capture, cancel, refund, and inquiry over HTTPS with a hand-rolled XML envelope.
|
Package wpg implements Worldpay's WPG (Worldpay Payment Gateway) XML Direct integration: order authorization, capture, cancel, refund, and inquiry over HTTPS with a hand-rolled XML envelope. |
|
internal
|
|
|
auth
Package auth builds Access Worldpay's Basic Auth header and generates the random keys used for Idempotency-Key / WP-CorrelationId headers.
|
Package auth builds Access Worldpay's Basic Auth header and generates the random keys used for Idempotency-Key / WP-CorrelationId headers. |
|
transport
Package transport is the infrastructure adapter that every domain package depends on through the Doer port, instead of talking to net/http directly.
|
Package transport is the infrastructure adapter that every domain package depends on through the Doer port, instead of talking to net/http directly. |
|
xmlutil
Package xmlutil provides a generic, schema-less XML→map decoder used by the wpg and cnp packages to flatten Worldpay's XML responses into string-keyed maps without hand-writing a struct per response shape.
|
Package xmlutil provides a generic, schema-less XML→map decoder used by the wpg and cnp packages to flatten Worldpay's XML responses into string-keyed maps without hand-writing a struct per response shape. |
|
Package shared is the shared kernel: value objects, error types, and cross-cutting contracts (telemetry, call options) used by every bounded context in this module.
|
Package shared is the shared kernel: value objects, error types, and cross-cutting contracts (telemetry, call options) used by every bounded context in this module. |