Class: FacturX::Party
- Inherits:
-
Object
- Object
- FacturX::Party
- Defined in:
- lib/factur_x/party.rb
Overview
A seller, buyer, payee or ship-to party.
French identifiers are first-class: siret becomes the party GlobalID
(scheme 0009), siren the legal organization ID (scheme 0002), and
routing_id the electronic address (scheme 0225) used to route the
invoice through the PPF, defaulting to the SIRET.
legal_information is BT-33, the seller's additional legal information:
legal form, share capital, RCS registration, and any other statement the
printed invoice must carry. A party holds a single postal address, so this
is also where a registered office that differs from the invoicing
establishment belongs.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#contact ⇒ Object
readonly
Returns the value of attribute contact.
-
#global_id ⇒ Object
readonly
Returns the value of attribute global_id.
-
#global_id_scheme ⇒ Object
readonly
Returns the value of attribute global_id_scheme.
-
#legal_id ⇒ Object
readonly
Returns the value of attribute legal_id.
-
#legal_id_scheme ⇒ Object
readonly
Returns the value of attribute legal_id_scheme.
-
#legal_information ⇒ Object
readonly
Returns the value of attribute legal_information.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#routing_id ⇒ Object
readonly
Returns the value of attribute routing_id.
-
#routing_id_scheme ⇒ Object
readonly
Returns the value of attribute routing_id_scheme.
-
#siren ⇒ Object
readonly
Returns the value of attribute siren.
-
#siret ⇒ Object
readonly
Returns the value of attribute siret.
-
#tax_id ⇒ Object
readonly
Returns the value of attribute tax_id.
-
#trading_name ⇒ Object
readonly
Returns the value of attribute trading_name.
-
#vat_number ⇒ Object
readonly
Returns the value of attribute vat_number.
Instance Method Summary collapse
- #contact? ⇒ Boolean
-
#initialize(name:, address: nil, contact: nil, trading_name: nil, legal_information: nil, siret: nil, siren: nil, vat_number: nil, tax_id: nil, global_id: nil, global_id_scheme: nil, legal_id: nil, legal_id_scheme: nil, routing_id: :derive_from_siret, routing_id_scheme: nil) ⇒ Party
constructor
A new instance of Party.
- #tax_registrations ⇒ Object
Constructor Details
#initialize(name:, address: nil, contact: nil, trading_name: nil, legal_information: nil, siret: nil, siren: nil, vat_number: nil, tax_id: nil, global_id: nil, global_id_scheme: nil, legal_id: nil, legal_id_scheme: nil, routing_id: :derive_from_siret, routing_id_scheme: nil) ⇒ Party
Returns a new instance of Party.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/factur_x/party.rb', line 23 def initialize(name:, address: nil, contact: nil, trading_name: nil, legal_information: nil, siret: nil, siren: nil, vat_number: nil, tax_id: nil, global_id: nil, global_id_scheme: nil, legal_id: nil, legal_id_scheme: nil, routing_id: :derive_from_siret, routing_id_scheme: nil) @name = name @trading_name = trading_name @legal_information = legal_information @address = address @contact = contact @siret = siret @siren = siren @vat_number = vat_number @tax_id = tax_id @global_id = global_id || siret @global_id_scheme = global_id_scheme || (Codes::Scheme::SIRET if @global_id && siret) @legal_id = legal_id || siren @legal_id_scheme = legal_id_scheme || (Codes::Scheme::SIREN if @legal_id && siren) @routing_id = routing_id == :derive_from_siret ? siret : routing_id @routing_id_scheme = routing_id_scheme || (Codes::Scheme::ROUTING_SIRET if @routing_id) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def address @address end |
#contact ⇒ Object (readonly)
Returns the value of attribute contact.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def contact @contact end |
#global_id ⇒ Object (readonly)
Returns the value of attribute global_id.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def global_id @global_id end |
#global_id_scheme ⇒ Object (readonly)
Returns the value of attribute global_id_scheme.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def global_id_scheme @global_id_scheme end |
#legal_id ⇒ Object (readonly)
Returns the value of attribute legal_id.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def legal_id @legal_id end |
#legal_id_scheme ⇒ Object (readonly)
Returns the value of attribute legal_id_scheme.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def legal_id_scheme @legal_id_scheme end |
#legal_information ⇒ Object (readonly)
Returns the value of attribute legal_information.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def legal_information @legal_information end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def name @name end |
#routing_id ⇒ Object (readonly)
Returns the value of attribute routing_id.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def routing_id @routing_id end |
#routing_id_scheme ⇒ Object (readonly)
Returns the value of attribute routing_id_scheme.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def routing_id_scheme @routing_id_scheme end |
#siren ⇒ Object (readonly)
Returns the value of attribute siren.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def siren @siren end |
#siret ⇒ Object (readonly)
Returns the value of attribute siret.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def siret @siret end |
#tax_id ⇒ Object (readonly)
Returns the value of attribute tax_id.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def tax_id @tax_id end |
#trading_name ⇒ Object (readonly)
Returns the value of attribute trading_name.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def trading_name @trading_name end |
#vat_number ⇒ Object (readonly)
Returns the value of attribute vat_number.
19 20 21 |
# File 'lib/factur_x/party.rb', line 19 def vat_number @vat_number end |
Instance Method Details
#contact? ⇒ Boolean
49 50 51 |
# File 'lib/factur_x/party.rb', line 49 def contact? !contact.nil? && !contact.empty? end |