Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,45 +1,42 @@
|
||||
const path = require("path");
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
`.env.${process.env.NODE_ENV || "development"}`
|
||||
),
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
|
||||
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
|
||||
|
||||
const processor = async (req, res) => {
|
||||
const {amount, stripe_acct_id} = req.body;
|
||||
const { amount, stripe_acct_id } = req.body;
|
||||
|
||||
try {
|
||||
await stripe.paymentIntents
|
||||
.create(
|
||||
{
|
||||
payment_method_types: ["card"],
|
||||
amount: amount,
|
||||
currency: "cad",
|
||||
application_fee_amount: 50,
|
||||
},
|
||||
{
|
||||
stripeAccount: stripe_acct_id,
|
||||
}
|
||||
)
|
||||
.then(function (paymentIntent) {
|
||||
try {
|
||||
return res.send({
|
||||
clientSecret: paymentIntent.client_secret,
|
||||
});
|
||||
} catch (err) {
|
||||
return res.status(500).send({
|
||||
error: err.message,
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
res.status(400).send(error);
|
||||
}
|
||||
try {
|
||||
await stripe.paymentIntents
|
||||
.create(
|
||||
{
|
||||
payment_method_types: ["card"],
|
||||
amount: amount,
|
||||
currency: "cad",
|
||||
application_fee_amount: 50
|
||||
},
|
||||
{
|
||||
stripeAccount: stripe_acct_id
|
||||
}
|
||||
)
|
||||
.then(function (paymentIntent) {
|
||||
try {
|
||||
return res.send({
|
||||
clientSecret: paymentIntent.client_secret
|
||||
});
|
||||
} catch (err) {
|
||||
return res.status(500).send({
|
||||
error: err.message
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("error", error);
|
||||
res.status(400).send(error);
|
||||
}
|
||||
};
|
||||
|
||||
exports.payment = processor;
|
||||
|
||||
Reference in New Issue
Block a user