Class: Comable::Payment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::Payment
- Includes:
- Ransackable
- Defined in:
- app/models/comable/payment.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.state_names ⇒ Object
55 56 57 |
# File 'app/models/comable/payment.rb', line 55 def state_names state_machine.states.keys end |
Instance Method Details
#complete! ⇒ Object
70 71 72 73 |
# File 'app/models/comable/payment.rb', line 70 def complete! provider_complete! touch :completed_at end |
#completed? ⇒ Boolean
66 67 68 |
# File 'app/models/comable/payment.rb', line 66 def completed? completed_at? end |
#current_fee ⇒ Object
75 76 77 |
# File 'app/models/comable/payment.rb', line 75 def current_fee payment_method.try(:fee) || 0 end |
#stated?(target_state) ⇒ Boolean
60 61 62 63 64 |
# File 'app/models/comable/payment.rb', line 60 def stated?(target_state) target_state_index = self.class.state_names.index(target_state.to_sym) current_state_index = self.class.state_names.index(state_name) target_state_index < current_state_index end |