fix linter errors

This commit is contained in:
Phillip Thelen
2016-10-10 14:27:51 +02:00
parent 5f3b147d2a
commit c84d6ba141

View File

@@ -54,9 +54,9 @@ api.iapAndroidVerify = {
userId: user._id, userId: user._id,
}); });
var amount = 0; let amount = 0;
switch (purchaseData.productId) { switch (receiptObj.productId) {
case 'com.habitrpg.android.habitica.iap.4gems': case 'com.habitrpg.android.habitica.iap.4gems':
amount = 1; amount = 1;
break; break;
@@ -72,11 +72,9 @@ api.iapAndroidVerify = {
break; break;
} }
if (amount === 0) { if (amount === 0) throw new Error('INVALID_ITEM_PURCHASED');
if (!correctReceipt) throw new Error('INVALID_ITEM_PURCHASED');
}
await payments.buyGems({user, paymentMethod: 'IAP GooglePlay', amount: amount, headers: req.headers}); // eslint-disable-line babel/no-await-in-loop await payments.buyGems({user, paymentMethod: 'IAP GooglePlay', amount, headers: req.headers}); // eslint-disable-line babel/no-await-in-loop
res.respond(200, googleRes); res.respond(200, googleRes);
}, },
@@ -131,14 +129,14 @@ api.iapiOSVerify = {
throw new Error('RECEIPT_ALREADY_USED'); throw new Error('RECEIPT_ALREADY_USED');
} }
var amount = 0; let amount = 0;
switch (purchaseData.productId) { switch (purchaseData.productId) {
case 'com.habitrpg.ios.Habitica.4gems': case 'com.habitrpg.ios.Habitica.4gems':
amount = 1; amount = 1;
break; break;
case 'com.habitrpg.ios.Habitica.20gems': case 'com.habitrpg.ios.Habitica.20gems':
case 'com.habitrpg.ios.Habitica.21gems': case 'com.habitrpg.ios.Habitica.21gems':
amount = 5.25 amount = 5.25;
break; break;
case 'com.habitrpg.ios.Habitica.42gems': case 'com.habitrpg.ios.Habitica.42gems':
amount = 10.5; amount = 10.5;
@@ -151,7 +149,7 @@ api.iapiOSVerify = {
correctReceipt = false; correctReceipt = false;
break; break;
} }
await payments.buyGems({user, paymentMethod: 'IAP AppleStore', amount: amount, headers: req.headers}); // eslint-disable-line babel/no-await-in-loop await payments.buyGems({user, paymentMethod: 'IAP AppleStore', amount, headers: req.headers}); // eslint-disable-line babel/no-await-in-loop
} }
if (!correctReceipt) throw new Error('INVALID_ITEM_PURCHASED'); if (!correctReceipt) throw new Error('INVALID_ITEM_PURCHASED');