Module: Ksef::FA3::SubjectReader
- Extended by:
- NodeReader
- Defined in:
- lib/ksef/fa3/subject_reader.rb
Overview
Constant Summary
Constants included from NodeReader
NodeReader::NAMESPACES, NodeReader::PREFIX
Class Method Summary collapse
-
.subject_from(node, role:) ⇒ Subject
roledecides which ofNazwaandAdresare required:TPodmiot1makes both mandatory,TPodmiot2makes both optional — the address explicitly *"opcjonalne dla przypadków określonych w art.
Class Method Details
.subject_from(node, role:) ⇒ Subject
role decides which of Nazwa and Adres are required: TPodmiot1 makes both
mandatory, TPodmiot2 makes both optional — the address explicitly "opcjonalne dla
przypadków określonych w art. 106e ust. 5 pkt 3", the simplified invoice
(docs/REFERENCE.md §8.2a). Requiring them of a buyer rejected valid FA(3).
Podmiot1K and Podmiot2K follow their live counterparts (§8.4).
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ksef/fa3/subject_reader.rb', line 25 def subject_from(node, role:) identity = require_element(node, "DaneIdentyfikacyjne", context: node.name) named = Subject::NAMED_PARTIES.include?(role) Subject.new( nip: identity_nip(identity), name: named ? text!(identity, "Nazwa") : text(identity, "Nazwa"), address: address_from(node, role: role), # Absent means "no" — which is both the schema's meaning for the seller, where # neither element exists, and the right default for a buyer that omits them. local_government_unit: Formatting.unflag(text(node, "JST")), vat_group_member: Formatting.unflag(text(node, "GV")), buyer_id: text(node, "IDNabywcy") ) end |