mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[web] Add audit log entry for billing-details-updated
GitOrigin-RevId: dd0079e4043d3a6ee64bd511b242d7f5649036ca
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user