satellite/compensation: make surge percent an int64 for strictcsv

Change-Id: I1783bf73ee68ca9beb8a03f5928873fab0bbe95d
This commit is contained in:
Jeff Wendling 2020-03-31 16:43:17 -06:00 committed by jens
parent 644df8dcdc
commit ffe7a3c211
4 changed files with 6 additions and 6 deletions

View File

@ -182,7 +182,7 @@ var (
Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"` Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"`
Output string `help:"destination of report output" default:""` Output string `help:"destination of report output" default:""`
Compensation compensation.Config Compensation compensation.Config
SurgePercent int `help:"surge percent for payments" default:"0"` SurgePercent int64 `help:"surge percent for payments" default:"0"`
} }
recordPeriodCfg struct { recordPeriodCfg struct {
Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"` Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"`

View File

@ -34,7 +34,7 @@ type Invoice struct {
CompGetRepair currency.MicroUnit `csv:"comp-get-repair"` // Compensation for usage-get-repair CompGetRepair currency.MicroUnit `csv:"comp-get-repair"` // Compensation for usage-get-repair
CompPutRepair currency.MicroUnit `csv:"comp-put-repair"` // Compensation for usage-put-repair CompPutRepair currency.MicroUnit `csv:"comp-put-repair"` // Compensation for usage-put-repair
CompGetAudit currency.MicroUnit `csv:"comp-get-audit"` // Compensation for usage-get-audit CompGetAudit currency.MicroUnit `csv:"comp-get-audit"` // Compensation for usage-get-audit
SurgePercent int `csv:"surge-percent"` // Surge percent used to calculate compensation, or 0 if no surge SurgePercent int64 `csv:"surge-percent"` // Surge percent used to calculate compensation, or 0 if no surge
Owed currency.MicroUnit `csv:"owed"` // Amount we intend to pay to the node (sum(comp-*) - held + disposed) Owed currency.MicroUnit `csv:"owed"` // Amount we intend to pay to the node (sum(comp-*) - held + disposed)
Held currency.MicroUnit `csv:"held"` // Amount held from sum(comp-*) for this period Held currency.MicroUnit `csv:"held"` // Amount held from sum(comp-*) for this period
Disposed currency.MicroUnit `csv:"disposed"` // Amount of owed that is due to graceful-exit or held period ending Disposed currency.MicroUnit `csv:"disposed"` // Amount of owed that is due to graceful-exit or held period ending

View File

@ -60,7 +60,7 @@ type Statement struct {
GetRepair currency.MicroUnit GetRepair currency.MicroUnit
PutRepair currency.MicroUnit PutRepair currency.MicroUnit
GetAudit currency.MicroUnit GetAudit currency.MicroUnit
SurgePercent int SurgePercent int64
Owed currency.MicroUnit Owed currency.MicroUnit
Held currency.MicroUnit Held currency.MicroUnit
Disposed currency.MicroUnit Disposed currency.MicroUnit
@ -93,7 +93,7 @@ type PeriodInfo struct {
// SurgePercent is the percent to adjust final amounts owed. For example, // SurgePercent is the percent to adjust final amounts owed. For example,
// to pay 150%, set to 150. Zero means no surge. // to pay 150%, set to 150. Zero means no surge.
SurgePercent int SurgePercent int64
} }
// GenerateStatements generates all of the Statements for the given PeriodInfo. // GenerateStatements generates all of the Statements for the given PeriodInfo.
@ -109,7 +109,7 @@ func GenerateStatements(info PeriodInfo) ([]Statement, error) {
withheldPercents = DefaultWithheldPercents withheldPercents = DefaultWithheldPercents
} }
surgePercent := decimal.NewFromInt(int64(info.SurgePercent)) surgePercent := decimal.NewFromInt(info.SurgePercent)
disposePercent := decimal.NewFromInt(int64(info.DisposePercent)) disposePercent := decimal.NewFromInt(int64(info.DisposePercent))
// Intermediate calculations (especially at-rest related) can overflow an // Intermediate calculations (especially at-rest related) can overflow an

View File

@ -44,7 +44,7 @@ func TestGenerateStatements(t *testing.T) {
nodeID := testrand.NodeID() nodeID := testrand.NodeID()
for _, tt := range []struct { for _, tt := range []struct {
name string name string
surgePercent int surgePercent int64
node compensation.NodeInfo node compensation.NodeInfo
statement compensation.Statement statement compensation.Statement
}{ }{