fixing charges input into db

This commit is contained in:
Arjun Patel
2019-03-26 02:05:25 -07:00
parent 2c26c7dd2c
commit e97239af79
3 changed files with 124 additions and 123 deletions
+12 -1
View File
@@ -6,6 +6,7 @@ const sendgrid = require("./sendgrid.controller");
const {
Grant,
Charge,
Cause,
Region,
Organization,
@@ -62,7 +63,7 @@ exports.createGrant = async (req, res, next) => {
});
// one time charge
await stripe.grantCharge({
const charge = await stripe.grantCharge({
grant,
stripeToken,
stripeToken,
@@ -72,6 +73,16 @@ exports.createGrant = async (req, res, next) => {
user
});
await Charge.create(
{
id: charge.id,
amount,
description: "One time payment for grant",
grant_id: grant.id
},
{ transaction }
);
// send email
await sendgrid.paymentReceipt({
organizations,