Check for undefined on latest_webhook_timestamp

Not all accounts are guaranteed to have this field, so we have to check
if it exists. If it doesn't, just set the value to 0.
This commit is contained in:
Daniel López Guimaraes
2023-08-28 17:58:32 +01:00
parent e0cae4667e
commit 5e49ea8666
2 changed files with 4 additions and 4 deletions

View File

@@ -38,9 +38,9 @@ export async function getUserData(_request: Empty, context: CallContext & Authen
priceId: pnid.connections.stripe.price_id,
tierLevel: pnid.connections.stripe.tier_level,
tierName: pnid.connections.stripe.tier_name,
latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp)
latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp ?? 0)
}
},
marketingFlag: pnid.flags.marketing
};
}
}

View File

@@ -40,9 +40,9 @@ export async function updateUserData(_request: UpdateUserDataRequest, context: C
priceId: pnid.connections.stripe.price_id,
tierLevel: pnid.connections.stripe.tier_level,
tierName: pnid.connections.stripe.tier_name,
latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp)
latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp ?? 0)
}
},
marketingFlag: pnid.flags.marketing
};
}
}