mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
better error handling and fix typo
This commit is contained in:
@@ -25,7 +25,7 @@ api.iapAndroidVerify = {
|
|||||||
async handler (req, res) {
|
async handler (req, res) {
|
||||||
let resObject = await iapAndroidVerify(res.locals.user, req.body);
|
let resObject = await iapAndroidVerify(res.locals.user, req.body);
|
||||||
return res
|
return res
|
||||||
.status(resObject.ok ? 200 : 500)
|
.status(resObject.ok === true ? 200 : 500)
|
||||||
.json(resObject);
|
.json(resObject);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -44,7 +44,7 @@ api.iapiOSVerify = {
|
|||||||
async handler (req, res) {
|
async handler (req, res) {
|
||||||
let resObject = await iapIOSVerify(res.locals.user, req.body);
|
let resObject = await iapIOSVerify(res.locals.user, req.body);
|
||||||
return res
|
return res
|
||||||
.status(resObject.ok ? 200 : 500)
|
.status(resObject.ok === true ? 200 : 500)
|
||||||
.json(resObject);
|
.json(resObject);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ async function iapAndroidVerify (user, iapBody) {
|
|||||||
await IapPurchaseReceipt.create({
|
await IapPurchaseReceipt.create({
|
||||||
_id: token,
|
_id: token,
|
||||||
consumed: true,
|
consumed: true,
|
||||||
userID: user._id,
|
userId: user._id,
|
||||||
});
|
});
|
||||||
|
|
||||||
await payments.buyGems({
|
await payments.buyGems({
|
||||||
@@ -98,7 +98,7 @@ async function iapIOSVerify (user, iapBody) {
|
|||||||
await IapPurchaseReceipt.create({
|
await IapPurchaseReceipt.create({
|
||||||
_id: token,
|
_id: token,
|
||||||
consumed: true,
|
consumed: true,
|
||||||
userID: user._id,
|
userId: user._id,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error('RECEIPT_ALREADY_USED');
|
throw new Error('RECEIPT_ALREADY_USED');
|
||||||
|
|||||||
Reference in New Issue
Block a user