@@ 71,9 71,12 @@ class CustomerPlan def bill_plan(note: nil)
EM.promise_fiber do
- DB.transaction do
+ DB.transaction do |db|
+ next false unless !block_given? || yield(db)
+ charge_for_plan(note)
add_one_month_to_current_plan unless activate_plan_starting_now
+ true
end
end
end