payment_method

package
v0.0.0-...-b3f3fbb Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2015 License: Apache-2.0 Imports: 7 Imported by: 8

Documentation

Overview

Package payment_method provides types to represent Payment Methods

Index

Constants

View Source
const (
	PaymentMethodStatusActive   methodStatus = "active"
	PaymentMethodStatusInactive methodStatus = "inactive"
	PaymentMethodStatusDisabled methodStatus = "disabled"
)
View Source
const MetadataModel metadataModel = 0

Variables

View Source
var (
	ErrPaymentMethodNotFound  = errors.New("payment method not found")
	ErrPaymentMethodWithoutID = errors.New("payment method has no id")
)

Functions

func InsertPaymentMethodMetadataTx

func InsertPaymentMethodMetadataTx(db *sql.Tx, pm *Method, createdBy string) error

func InsertPaymentMethodStatusTx

func InsertPaymentMethodStatusTx(db *sql.Tx, pm *Method) error

func InsertPaymentMethodTx

func InsertPaymentMethodTx(db *sql.Tx, pm *Method) error

func ParseMethodStatus

func ParseMethodStatus(s string) (methodStatus, error)

returns a valid paymentMethodStatus or error

func PaymentMethodMetadataTx

func PaymentMethodMetadataTx(db *sql.Tx, pm *Method) (map[string]string, error)

Types

type Method

type Method struct {
	ID        int64 `json:",string"`
	ProjectID int64 `json:",string"`
	Provider  provider.Provider
	MethodKey string
	Created   time.Time
	CreatedBy string

	Status          methodStatus
	StatusChanged   time.Time
	StatusCreatedBy string

	Metadata map[string]string
}

PaymentMethod represents a mode (method of payment)

It is associated with a Provider and can be configured on a per-project base.

func PaymentMethodByIDDB

func PaymentMethodByIDDB(db *sql.DB, id int64) (*Method, error)

func PaymentMethodByIDTx

func PaymentMethodByIDTx(db *sql.Tx, id int64) (*Method, error)

func PaymentMethodByProjectIDProviderNameMethodKeyDB

func PaymentMethodByProjectIDProviderNameMethodKeyDB(db *sql.DB, project_id int64, provider string, method_key string) (*Method, error)

func PaymentMethodByProjectIDProviderNameMethodKeyTx

func PaymentMethodByProjectIDProviderNameMethodKeyTx(tx *sql.Tx, project_id int64, provider string, method_key string) (*Method, error)

func (*Method) Active

func (m *Method) Active() bool

Active returns true if the payment method is considered active

func (*Method) Disabled

func (m *Method) Disabled() bool

Active returns true if the payment method is considered disabled

Jump to

Keyboard shortcuts

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