fix(topup): settle recharge orders atomically
This commit is contained in:
@@ -146,3 +146,9 @@ func QuotaFromDecimalChecked(d decimal.Decimal) (int, *QuotaClamp) {
|
||||
f, _ := d.Round(0).Float64()
|
||||
return saturateQuota(f, "QuotaFromDecimal")
|
||||
}
|
||||
|
||||
// QuotaFromDecimalStrict converts an in-range decimal quota and rejects a
|
||||
// value that would otherwise be saturated at the database's int32 boundary.
|
||||
func QuotaFromDecimalStrict(d decimal.Decimal) (int, error) {
|
||||
return strictQuota(QuotaFromDecimalChecked(d))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user