eu_vat_rates_data 2026.8.13 → 2026.8.14

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: c62370ff31248e9e8423a48b7ccf89e430cb44fa87611f8ab4c64f9eb4d8362d
4
- data.tar.gz: 67a77f3cdebffa3e96aad1ff9f3f7f359ea764cf8c1796b658886b1c41838429
3
+ metadata.gz: 867e872a863f754240a5bc267436a0c980015a449506db8ee5617f3597334af3
4
+ data.tar.gz: 85a05ca031f7db5d96295f7017df4de7c1161ef97287d453a2242da0f044163a
5
5
  SHA512:
6
- metadata.gz: 6aa11a7d0183249888ed564473a7160da82a3fd5047a545063914e2e3f3648600dc4648bfee3f08c570ac50c9e833415ef8ddd4fc644a30907f725cd16ae78d9
7
- data.tar.gz: caf20520cbae2ac8d9a6a3055a58eaaaba10174fed37d54a92a7f9d36008824161363fa824cc675810406e88ac74d9feae7149a4727be9137f7fb058848abd8f
6
+ metadata.gz: 6e2042ba9b7dc8ab16fdf692c41bbaa11d332363dc43b24971d14f2bd0688c214661c5619a3b202e94717f1a221c0c0d18cee02c10abbd8c15c5c5e05a21bfc2
7
+ data.tar.gz: 03df437a6bde6839ce51c07bcb4c011b3191f8573f4587e4c814925be350f4c7eb931d219b3aaead9b75632e372557366b62eea3ef87328ce4c7dd733a728190
data/README.md CHANGED
@@ -110,6 +110,43 @@ EuVatRatesData.flag("XX") # => "" (empty string for unknown/invalid codes)
110
110
 
111
111
  ---
112
112
 
113
+ ## Example: charging VAT on an invoice
114
+
115
+ Rates on their own rarely answer the question you actually have, which is what
116
+ to put on the invoice. Two rules cover most of it: charge the buyer's domestic
117
+ rate, unless the sale is cross-border B2B inside the EU, where the reverse
118
+ charge applies and you invoice 0%.
119
+
120
+ ```ruby
121
+ # Money in minor units (cents). Never floats.
122
+ def invoice_total(net_cents, seller_country, buyer_country, buyer_vat_id = nil)
123
+ cross_border_b2b = buyer_country != seller_country &&
124
+ !buyer_vat_id.nil? &&
125
+ EuVatRatesData.valid_format?(buyer_vat_id)
126
+
127
+ return { vat_cents: 0, total_cents: net_cents, reverse_charge: true } if cross_border_b2b
128
+
129
+ rate = EuVatRatesData.get_standard_rate(buyer_country)
130
+ vat_cents = (net_cents * rate / 100.0).round
131
+
132
+ { vat_cents: vat_cents, total_cents: net_cents + vat_cents, reverse_charge: false }
133
+ end
134
+
135
+ # Domestic sale in Finland — 25.5%
136
+ invoice_total(10_000, 'FI', 'FI')
137
+ # => { vat_cents: 2550, total_cents: 12550, reverse_charge: false }
138
+
139
+ # Finnish seller, German business buyer — reverse charge
140
+ invoice_total(10_000, 'FI', 'DE', 'DE123456789')
141
+ # => { vat_cents: 0, total_cents: 10000, reverse_charge: true }
142
+ ```
143
+
144
+ `valid_format?` only checks the shape of the number. Applying the reverse charge
145
+ requires the buyer to actually be VAT-registered, which is a VIES lookup — see
146
+ above.
147
+
148
+ ---
149
+
113
150
  ## Data source & update frequency
114
151
 
115
152
  How the daily check works, and what changed when: [vatnode.dev/data](https://vatnode.dev/data?ref=rates-readme-rb).
@@ -1,3 +1,3 @@
1
1
  module EuVatRatesData
2
- VERSION = "2026.8.13"
2
+ VERSION = "2026.8.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eu_vat_rates_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 2026.8.13
4
+ version: 2026.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iurii Rogulia