cbbd5ab1ef
Commit fb59974
disabled usage price overrides because of a failing
test. This change reenables it while resolving the issue that caused
the test to fail.
The previous version of the test passed Gerrit verification and was
merged, but it failed for the primary Jenkins pipeline after merge.
This is due to a difference in how the Jenkins build runs Cockroach
and Postgres for each pipeline.
This commit rewrites the test to be safe for concurrent execution by
ensuring any mutable variables are defined within each test so that
shared state across tests is reduced.
Change-Id: Ia4566c9cd2d698afdb2caa4b7e2808b17e18de4e
57 lines
2.1 KiB
Go
57 lines
2.1 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package payments
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
"storj.io/common/uuid"
|
|
)
|
|
|
|
// ErrAccountNotSetup is an error type which indicates that payment account is not created.
|
|
var ErrAccountNotSetup = errs.Class("payment account is not set up")
|
|
|
|
// Accounts exposes all needed functionality to manage payment accounts.
|
|
//
|
|
// architecture: Service
|
|
type Accounts interface {
|
|
// Setup creates a payment account for the user.
|
|
// If account is already set up it will return nil.
|
|
Setup(ctx context.Context, userID uuid.UUID, email string, signupPromoCode string) (CouponType, error)
|
|
|
|
// Balance returns an object that represents current free credits and coins balance in cents.
|
|
Balance(ctx context.Context, userID uuid.UUID) (Balance, error)
|
|
|
|
// ProjectCharges returns how much money current user will be charged for each project.
|
|
ProjectCharges(ctx context.Context, userID uuid.UUID, since, before time.Time) ([]ProjectCharge, error)
|
|
|
|
// GetProjectUsagePriceModel returns the project usage price model for a partner name.
|
|
GetProjectUsagePriceModel(partner string) ProjectUsagePriceModel
|
|
|
|
// CheckProjectInvoicingStatus returns error if for the given project there are outstanding project records and/or usage
|
|
// which have not been applied/invoiced yet (meaning sent over to stripe).
|
|
CheckProjectInvoicingStatus(ctx context.Context, projectID uuid.UUID) error
|
|
|
|
// CheckProjectUsageStatus returns error if for the given project there is some usage for current or previous month.
|
|
CheckProjectUsageStatus(ctx context.Context, projectID uuid.UUID) error
|
|
|
|
// Charges returns list of all credit card charges related to account.
|
|
Charges(ctx context.Context, userID uuid.UUID) ([]Charge, error)
|
|
|
|
// CreditCards exposes all needed functionality to manage account credit cards.
|
|
CreditCards() CreditCards
|
|
|
|
// StorjTokens exposes all storj token related functionality.
|
|
StorjTokens() StorjTokens
|
|
|
|
// Invoices exposes all needed functionality to manage account invoices.
|
|
Invoices() Invoices
|
|
|
|
// Coupons exposes all needed functionality to manage coupons.
|
|
Coupons() Coupons
|
|
}
|