Module: Spree::Reimbursement::ReimbursementTypeValidator
- Included in:
- ReimbursementTypeEngine
- Defined in:
- app/models/spree/reimbursement/reimbursement_type_validator.rb
Instance Method Summary collapse
- #past_reimbursable_time_period?(return_item) ⇒ Boolean
- #valid_preferred_reimbursement_type?(return_item) ⇒ Boolean
Instance Method Details
#past_reimbursable_time_period?(return_item) ⇒ Boolean
12 13 14 15 |
# File 'app/models/spree/reimbursement/reimbursement_type_validator.rb', line 12 def past_reimbursable_time_period?(return_item) shipped_at = return_item.inventory_unit.shipment.shipped_at shipped_at && shipped_at < refund_time_constraint.ago end |
#valid_preferred_reimbursement_type?(return_item) ⇒ Boolean
5 6 7 8 9 10 |
# File 'app/models/spree/reimbursement/reimbursement_type_validator.rb', line 5 def valid_preferred_reimbursement_type?(return_item) preferred_type = return_item.preferred_reimbursement_type.class !past_reimbursable_time_period?(return_item) || preferred_type == expired_reimbursement_type end |