[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:
Kristina
2026-02-20 09:06:43 +00:00
committed by Copybot
parent 00fe0473c5
commit 820adf568e
4 changed files with 327 additions and 151 deletions
@@ -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