diff --git a/config-schema.dhall b/config-schema.dhall index fd5ab67b2964c0bca619510e27e1b9d654f2381e..1e6f5eda9b7a7e1fcc9d441b3180cfb6015467bc 100644 --- a/config-schema.dhall +++ b/config-schema.dhall @@ -1,4 +1,5 @@ { activation_amount : Natural +, activation_amount_accept : Natural , admins : List Text , adr : Text , approved_domains : List { mapKey : Text, mapValue : Optional Text } diff --git a/config.dhall.sample b/config.dhall.sample index 3e19598df5cd8ad7565ccb03d4938dae6ef9dfd9..61b0e87b7696af2d85c995a912f0ed2ac43293dc 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -66,6 +66,7 @@ in }, oxr_app_id = "", activation_amount = 15, + activation_amount_accept = 15, credit_card_url = \(jid: Text) -> \(customer_id: Text) -> "https://pay.jmp.chat/${jid}/credit_cards?customer_id=${customer_id}", electrum_notify_url = \(address: Text) -> \(customer_id: Text) -> diff --git a/lib/registration.rb b/lib/registration.rb index 8195975da68654dfa6882da905f141c20490240b..ca21c8062c0bab1f2deb97cc0470baf36e5cfd41 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -38,6 +38,8 @@ class Registration jid = ProxiedJID.new(customer.jid).unproxied if customer.active? Finish.new(customer, tel) + elsif customer.balance >= CONFIG[:activation_amount_accept] + BillPlan.new(customer, tel) elsif CONFIG[:approved_domains].key?(jid.domain.to_sym) Allow.for(customer, tel, jid) else diff --git a/test/test_helper.rb b/test/test_helper.rb index f397d1555d0275e6d0e5671843551219f73db4ad..981decc44f4161de852b4cf79386c510f1100a92 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -68,6 +68,7 @@ CONFIG = { }, notify_from: "notify_from@example.org", activation_amount: 1, + activation_amount_accept: 1, plans: [ { name: "test_usd",