storj/satellite/payments/stripecoinpayments/conversion.go
Yaroslav Vorobiov bb1e86c790 satellite: remove unused coinpayments code and chores
issue: https://github.com/storj/storj/issues/4824

Change-Id: I2e3e63151d1def96270279719f6eceda0acba66c
2022-11-30 16:24:48 +00:00

19 lines
452 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package stripecoinpayments
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()
}