Module: Spree::Reimbursement::ReimbursementTypeValidator

Included in:
ReimbursementTypeEngine
Defined in:
app/models/spree/reimbursement/reimbursement_type_validator.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) past_reimbursable_time_period?(return_item)

Returns:

  • (Boolean)


10
11
12
13
# File 'app/models/spree/reimbursement/reimbursement_type_validator.rb', line 10

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

- (Boolean) valid_preferred_reimbursement_type?(return_item)

Returns:

  • (Boolean)


3
4
5
6
7
8
# File 'app/models/spree/reimbursement/reimbursement_type_validator.rb', line 3

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