Class: Pay::Charge
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pay::Charge
- Defined in:
- app/models/pay/charge.rb
Instance Method Summary collapse
- #braintree? ⇒ Boolean
- #charged_to ⇒ Object
- #paypal? ⇒ Boolean
- #processor_charge ⇒ Object
- #refund!(refund_amount = nil) ⇒ Object
- #stripe? ⇒ Boolean
Instance Method Details
#braintree? ⇒ Boolean
35 36 37 |
# File 'app/models/pay/charge.rb', line 35 def braintree? processor == "braintree" end |
#charged_to ⇒ Object
27 28 29 |
# File 'app/models/pay/charge.rb', line 27 def charged_to "#{card_type} (**** **** **** #{card_last4})" end |
#paypal? ⇒ Boolean
39 40 41 |
# File 'app/models/pay/charge.rb', line 39 def paypal? braintree? && card_type == "PayPal" end |
#processor_charge ⇒ Object
18 19 20 |
# File 'app/models/pay/charge.rb', line 18 def processor_charge send("#{processor}_charge") end |
#refund!(refund_amount = nil) ⇒ Object
22 23 24 25 |
# File 'app/models/pay/charge.rb', line 22 def refund!(refund_amount = nil) refund_amount ||= amount send("#{processor}_refund!", refund_amount) end |
#stripe? ⇒ Boolean
31 32 33 |
# File 'app/models/pay/charge.rb', line 31 def stripe? processor == "stripe" end |