paymentprovider

package
v0.0.0-...-081ecb4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound         = errors.New("not found in provider")
	ErrInvalidCardToken = errors.New("invalid card token")
)

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID    string
	Email string
}

type CustomerUpdatePayload

type CustomerUpdatePayload struct {
}

type Event

type Event struct {
	ID   string
	Type string
	Data json.RawMessage
}

type EventProcessor

type EventProcessor interface {
	Process(payload string, eventUUID string) error
}

type Provider

type Provider interface {
	Name() string

	SetBaseURL(url string) error

	CreateCustomer(ctx context.Context, email string, token string) (*Customer, error)

	GetSubscription(ctx context.Context, cust string, sub string) (*Subscription, error)
	GetSubscriptions(ctx context.Context, cust string) ([]Subscription, error)
	CreateSubscription(ctx context.Context, cust string, seats int) (*Subscription, error)
	UpdateSubscription(ctx context.Context, cust string, sub string, payload SubscriptionUpdatePayload) (*Subscription, error)
	DeleteSubscription(ctx context.Context, cust string, sub string) error

	GetEvent(ctx context.Context, eventID string) (*Event, error)
}

type Subscription

type Subscription struct {
	ID     string
	Status SubscriptionStatus
}

type SubscriptionStatus

type SubscriptionStatus string
const (
	SubscriptionStatusTrialing  SubscriptionStatus = "trialing"
	SubscriptionStatusActive    SubscriptionStatus = "active"
	SubscriptionStatusPastDue   SubscriptionStatus = "past_due"
	SubscriptionStatusCancelled SubscriptionStatus = "cancelled"
	SubscriptionStatusUnpaid    SubscriptionStatus = "unpaid"
)

type SubscriptionUpdatePayload

type SubscriptionUpdatePayload struct {
	CardToken  string
	SeatsCount int
}

Jump to

Keyboard shortcuts

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