2019-10-31 16:56:54 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package payments
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
2020-03-30 10:08:50 +01:00
|
|
|
"storj.io/common/uuid"
|
2019-10-31 16:56:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Invoices exposes all needed functionality to manage account invoices.
|
2020-01-29 00:57:15 +00:00
|
|
|
//
|
|
|
|
// architecture: Service
|
2019-10-31 16:56:54 +00:00
|
|
|
type Invoices interface {
|
2021-10-18 23:18:18 +01:00
|
|
|
// List returns a list of invoices for a given payment account.
|
|
|
|
List(ctx context.Context, userID uuid.UUID) ([]Invoice, error)
|
|
|
|
// ListWithDiscounts returns a list of invoices and coupon usages for a given payment account.
|
|
|
|
ListWithDiscounts(ctx context.Context, userID uuid.UUID) ([]Invoice, []CouponUsage, error)
|
2020-07-06 22:31:40 +01:00
|
|
|
// CheckPendingItems returns if pending invoice items for a given payment account exist.
|
|
|
|
CheckPendingItems(ctx context.Context, userID uuid.UUID) (existingItems bool, err error)
|
2019-10-31 16:56:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Invoice holds all public information about invoice.
|
|
|
|
type Invoice struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Amount int64 `json:"amount"`
|
|
|
|
Status string `json:"status"`
|
|
|
|
Link string `json:"link"`
|
|
|
|
Start time.Time `json:"start"`
|
|
|
|
End time.Time `json:"end"`
|
|
|
|
}
|
2021-08-27 01:51:26 +01:00
|
|
|
|
|
|
|
// CouponUsage describes the usage of a coupon on an invoice.
|
|
|
|
type CouponUsage struct {
|
|
|
|
Coupon Coupon
|
|
|
|
Amount int64
|
|
|
|
PeriodStart time.Time
|
|
|
|
PeriodEnd time.Time
|
|
|
|
}
|