Module: LoyaltyProgram::Benefits::EarlyBird

Included in:
EarlyBird::RewardOperation
Defined in:
app/my_lib/loyalty_program/benefits/early_bird.rb

Instance Method Summary collapse

Instance Method Details

#early_bird_rewards_amount(user, country_code = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/my_lib/loyalty_program/benefits/early_bird.rb', line 2

def early_bird_rewards_amount(user, country_code = nil)
  user_loyalty = user.user_loyalty

  method_name = if country_code.present? && country_code == ApiV5::Constants::COUNTRY_CODE_SG
                  'five_reviews_point_sg'
                elsif country_code.present? && country_code == ApiV5::Constants::COUNTRY_CODE_MY
                  'five_reviews_point_my'
                else
                  'five_reviews_point_th'
                end

  user_loyalty.benefit_value(method_name, cast: :to_i)
end