Module: Auth::Concerns::Shopping::PaymentConcern::ClassMethods
- Defined in:
- app/models/auth/concerns/shopping/payment_concern.rb
Instance Method Summary collapse
- #find_payments(resource, cart) ⇒ Object
-
#get_discount_payments(cart_id) ⇒ Object
will return discount_payments of this cart id with a payments_status of 1.
-
#get_sum_of_discount_payments(cart_id) ⇒ Object
will return the sum of the amounts of all successfull discount_payments.
Instance Method Details
#find_payments(resource, cart) ⇒ Object
206 207 208 209 210 211 |
# File 'app/models/auth/concerns/shopping/payment_concern.rb', line 206 def find_payments(resource,cart) res = Auth.configuration.payment_class.constantize.where(:resource_id => resource.id.to_s, :cart_id => cart.id.to_s) res.each do |p| #puts "found payment: #{p.id.to_s}" end end |
#get_discount_payments(cart_id) ⇒ Object
will return discount_payments of this cart id with a payments_status of 1.
214 215 216 217 218 |
# File 'app/models/auth/concerns/shopping/payment_concern.rb', line 214 def get_discount_payments(cart_id) discount_payments = Auth.configuration.payment_class.constantize.where(:cart_id => cart_id, :discount_id.nin => ["", nil], :payment_status => 1) discount_payments end |
#get_sum_of_discount_payments(cart_id) ⇒ Object
will return the sum of the amounts of all successfull discount_payments.
221 222 223 224 225 226 227 228 229 230 |
# File 'app/models/auth/concerns/shopping/payment_concern.rb', line 221 def get_sum_of_discount_payments(cart_id) sum_of_discount_payments = 0 get_discount_payments(cart_id).each do |dp| sum_of_discount_payments+= dp.amount end sum_of_discount_payments end |