payments

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: AGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddPaymentMethodParams added in v0.15.0

type AddPaymentMethodParams struct {
	Token      string
	CustomerID string
}

AddPaymentMethodParams contains info needed to create new payment method

type Card

type Card struct {
	Country  string
	Brand    string
	Name     string
	ExpMonth int64
	ExpYear  int64
	LastFour string
}

Card contains credit card info

type CreateCustomerParams

type CreateCustomerParams struct {
	Email string
	Name  string
}

CreateCustomerParams contains info needed to create new customer

type CreateProjectInvoiceParams

type CreateProjectInvoiceParams struct {
	ProjectName     string
	CustomerID      []byte
	PaymentMethodID []byte

	Storage     float64
	Egress      float64
	ObjectCount float64

	StartDate time.Time
	EndDate   time.Time
}

CreateProjectInvoiceParams contains info needed to create project invoice

type Currency

type Currency string

Currency is type for allowed currency

const (
	// CurrencyUSD is USA default currency
	CurrencyUSD Currency = "usd"
)

type CustomField

type CustomField struct {
	Name  string
	Value string
}

CustomField represents custom field/value field

type Customer

type Customer struct {
	ID    []byte
	Name  string
	Email string

	CreatedAt time.Time
}

Customer contains customer info

type Invoice

type Invoice struct {
	ID              []byte
	PaymentMethodID []byte

	Amount       int64
	Currency     Currency
	LineItems    []LineItem
	CustomFields []CustomField

	CreatedAt time.Time
}

Invoice holds invoice information

type LineItem

type LineItem struct {
	Key      string
	Quantity int64
	Amount   int64
}

LineItem contains invoice line item info

type PaymentMethod

type PaymentMethod struct {
	ID         []byte
	CustomerID []byte

	Card      Card
	IsDefault bool

	CreatedAt time.Time
}

PaymentMethod contains payment method description. Credit cards are the only allowed payment methods so far

type Service

type Service interface {
	CreateCustomer(ctx context.Context, params CreateCustomerParams) (*Customer, error)
	AddPaymentMethod(ctx context.Context, params AddPaymentMethodParams) (*PaymentMethod, error)
	GetCustomer(ctx context.Context, id []byte) (*Customer, error)
	GetCustomerDefaultPaymentMethod(ctx context.Context, customerID []byte) (*PaymentMethod, error)
	GetCustomerPaymentsMethods(ctx context.Context, customerID []byte) ([]PaymentMethod, error)
	GetPaymentMethod(ctx context.Context, id []byte) (*PaymentMethod, error)
	CreateProjectInvoice(ctx context.Context, params CreateProjectInvoiceParams) (*Invoice, error)
	GetInvoice(ctx context.Context, id []byte) (*Invoice, error)
}

Service is interfaces that defines behavior for working with payments

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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