Fix migrate billing

Stephen Paul Weber created

Change summary

sgx_jmp.rb | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

Detailed changes

sgx_jmp.rb 🔗

@@ -601,11 +601,15 @@ Command.new(
 			reply.command << FormTemplate.render("migrate_billing")
 		end
 	]).then do |(customer, iq)|
-		Registration::Payment.for(
-			iq, customer, customer.registered?.phone,
-			final_message: PaypalDone::MESSAGE,
-			finish: PaypalDone
-		).then(&:write).catch_only(Command::Execution::FinalStanza) do |s|
+		plan_name = iq.form.field("plan_name").value.to_s
+		customer = customer.with_plan(plan_name)
+		customer.save_plan!.then {
+			Registration::Payment.for(
+				iq, customer, customer.registered?.phone,
+				final_message: PaypalDone::MESSAGE,
+				finish: PaypalDone
+			)
+		}.then(&:write).catch_only(Command::Execution::FinalStanza) do |s|
 			BLATHER.join(CONFIG[:notify_admin], "sgx-jmp")
 			BLATHER.say(
 				CONFIG[:notify_admin],