Invoice items say what the service is
'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:
@@ -86,6 +86,8 @@ struct Due {
|
||||
buyer_tax_type: String,
|
||||
buyer_tax_number: Option<String>,
|
||||
item_name: String,
|
||||
item_comment: Option<String>,
|
||||
item_unit: String,
|
||||
gross_huf: i32,
|
||||
vat_rate: String,
|
||||
payment_method: String,
|
||||
@@ -128,7 +130,7 @@ pub async fn run_once(db: &PgPool, billingo: &Billingo, max_attempts: i32) -> Re
|
||||
WHERE c.id = i.checkout_id AND i.id = (SELECT id FROM invoices WHERE status = 'pending' \
|
||||
AND next_attempt_at <= now() ORDER BY next_attempt_at FOR UPDATE SKIP LOCKED LIMIT 1) \
|
||||
RETURNING i.id, i.attempts, i.buyer_name, i.buyer_email, i.buyer_country, i.buyer_post_code, \
|
||||
i.buyer_city, i.buyer_address, i.buyer_tax_type, i.buyer_tax_number, i.item_name, i.gross_huf, \
|
||||
i.buyer_city, i.buyer_address, i.buyer_tax_type, i.buyer_tax_number, i.item_name, i.item_comment, i.item_unit, i.gross_huf, \
|
||||
i.vat_rate, i.payment_method, i.billingo_partner_id, i.billingo_document_id, i.sent_at, \
|
||||
coalesce(c.completed_at, i.created_at) AS paid_at"
|
||||
))
|
||||
@@ -240,8 +242,9 @@ async fn issue(db: &PgPool, billingo: &Billingo, due: &Due) -> Result<String, Fa
|
||||
"unit_price": due.gross_huf,
|
||||
"unit_price_type": "gross",
|
||||
"quantity": 1,
|
||||
"unit": "db",
|
||||
"unit": due.item_unit,
|
||||
"vat": due.vat_rate,
|
||||
"comment": due.item_comment.clone().unwrap_or_default(),
|
||||
}],
|
||||
"comment": if due.vat_rate == "AAM" {
|
||||
"Bankkártyával kifizetve (Stripe). Alanyi adómentes."
|
||||
@@ -399,7 +402,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, 6000, 0)",
|
||||
'Asztrológiai elemzéscsomag – Páros', 6000, 6000, 0)",
|
||||
)
|
||||
.bind(id)
|
||||
.bind(&checkout)
|
||||
@@ -449,6 +452,10 @@ mod tests {
|
||||
(&json!(true), &json!("online_bankcard"), &json!("HUF"))
|
||||
);
|
||||
assert_eq!(doc["items"][0]["unit_price"], 6000);
|
||||
assert_eq!(
|
||||
(&doc["items"][0]["name"], &doc["items"][0]["unit"]),
|
||||
(&json!("Asztrológiai elemzéscsomag – Páros"), &json!("csomag"))
|
||||
);
|
||||
assert_eq!(
|
||||
(&doc["items"][0]["unit_price_type"], &doc["items"][0]["vat"]),
|
||||
(&json!("gross"), &json!("AAM"))
|
||||
|
||||
Reference in New Issue
Block a user