2019-10-10 18:12:23 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package payments
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2019-10-17 15:42:18 +01:00
|
|
|
|
|
|
|
"github.com/skyrings/skyring-common/tools/uuid"
|
|
|
|
"github.com/zeebo/errs"
|
2019-10-10 18:12:23 +01:00
|
|
|
)
|
|
|
|
|
2019-10-17 15:42:18 +01:00
|
|
|
// ErrAccountNotSetup is an error type which indicates that payment account is not created.
|
|
|
|
var ErrAccountNotSetup = errs.Class("payment account is not set up")
|
|
|
|
|
2019-10-10 18:12:23 +01:00
|
|
|
// Accounts exposes all needed functionality to manage payment accounts.
|
|
|
|
type Accounts interface {
|
|
|
|
// Setup creates a payment account for the user.
|
2019-10-17 15:42:18 +01:00
|
|
|
// If account is already set up it will return nil.
|
|
|
|
Setup(ctx context.Context, userID uuid.UUID, email string) error
|
2019-10-11 16:00:35 +01:00
|
|
|
|
|
|
|
// Balance returns an integer amount in cents that represents the current balance of payment account.
|
2019-10-17 15:42:18 +01:00
|
|
|
Balance(ctx context.Context, userID uuid.UUID) (int64, error)
|
2019-10-15 12:23:54 +01:00
|
|
|
|
2019-11-15 14:27:44 +00:00
|
|
|
// ProjectCharges returns how much money current user will be charged for each project.
|
|
|
|
ProjectCharges(ctx context.Context, userID uuid.UUID) ([]ProjectCharge, error)
|
|
|
|
|
2019-11-26 17:58:51 +00:00
|
|
|
// Coupons return list of all coupons of specified payment account.
|
|
|
|
Coupons(ctx context.Context, userID uuid.UUID) ([]Coupon, error)
|
|
|
|
|
2019-10-15 12:23:54 +01:00
|
|
|
// CreditCards exposes all needed functionality to manage account credit cards.
|
|
|
|
CreditCards() CreditCards
|
2019-10-31 16:56:54 +00:00
|
|
|
|
2019-10-17 15:04:50 +01:00
|
|
|
// StorjTokens exposes all storj token related functionality.
|
|
|
|
StorjTokens() StorjTokens
|
2019-10-31 16:56:54 +00:00
|
|
|
|
|
|
|
// Invoices exposes all needed functionality to manage account invoices.
|
|
|
|
Invoices() Invoices
|
2019-10-10 18:12:23 +01:00
|
|
|
}
|