secretariat 3.8.0 → 3.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6d311cbeb3472a1af82827bb21d95e1f789fb21fe486995e1be364213761e44
4
- data.tar.gz: e52061bd2915e2ef348c33c714a1f6ae74ee5b2ab3961c5adce7ea0ceac1a804
3
+ metadata.gz: 9928207c56dc9a9c063c57efec9df9ddbe584c6337bb5b24fef7c67843686a63
4
+ data.tar.gz: d3c080148511c7953403aa4bb0dfc57e4efc9bcfeabd7e5c801aef890b4e28b6
5
5
  SHA512:
6
- metadata.gz: 7ebfa196f6d6c1710bbdb6768526321e9ca1a729d9d4ff8117914ab7d84bf1b919eea3c212cc3dfcc4574aa2f9272c415ec319cf941912ffccd2ddfef03f08bd
7
- data.tar.gz: 6cb203137f2af48c89635b4bea7860b0aafb02feaebbecf649f8aabf0c43ac56afa3a3932439fa0d516f790d96dae80c800f46a31eac556afbbdc421a6ff7215
6
+ metadata.gz: cf35ee563819fb8f7739ea83ed631aa6cb346ba1134de090731a26c7b3dfc7e47abc83e28594633c79c33bb696b9d0e17fdaf2bcc8ffdb7a7d1a12caf2830a97
7
+ data.tar.gz: b899f47bcf8f0c8bedb7c6e79b4f22c80a655ae89c943e2e36121ecea677410407a6124f36d3a2b96031e0237d343f265f5d64ba34022d137d3752bd6fb97249
@@ -51,7 +51,8 @@ module Secretariat
51
51
  :attachments,
52
52
  :direct_debit_mandate_reference_id, # BT-89
53
53
  :direct_debit_creditor_id, # BT-90
54
- :direct_debit_iban, # BT-91
54
+ :direct_debit_iban, # BT-91,
55
+ :subject_code, # BT-21
55
56
  keyword_init: true
56
57
  ) do
57
58
 
@@ -120,12 +121,12 @@ module Secretariat
120
121
  @errors = []
121
122
  tax = BigDecimal(tax_amount)
122
123
  basis = BigDecimal(basis_amount)
123
- summed_tax_amount = taxes.sum(&:tax_amount)
124
+ summed_tax_amount = taxes.sum(&:tax_amount).round(2)
124
125
  if tax != summed_tax_amount
125
126
  @errors << "Tax amount and summed tax amounts deviate: #{tax_amount} / #{summed_tax_amount}"
126
127
  return false
127
128
  end
128
- summed_tax_base_amount = taxes.sum(&:base_amount)
129
+ summed_tax_base_amount = taxes.sum(&:base_amount).round(2)
129
130
  if basis != summed_tax_base_amount
130
131
  @errors << "Base amount and summed tax base amount deviate: #{basis} / #{summed_tax_base_amount}"
131
132
  return false
@@ -220,6 +221,7 @@ module Secretariat
220
221
  Array(self.notes).each do |note|
221
222
  xml['ram'].IncludedNote do
222
223
  xml['ram'].Content note
224
+ xml['ram'].SubjectCode subject_code if subject_code
223
225
  end
224
226
  end
225
227
  end
@@ -74,7 +74,7 @@ module Secretariat
74
74
  gross_price = BigDecimal(gross_amount)
75
75
  charge_price = BigDecimal(charge_amount)
76
76
  tax = BigDecimal(tax_amount)
77
- unit_price = net_price * BigDecimal(billed_quantity.abs)
77
+ unit_price = (net_price * BigDecimal(billed_quantity.abs)).round(2)
78
78
 
79
79
  if charge_price != unit_price
80
80
  @errors << "charge price and gross price times quantity deviate: #{charge_price} / #{unit_price}"
@@ -173,7 +173,7 @@ module Secretariat
173
173
  xml['udt'].Indicator 'false'
174
174
  end
175
175
  Helpers.currency_element(xml, 'ram', 'ActualAmount', discount_amount, currency_code, add_currency: version == 1)
176
- xml['ram'].Reason discount_reason
176
+ xml['ram'].Reason discount_reason if discount_reason
177
177
  end
178
178
  end
179
179
  if version == 1 && discount_amount
@@ -182,7 +182,7 @@ module Secretariat
182
182
  xml['udt'].Indicator 'false'
183
183
  end
184
184
  Helpers.currency_element(xml, 'ram', 'ActualAmount', discount_amount, currency_code, add_currency: version == 1)
185
- xml['ram'].Reason discount_reason
185
+ xml['ram'].Reason discount_reason if discount_reason
186
186
  end
187
187
  end
188
188
  end
@@ -16,11 +16,11 @@ limitations under the License.
16
16
 
17
17
  module Secretariat
18
18
  using ObjectExtensions
19
-
19
+
20
20
  TradeParty = Struct.new('TradeParty',
21
21
  :id,
22
22
  :name, :street1, :street2, :city, :postal_code, :country_id, :vat_id, :global_id, :global_id_scheme_id, :tax_id,
23
- :person_name,
23
+ :person_name, :legal_organization,
24
24
  keyword_init: true,
25
25
  ) do
26
26
  def to_xml(xml, exclude_tax: false, version: 2)
@@ -33,6 +33,13 @@ module Secretariat
33
33
  end
34
34
  end
35
35
  xml['ram'].Name name
36
+ if legal_organization.present?
37
+ xml['ram'].SpecifiedLegalOrganization do
38
+ xml['ram'].ID(schemeID: legal_organization[:scheme_id] || "0002") do
39
+ xml.text(legal_organization[:id])
40
+ end
41
+ end
42
+ end
36
43
  if person_name
37
44
  xml['ram'].DefinedTradeContact do
38
45
  xml['ram'].PersonName person_name
@@ -64,4 +71,4 @@ module Secretariat
64
71
  end
65
72
  end
66
73
 
67
- # assert_match(%r{<ram:DefinedTradeContact>\s*<ram:PersonName>Max Mustermann</ram:PersonName>\s*</ram:DefinedTradeContact>}, xml)
74
+ # assert_match(%r{<ram:DefinedTradeContact>\s*<ram:PersonName>Max Mustermann</ram:PersonName>\s*</ram:DefinedTradeContact>}, xml)
@@ -15,5 +15,5 @@ limitations under the License.
15
15
  =end
16
16
 
17
17
  module Secretariat
18
- VERSION = "3.8.0"
18
+ VERSION = "3.9.0"
19
19
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secretariat
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Krutisch
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-11-06 00:00:00.000000000 Z
10
+ date: 2026-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri