Module: Ksef::FA3::Builder::Corrections

Included in:
Ksef::FA3::Builder
Defined in:
lib/ksef/fa3/builder/corrections.rb

Overview

The DSL calls that make an invoice a correction, and the assembly behind them.

Split out of Ksef::FA3::Builder for length, and along the same seam the validator splits: a correction is a self-contained subject with its own value objects (docs/REFERENCE.md §8.4). Mixed into Ksef::FA3::Builder, so @correction and @corrected are its state.

Instance Method Summary collapse

Instance Method Details

#correction(**attributes) ⇒ Object

Makes this a correction. Optional next to #corrects, which is what a correction actually needs; call this for the reason, the effect date and the rest.

Parameters:

  • attributes (Hash) —

    :reason, :effect, :period, :corrected_number, :previous_seller, :previous_buyers, and for a KOR_ZAL/KOR_ROZ :paid_before (P_15ZK) and :exchange_rate_before — see Correction



18
19
20
# File 'lib/ksef/fa3/builder/corrections.rb', line 18

def correction(**attributes)
  @correction = normalise(attributes, CORRECTION_KEYS, {}, "correction")
end

#corrects(**attributes) ⇒ Object

Names one invoice this correction corrects. Call once per corrected invoice; a collective correction under art. 106j ust. 3 names many.

Parameters:

  • attributes (Hash) —

    :number, :issue_date, and :ksef_number unless the corrected invoice was issued outside KSeF



27
28
29
# File 'lib/ksef/fa3/builder/corrections.rb', line 27

def corrects(**attributes)
  @corrected << CorrectedInvoice.new(**normalise(attributes, CORRECTED_KEYS, {}, "corrects"))
end