finvoice3 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +0 -0
  3. data/README.md +46 -0
  4. data/Rakefile +8 -0
  5. data/lib/finvoice3/any_party_communication_details.rb +19 -0
  6. data/lib/finvoice3/any_party_details/any_party_communication_details.rb +19 -0
  7. data/lib/finvoice3/any_party_details/any_party_postal_address_details.rb +34 -0
  8. data/lib/finvoice3/any_party_details.rb +46 -0
  9. data/lib/finvoice3/attachment_message_details/attachment_message_identifier.rb +5 -0
  10. data/lib/finvoice3/attachment_message_details.rb +14 -0
  11. data/lib/finvoice3/buyer_communication_details.rb +19 -0
  12. data/lib/finvoice3/buyer_party_details/buyer_postal_address_details.rb +32 -0
  13. data/lib/finvoice3/buyer_party_details.rb +46 -0
  14. data/lib/finvoice3/country_code.rb +7 -0
  15. data/lib/finvoice3/delivery_communication_details.rb +19 -0
  16. data/lib/finvoice3/delivery_details/delivery_period_details.rb +19 -0
  17. data/lib/finvoice3/delivery_details/destination_name.rb +13 -0
  18. data/lib/finvoice3/delivery_details/package_details.rb +31 -0
  19. data/lib/finvoice3/delivery_details/shipment_party_details/shipment_postal_address_details.rb +34 -0
  20. data/lib/finvoice3/delivery_details/shipment_party_details.rb +34 -0
  21. data/lib/finvoice3/delivery_details.rb +112 -0
  22. data/lib/finvoice3/delivery_party_details/delivery_postal_address_details.rb +34 -0
  23. data/lib/finvoice3/delivery_party_details.rb +31 -0
  24. data/lib/finvoice3/direct_debit_info.rb +22 -0
  25. data/lib/finvoice3/electronic_addr_id.rb +14 -0
  26. data/lib/finvoice3/epi_account_id.rb +13 -0
  27. data/lib/finvoice3/epi_details/epi_identification_details/epi_reference.rb +7 -0
  28. data/lib/finvoice3/epi_details/epi_identification_details.rb +28 -0
  29. data/lib/finvoice3/epi_details/epi_party_details/epi_beneficiary_party_details.rb +22 -0
  30. data/lib/finvoice3/epi_details/epi_party_details/epi_bfi_party_details/epi_bfi_identifier.rb +14 -0
  31. data/lib/finvoice3/epi_details/epi_party_details/epi_bfi_party_details.rb +19 -0
  32. data/lib/finvoice3/epi_details/epi_party_details.rb +19 -0
  33. data/lib/finvoice3/epi_details/epi_payment_instruction_details/epi_amount.rb +7 -0
  34. data/lib/finvoice3/epi_details/epi_payment_instruction_details/epi_charge.rb +14 -0
  35. data/lib/finvoice3/epi_details/epi_payment_instruction_details/epi_remittance_info_identifier.rb +14 -0
  36. data/lib/finvoice3/epi_details/epi_payment_instruction_details.rb +40 -0
  37. data/lib/finvoice3/epi_details.rb +22 -0
  38. data/lib/finvoice3/factoring_agreement_details/factoring_party_postal_address_details.rb +34 -0
  39. data/lib/finvoice3/factoring_agreement_details.rb +37 -0
  40. data/lib/finvoice3/finvoice.rb +187 -0
  41. data/lib/finvoice3/invoice.rb +33 -0
  42. data/lib/finvoice3/invoice_details/definition_details/definition_header_text.rb +14 -0
  43. data/lib/finvoice3/invoice_details/definition_details.rb +19 -0
  44. data/lib/finvoice3/invoice_details/discount_details.rb +34 -0
  45. data/lib/finvoice3/invoice_details/invoice_charge_details.rb +32 -0
  46. data/lib/finvoice3/invoice_details/invoice_classification.rb +19 -0
  47. data/lib/finvoice3/invoice_details/invoice_type_code_fi.rb +13 -0
  48. data/lib/finvoice3/invoice_details/origin_code.rb +4 -0
  49. data/lib/finvoice3/invoice_details/payment_terms_details/cash_discount_vat_details.rb +19 -0
  50. data/lib/finvoice3/invoice_details/payment_terms_details/header_value.rb +16 -0
  51. data/lib/finvoice3/invoice_details/payment_terms_details/payment_over_due_fine_details.rb +22 -0
  52. data/lib/finvoice3/invoice_details/payment_terms_details.rb +46 -0
  53. data/lib/finvoice3/invoice_details/vat_point.rb +19 -0
  54. data/lib/finvoice3/invoice_details/vat_specification_details.rb +31 -0
  55. data/lib/finvoice3/invoice_details.rb +211 -0
  56. data/lib/finvoice3/invoice_recipient_communication_details.rb +19 -0
  57. data/lib/finvoice3/invoice_recipient_party_details/invoice_recipient_postal_address_details.rb +34 -0
  58. data/lib/finvoice3/invoice_recipient_party_details.rb +31 -0
  59. data/lib/finvoice3/invoice_row/article_group_identifier.rb +13 -0
  60. data/lib/finvoice3/invoice_row/customs_info.rb +28 -0
  61. data/lib/finvoice3/invoice_row/ean_code.rb +9 -0
  62. data/lib/finvoice3/invoice_row/row_any_party_details/row_any_party_postal_address_details.rb +34 -0
  63. data/lib/finvoice3/invoice_row/row_any_party_details.rb +40 -0
  64. data/lib/finvoice3/invoice_row/row_charge_details.rb +28 -0
  65. data/lib/finvoice3/invoice_row/row_definition_details/row_definition_header_text.rb +9 -0
  66. data/lib/finvoice3/invoice_row/row_definition_details.rb +14 -0
  67. data/lib/finvoice3/invoice_row/row_delivery_details/row_package_details.rb +34 -0
  68. data/lib/finvoice3/invoice_row/row_delivery_details.rb +97 -0
  69. data/lib/finvoice3/invoice_row/row_over_due_payment_details.rb +73 -0
  70. data/lib/finvoice3/invoice_row/row_progressive_discount_details.rb +28 -0
  71. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_any_party_details/sub_row_any_party_postal_address_details.rb +34 -0
  72. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_any_party_details.rb +40 -0
  73. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_definition_details/sub_row_definition_header_text.rb +9 -0
  74. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_definition_details.rb +19 -0
  75. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_delivery_details/sub_row_package_details.rb +34 -0
  76. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_delivery_details.rb +73 -0
  77. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_over_due_payment_details.rb +73 -0
  78. data/lib/finvoice3/invoice_row/sub_invoice_row/sub_row_progressive_discount_details.rb +28 -0
  79. data/lib/finvoice3/invoice_row/sub_invoice_row.rb +250 -0
  80. data/lib/finvoice3/invoice_row/transaction_details.rb +22 -0
  81. data/lib/finvoice3/invoice_row.rb +255 -0
  82. data/lib/finvoice3/invoice_sender_party_details.rb +25 -0
  83. data/lib/finvoice3/invoiced_object_id.rb +13 -0
  84. data/lib/finvoice3/message_transmission_details/message_details.rb +29 -0
  85. data/lib/finvoice3/message_transmission_details/message_receiver_details.rb +19 -0
  86. data/lib/finvoice3/message_transmission_details/message_sender_details.rb +19 -0
  87. data/lib/finvoice3/message_transmission_details.rb +22 -0
  88. data/lib/finvoice3/original_invoice_reference.rb +19 -0
  89. data/lib/finvoice3/partial_payment_details.rb +43 -0
  90. data/lib/finvoice3/party_identifier.rb +17 -0
  91. data/lib/finvoice3/party_legal_reg_id.rb +13 -0
  92. data/lib/finvoice3/payment_card_info.rb +19 -0
  93. data/lib/finvoice3/payment_status_details/payment_status_code.rb +5 -0
  94. data/lib/finvoice3/payment_status_details.rb +19 -0
  95. data/lib/finvoice3/seller_communication_details.rb +19 -0
  96. data/lib/finvoice3/seller_information_details/invoice_recipient_details.rb +19 -0
  97. data/lib/finvoice3/seller_information_details/seller_account_details/seller_account_id.rb +15 -0
  98. data/lib/finvoice3/seller_information_details/seller_account_details/seller_bic.rb +14 -0
  99. data/lib/finvoice3/seller_information_details/seller_account_details.rb +22 -0
  100. data/lib/finvoice3/seller_information_details/seller_official_postal_address_details.rb +31 -0
  101. data/lib/finvoice3/seller_information_details.rb +61 -0
  102. data/lib/finvoice3/seller_party_details/seller_postal_address_details.rb +32 -0
  103. data/lib/finvoice3/seller_party_details.rb +46 -0
  104. data/lib/finvoice3/soap_envelope.rb +82 -0
  105. data/lib/finvoice3/specification_details/external_specification_details.rb +5 -0
  106. data/lib/finvoice3/specification_details.rb +19 -0
  107. data/lib/finvoice3/tag/complex.rb +22 -0
  108. data/lib/finvoice3/tag/simple.rb +13 -0
  109. data/lib/finvoice3/tag.rb +27 -0
  110. data/lib/finvoice3/templates/fi_b2b.rb +232 -0
  111. data/lib/finvoice3/vat_category_code.rb +4 -0
  112. data/lib/finvoice3/version.rb +5 -0
  113. data/lib/finvoice3.rb +135 -0
  114. metadata +225 -0
