fix jamclass posa cards

This commit is contained in:
Seth Call 2016-10-07 11:56:48 -05:00
parent a2fd9cb87a
commit abf3c6f0f5
5 changed files with 16 additions and 0 deletions

View File

@ -154,6 +154,7 @@ module JamRuby
if self.save
UserWhitelist.card_create(user, 'posa')
SaleLineItem.associate_user_for_posa(self, user)
# when you claim a POSA card, you are also making a LessonPackagePurchase

View File

@ -22,6 +22,14 @@ module JamRuby
APP_CONFIG.admin_root_url + "/admin/user_whitelists/" + id
end
# if a user claims a gift card or posa card, whitelist their account so they don't get messed with by fraud code
def self.card_create(user, notes)
user_whitelist = UserWhitelist.new
user_whitelist.user = user
user_whitelist.notes = notes
user_whitelist.save
end
def to_s
user
end

View File

@ -19,6 +19,10 @@ badCode = 'This is not a valid code. Please carefully re-enter the code and try
if errorText? && errorText.indexOf('must already be set') > -1
errorText = 'This card has not been activated by a retailer and cannot currently be used. If you purchased this card from a store, please return to the store and have the store activate the card. Only the store where you purchased this card can activate it.'
if errorText? && errorText.indexOf('already claimed') > -1
errorText = 'This card has already been claimed. If you believe this is in error, please email us at support@jamkazam.com to report this problem.'
buttonClassnames = classNames({'redeem-giftcard': true, 'button-orange': true, disabled: @state.processing || @state.done })

View File

@ -1061,6 +1061,7 @@ class ApiUsersController < ApiController
return
else
UserWhitelist.card_create(current_user, 'giftcard')
# apply gift card items to everything in shopping cart
current_user.reload
ShoppingCart.apply_gifted_jamtracks(current_user)

View File

@ -451,5 +451,7 @@ if defined?(Bundler)
# If you want to use the new JSON-based format in your application, you can add an initializer file with the following content:
# This would transparently migrate your existing Marshal-serialized cookies into the new JSON-based format.
config.action_dispatch.cookies_serializer = :hybrid
config.jam_class_card_wait_period_year = 1
end
end