storj/satellite/console/billinghistoryitem.go
Kaloyan Raev d66e646b57 satellite/payments: add deposit bonus to stripe balance
Jira issue: https://storjlabs.atlassian.net/browse/USR-820

The bonus for depositing STORJ tokens is now added as to the Stripe
balance instead of the to `credits` DB table on the satellite.

Existing unspent bonuses in the `credits` DB table are still processed
as usual when generating invoices. They will be migrated to the Stripe
balance with a separate change.

The bonus is added to the Stripe balance with a separate Credit
transaction. The balance transactions for the deposit and the bonus can
be differentiate by their different description.

The billing history is modified to list the bonus from the Stripe
transactions list.

The workflow for depositing STORJ tokens to the Stripe balance is
improved to survive failures in the middle of the process.

Change-Id: I6a1017984eae34e97c580f9093f7e51ca417b962
2020-06-01 17:41:10 +00:00

38 lines
1.3 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package console
import (
"time"
)
// BillingHistoryItem holds all public information about billing history line.
type BillingHistoryItem struct {
ID string `json:"id"`
Description string `json:"description"`
Amount int64 `json:"amount"`
Received int64 `json:"received"`
Status string `json:"status"`
Link string `json:"link"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
Type BillingHistoryItemType `json:"type"`
}
// BillingHistoryItemType indicates type of billing history item.
type BillingHistoryItemType int
const (
// Invoice is a Stripe invoice billing item.
Invoice BillingHistoryItemType = 0
// Transaction is a Coinpayments transaction billing item.
Transaction BillingHistoryItemType = 1
// Charge is a credit card charge billing item.
Charge BillingHistoryItemType = 2
// Coupon is an entity that adds some funds to Accounts balance for some fixed period.
Coupon BillingHistoryItemType = 3
// DepositBonus is an entity that adds some funds to Accounts balance after deposit with storj coins.
DepositBonus BillingHistoryItemType = 4
)