@@ -0,0 +1,43 @@
1
+ module Finvoice3
2
+ class PartialPaymentDetails < Tag::Complex
3
+ attr_accessor :paid_amount
4
+ attr_accessor :paid_vat_excluded_amount
5
+ attr_accessor :un_paid_amount
6
+ attr_accessor :un_paid_vat_excluded_amount
7
+ attr_accessor :interest_percent
8
+ attr_accessor :processing_cost_amount
9
+ attr_accessor :partial_payment_vat_included_amount
10
+ attr_accessor :partial_payment_vat_excluded_amount
11
+ attr_accessor :partial_payment_due_date
12
+ attr_accessor :partial_payment_reference_identifier
13
+
14
+ def initialize
15
+ super
16
+ @paid_amount = Tag::Simple.new(name: "PaidAmount")
17
+ @paid_vat_excluded_amount = Tag::Simple.new(name: "PaidVatExcludedAmount")
18
+ @un_paid_amount = Tag::Simple.new(name: "UnPaidAmount")
19
+ @un_paid_vat_excluded_amount = Tag::Simple.new(name: "UnPaidVatExcludedAmount")
20
+ @interest_percent = Tag::Simple.new(name: "InterestPercent")
21
+ @processing_cost_amount = Tag::Simple.new(name: "ProcessingCostAmount")
22
+ @partial_payment_vat_included_amount = Tag::Simple.new(name: "PartialPaymentVatIncludedAmount")
23
+ @partial_payment_vat_excluded_amount = Tag::Simple.new(name: "PartialPaymentVatExcludedAmount")
24
+ @partial_payment_due_date = Tag::Simple.new(name: "PartialPaymentDueDate")
25
+ @partial_payment_reference_identifier = Tag::Simple.new(name: "PartialPaymentReferenceIdentifier")
26
+ end
27
+
28
+ def sub_tags
29
+ [
30
+ @paid_amount,
31
+ @paid_vat_excluded_amount,
32
+ @un_paid_amount,
33
+ @un_paid_vat_excluded_amount,
34
+ @interest_percent,
35
+ @processing_cost_amount,
36
+ @partial_payment_vat_included_amount,
37
+ @partial_payment_vat_excluded_amount,
38
+ @partial_payment_due_date,
39
+ @partial_payment_reference_identifier
40
+ ]
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ module Finvoice3
2
+ class PartyIdentifier < Tag::Simple
3
+ attr_accessor :identifier_type
4
+ attr_accessor :scheme_id
5
+
6
+ def initialize(name: nil)
7
+ super(name: name)
8
+ end
9
+
10
+ def attributes
11
+ {
12
+ "IdentifierType": @identifier_type,
13
+ "SchemeID": @scheme_id
14
+ }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Finvoice3
2
+ class PartyLegalRegId < Tag::Simple
3
+ attr_accessor :scheme_id
4
+
5
+ def initialize(name: nil)
6
+ super(name: name)
7
+ end
8
+
9
+ def attributes
10
+ {"SchemeID": @scheme_id}
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ module Finvoice3
2
+ class PaymentCardInfo < Tag::Complex
3
+ attr_accessor :primary_account_number
4
+ attr_accessor :card_holder_name
5
+
6
+ def initialize
7
+ super
8
+ @primary_account_number = Tag::Simple.new(name: "PrimaryAccountNumber")
9
+ @card_holder_name = Tag::Simple.new(name: "CardHolderName")
10
+ end
11
+
12
+ def sub_tags
13
+ [
14
+ @primary_account_number,
15
+ @card_holder_name
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Finvoice3
2
+ class PaymentStatusDetails::PaymentStatusCode < Tag::Simple
3
+ # enum PAID NOTPAID PARTLYPAID
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module Finvoice3
2
+ class PaymentStatusDetails < Tag::Complex
3
+ attr_accessor :payment_status_code
4
+ attr_accessor :payment_method_text
5
+
6
+ def initialize
7
+ super
8
+ @payment_status_code = PaymentStatusCode.new
9
+ @payment_method_text = Tag::Simple.new(name: "PaymentMethodText")
10
+ end
11
+
12
+ def sub_tag
13
+ [
14
+ @payment_status_code,
15
+ @payment_method_text
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Finvoice3
2
+ class SellerCommunicationDetails < Tag::Complex
3
+ attr_accessor :seller_phone_number_identifier
4
+ attr_accessor :seller_emailaddress_identifier
5
+
6
+ def initialize
7
+ super
8
+ @seller_phone_number_identifier = Tag::Simple.new(name: "SellerPhoneNumberIdentifier")
9
+ @seller_emailaddress_identifier = Tag::Simple.new(name: "SellerEmailaddressIdentifier")
10
+ end
11
+
12
+ def sub_tags
13
+ [
14
+ @seller_phone_number_identifier,
15
+ @seller_emailaddress_identifier
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails::InvoiceRecipientDetails < Tag::Complex
3
+ attr_accessor :invoice_recipient_address
4
+ attr_accessor :invoice_recipient_intermediator_address
5
+
6
+ def initialize
7
+ super
8
+ @invoice_recipient_address = Tag::Simple.new(name: "InvoiceRecipientAddress")
9
+ @invoice_recipient_intermediator_address = Tag::Simple.new(name: "InvoiceRecipientIntermediatorAddress")
10
+ end
11
+
12
+ def sub_tags
13
+ [
14
+ @invoice_recipient_address,
15
+ @invoice_recipient_intermediator_address
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails::SellerAccountDetails::SellerAccountId < Tag::Simple
3
+ attr_accessor :identification_scheme_name
4
+
5
+ def initialize
6
+ super
7
+ @name = "SellerAccountID"
8
+ @identification_scheme_name = ""
9
+ end
10
+
11
+ def attributes
12
+ {"IdentificationSchemeName": @identification_scheme_name}
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails::SellerAccountDetails::SellerBic < Tag::Simple
3
+ attr_accessor :identification_scheme_name
4
+
5
+ def initialize
6
+ super
7
+ @identification_scheme_name = ""
8
+ end
9
+
10
+ def attributes
11
+ {"IdentificationSchemeName": @identification_scheme_name}
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails::SellerAccountDetails < Tag::Complex
3
+ attr_accessor :seller_account_id
4
+ attr_accessor :seller_bic
5
+ attr_accessor :seller_account_name
6
+
7
+ def initialize
8
+ super
9
+ @seller_account_id = SellerAccountId.new
10
+ @seller_bic = SellerBic.new
11
+ @seller_account_name = Tag::Simple.new(name: "SellerAccountName")
12
+ end
13
+
14
+ def sub_tags
15
+ [
16
+ @seller_account_id,
17
+ @seller_bic,
18
+ @seller_account_name
19
+ ]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails::SellerOfficialPostalAddressDetails < Tag::Complex
3
+ attr_accessor :seller_official_street_name
4
+ attr_accessor :seller_official_town_name
5
+ attr_accessor :seller_official_post_code_identifier
6
+ attr_accessor :seller_official_country_subdivision
7
+ attr_accessor :country_code
8
+ attr_accessor :country_name
9
+
10
+ def initialize
11
+ super
12
+ @seller_official_street_name = Tag::Simple.new(name: "SellerOfficialStreetName")
13
+ @seller_official_town_name = Tag::Simple.new(name: "SellerOfficialTownName")
14
+ @seller_official_post_code_identifier = Tag::Simple.new(name: "SellerOfficialPostCodeIdentifier")
15
+ @seller_official_country_subdivision = Tag::Simple.new(name: "SellerOfficialCountrySubdivision")
16
+ @country_code = CountryCode.new
17
+ @country_name = Tag::Simple.new(name: "CountryName")
18
+ end
19
+
20
+ def sub_tags
21
+ [
22
+ @seller_official_street_name,
23
+ @seller_official_town_name,
24
+ @seller_official_post_code_identifier,
25
+ @seller_official_country_subdivision,
26
+ @country_code,
27
+ @country_name
28
+ ]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,61 @@
1
+ module Finvoice3
2
+ class SellerInformationDetails < Tag::Complex
3
+ attr_accessor :seller_official_postal_address_details
4
+ attr_accessor :seller_home_town_name
5
+ attr_accessor :seller_vat_registration_text
6
+ attr_accessor :seller_vat_registration_date
7
+ attr_accessor :seller_tax_registrarion_text
8
+ attr_accessor :seller_additional_legal_info
9
+ attr_accessor :seller_phone_number
10
+ attr_accessor :seller_fax_number
11
+ attr_accessor :seller_common_emailaddress_identifier
12
+ attr_accessor :seller_webaddress_identifier
13
+ attr_accessor :seller_free_text
14
+ attr_accessor :seller_account_details
15
+ attr_accessor :invoice_recipient_details
16
+
17
+ def initialize
18
+ super
19
+ @seller_official_postal_address_details = SellerOfficialPostalAddressDetails.new
20
+ @seller_home_town_name = Tag::Simple.new(name: "SellerHomeTownName")
21
+ @seller_vat_registration_text = Tag::Simple.new(name: "SellerVatRegistrationText")
22
+ @seller_vat_registration_date = Tag::Simple.new(name: "SellerVatRegistrationDate")
23
+ @seller_tax_registration_text = Tag::Simple.new(name: "SellerTaxRegistrationText")
24
+ @seller_additional_legal_info = Tag::Simple.new(name: "SellerAdditionalLegalInfo")
25
+ @seller_phone_number = Tag::Simple.new(name: "SellerPhoneNumber")
26
+ @seller_fax_number = Tag::Simple.new(name: "SellerFaxNumber")
27
+ @seller_common_emailaddress_identifier = Tag::Simple.new(name: "SellerCommonEmailaddressIdentifier")
28
+ @seller_webaddress_identifier = Tag::Simple.new(name: "SellerWebaddressIdentifier")
29
+ @seller_free_text = Tag::Simple.new(name: "SellerFreeText")
30
+ @seller_account_details = []
31
+ @invoice_recipient_details = InvoiceRecipientDetails.new
32
+ end
33
+
34
+ def sub_tags
35
+ [
36
+ @seller_official_postal_address_details,
37
+ @seller_home_town_name,
38
+ @seller_vat_registration_text,
39
+ @seller_vat_registration_date,
40
+ @seller_tax_registration_text,
41
+ @seller_additional_legal_info,
42
+ @seller_phone_number,
43
+ @seller_fax_number,
44
+ @seller_common_emailaddress_identifier,
45
+ @seller_webaddress_identifier,
46
+ @seller_free_text,
47
+ *@seller_account_details,
48
+ @invoice_recipient_details
49
+ ]
50
+ end
51
+
52
+ def add_seller_account(name: "", account_id_scheme:, account_id:, bic_scheme:, bic:)
53
+ account = SellerAccountDetails.new
54
+ account.seller_account_id.identification_scheme_name = account_id_scheme
55
+ account.seller_account_id.value = account_id
56
+ account.seller_bic.identification_scheme_name = bic_scheme
57
+ account.seller_bic.value = bic
58
+ @seller_account_details << account
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,32 @@
1
+ module Finvoice3
2
+ class SellerPartyDetails::SellerPostalAddressDetails < Tag::Complex
3
+ attr_accessor :seller_street_name
4
+ attr_accessor :seller_town_name
5
+ attr_accessor :seller_post_code_identifier
6
+ attr_accessor :seller_country_subdivision
7
+ attr_accessor :country_code
8
+ attr_accessor :country_name
9
+ attr_accessor :seller_post_office_box_identifier
10
+
11
+ def initialize
12
+ super
13
+ @seller_street_name = Tag::Simple.new(name: "SellerStreetName")
14
+ @seller_town_name = Tag::Simple.new(name: "SellerTownName")
15
+ @seller_post_code_identifier = Tag::Simple.new(name: "SellerPostCodeIdentifier")
16
+ @seller_country_subdivision = Tag::Simple.new(name: "SellerCountrySubdivision")
17
+ @country_code = CountryCode.new
18
+ @country_name = Tag::Simple.new(name: "CountryName")
19
+ @seller_post_office_box_identifier = Tag::Simple.new(name: "SellerPostOfficeBoxIdentifier")
20
+ end
21
+
22
+ def sub_tags
23
+ [
24
+ @seller_street_name,
25
+ @seller_town_name,
26
+ @seller_post_code_identifier,
27
+ @seller_country_code,
28
+ @seller_country_name
29
+ ]
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,46 @@
1
+ module Finvoice3
2
+ class SellerPartyDetails < Tag::Complex
3
+ attr_accessor :seller_party_identifier
4
+ attr_accessor :seller_party_identifier_url_text
5
+ attr_accessor :seller_organisation_names
6
+ attr_accessor :seller_organisation_trading_name
7
+ attr_accessor :seller_organisation_department
8
+ attr_accessor :seller_organisation_tax_code
9
+ attr_accessor :seller_organisation_tax_code_url_text
10
+ attr_accessor :seller_code
11
+ attr_accessor :seller_postal_address_details
12
+
13
+ def initialize
14
+ super
15
+ @seller_party_identifier = Tag::Simple.new(name: "SellerPartyIdentifier")
16
+ @seller_party_identifier_url_text = Tag::Simple.new(name: "SellerPartyIdentifierUrlText")
17
+ @seller_organisation_names = []
18
+ @seller_organisation_trading_name = Tag::Simple.new(name: "SellerOrganisationTradingName")
19
+ @seller_organisation_department = Tag::Simple.new(name: "SellerOrganisationDepartment")
20
+ @seller_organisation_tax_code = Tag::Simple.new(name: "SellerOrganisationTaxCode")
21
+ @seller_organisation_tax_code_url_text = Tag::Simple.new(name: "SellerOrganisationTaxCodeUrlText")
22
+ @seller_code = Tag::Simple.new(name: "SellerCode")
23
+ @seller_postal_address_details = SellerPostalAddressDetails.new
24
+ end
25
+
26
+ def add_seller_organisation_name(name)
27
+ tag = Tag::Simple.new(name: "SellerOrganisationName")
28
+ tag.value = name
29
+ @seller_organisation_names << tag
30
+ end
31
+
32
+ def sub_tags
33
+ [
34
+ @seller_party_identifier,
35
+ @seller_party_identifier_url_text,
36
+ *@seller_organisation_names,
37
+ @seller_organisation_trading_name,
38
+ @seller_organisation_department,
39
+ @seller_organisation_tax_code,
40
+ @seller_organisation_tax_code_url_text,
41
+ @seller_code,
42
+ @seller_postal_address_details
43
+ ]
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,82 @@
1
+ module Finvoice3
2
+ class SoapEnvelope
3
+ def initialize(from_id:, from_intermediator_id:, to_id:, to_intermediator_id:)
4
+ namespaces = {
5
+ "xmlns:SOAP-ENV" => "http://schemas.xmlsoap.org/soap/envelope/",
6
+ "xmlns:xlink" => "http://www.w3.org/1999/xlink",
7
+ "xmlns:eb" => "http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"
8
+ }
9
+
10
+ message_header_attributes = {
11
+ "xmlns:eb" => "http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd",
12
+ "SOAP-ENV:mustUnderstand" => "1",
13
+ "eb:version" => "2.0"
14
+ }
15
+
16
+ manifest_attributes = {
17
+ "eb:id" => "Manifest",
18
+ "eb:version" => "2.0"
19
+ }
20
+
21
+ reference_attributes = {
22
+ "eb:id" => "Finvoice",
23
+ "xml:href" => "200911180001"
24
+ }
25
+
26
+ schema_attributes = {
27
+ "eb:location" => "http://www.finvoice.info/finvoice.xsd",
28
+ "eb:version" => "2.0"
29
+ }
30
+
31
+ @builder = Nokogiri::XML::Builder.new do |xml|
32
+ xml[:"SOAP-ENV"].Envelope(namespaces) do
33
+ xml[:"SOAP-ENV"].Header do
34
+ xml[:eb].MessageHeader(message_header_attributes) do
35
+ xml[:eb].From do
36
+ xml[:eb].PartyId from_id
37
+ xml[:eb].Role "Sender"
38
+ end
39
+
40
+ xml[:eb].From do
41
+ xml[:eb].PartyId from_intermediator_id
42
+ xml[:eb].Role "Intermediator"
43
+ end
44
+
45
+ xml[:eb].To do
46
+ xml[:eb].PartyId to_id
47
+ xml[:eb].Role "Receiver"
48
+ end
49
+
50
+ xml[:eb].To do
51
+ xml[:eb].PartyId to_intermediator_id
52
+ xml[:eb].Role "Intermediator"
53
+ end
54
+
55
+ xml[:eb].CPAID
56
+ xml[:eb].ConversationId
57
+ xml[:eb].Service
58
+ xml[:eb].Action
59
+ xml[:eb].MessageData do
60
+ xml[:eb].MessageId
61
+ xml[:eb].Timestamp
62
+ xml[:eb].RefToMessageId
63
+ end
64
+ end
65
+ end
66
+
67
+ xml[:"SOAP-ENV"].Body do
68
+ xml[:eb].Manifest(manifest_attributes) do
69
+ xml[:eb].Reference(reference_attributes) do
70
+ xml[:eb].Schema(schema_attributes)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+
78
+ def to_xml
79
+ Nokogiri::XML(@builder.to_xml).root.to_xml
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,5 @@
1
+ module Finvoice3
2
+ class SpecificationDetails::ExternalSpecificationDetails < Tag::Complex
3
+
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module Finvoice3
2
+ class SpecificationDetails < Tag::Complex
3
+ attr_accessor :specification_free_text
4
+ attr_accessor :external_specification_details
5
+
6
+ def initialize
7
+ super
8
+ @specification_free_text = Tag::Simple.new(name: "SpecificationFreeText")
9
+ @external_specification_details = ExternalSpecificationDetails.new
10
+ end
11
+
12
+ def sub_tags
13
+ [
14
+ @specification_free_text,
15
+ @external_specification_details
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ module Finvoice3
2
+ class Tag::Complex < Tag
3
+ attr_accessor :sub_tags
4
+
5
+ def initialize(name: nil)
6
+ super(name: name)
7
+ @sub_tags = []
8
+ end
9
+
10
+ def to_xml(parent_context)
11
+ parent_context.send(name.to_sym, attributes.compact) do |context|
12
+ sub_tags.compact.each do |sub_tag|
13
+ sub_tag.to_xml(context) unless sub_tag.blank?
14
+ end
15
+ end
16
+ end
17
+
18
+ def blank?
19
+ sub_tags.compact.reduce(true) { |memo, tag| memo && tag.blank? }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module Finvoice3
2
+ class Tag::Simple < Tag
3
+ attr_accessor :value
4
+
5
+ def to_xml(context)
6
+ context.send(name.to_sym, value, attributes.compact)
7
+ end
8
+
9
+ def blank?
10
+ (value.nil? or value.empty?) and attributes.values.compact.empty?
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,27 @@
1
+ module Finvoice3
2
+ class Tag
3
+ attr_accessor :attributes
4
+ attr_accessor :name
5
+
6
+ def initialize(name: nil)
7
+ @attributes = {}
8
+ @name = name || self.class.name.split("::").last
9
+ end
10
+
11
+ def set_attribute(key, value)
12
+ @attributes[key] = value
13
+ end
14
+
15
+ def attribute(key)
16
+ @attributes[key]
17
+ end
18
+
19
+ def to_xml(_context)
20
+ raise "This abstract method should be overriden"
21
+ end
22
+
23
+ def blank?
24
+ raise "This abstract method should be overriden"
25
+ end
26
+ end
27
+ end