164 lines
4.7 KiB
JavaScript
164 lines
4.7 KiB
JavaScript
// MongoDB Seed Script for Plans Collection
|
||
// Run this script with: mongosh "mongodb://admin:c4rn31r0@129.146.116.218:27017,141.148.162.114:27017/QrRapido?replicaSet=rs0&authSource=admin" seed-mongodb-plans.js
|
||
|
||
// Ensure we're using the correct database
|
||
db = db.getSiblingDB('QrRapido');
|
||
|
||
// Clear existing plans (optional - comment out if you want to keep existing plans)
|
||
// db.Plans.deleteMany({});
|
||
|
||
print("\n📦 Seeding Plans Collection...\n");
|
||
|
||
// 1. PLANO MENSAL
|
||
db.Plans.insertOne({
|
||
name: {
|
||
"pt-BR": "Premium Mensal",
|
||
"es-PY": "Premium Mensual",
|
||
"en": "Premium Monthly"
|
||
},
|
||
description: {
|
||
"pt-BR": "Acesso ilimitado a todos os recursos premium - Cobrança mensal",
|
||
"es-PY": "Acceso ilimitado a todas las funciones premium - Facturación mensual",
|
||
"en": "Unlimited access to all premium features - Monthly billing"
|
||
},
|
||
features: {
|
||
"pt-BR": [
|
||
"QR Codes ilimitados",
|
||
"Sem anúncios",
|
||
"QR Codes dinâmicos (editáveis)",
|
||
"Estatísticas avançadas",
|
||
"Suporte prioritário",
|
||
"Acesso à API",
|
||
"Cancele a qualquer momento"
|
||
],
|
||
"es-PY": [
|
||
"Códigos QR ilimitados",
|
||
"Sin anuncios",
|
||
"Códigos QR dinámicos (editables)",
|
||
"Estadísticas avanzadas",
|
||
"Soporte prioritario",
|
||
"Acceso a la API",
|
||
"Cancela cuando quieras"
|
||
],
|
||
"en": [
|
||
"Unlimited QR Codes",
|
||
"No ads",
|
||
"Dynamic QR Codes (editable)",
|
||
"Advanced analytics",
|
||
"Priority support",
|
||
"API access",
|
||
"Cancel anytime"
|
||
]
|
||
},
|
||
interval: "month",
|
||
stripePriceId: "price_1SJwebB6bFjHQirAloEqXWd6", // Default price (BR)
|
||
pricesByCountry: {
|
||
"BR": {
|
||
amount: 9.90,
|
||
currency: "BRL",
|
||
stripePriceId: "price_1SJwebB6bFjHQirAloEqXWd6"
|
||
},
|
||
"PY": {
|
||
amount: 35000,
|
||
currency: "PYG",
|
||
stripePriceId: "price_1SK4Y0B6bFjHQirAaxNHxILi"
|
||
},
|
||
"US": {
|
||
amount: 1.99,
|
||
currency: "USD",
|
||
stripePriceId: "price_XXXXX_monthly_us" // TODO: Update with real Stripe Price ID
|
||
}
|
||
},
|
||
isActive: true,
|
||
displayOrder: 1
|
||
});
|
||
|
||
print("✅ Plano Mensal inserido");
|
||
|
||
// 2. PLANO ANUAL (com desconto)
|
||
db.Plans.insertOne({
|
||
name: {
|
||
"pt-BR": "Premium Anual",
|
||
"es-PY": "Premium Anual",
|
||
"en": "Premium Yearly"
|
||
},
|
||
description: {
|
||
"pt-BR": "Acesso ilimitado a todos os recursos premium - Economia de 20% no plano anual!",
|
||
"es-PY": "Acceso ilimitado a todas las funciones premium - ¡Ahorra 20% con el plan anual!",
|
||
"en": "Unlimited access to all premium features - Save 20% with yearly billing!"
|
||
},
|
||
features: {
|
||
"pt-BR": [
|
||
"QR Codes ilimitados",
|
||
"Sem anúncios",
|
||
"QR Codes dinâmicos (editáveis)",
|
||
"Estatísticas avançadas",
|
||
"Suporte prioritário",
|
||
"Acesso à API",
|
||
"💰 Economia de 20%",
|
||
"Cobrança anual única"
|
||
],
|
||
"es-PY": [
|
||
"Códigos QR ilimitados",
|
||
"Sin anuncios",
|
||
"Códigos QR dinámicos (editables)",
|
||
"Estadísticas avanzadas",
|
||
"Soporte prioritario",
|
||
"Acceso a la API",
|
||
"💰 Ahorro del 20%",
|
||
"Facturación anual única"
|
||
],
|
||
"en": [
|
||
"Unlimited QR Codes",
|
||
"No ads",
|
||
"Dynamic QR Codes (editable)",
|
||
"Advanced analytics",
|
||
"Priority support",
|
||
"API access",
|
||
"💰 Save 20%",
|
||
"Billed annually"
|
||
]
|
||
},
|
||
interval: "year",
|
||
stripePriceId: "price_1SK4X7B6bFjHQirAdMtviPw4", // Default price (BR)
|
||
pricesByCountry: {
|
||
"BR": {
|
||
amount: 95.04, // 9.90 * 12 * 0.80 = Economia de 20%
|
||
currency: "BRL",
|
||
stripePriceId: "price_1SK4X7B6bFjHQirAdMtviPw4"
|
||
},
|
||
"PY": {
|
||
amount: 336000, // 35000 * 12 * 0.80 = Economia de 20%
|
||
currency: "PYG",
|
||
stripePriceId: "price_1SK4Y0B6bFjHQirAaxNHxILi"
|
||
},
|
||
"US": {
|
||
amount: 19.10, // 1.99 * 12 * 0.80 = Economia de 20%
|
||
currency: "USD",
|
||
stripePriceId: "price_XXXXX_yearly_us" // TODO: Update with real Stripe Price ID
|
||
}
|
||
},
|
||
isActive: true,
|
||
displayOrder: 2,
|
||
badge: {
|
||
"pt-BR": "MELHOR VALOR",
|
||
"es-PY": "MEJOR VALOR",
|
||
"en": "BEST VALUE"
|
||
}
|
||
});
|
||
|
||
print("✅ Plano Anual inserido");
|
||
|
||
print("\n✅ Plans collection seeded successfully!");
|
||
print("\n⚠️ PRÓXIMOS PASSOS:");
|
||
print("1. Acesse o Stripe Dashboard: https://dashboard.stripe.com/prices");
|
||
print("2. Crie os Price IDs para cada país e plano (mensal e anual)");
|
||
print("3. Copie os Price IDs (começam com 'price_')");
|
||
print("4. Atualize os valores no appsettings.json > Stripe:Plans");
|
||
print("5. Execute este script novamente após atualizar os Price IDs acima");
|
||
print("\n📊 Verificar planos inseridos:");
|
||
print(" db.Plans.find().pretty()");
|
||
print("\n🗑️ Para limpar e começar de novo:");
|
||
print(" db.Plans.deleteMany({})");
|
||
print("");
|