Posted By

andresbravog on 03/25/11


Tagged

ruby qustodian


Versions (?)

List of users for pay in Qustodian


 / Published in: Ruby
 

is for easy pay

  1. users_params = ['600203389', '616487321', '622242409', '622280776', '625902608', '626383823', '628421395', '628922862', '633623378', '635232596', '635496283', '636931966', '639565592', '644360760', '644376209', '645909745', '658539781', '659039288', '659417827', '660119737', '666261379', '666279407', '668829310', '670495225', '675319539', '677320912', '677635338', '679628257', '680831293', '686272477', '687998501', '693777289']
  2. users = User.find(:all, :conditions => ['login in (?)', users_params ])
  3. paid_users = []
  4. users.each do |user|
  5. if user && !user.payment_requested.nil?
  6. fail = false
  7. begin
  8. UserPayment.pay(user)
  9. user.reload
  10. paid_users << user
  11. rescue Exception => msg
  12. fail = true
  13. puts "* user [#{user.login}] : Impossible to pay to this user: " + msg
  14. end
  15. paid_users << user unless fail
  16. puts "* user [#{user.login}] : user paid " unless fail
  17. else
  18. if user.nil?
  19. "* user [#{user.login}] : This user does not exists "
  20. else
  21. "* user [#{user.login}] : Any payment requested by this user "
  22. end
  23. end
  24. end

Report this snippet  

You need to login to post a comment.