bb1e86c790
issue: https://github.com/storj/storj/issues/4824 Change-Id: I2e3e63151d1def96270279719f6eceda0acba66c
44 lines
1.3 KiB
Go
44 lines
1.3 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package stripecoinpayments
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
"storj.io/common/currency"
|
|
"storj.io/common/uuid"
|
|
"storj.io/storj/satellite/payments/coinpayments"
|
|
)
|
|
|
|
// TransactionsDB is an interface which defines functionality
|
|
// of DB which stores coinpayments transactions.
|
|
//
|
|
// architecture: Database
|
|
type TransactionsDB interface {
|
|
// GetLockedRate returns locked conversion rate for transaction or error if non exists.
|
|
GetLockedRate(ctx context.Context, id coinpayments.TransactionID) (decimal.Decimal, error)
|
|
// ListAccount returns all transaction for specific user.
|
|
ListAccount(ctx context.Context, userID uuid.UUID) ([]Transaction, error)
|
|
// TestInsert inserts new coinpayments transaction into DB.
|
|
TestInsert(ctx context.Context, tx Transaction) (time.Time, error)
|
|
// TestLockRate locks conversion rate for transaction.
|
|
TestLockRate(ctx context.Context, id coinpayments.TransactionID, rate decimal.Decimal) error
|
|
}
|
|
|
|
// Transaction defines coinpayments transaction info that is stored in the DB.
|
|
type Transaction struct {
|
|
ID coinpayments.TransactionID
|
|
AccountID uuid.UUID
|
|
Address string
|
|
Amount currency.Amount
|
|
Received currency.Amount
|
|
Status coinpayments.Status
|
|
Key string
|
|
Timeout time.Duration
|
|
CreatedAt time.Time
|
|
}
|