fixing stripe errors on amounts
This commit is contained in:
@@ -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
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user