New prices: a forecast in the single package, cheaper Páros, Család and add-ons

- Egy elemzés: 2 000 Ft, now with a yearly forecast.
- Páros 5 000 Ft, Család 7 000 Ft, +1 kapcsolati and +1 előrejelzés 1 500 Ft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-24 18:17:38 +00:00
co-authored by Claude Opus 5.5
parent 5feaa6836c
commit e6aacd0baa
4 changed files with 32 additions and 33 deletions
+11 -14
View File
@@ -15,9 +15,8 @@ use crate::error::ApiError;
/// List prices of the single items, for showing what a package saves.
const NATAL_PRICE: i64 = 2_000;
const SYNASTRY_PRICE: i64 = 2_500;
/// A yearly forecast bought alone costs more than one in a package.
const FORECAST_PRICE: i64 = 2_500;
const SYNASTRY_PRICE: i64 = 1_500;
const FORECAST_PRICE: i64 = 1_500;
const PERSON_PRICE: i64 = 300; // 1 500 Ft for five
/// Questions every package of the main ladder comes with (not counted in the
/// "bought one by one" price: they are a bonus).
@@ -55,12 +54,12 @@ pub const CATALOG: [Package; 8] = [
Package {
id: "single",
name: "Egy elemzés",
tagline: "Egy részletes képletelemzés: neked vagy egy felvett személynek.",
tagline: "Egy részletes képletelemzés és egy éves előrejelzés: neked vagy egy felvett személynek.",
tier: Tier::Main,
price_huf: 2_000,
natal: 1,
synastry: 0,
forecast: 0,
forecast: 1,
persons: 0,
questions: QUESTIONS_INCLUDED,
tarot: 2,
@@ -71,7 +70,7 @@ pub const CATALOG: [Package; 8] = [
name: "Páros",
tagline: "Te és ő: mindkettőtök képlete, éves előrejelzése és a kapcsolati elemzés.",
tier: Tier::Main,
price_huf: 6_000,
price_huf: 5_000,
natal: 2,
synastry: 1,
forecast: 2,
@@ -85,7 +84,7 @@ pub const CATALOG: [Package; 8] = [
name: "Család",
tagline: "Az egész család: öt személy, mindenki képlete és éves előrejelzése, és öt kapcsolat.",
tier: Tier::Main,
price_huf: 11_000,
price_huf: 7_000,
natal: 6,
synastry: 5,
forecast: 6,
@@ -99,7 +98,7 @@ pub const CATALOG: [Package; 8] = [
name: "+1 kapcsolati elemzés",
tagline: "Egy újabb összevetés részletes elemzése.",
tier: Tier::Addon,
price_huf: 2_500,
price_huf: SYNASTRY_PRICE,
natal: 0,
synastry: 1,
forecast: 0,
@@ -416,12 +415,10 @@ mod tests {
#[test]
fn bigger_packages_are_cheaper_per_analysis() {
let per = |id: &str| find(id).unwrap().view()["per_analysis_huf"].as_i64().unwrap();
assert!(per("single") > per("couple") && per("couple") > per("family"));
assert_eq!(find("family").unwrap().view()["savings_percent"], 73);
assert_eq!(find("couple").unwrap().view()["savings_percent"], 49);
// Alone a forecast costs more than a natal analysis.
assert!(find("addon_forecast").unwrap().price_huf > find("single").unwrap().price_huf);
assert!(find("single").unwrap().view()["savings_percent"].is_null());
assert!(per("single") >= per("couple") && per("couple") > per("family"));
assert_eq!(find("family").unwrap().view()["savings_percent"], 77);
assert_eq!(find("couple").unwrap().view()["savings_percent"], 43);
assert_eq!(find("single").unwrap().view()["savings_percent"], 43);
assert!(find("unlimited").is_none());
assert!(CATALOG.iter().all(|p| find(p.id).is_some()));
// Every package of the ladder comes with questions; more can be bought.
+7 -7
View File
@@ -1350,7 +1350,7 @@ async fn admins_use_units_too_and_mock_payments_add_units(pool: PgPool) {
let r = app.post("/v1/payments/mock", Some(&anna), json!({"unit": "natal"})).await;
assert_eq!(
(r.status, &r.body["analyses_left"]),
(StatusCode::OK, &json!({"natal": 1, "synastry": 0, "forecast": 0, "question": 3, "tarot": 2})),
(StatusCode::OK, &json!({"natal": 1, "synastry": 0, "forecast": 1, "question": 3, "tarot": 2})),
"{}",
r.body
);
@@ -1359,7 +1359,7 @@ async fn admins_use_units_too_and_mock_payments_add_units(pool: PgPool) {
assert_eq!((r.status, &r.body["credits_charged"]), (StatusCode::ACCEPTED, &json!(1)), "{}", r.body);
assert_eq!(
app.get("/v1/credits", Some(&anna)).await.body["balance"],
json!({"natal": 0, "synastry": 0, "forecast": 0, "question": 3, "tarot": 2})
json!({"natal": 0, "synastry": 0, "forecast": 1, "question": 3, "tarot": 2})
);
// without MOCK_PAYMENTS there is no such payment
@@ -1663,7 +1663,7 @@ async fn packages_grant_units(pool: PgPool) {
);
assert_eq!(
(&r.body["packages"][2]["badge"], &r.body["packages"][2]["per_analysis_huf"]),
(&json!("Legnépszerűbb"), &json!(647))
(&json!("Legnépszerűbb"), &json!(412))
);
// an admin gives a package as a gift
@@ -1703,7 +1703,7 @@ async fn packages_grant_units(pool: PgPool) {
);
let (price,): (i32,) =
sqlx::query_as("SELECT price_huf FROM package_orders WHERE package = 'couple'").fetch_one(&pool).await.unwrap();
assert_eq!(price, 6000);
assert_eq!(price, 5000);
// the header shows the latest main package; a top-up does not change it
app.post("/v1/payments/mock", Some(&anna), json!({"package": "addon_persons"})).await;
assert_eq!(app.get("/v1/me", Some(&anna)).await.body["package"]["name"], "Páros");
@@ -2632,7 +2632,7 @@ async fn stripe_checkout_grants_the_paid_package_once(pool: PgPool) {
let url = r.body["url"].as_str().unwrap();
let id = url.rsplit('/').next().unwrap().to_string();
assert_eq!(stripe_form(&id, "line_items[0][price_data][currency]").as_deref(), Some("huf"));
assert_eq!(stripe_form(&id, "line_items[0][price_data][unit_amount]").as_deref(), Some("600000"));
assert_eq!(stripe_form(&id, "line_items[0][price_data][unit_amount]").as_deref(), Some("500000"));
assert_eq!(
stripe_form(&id, "line_items[0][price_data][product_data][name]").as_deref(),
Some("Sorsfonalak – Páros")
@@ -2694,7 +2694,7 @@ async fn stripe_checkout_grants_the_paid_package_once(pool: PgPool) {
.await;
assert_eq!(r.status, StatusCode::OK, "{}", r.body);
}
assert_eq!(stripe_orders(&app.pool, "anna@example.com").await, vec![("couple".to_string(), 6000)]);
assert_eq!(stripe_orders(&app.pool, "anna@example.com").await, vec![("couple".to_string(), 5000)]);
// What the invoice needs is kept, and the invoice is queued.
let (intent, amount, customer, terms): (String, i32, Value, Option<String>) = sqlx::query_as(
"SELECT payment_intent, amount_huf, customer, terms_version FROM stripe_checkouts \
@@ -2809,7 +2809,7 @@ async fn stripe_checkout_grants_the_paid_package_once(pool: PgPool) {
assert_eq!(r.body["status"], "paid");
assert_eq!(
stripe_orders(&app.pool, "anna@example.com").await,
vec![("couple".to_string(), 6000), ("single".to_string(), 2000)]
vec![("couple".to_string(), 5000), ("single".to_string(), 2000)]
);
let (name, tax_type): (String, String) =
sqlx::query_as("SELECT buyer_name, buyer_tax_type FROM invoices WHERE checkout_id = $1")