4ad7056bf7
3b751a35c
Removed our old coupon functionality, and slightly reworked
the invoice List() function in the stripecoinpayments package.
It turns out, this is causing some issues when trying to delete users.
This change keeps the new functionality, which is used in the satellite
UI, but under a new name, ListWithDiscounts()
Change-Id: I6a62a1de480e09d005dd22d75aa1e024fd2ed3a0
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package payments
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"storj.io/common/uuid"
|
|
)
|
|
|
|
// Invoices exposes all needed functionality to manage account invoices.
|
|
//
|
|
// architecture: Service
|
|
type Invoices interface {
|
|
// 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)
|
|
// CheckPendingItems returns if pending invoice items for a given payment account exist.
|
|
CheckPendingItems(ctx context.Context, userID uuid.UUID) (existingItems bool, err error)
|
|
}
|
|
|
|
// 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"`
|
|
}
|
|
|
|
// CouponUsage describes the usage of a coupon on an invoice.
|
|
type CouponUsage struct {
|
|
Coupon Coupon
|
|
Amount int64
|
|
PeriodStart time.Time
|
|
PeriodEnd time.Time
|
|
}
|