fix(gem-cap) use customerId in gem purchase

This commit is contained in:
Tyler Renelle 2014-12-05 15:11:27 -07:00
parent f010bd7ad9
commit 2018cc84ab
2 changed files with 2 additions and 2 deletions

View file

@ -15067,7 +15067,7 @@ api.wrap = function(user, main) {
if (type === 'gems' && key === 'gem') {
_ref1 = api.planGemLimits, convRate = _ref1.convRate, convCap = _ref1.convCap;
convCap += user.purchased.plan.consecutive.gemCapExtra;
if (!((_ref2 = user.purchased) != null ? (_ref3 = _ref2.plan) != null ? _ref3.planId : void 0 : void 0)) {
if (!((_ref2 = user.purchased) != null ? (_ref3 = _ref2.plan) != null ? _ref3.customerId : void 0 : void 0)) {
return typeof cb === "function" ? cb({
code: 401,
message: "Must subscribe to purchase gems with GP"

View file

@ -696,7 +696,7 @@ api.wrap = (user, main=true) ->
if type is 'gems' and key is 'gem'
{convRate, convCap} = api.planGemLimits
convCap += user.purchased.plan.consecutive.gemCapExtra
return cb?({code:401,message:"Must subscribe to purchase gems with GP"},req) unless user.purchased?.plan?.planId
return cb?({code:401,message:"Must subscribe to purchase gems with GP"},req) unless user.purchased?.plan?.customerId
return cb?({code:401,message:"Not enough Gold"}) unless user.stats.gp >= convRate
return cb?({code:401,message:"You've reached the Gold=>Gem conversion cap (#{convCap}) for this month. We have this to prevent abuse / farming. The cap will reset within the first three days of next month."}) if user.purchased.plan.gemsBought >= convCap
user.balance += .25