6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/services/spree_cm_commissioner/ticket_transfers/eligibility_checker.rb', line 6
def call(from_guest:, rule:, transfer_type:, price: nil)
return failure(nil, I18n.t('ticket_transfer.guest_not_found')) if from_guest.blank?
return success(from_guest: from_guest) if rule.nil?
if (error = check_cooldown(from_guest, rule)) return failure(nil, error)
end
if (error = check_chain_length(from_guest, rule)) return failure(nil, error)
end
if (error = check_event_cutoff(from_guest, rule)) return failure(nil, error)
end
if (error = check_price_range(from_guest, rule, price, transfer_type)) return failure(nil, error)
end
success(from_guest: from_guest)
end
|