diff --git a/lib/registration.rb b/lib/registration.rb index 07049b485069153dc3684a1c4907bc53ce3afcdd..390f2e78546c79887859940da61698131d00ec28 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -116,9 +116,11 @@ class Registration ) end - Registration::FinishOrStartActivation.for( - customer, google_play_userid, product - ) + reload_customer(customer).then do |reloaded| + Registration::FinishOrStartActivation.for( + reloaded, google_play_userid, product + ) + end end end diff --git a/test/test_registration.rb b/test/test_registration.rb index 38610da3c67c56ece2aab091919d2f05fdf07b1f..7f3c7c3a46e2fd9970f522993ea195909130cf33 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -56,17 +56,15 @@ class RegistrationTest < Minitest::Test "test@example.net", TelSelections::ChooseTel::Tn.for_pending_value("+15555550000") ) - result = execute_command do + result = execute_command do |exe| sgx = OpenStruct.new(registered?: false) - Registration.for( - customer( - plan_name: "test_usd", - expires_at: Time.now + 999, - sgx: sgx - ), - nil, - web_manager + cust = customer( + plan_name: "test_usd", + expires_at: Time.now + 999, + sgx: sgx ) + exe.customer_repo.expect(:find, cust, [cust.customer_id]) + Registration.for(cust, nil, web_manager) end assert_kind_of Registration::Finish, result assert_requested reservation_req @@ -2268,9 +2266,13 @@ class RegistrationTest < Minitest::Test def test_for_with_telephone_number cust = customer(plan_name: "test_usd", expires_at: Time.now + 999) tel = TelSelections::ChooseTel::Tn.for_pending_value("+15555550000") - result = Registration::RegistrationType.for(cust, nil, tel) + result = execute_command do |exe| + exe.customer_repo.expect(:find, cust, [cust.customer_id]) + Registration::RegistrationType.for(cust, nil, tel).sync + end assert_kind_of Registration::Finish, result end + em :test_for_with_telephone_number end class DataOnlyTest < Minitest::Test