fixing charges input into db
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user