fixing stripe errors on amounts

This commit is contained in:
Arjun Patel
2019-03-16 13:38:34 -07:00
parent f99b8fce30
commit 661828bab2
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -20,7 +20,7 @@ exports.create = (req, res, next) => {
stripeToken stripeToken
} = req.body; } = req.body;
amount = Math.round(amount * 100) / 100; actual_total = Math.round(amount * 100) / 100;
if (!stripeToken) { if (!stripeToken) {
throw errorMaker(400, 'No stripe token given'); throw errorMaker(400, 'No stripe token given');
@@ -32,7 +32,7 @@ exports.create = (req, res, next) => {
{ {
donor_id: user.id, donor_id: user.id,
name, name,
amount, amount: actual_total,
monthly, monthly,
num_causes: causes.length, num_causes: causes.length,
num_regions: regions.length num_regions: regions.length
@@ -67,7 +67,7 @@ exports.create = (req, res, next) => {
sendgrid.paymentReceipt({ sendgrid.paymentReceipt({
organizations, organizations,
total_amount: amount, total_amount: actual_total,
receiver: user.email receiver: user.email
}); });
+1 -1
View File
@@ -34,7 +34,7 @@ exports.grantCharge = async ({
}); });
let transfers = await organizations.map(async org => { let transfers = await organizations.map(async org => {
let stripeOrgAmount = Math.round(org.amount * 100 * 100) / 100; let stripeOrgAmount = Math.round(org.amount * 100);
const applicationStripeFee = stripeOrgAmount * 0.05; const applicationStripeFee = stripeOrgAmount * 0.05;
let t = await stripe.transfers.create({ let t = await stripe.transfers.create({