diff --git a/lib/bill_plan_command.rb b/lib/bill_plan_command.rb index 69c2ca915b0c64275ea48f99b6d7a12ad491a9f9..2e74d4be9803a80257ce78dd263e7797662a2518 100644 --- a/lib/bill_plan_command.rb +++ b/lib/bill_plan_command.rb @@ -24,7 +24,7 @@ class BillPlanCommand def call ExpiringLock.new("jmp_customer_bill_plan-#{customer_id}").with { - @customer.bill_plan(note: "Renew account plan") { |db| + @customer.bill_plan(note: note) { |db| reload_customer(db).balance > @customer.monthly_price } }.then do |billed| @@ -37,6 +37,10 @@ class BillPlanCommand protected + def note + "Renew account plan for #{@customer.registered?.phone}" + end + def customer_id @customer.customer_id end diff --git a/lib/registration.rb b/lib/registration.rb index 9bb03b7d1e20ee22e02aa7ca502b7f1dc346c2c0..e08d4eba9e7911777968ada8d662636779d4e2a7 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -427,7 +427,7 @@ class Registration end def write - @customer.bill_plan(note: "Bill for first month").then do + @customer.bill_plan(note: "Bill #{@tel} for first month").then do @finish.new(@customer, @tel).write end end diff --git a/test/test_registration.rb b/test/test_registration.rb index c2561d3af146680540921bd6288a86f88f1816f6..c711411f8963ef911c1d90d87d6aa3b4114aa5cf 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -432,7 +432,11 @@ class RegistrationTest < Minitest::Test assert_equal CONFIG[:activation_amount], amount assert_equal :test_default_method, payment_method end - customer.expect(:bill_plan, nil, [{ note: "Bill for first month" }]) + customer.expect( + :bill_plan, + nil, + [{ note: "Bill +15555550000 for first month" }] + ) Registration::Payment::CreditCard::Activate::Finish.expect( :new, OpenStruct.new(write: nil),