~singpolyma/sgx-jmp

9dd19f4a85ac8c1cff75e95501ac831471fa3877 — Stephen Paul Weber 1 year, 9 months ago 579c4fe
Only ask which card to use if there is more than one
1 files changed, 4 insertions(+), 4 deletions(-)

M sgx_jmp.rb
M sgx_jmp.rb => sgx_jmp.rb +4 -4
@@ 330,7 330,7 @@ command :execute?, node: "buy-credit", sessionid: nil do |iq|
				type: "fixed",
				value: "Current balance: $#{balance.to_s('F')}"
			},
			{
			({
				var: "payment_method",
				type: "list-single",
				label: "Credit card to pay with",


@@ 342,7 342,7 @@ command :execute?, node: "buy-credit", sessionid: nil do |iq|
						label: "#{method.card_type} #{method.last_4}"
					}
				end
			},
			} if payment_methods.length > 1),
			XEP0122Field.new(
				"xs:decimal",
				range: (0..1000),


@@ 350,7 350,7 @@ command :execute?, node: "buy-credit", sessionid: nil do |iq|
				label: "Amount of credit to buy",
				required: true
			).field
		]
		].compact

		EMPromise.all([
			payment_methods,


@@ 359,7 359,7 @@ command :execute?, node: "buy-credit", sessionid: nil do |iq|
	}.then { |(payment_methods, iq2)|
		iq = iq2 # This allows the catch to use it also
		payment_method = payment_methods.fetch(
			iq.form.field("payment_method").value.to_i
			iq.form.field("payment_method")&.value.to_i
		)
		BRAINTREE.transaction.sale(
			amount: iq.form.field("amount").value.to_s,