storj/satellite/payments/stripecoinpayments/customers.go
Egon Elbre 0a69da4ff1 all: switch to storj.io/common/uuid
Change-Id: I178a0a8dac691e57bce317b91411292fb3c40c9f
2020-03-31 19:16:41 +03:00

42 lines
1.1 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package stripecoinpayments
import (
"context"
"time"
"storj.io/common/uuid"
)
// ErrNoCustomer is error class defining that there is no customer for user.
var ErrNoCustomer = Error.New("customer doesn't exist")
// CustomersDB is interface for working with stripe customers table.
//
// architecture: Database
type CustomersDB interface {
// Insert inserts a stripe customer into the database.
Insert(ctx context.Context, userID uuid.UUID, customerID string) error
// GetCustomerID return stripe customers id.
GetCustomerID(ctx context.Context, userID uuid.UUID) (string, error)
// List returns page with customers ids created before specified date.
List(ctx context.Context, offset int64, limit int, before time.Time) (CustomersPage, error)
}
// Customer holds customer id and user id.
type Customer struct {
ID string
UserID uuid.UUID
}
// CustomersPage holds customers and
// indicates if there is more data available
// and provides next offset.
type CustomersPage struct {
Customers []Customer
Next bool
NextOffset int64
}