fixes for rounding

This commit is contained in:
Arjun Patel
2019-03-15 21:41:54 -07:00
parent 1568a99457
commit 49427ee8f7
3 changed files with 11 additions and 12 deletions
+5 -4
View File
@@ -10,7 +10,7 @@ const { Grant, Cause, Region, Organization, sequelize } = db;
exports.create = (req, res, next) => {
const user = req.user;
const {
var {
name,
monthly,
causes,
@@ -20,6 +20,8 @@ exports.create = (req, res, next) => {
stripeToken
} = req.body;
amount = Math.round(amount * 100) / 100;
if (!stripeToken) {
throw errorMaker(400, 'No stripe token given');
}
@@ -56,7 +58,6 @@ exports.create = (req, res, next) => {
stripe.grantCharge({
grant: grants.dataValues,
stripeToken,
grant,
stripeToken,
organizations,
monthly,
@@ -66,13 +67,13 @@ exports.create = (req, res, next) => {
sendgrid.paymentReceipt({
organizations,
total_amount,
total_amount: amount,
receiver: user.email
});
return res.status(200).json({
message: 'Successfully charged or subscribed',
grant
grant: grants.dataValues
});
})
.catch(function(error) {