cleaning
This commit is contained in:
@@ -9,6 +9,7 @@ const { Donor, Charge, PaymentPlan } = db;
|
|||||||
exports.grantCharge = async (req, res, next) => {
|
exports.grantCharge = async (req, res, next) => {
|
||||||
const { stripeToken, grant_id, amount, monthly } = req.body;
|
const { stripeToken, grant_id, amount, monthly } = req.body;
|
||||||
const user = req.user;
|
const user = req.user;
|
||||||
|
const product_id = 'prod_ER3jOog6QMX1GP';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const donors = await Donor.findAll({ where: { id: user.id } });
|
const donors = await Donor.findAll({ where: { id: user.id } });
|
||||||
@@ -26,6 +27,7 @@ exports.grantCharge = async (req, res, next) => {
|
|||||||
|
|
||||||
await Donor.update({ stripe_id }, { where: { id: user.id } });
|
await Donor.update({ stripe_id }, { where: { id: user.id } });
|
||||||
}
|
}
|
||||||
|
// TODO: if there is, then update with the given source
|
||||||
|
|
||||||
var result;
|
var result;
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ exports.grantCharge = async (req, res, next) => {
|
|||||||
const plan = await stripe.plans.create({
|
const plan = await stripe.plans.create({
|
||||||
id: grant_id,
|
id: grant_id,
|
||||||
nickname: `Grant for grant: ${grant_id}`,
|
nickname: `Grant for grant: ${grant_id}`,
|
||||||
product: 'prod_ER3jOog6QMX1GP',
|
product: product_id,
|
||||||
currency: 'usd',
|
currency: 'usd',
|
||||||
interval: 'month',
|
interval: 'month',
|
||||||
amount
|
amount
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ module.exports = (sequelize, DataTypes) => {
|
|||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false
|
||||||
unique: true
|
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
type: DataTypes.INTEGER,
|
type: DataTypes.INTEGER,
|
||||||
|
|||||||
Reference in New Issue
Block a user