1# frozen_string_literal: true
2
3require "bigdecimal"
4
5module SIMPricing
6 # SIM refill billing records currency amounts in transactions. Use BigDecimal
7 # because the configured per-GB price is stored in cents.
8 def self.five_gb_refill_price(currency, config)
9 (BigDecimal(config[:sims][currency][:per_gb]) / 100) * 5
10 end
11
12 # CustomerRepo#put_monthly_limits stores limits with to_i, so render monthly
13 # data limit form steps in that same integer-dollar unit.
14 def self.whole_dollars(price)
15 price.to_i
16 end
17end