Subscriptions
This commit is contained in:
@@ -57,7 +57,8 @@ DB.getDB.then((DB) => {
|
||||
paymentIntent,
|
||||
userid,
|
||||
price,
|
||||
description
|
||||
description,
|
||||
client_secret: paymentIntent.client_secret,
|
||||
};
|
||||
DB.newIntent(intent);
|
||||
|
||||
@@ -81,7 +82,16 @@ DB.getDB.then((DB) => {
|
||||
result,
|
||||
userid
|
||||
};
|
||||
DB.newResult(payment);
|
||||
//console.log(payment);
|
||||
const intent = await DB.getIntent(result.client_secret);
|
||||
if(intent.description === "Subscription 1 Month"){
|
||||
//update profile subscription status
|
||||
const profileid = getProfileId(req);
|
||||
const isSubscriptor = await DB.isSubscriptor(profileid);
|
||||
const updateR = await DB.updateProfileSubscription(profileid, !isSubscriptor);
|
||||
console.log(updateR);
|
||||
}
|
||||
await DB.newResult(payment, result.client_secret);
|
||||
|
||||
return res.send({
|
||||
status: 'ok'
|
||||
|
||||
Reference in New Issue
Block a user