driver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package driver defines interfaces to be implemented by payment drivers as used by package payment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	// SaveCard saves limited information about the card to the Cards table
	// in the database including a hashed zipcode and a payment service card
	// token. Returns the ID of the newly created card from the database.
	SaveCard(params *dt.CardParams, user *dt.User) (cardID uint64, err error)

	// Charge a customer for something. The isoCurrency is the currency in
	// its 3-letter ISO code.
	ChargeCard(cardID uint64, amountInCents uint64, isoCurrency string) error

	// RegisterUser on the external payment service, saving the customer
	// identifying token to User.PaymentServiceID in the database.
	RegisterUser(user *dt.User) error

	// Close the connection.
	Close() error
}

Conn is a connection to the external payment service.

type Driver

type Driver interface {
	// Open returns a new connection to the payment server. The echo router
	// is included to drivers to extend routes at runtime. The database
	// connection allows the implementation to set and retrieve
	// User.PaymentServiceID in the database.The name is a string in a
	// driver-specific format.
	Open(db *sqlx.DB, e *echo.Echo, name string) (Conn, error)
}

Driver is the interface that must be implemented by a payment driver.

Jump to

Keyboard shortcuts

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