/ Published in: Ruby
is for easy pay
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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'] users = User.find(:all, :conditions => ['login in (?)', users_params ]) paid_users = [] users.each do |user| if user && !user.payment_requested.nil? fail = false begin UserPayment.pay(user) user.reload paid_users << user rescue Exception => msg fail = true puts "* user [#{user.login}] : Impossible to pay to this user: " + msg end paid_users << user unless fail puts "* user [#{user.login}] : user paid " unless fail else if user.nil? "* user [#{user.login}] : This user does not exists " else "* user [#{user.login}] : Any payment requested by this user " end end end