[web] Add audit log entry for billing-details-updated

GitOrigin-RevId: dd0079e4043d3a6ee64bd511b242d7f5649036ca
This commit is contained in:
Simon Gardner
2025-11-27 10:17:41 +00:00
committed by Copybot
parent e89a5da7de
commit 43c263b419
3 changed files with 44 additions and 0 deletions

View File

@@ -15,6 +15,20 @@ const JSON_ESCAPE = {
'\u2029': '\\u2029',
}
/**
* Converts a snake_case string into a user friendly string with each word capitalized.
* @param {string} snakecaseStr
* @returns {string}
*/
export function wordifySnakecase(snakecaseStr) {
return snakecaseStr
.split('_')
.map(word => {
return word.charAt(0).toUpperCase() + word.slice(1)
})
.join(' ')
}
export default StringHelper = {
// stringifies and escapes a json object for use in a script. This ensures that &, < and > characters are escaped,
// along with quotes. This ensures that the string can be safely rendered into HTML. See rationale at:

View File

@@ -106,6 +106,20 @@ const SubscriptionLocator = {
)
},
async getUniqueManagedSubscriptionUserAssociation(userId) {
return await Subscription.findOne(
{
managedUsersEnabled: true,
$or: [
{ member_ids: userId },
{ manager_ids: userId },
{ admin_id: userId },
],
},
{ _id: 1 }
)
},
async getGroupsWithEmailInvite(email) {
return await Subscription.find({ invited_emails: email }).exec()
},

View File

@@ -114,6 +114,21 @@ export interface CustomerCreatedWebhookEvent extends Stripe.EventBase {
}
}
export interface CustomerUpdatedWebhookEvent extends Stripe.EventBase {
type: 'customer.updated'
data: {
object: Stripe.Customer
previous_attributes?: {
invoice_settings?: {
default_payment_method?: string
}
address?: Stripe.Address
name?: string
email?: string
}
}
}
export type CustomerSubscriptionWebhookEvent =
| CustomerSubscriptionUpdatedWebhookEvent
| CustomerSubscriptionCreatedWebhookEvent
@@ -127,3 +142,4 @@ export type WebhookEvent =
| SetupIntentSetupFailedWebhookEvent
| InvoiceOverdueWebhookEvent
| CustomerCreatedWebhookEvent
| CustomerUpdatedWebhookEvent