[web] add scripts for updating Stripe prices (#29858)

* update generate recurly prices script to skip stripe-only prices
* add script for creating new Stripe prices from a CSV
* add script to archive Stripe prices by version key
* add script for exporting Stripe products and prices
* add script to import Stripe products

GitOrigin-RevId: 3c9cf8037d956b9532c3efed5fe8d63f8be53a93
This commit is contained in:
Kristina
2025-11-27 09:05:35 +00:00
committed by Copybot
parent d748d8d606
commit 731bf1d8b6
6 changed files with 1257 additions and 2 deletions
@@ -78,6 +78,16 @@ function computeAddOnPrices(prices, size) {
})
}
function shouldSkipPlan(record) {
const planCode = record.plan_code
// Skip non-legacy group plan codes (e.g. group_professional_20_enterprise)
if (planCode.startsWith('group_') && !GROUP_SIZE_REGEX.test(planCode)) {
return true
}
return false
}
// Convert the raw records into the output format
function transformRecordToPlan(record) {
@@ -104,8 +114,12 @@ function transformRecordToPlan(record) {
function generate(inputFile, outputFile) {
const input = fs.readFileSync(inputFile, 'utf8')
const rawRecords = csv.parse(input, { columns: true })
// filter out plans that should be skipped
const filteredRecords = rawRecords.filter(record => !shouldSkipPlan(record))
// transform the raw records into the output format
const plans = _.sortBy(rawRecords, 'plan_code').map(transformRecordToPlan)
const plans = _.sortBy(filteredRecords, 'plan_code').map(
transformRecordToPlan
)
const output = JSON.stringify(plans, null, 2)
fs.writeFileSync(outputFile, output)
}