@@ -32,8 +32,8 @@ SCHEMA = "{
component: { jid: Text },
keepgo: Optional { access_token: Text, api_key: Text },
sims: {
- CAD: { per_gb: Natural, annual: Natural },
- USD: { per_gb: Natural, annual: Natural }
+ annual: { CAD: Natural, USD: Natural },
+ per_gb: { CAD: Natural, USD: Natural }
},
plans: List {
currency: < CAD | USD >,
@@ -69,6 +69,7 @@ require_relative "../lib/expiring_lock"
require_relative "../lib/low_balance"
require_relative "../lib/postgres"
require_relative "../lib/sim_repo"
+require_relative "../lib/sim_pricing"
require_relative "../lib/transaction"
BRAINTREE = AsyncBraintree.new(**CONFIG[:braintree])
@@ -107,7 +108,7 @@ module SimAction
end
def refill_price
- (BigDecimal(CONFIG[:sims][customer.currency][:per_gb]) / 100) * 5
+ SIMPricing.five_gb_refill_price(customer.currency, CONFIG)
end
def refill_and_bill(data, price, note)
@@ -206,7 +207,7 @@ class SimAnnual
end
def annual_price
- BigDecimal(CONFIG[:sims][customer.currency][:annual]) / 100
+ SIMPricing.annual_price(customer.currency, CONFIG)
end
def call