Invoice items say what the service is
CI / test (push) Successful in 1m32s
CI / build (push) Successful in 5m50s
CI / deploy (push) Skipped

'Sorsfonalak – Páros' does not identify the service, as the VAT act
(169. § e) asks. The item is now e.g. 'Asztrológiai elemzéscsomag –
Páros', unit 'csomag', with the package's contents as its comment.

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:34:08 +00:00
co-authored by Claude Opus 5.5
parent 76bc965537
commit f578e84b3f
7 changed files with 61 additions and 10 deletions
+37
View File
@@ -202,6 +202,29 @@ impl Source {
}
impl Package {
/// The invoice item: a name that says what the service is, and what the
/// package contains (Áfa tv. 169. § e).
pub fn invoice_item(&self) -> (String, String) {
let name = match self.tier {
Tier::Main => format!("Asztrológiai elemzéscsomag – {}", self.name),
Tier::Addon => format!("Asztrológiai kiegészítő – {}", self.name),
};
let lines: Vec<String> = [
(self.natal, "részletes képletelemzés"),
(self.synastry, "kapcsolati elemzés"),
(self.forecast, "éves előrejelzés"),
(self.persons, "személy felvétele"),
(self.questions, "kérdés az elemzésekről"),
]
.into_iter()
.filter(|&(n, _)| n > 0)
.map(|(n, what)| format!("{n} {what}"))
.collect();
let comment =
format!("Tartalma: {}. Online elérhető digitális szolgáltatás (sorsfonalak.hu).", lines.join(", "));
(name, comment)
}
/// What the package gives, unit by unit.
pub fn contents(&self) -> [(Unit, i64); 5] {
[
@@ -341,4 +364,18 @@ mod tests {
assert!(CATALOG.iter().filter(|p| p.tier == Tier::Main).all(|p| p.questions == QUESTIONS_INCLUDED));
assert_eq!(find("addon_questions").unwrap().questions, 5);
}
#[test]
fn invoice_items_say_what_was_bought() {
let (name, comment) = find("couple").unwrap().invoice_item();
assert_eq!(name, "Asztrológiai elemzéscsomag – Páros");
assert!(
comment.starts_with("Tartalma: 2 részletes képletelemzés, 1 kapcsolati elemzés, 2 éves előrejelzés"),
"{comment}"
);
assert!(comment.ends_with("Online elérhető digitális szolgáltatás (sorsfonalak.hu)."));
let (name, comment) = find("addon_persons").unwrap().invoice_item();
assert_eq!(name, "Asztrológiai kiegészítő – +5 személy");
assert!(comment.starts_with("Tartalma: 5 személy felvétele."), "{comment}");
}
}