Progress
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
"soap": "^1.0.0",
|
"soap": "^1.0.0",
|
||||||
"socket.io": "^4.7.2",
|
"socket.io": "^4.7.2",
|
||||||
"ssh2-sftp-client": "^9.1.0",
|
"ssh2-sftp-client": "^9.1.0",
|
||||||
"stripe": "^9.15.0",
|
"stripe": "^14.5.0",
|
||||||
"twilio": "^4.19.0",
|
"twilio": "^4.19.0",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"xml2js": "^0.6.2",
|
"xml2js": "^0.6.2",
|
||||||
|
|||||||
@@ -1,79 +1,46 @@
|
|||||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const queries = require("../graphql-client/queries");
|
|
||||||
const Dinero = require("dinero.js");
|
|
||||||
|
|
||||||
require("dotenv").config({
|
require("dotenv").config({
|
||||||
path: path.resolve(
|
path: path.resolve(
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
`.env.${process.env.NODE_ENV || "development"}`
|
`.env.${process.env.NODE_ENV || "development"}`
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
|
|
||||||
|
|
||||||
exports.payment = async (req, res) => {
|
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
|
||||||
const { amount, stripe_acct_id } = req.body;
|
|
||||||
|
|
||||||
try {
|
const processor = async (req, res) => {
|
||||||
await stripe.paymentIntents
|
const {amount, stripe_acct_id} = req.body;
|
||||||
.create(
|
|
||||||
{
|
try {
|
||||||
payment_method_types: ["card"],
|
await stripe.paymentIntents
|
||||||
amount: amount,
|
.create(
|
||||||
currency: "cad",
|
{
|
||||||
application_fee_amount: 50,
|
payment_method_types: ["card"],
|
||||||
},
|
amount: amount,
|
||||||
{
|
currency: "cad",
|
||||||
stripeAccount: stripe_acct_id,
|
application_fee_amount: 50,
|
||||||
}
|
},
|
||||||
)
|
{
|
||||||
.then(function (paymentIntent) {
|
stripeAccount: stripe_acct_id,
|
||||||
try {
|
}
|
||||||
return res.send({
|
)
|
||||||
clientSecret: paymentIntent.client_secret,
|
.then(function (paymentIntent) {
|
||||||
});
|
try {
|
||||||
} catch (err) {
|
return res.send({
|
||||||
return res.status(500).send({
|
clientSecret: paymentIntent.client_secret,
|
||||||
error: err.message,
|
});
|
||||||
});
|
} catch (err) {
|
||||||
}
|
return res.status(500).send({
|
||||||
});
|
error: err.message,
|
||||||
} catch (error) {
|
});
|
||||||
console.log("error", error);
|
}
|
||||||
res.status(400).send(error);
|
});
|
||||||
}
|
} catch (error) {
|
||||||
|
console.log("error", error);
|
||||||
|
res.status(400).send(error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.mobile_payment = async (req, res) => {
|
exports.payment = processor;
|
||||||
const { amount, stripe_acct_id } = req.body;
|
exports.mobile_payment = processor;
|
||||||
|
|
||||||
try {
|
|
||||||
await stripe.paymentIntents
|
|
||||||
.create(
|
|
||||||
{
|
|
||||||
//Pull the amounts from the payment request.
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
12
yarn.lock
12
yarn.lock
@@ -3850,7 +3850,7 @@ qs@6.11.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
side-channel "^1.0.4"
|
side-channel "^1.0.4"
|
||||||
|
|
||||||
qs@^6.10.3, qs@^6.11.0, qs@^6.9.4:
|
qs@^6.11.0, qs@^6.9.4:
|
||||||
version "6.11.2"
|
version "6.11.2"
|
||||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9"
|
resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9"
|
||||||
integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==
|
integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==
|
||||||
@@ -4415,13 +4415,13 @@ strip-json-comments@^3.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
|
||||||
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
|
||||||
|
|
||||||
stripe@^9.15.0:
|
stripe@^14.5.0:
|
||||||
version "9.16.0"
|
version "14.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/stripe/-/stripe-9.16.0.tgz#94c24549c91fced457b9e3259e8a1a1bdb6dbd0e"
|
resolved "https://registry.yarnpkg.com/stripe/-/stripe-14.5.0.tgz#97491ec04271abdcb3d5c0591a3035b338647d6f"
|
||||||
integrity sha512-Dn8K+jSoQcXjxCobRI4HXUdHjOXsiF/KszK49fJnkbeCFjZ3EZxLG2JiM/CX+Hcq27NBDtv/Sxhvy+HhTmvyaQ==
|
integrity sha512-MTt0P0VYDAj2VZyZMW41AxcXVs9s06EDFIHYat4UUkluJgnBHo4T4E2byPhnxoJCPvdzWBwBLnhWbSOg//VTpA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" ">=8.1.0"
|
"@types/node" ">=8.1.0"
|
||||||
qs "^6.10.3"
|
qs "^6.11.0"
|
||||||
|
|
||||||
strnum@^1.0.5:
|
strnum@^1.0.5:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user