storj/satellite/payments/stripe/transactions.go
Michal Niewrzal 8a50a3baa3 satellite/payments: rename 'stripecoinpayments' package to 'stripe'
Automatic rename. May require some more cleanups later.

Change-Id: I18220a4278056d25c41fb137832bb81f2b876ac1
2023-04-06 16:51:43 +00:00

44 lines
1.3 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package stripe
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
}