8a50a3baa3
Automatic rename. May require some more cleanups later. Change-Id: I18220a4278056d25c41fb137832bb81f2b876ac1
19 lines
440 B
Go
19 lines
440 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package stripe
|
|
|
|
import (
|
|
"github.com/shopspring/decimal"
|
|
|
|
"storj.io/common/currency"
|
|
)
|
|
|
|
// convertToCents convert amount to USD cents with given rate.
|
|
func convertToCents(rate decimal.Decimal, amount currency.Amount) int64 {
|
|
amountDecimal := amount.AsDecimal()
|
|
usd := amountDecimal.Mul(rate)
|
|
usdCents := usd.Shift(2)
|
|
return usdCents.Round(0).IntPart()
|
|
}
|