Skip to content

Commit

Permalink
Logging to troubleshoot free trials
Browse files Browse the repository at this point in the history
  • Loading branch information
cynicaloptimist committed Aug 31, 2023
1 parent ae1a3b5 commit 7c0f5ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/patreon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export async function handleCurrentUser(
res: Res,
apiResponse: Record<string, any>
): Promise<void> {
//console.log(`api response: ${JSON.stringify(apiResponse)}`);
let encounterId = "";
if (req.query && req.query.state) {
encounterId = (req.query.state as string).replace(/['"]/g, "");
Expand All @@ -104,6 +103,11 @@ export async function handleCurrentUser(
const userId = apiResponse.data.id;
const standing = getUserAccountLevel(userId, userRewards);
const emailAddress = _.get(apiResponse, "data.attributes.email", "");
console.log(
`User login: ${emailAddress}, API response: ${JSON.stringify(
apiResponse
)}, resolved rewards: ${userRewards}`
);

const session = req.session;

Expand Down Expand Up @@ -256,7 +260,7 @@ async function handleWebhook(req: Req, res: Res) {
entitledTiers.map(tier => tier.id)
);
console.log(
`Updating account level for ${userEmail} to ${userAccountLevel}`
`Webhook: Updating account level for ${userEmail} to ${userAccountLevel}`
);
await DB.upsertUser(userId, userAccountLevel, userEmail);
return res.send(201);
Expand Down

0 comments on commit 7c0f5ad

Please sign in to comment.