fixes to payments for the .3 to be distributed

This commit is contained in:
Arjun Patel
2019-05-09 01:35:41 -07:00
parent 98485a0da0
commit ed0cee28a2
3 changed files with 34 additions and 18 deletions
+22 -1
View File
@@ -48,11 +48,32 @@ exports.createGrant = async (req, res, next) => {
}
);
await Promise.all(
await organizations.map(async org => {
let dbOrgs = await sequelize.query(
`
SELECT stripe_account_id,
ein,
charify_credit
FROM organizations
WHERE id = :org_id
`,
{
type: sequelize.QueryTypes.SELECT,
replacements: { org_id: org.id }
}
);
org.stripe_account_id = dbOrgs[0].stripe_account_id;
org.ein = dbOrgs[0].ein;
org.charify_credit = dbOrgs[0].ein;
})
);
// one time charge
const charge = await stripe.grantCharge({
grant,
stripeToken,
stripeToken,
organizations,
monthly,
amount,