2019-11-15 14:27:44 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package payments
|
|
|
|
|
|
|
|
import (
|
2023-01-12 03:41:14 +00:00
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
|
2020-03-30 10:08:50 +01:00
|
|
|
"storj.io/common/uuid"
|
2020-03-04 13:23:10 +00:00
|
|
|
"storj.io/storj/satellite/accounting"
|
2019-11-15 14:27:44 +00:00
|
|
|
)
|
|
|
|
|
2023-03-21 06:48:11 +00:00
|
|
|
// ProjectCharge contains project usage and how much it will cost at the end of the month.
|
2019-11-15 14:27:44 +00:00
|
|
|
type ProjectCharge struct {
|
2020-03-04 13:23:10 +00:00
|
|
|
accounting.ProjectUsage
|
|
|
|
|
2019-11-15 14:27:44 +00:00
|
|
|
// StorageGbHrs shows how much cents we should pay for storing GB*Hrs.
|
2020-03-04 13:23:10 +00:00
|
|
|
StorageGbHrs int64 `json:"storagePrice"`
|
2019-11-15 14:27:44 +00:00
|
|
|
// Egress shows how many cents we should pay for Egress.
|
2020-03-04 13:23:10 +00:00
|
|
|
Egress int64 `json:"egressPrice"`
|
2021-10-20 23:54:34 +01:00
|
|
|
// SegmentCount shows how many cents we should pay for objects count.
|
|
|
|
SegmentCount int64 `json:"segmentPrice"`
|
2019-11-15 14:27:44 +00:00
|
|
|
}
|
2023-01-12 03:41:14 +00:00
|
|
|
|
2023-03-21 06:48:11 +00:00
|
|
|
// ProjectChargesResponse represents a collection of project usage charges grouped by project ID and partner name.
|
|
|
|
// It is implemented as a map of project public IDs to a nested map of partner names to ProjectCharge structs.
|
|
|
|
//
|
|
|
|
// The values of the inner map are ProjectCharge structs which contain information about the charges associated
|
|
|
|
// with a particular project-partner combination.
|
|
|
|
type ProjectChargesResponse map[uuid.UUID]map[string]ProjectCharge
|
|
|
|
|
2023-01-12 03:41:14 +00:00
|
|
|
// ProjectUsagePriceModel represents price model for project usage.
|
|
|
|
type ProjectUsagePriceModel struct {
|
|
|
|
StorageMBMonthCents decimal.Decimal `json:"storageMBMonthCents"`
|
|
|
|
EgressMBCents decimal.Decimal `json:"egressMBCents"`
|
|
|
|
SegmentMonthCents decimal.Decimal `json:"segmentMonthCents"`
|
2023-04-03 14:24:34 +01:00
|
|
|
EgressDiscountRatio float64 `json:"egressDiscountRatio"`
|
2023-01-12 03:41:14 +00:00
|
|
|
}
|