Module: Comable::Checkout
- Extended by:
- ActiveSupport::Concern
- Included in:
- Order
- Defined in:
- app/models/concerns/comable/checkout.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #allow_cancel? ⇒ Boolean
- #allow_return? ⇒ Boolean
- #delivery_required? ⇒ Boolean
- #orderer_required? ⇒ Boolean
- #payment_required? ⇒ Boolean
- #shipment_required? ⇒ Boolean
- #stated?(target_state) ⇒ Boolean
Instance Method Details
#allow_cancel? ⇒ Boolean
73 74 75 76 77 |
# File 'app/models/concerns/comable/checkout.rb', line 73 def allow_cancel? # TODO: Implement shipments # !shipments.exists? true end |
#allow_return? ⇒ Boolean
79 80 81 82 83 |
# File 'app/models/concerns/comable/checkout.rb', line 79 def allow_return? # TODO: Implement shipments # shipments.exists? false end |
#delivery_required? ⇒ Boolean
61 62 63 |
# File 'app/models/concerns/comable/checkout.rb', line 61 def delivery_required? ship_address.nil? || ship_address.new_record? end |
#orderer_required? ⇒ Boolean
57 58 59 |
# File 'app/models/concerns/comable/checkout.rb', line 57 def orderer_required? bill_address.nil? || bill_address.new_record? end |
#payment_required? ⇒ Boolean
65 66 67 |
# File 'app/models/concerns/comable/checkout.rb', line 65 def payment_required? Comable::PaymentMethod.exists? && payment.nil? end |
#shipment_required? ⇒ Boolean
69 70 71 |
# File 'app/models/concerns/comable/checkout.rb', line 69 def shipment_required? Comable::ShipmentMethod.activated.exists? && shipment.nil? end |
#stated?(target_state) ⇒ Boolean
51 52 53 54 55 |
# File 'app/models/concerns/comable/checkout.rb', line 51 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 |