Change summary
lib/bill_plan_command.rb | 6 +++++-
lib/registration.rb | 2 +-
test/test_registration.rb | 6 +++++-
3 files changed, 11 insertions(+), 3 deletions(-)
Detailed changes
@@ -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
@@ -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
@@ -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),