Class: Pay::Charge
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Pay::Charge
- Defined in:
- app/models/pay/charge.rb
Instance Method Summary collapse
- #braintree? ⇒ Boolean
- #charged_to ⇒ Object
- #paddle? ⇒ Boolean
- #paypal? ⇒ Boolean
- #processor_charge ⇒ Object
- #refund!(refund_amount = nil) ⇒ Object
- #stripe? ⇒ Boolean
Methods inherited from ApplicationRecord
Instance Method Details
#braintree? ⇒ Boolean
38 39 40 |
# File 'app/models/pay/charge.rb', line 38 def braintree? processor == "braintree" end |
#charged_to ⇒ Object
30 31 32 |
# File 'app/models/pay/charge.rb', line 30 def charged_to "#{card_type} (**** **** **** #{card_last4})" end |
#paddle? ⇒ Boolean
46 47 48 |
# File 'app/models/pay/charge.rb', line 46 def paddle? processor == "paddle" end |
#paypal? ⇒ Boolean
42 43 44 |
# File 'app/models/pay/charge.rb', line 42 def paypal? braintree? && card_type == "PayPal" end |
#processor_charge ⇒ Object
21 22 23 |
# File 'app/models/pay/charge.rb', line 21 def processor_charge send("#{processor}_charge") end |
#refund!(refund_amount = nil) ⇒ Object
25 26 27 28 |
# File 'app/models/pay/charge.rb', line 25 def refund!(refund_amount = nil) refund_amount ||= amount send("#{processor}_refund!", refund_amount) end |
#stripe? ⇒ Boolean
34 35 36 |
# File 'app/models/pay/charge.rb', line 34 def stripe? processor == "stripe" end |