Preskoči na sadržaj

E8-F4: Obračuni (Deferred Payment Billing)

Epic: E8: Payment Processing

Size: M (Medium)

Problem / Outcome

Petrol and deferred-payment quota owners take seats and pay HNS later. An Obračun (OBR-…) records what each quota owes (ADR 0039 in the ticketing repository). One debtor, such as a player who asks for quotas for family, friends and a company on several matches of a year, is billed once for all of them: his Obračuni go on one Ponuda dužnika (PD-…), which HNS's accounting bills and which is marked paid when the money arrives (ADR 0052, HNSTIK-440).

Scope

In-Scope:

  • One Obračun per Petrol quota, for its allocation (every seat it holds, sold or not), and one per priced, deferred, top-level quota, for the tickets claimed from it and its sub-quotas
  • Kept in step with its quota; a cancelled quota or a cancelled match owes nothing
  • A quota's Dužnik: free text naming who HNS bills for it, set on the quota form, the quota's page and the import; HNS's own label, which no claimer sees
  • Admin portal Naplata ▸ Obračuni, grouped by Dužnik across matches with each group's sum; the admin selects Obračuni of matches that have kicked off and makes a Ponuda dužnika
  • Naplata ▸ Ponude dužnika: who pays (name, OIB, address), the due date, a specification PDF for accounting, "Izdano" with the accounting document's number, paid, storno; overdue (Dospjelo) past its due date
  • The quota portal names who is billed for a deferred quota's claims (the quota's Napomena), and by when

Out-of-Scope:

  • Issuing the document through e-Računi (HNSTIK-419, waiting for HNS)
  • Paying a Ponuda dužnika by card (HNSTIK-457)
  • E-mailing the Ponuda: accounting sends its own document
  • Automatic payment matching and payment reminders

Acceptance Criteria

  • AC1: A Petrol quota opens a draft Obračun for its allocation; a deferred quota one for the tickets claimed from it
  • AC2: An Obračun is billed only on a Ponuda dužnika; issued with the accounting document's number, its Obračuni are sent, and paid, they are paid; a later change shows as a difference
  • AC3: A cancelled quota's draft Obračun is cancelled; a cancelled match owes nothing
  • AC4: Two deferred quotas on two matches with one Dužnik, however spelt, show in one group with their sum; one Ponuda of both lists each quota by its Napomena with its match, tickets and price
  • AC5: An Obračun on a live Ponuda goes on no other; after a storno it can, with Obračuni of later matches

Data Model Impact

bills replaces payment_offers and debtors: see data-model.md#bills. Ponude dužnika are bill_offers and their items; a quota's Dužnik is quotas.debtor.

Permissions/Roles

  • Match manager: Naplata ▸ Obračuni and Ponude dužnika (the reports role reads the totals in Naplata ▸ Pregled)

How to Verify

make backend-test ARGS="tests/E8/F4/" in the ticketing repository (BillTest, BillOfferTest).

Dependencies

Implementation Tasks

See E8: Payment Processing Tasks

Doc References


Last Updated: January 2026