~singpolyma/sgx-jmp

8291b1590999a63e693eeb806b70869f0382ecde — Stephen Paul Weber 1 year, 2 months ago 4ef20f6
If customer already has enough balance, just bill them and finish
4 files changed, 5 insertions(+), 0 deletions(-)

M config-schema.dhall
M config.dhall.sample
M lib/registration.rb
M test/test_helper.rb
M config-schema.dhall => config-schema.dhall +1 -0
@@ 1,4 1,5 @@
{ activation_amount : Natural
, activation_amount_accept : Natural
, admins : List Text
, adr : Text
, approved_domains : List { mapKey : Text, mapValue : Optional Text }

M config.dhall.sample => config.dhall.sample +1 -0
@@ 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) ->

M lib/registration.rb => lib/registration.rb +2 -0
@@ 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

M test/test_helper.rb => test/test_helper.rb +1 -0
@@ 68,6 68,7 @@ CONFIG = {
	},
	notify_from: "notify_from@example.org",
	activation_amount: 1,
	activation_amount_accept: 1,
	plans: [
		{
			name: "test_usd",