Stripe integration flow

This commit is contained in:
metacryst
2026-03-05 00:29:34 -06:00
parent bdd260c2b5
commit 661bf86a1a
17 changed files with 303 additions and 117 deletions

View File

@@ -28,18 +28,31 @@ export default class AuthHandler {
}
}
getProfile(req, res) {
getRequestEmail(req, res) {
const token = req.cookies?.auth_token;
if (!token) return res.status(401).send({ error: "No auth token" });
try {
const payload = jwt.verify(token, process.env.JWT_SECRET);
const email = payload.email;
return email
} catch (e) {
console.error("Error getting profile: ", e)
throw new Error("Error getting email: invalid auth token")
}
}
getProfile(req, res) {
try {
let email = global.auth.getRequestEmail(req, res)
const user = db.members.getByEmail(email);
let connections = db.MEMBER_IN_NETWORK.getByMember(db.members.prefix + "-" + user.id)
let userOrgs = connections.map((c) => {
return db.networks.get(c.to)
let network = db.networks.get(c.to)
delete network.stripeAccountId
delete network.stripeAccessToken
return network
})
res.send({