mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
[web] add support for migrating paypal subscriptions (#31607)
* support Paypal for migration * remove sensitive payment info in logging * add `resolveStripeCustomer` GitOrigin-RevId: a8fc7de4a4bf3971c5221a0dec3fc279d8d2f67d
This commit is contained in:
@@ -898,6 +898,36 @@ export function getTaxIdType(country, taxIdValue, postalCode) {
|
||||
return countryTaxIdTypes[upperCountry] || null
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove paypal billing agreement id from account for logging purposes
|
||||
*
|
||||
* @param {object} account
|
||||
* @returns {object} sanitized account object
|
||||
*/
|
||||
export function sanitizeAccount(account) {
|
||||
return {
|
||||
...account,
|
||||
billingInfo: sanitizeBillingInfo(account.billingInfo),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove paypal billing agreement id from billing info for logging purposes
|
||||
*
|
||||
* @param {object} billingInfo
|
||||
* @returns {object} sanitized billing info object
|
||||
*/
|
||||
export function sanitizeBillingInfo(billingInfo) {
|
||||
const sanitizedBillingInfo = structuredClone(billingInfo)
|
||||
if (
|
||||
sanitizedBillingInfo?.paymentMethod?.object === 'paypal_billing_agreement'
|
||||
) {
|
||||
sanitizedBillingInfo.paymentMethod.billingAgreementId =
|
||||
'REDACTED_FOR_LOGGING'
|
||||
}
|
||||
return sanitizedBillingInfo
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Stripe.PaymentMethod[]} paymentMethods
|
||||
|
||||
Reference in New Issue
Block a user