Method: Ishapi::PaymentsController#unlock
- Defined in:
- app/controllers/ishapi/payments_controller.rb
#unlock ⇒ Object
Spend an unlock without spending money. vp 2022-03-01
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'app/controllers/ishapi/payments_controller.rb', line 89 def unlock :unlock, ::Ish::Payment item = Object::const_get(params['kind']).find params['id'] existing = Ish::Payment.where( profile: @current_profile, item: item ).first if existing render status: 200, json: { status: :ok, message: 'already purchased' } return end @current_profile.inc( n_unlocks: -item.premium_tier ) purchase = ::Ish::Payment.create!( item: item, profile: @current_profile, ) @profile = @current_profile render 'ishapi/user_profiles/account' end |