Class: Ksef::FA3::CorrectedInvoice
- Inherits:
-
Data
- Object
- Data
- Ksef::FA3::CorrectedInvoice
- Includes:
- Canonical
- Defined in:
- lib/ksef/fa3/corrected_invoice.rb
Overview
One invoice a correction corrects (DaneFaKorygowanej).
A KOR names at least one and may name up to 50 000 — art. 106j ust. 3 lets a
single correction carry a discount granted across a whole period, and the Ministry's
Przykład 6 does exactly that over six invoices with an OkresFaKorygowanej naming the
half-year (docs/REFERENCE.md §8.4).
ksef_number is nil-able, and the nil is the point
The schema puts a choice here: either NrKSeF + NrKSeFFaKorygowanej, or
NrKSeFN on its own — "znacznik faktury korygowanej wystawionej poza KSeF", the
marker for an invoice issued outside the system. Both branches are single-valued
markers, so the whole choice is decided by whether a number is known. Modelling it as
one nil-able field makes emitting both branches, or neither, unrepresentable rather
than merely discouraged.
Instance Attribute Summary collapse
-
#issue_date ⇒ Object
readonly
Returns the value of attribute issue_date.
-
#ksef_number ⇒ Object
readonly
Returns the value of attribute ksef_number.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
-
#initialize(number:, issue_date:, ksef_number: nil) ⇒ CorrectedInvoice
constructor
A new instance of CorrectedInvoice.
- #to_fa3 ⇒ Object
Methods included from Canonical
Constructor Details
#initialize(number:, issue_date:, ksef_number: nil) ⇒ CorrectedInvoice
Returns a new instance of CorrectedInvoice.
28 29 30 31 32 33 |
# File 'lib/ksef/fa3/corrected_invoice.rb', line 28 def initialize(number:, issue_date:, ksef_number: nil) # Coerced here rather than at serialisation, so an invoice built from a String and # the same invoice parsed back from XML are one object (§8.2b). super(number: Formatting.text(number), issue_date: Formatting.to_date(issue_date), ksef_number: Formatting.text(ksef_number)) end |
Instance Attribute Details
#issue_date ⇒ Object (readonly)
Returns the value of attribute issue_date
20 21 22 |
# File 'lib/ksef/fa3/corrected_invoice.rb', line 20 def issue_date @issue_date end |
#ksef_number ⇒ Object (readonly)
Returns the value of attribute ksef_number
20 21 22 |
# File 'lib/ksef/fa3/corrected_invoice.rb', line 20 def ksef_number @ksef_number end |
#number ⇒ Object (readonly)
Returns the value of attribute number
20 21 22 |
# File 'lib/ksef/fa3/corrected_invoice.rb', line 20 def number @number end |
Instance Method Details
#to_fa3 ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ksef/fa3/corrected_invoice.rb', line 35 def to_fa3 { "DataWystFaKorygowanej" => Formatting.date(issue_date), "NrFaKorygowanej" => number }.merge(reference) end |