storj/satellite/payments/credits.go
Qweder93 dc075eaa96 satellite/payments : deposit bonuses (credits) added
Change-Id: Ib151bbb9b02d655fa619c53bfbc04ed6f3bb39e0
2020-02-11 11:11:42 +00:00

41 lines
1.1 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package payments
import (
"context"
"time"
"github.com/skyrings/skyring-common/tools/uuid"
"storj.io/storj/satellite/payments/coinpayments"
)
// Credits exposes all needed functionality to manage credits.
//
// architecture: Service
type Credits interface {
// Create attaches a credit for payment account.
Create(ctx context.Context, credit Credit) (err error)
// ListByUserID return list of all credits of specified payment account.
ListByUserID(ctx context.Context, userID uuid.UUID) ([]Credit, error)
}
// Credit is an entity that holds bonus balance of user, earned by depositing with storj coins.
type Credit struct {
UserID uuid.UUID `json:"userId"`
Amount int64 `json:"credit"`
TransactionID coinpayments.TransactionID `json:"transactionId"`
Created time.Time `json:"created"`
}
// CreditsPage holds set of credits and indicates if
// there are more credits to fetch.
type CreditsPage struct {
Credits []Credit
Next bool
NextOffset int64
}