[migration] fix issues found in finalization script during stage 3b (#32472)

* accept taxInfoPending as tax id comparison point
* convert recurly unit amount to minor units correctly for no cent currencies
* Use original subscription currency in finalization check
* make it easier to spot migrated with tax info pending

---------

Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GitOrigin-RevId: d3c74032bc06369fcf6bafb4cfaff85c49a3cfef
This commit is contained in:
Kristina
2026-03-30 08:05:28 +00:00
committed by Copybot
co-authored by John Lees-Miller Copilot
parent 251ccbf1ad
commit ad853d661a
2 changed files with 23 additions and 9 deletions
@@ -1459,13 +1459,8 @@ export async function compareAccountFields({
if (taxIdTypeResult.type && address?.country) {
expectedTaxIdType = taxIdTypeResult.type
expectedTaxIdValue = vatNumber
} else {
expectedMetadata.taxInfoPending = vatNumber
}
}
if (!expectedMetadata.taxInfoPending) {
expectedMetadata.taxInfoPending = ''
}
for (const [key, expectedValue] of Object.entries(expectedMetadata)) {
const stripeValue = stripeCustomer.metadata?.[key] ?? ''
@@ -1504,7 +1499,19 @@ export async function compareAccountFields({
// Tax ID
if (expectedTaxIdType && expectedTaxIdValue) {
const normalizedExpectedTaxIdValue = normalizeTaxIdValue(expectedTaxIdValue)
const stripeTaxIds = stripeCustomer.tax_ids?.data || []
const stripePendingTaxId = stripeCustomer.metadata?.taxInfoPending
? [
{
type: expectedTaxIdType,
value: stripeCustomer.metadata.taxInfoPending,
},
]
: null
const stripeTaxIdsFromStripe = stripeCustomer.tax_ids?.data
const stripeTaxIds =
Array.isArray(stripeTaxIdsFromStripe) && stripeTaxIdsFromStripe.length > 0
? stripeTaxIdsFromStripe
: stripePendingTaxId || []
const matchingTaxId = stripeTaxIds.find(
tid =>
tid.type === expectedTaxIdType &&