From 5b038160f74a757b33e12bd19d92b5faf1d9056d Mon Sep 17 00:00:00 2001 From: Amolith Date: Thu, 4 Jun 2026 18:14:03 -0600 Subject: [PATCH] Flatten SIM job pricing config Update the SIM job's inline Dhall schema to use fixed CAD/USD records for the annual and per-GB prices it reads. --- bin/sim_job | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/sim_job b/bin/sim_job index 72d6be793f640b4152439baf857010276cb9b438..7a4ef2486ddfe2f3ecf0e49e1297f2b8f566bd67 100755 --- a/bin/sim_job +++ b/bin/sim_job @@ -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