M lib/bill_plan_command.rb => lib/bill_plan_command.rb +5 -1
@@ 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
M lib/registration.rb => lib/registration.rb +1 -1
@@ 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
M test/test_registration.rb => test/test_registration.rb +5 -1
@@ 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),