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
+6 -4
View File
@@ -21,9 +21,11 @@ exports.grantCharge = async ({
var result;
const stripeAmount = amount * 100;
// charge if yes or no monthly
let charge = await stripe.charges.create({
amount,
amount: stripeAmount,
currency: 'usd',
source: 'tok_visa',
description: `Charity Bundle Payment`,
@@ -32,11 +34,11 @@ exports.grantCharge = async ({
});
let transfers = await organizations.map(async org => {
org.amount = org.amount * 100;
const applicationStripeFee = org.amount * 0.05;
let stripeOrgAmount = Math.round(org.amount * 100 * 100) / 100;
const applicationStripeFee = stripeOrgAmount * 0.05;
let t = await stripe.transfers.create({
amount: org.amount - applicationStripeFee,
amount: stripeOrgAmount - applicationStripeFee,
currency: 'usd',
source_transaction: charge.id,
destination: 'acct_1EAxzUIVW1uo07uH'