Documentation
¶
Index ¶
Constants ¶
const ( // StripeProvider is the string identifier for the Stripe payment provider. StripeProvider = "stripe" // PayPalProvider is the string identifier for the PayPal payment provider. PayPalProvider = "paypal" )
Variables ¶
This section is empty.
Functions ¶
func NewPaymentConfirmFailError ¶ added in v1.7.1
NewPaymentConfirmFailError creates an error to use when a payment confirmation fails
func NewPaymentPendingError ¶ added in v1.7.1
NewPaymentPendingError creates an error for a pending action on a payment
Types ¶
type Charger ¶
type Charger func(amount uint64, currency string, order *models.Order, invoiceNumber int64) (string, error)
Charger wraps the Charge method which creates new payments with the provider.
type Confirmer ¶ added in v1.7.1
Confirmer wraps a confirm method used for checking two-step payments in a synchronous flow
type PaymentConfirmFailError ¶ added in v1.7.1
type PaymentConfirmFailError struct {
// contains filtered or unexported fields
}
PaymentConfirmFailError is returned when the confirmation request got a negative response
func (*PaymentConfirmFailError) Error ¶ added in v1.7.1
func (p *PaymentConfirmFailError) Error() string
type PaymentPendingError ¶ added in v1.7.1
type PaymentPendingError struct {
// contains filtered or unexported fields
}
PaymentPendingError is returned when the payment provider requests additional action e.g. 2-step authorization through 3D secure
func (*PaymentPendingError) Error ¶ added in v1.7.1
func (p *PaymentPendingError) Error() string
func (*PaymentPendingError) Metadata ¶ added in v1.7.1
func (p *PaymentPendingError) Metadata() map[string]interface{}
Metadata returns fields that should be passed to the client for use in additional actions
type PreauthorizationResult ¶
type PreauthorizationResult struct {
}PreauthorizationResult contains the data returned from a Preauthorization.
type Preauthorizer ¶
type Preauthorizer func(amount uint64, currency string, description string) (*PreauthorizationResult, error)
Preauthorizer wraps the Preauthorize method which pre-authorizes a payment with the provider.
type Provider ¶
type Provider interface { Name() string NewCharger(ctx context.Context, r *http.Request, log logrus.FieldLogger) (Charger, error) NewRefunder(ctx context.Context, r *http.Request, log logrus.FieldLogger) (Refunder, error) NewConfirmer(ctx context.Context, r *http.Request, log logrus.FieldLogger) (Confirmer, error) }
Provider represents a payment provider that can optionally charge, refund, preauthorize payments.