Invoices: alanyi adómentes (AAM) by default
CI / test (push) Successful in 1m29s
CI / build (push) Successful in 5m57s
CI / deploy (push) Skipped

INVOICE_VAT picks the VAT of the invoices: AAM (no VAT, net = gross, the
invoice says so) or a rate like 27% once the exemption limit is passed.
The packages page tells which.

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-20 08:03:04 +00:00
co-authored by Claude Opus 5.5
parent 2a0830fda0
commit 4338a35202
14 changed files with 90 additions and 27 deletions
+9 -5
View File
@@ -243,7 +243,11 @@ async fn issue(db: &PgPool, billingo: &Billingo, due: &Due) -> Result<String, Fa
"unit": "db",
"vat": due.vat_rate,
}],
"comment": "Bankkártyával kifizetve (Stripe).",
"comment": if due.vat_rate == "AAM" {
"Bankkártyával kifizetve (Stripe). Alanyi adómentes."
} else {
"Bankkártyával kifizetve (Stripe)."
},
});
let doc = billingo.call(Method::POST, "/documents", Some(&body)).await?;
let id = doc["id"].as_i64().ok_or("Billingo invoice without id")?;
@@ -353,7 +357,7 @@ mod tests {
Json(json!({"id": 900 + n, "invoice_number": format!("SF-2026-{n}"), "invoice_date": "2026-11-20",
"fulfillment_date": body["fulfillment_date"], "due_date": body["due_date"],
"gross_total": 6000.0,
"items": [{"name": "x", "net_amount": 4724.41, "vat_amount": 1275.59, "gross_amount": 6000.0}]})),
"items": [{"name": "x", "net_amount": 6000.0, "vat_amount": 0.0, "gross_amount": 6000.0}]})),
)
}
async fn send(
@@ -395,7 +399,7 @@ mod tests {
"INSERT INTO invoices (id, checkout_id, buyer_name, buyer_email, buyer_country, buyer_post_code, \
buyer_city, buyer_address, buyer_tax_type, buyer_tax_number, item_name, gross_huf, net_huf, vat_huf) \
VALUES ($1, $2, 'Csillag Kft.', 'anna@example.com', 'HU', '6720', 'Szeged', 'Fő utca 1.', $3, $4, \
'Sorsfonalak – Páros', 6000, 4724, 1276)",
'Sorsfonalak – Páros', 6000, 6000, 0)",
)
.bind(id)
.bind(&checkout)
@@ -447,7 +451,7 @@ mod tests {
assert_eq!(doc["items"][0]["unit_price"], 6000);
assert_eq!(
(&doc["items"][0]["unit_price_type"], &doc["items"][0]["vat"]),
(&json!("gross"), &json!("27%"))
(&json!("gross"), &json!("AAM"))
);
// Paid at 00:30 in Budapest.
assert_eq!(doc["fulfillment_date"], "2026-11-21");
@@ -466,7 +470,7 @@ mod tests {
.fetch_one(&db)
.await
.unwrap();
assert_eq!((net, vat, &kept["invoice_number"]), (4724, 1276, &json!("SF-2026-1")));
assert_eq!((net, vat, &kept["invoice_number"]), (6000, 0, &json!("SF-2026-1")));
assert_eq!(run_once(&db, &billingo, 5).await.unwrap(), 0);
}