zugpferd 0.3.3 → 0.3.5

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: a5f92588b928e3ddebb536ee082e58b47f25b078defb969d0407c9ad5f86ec2e
4
- data.tar.gz: 8375975a159bc34c31a9dc7231dd64567faf31bec021c51311b4453e7dc7cbbb
3
+ metadata.gz: abb862a514f5dca77411e88cf1f21a3ed148192d30c3e6e661dbd9720344cae4
4
+ data.tar.gz: 7effd9d5bed0d5a9e6d054acbad9602846f7c334a98ee32ec65037c62b4aee95
5
5
  SHA512:
6
- metadata.gz: a8a4faadffd2c53608959f6610f7aae35513eb262a885da430ac22cc248069c0ac9ed41828cd84e27b0f56f662c557a1310a4100cb08d1e3ff1732f7dc6049af
7
- data.tar.gz: dfe0208222f0ef32c181ba27718b82a0d30474894c4c3fe1d16043fb059cfe7d3827f20ffc2f8d4cbec3dc4028c90369a50337e032906b8df7ccfeab21753576
6
+ metadata.gz: 111a8f3af318dba1cd0d4f5f208ed5a35fce92d59eda7c5660098cc83d10d61d8229ad97a400fba46160bb4bb7df80fe23820c2a35d92f81e563b3b2e1bc36a3
7
+ data.tar.gz: 16c0f30986919d7365f321ef18c3f3cf820152d6d0abc3943a3889e7485733ffc77d61a392755d48859011e79bac8bd30e3b4e77e65ed0f2fca2c9f866b57065
data/bin/setup-schemas CHANGED
@@ -1,12 +1,13 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- VENDOR_DIR="$(cd "$(dirname "$0")/../vendor" && pwd)"
4
+ VENDOR_DIR="$(pwd)/vendor"
5
5
  SCHEMAS_DIR="$VENDOR_DIR/schemas"
6
6
  TMP_DIR=$(mktemp -d)
7
7
  trap 'rm -rf "$TMP_DIR"' EXIT
8
8
 
9
9
  CURL_UA="Mozilla/5.0"
10
+ ZUGPFERD_REPO="https://github.com/alexzeitler/zugpferd"
10
11
 
11
12
  # --- Saxon HE (for Schematron validation) ---
12
13
 
@@ -45,9 +46,8 @@ if [ ! -d "$UBL_DIR/xsd/maindoc" ]; then
45
46
  echo " Downloading UBL-2.1.zip..."
46
47
  curl -fsSL -A "$CURL_UA" "http://docs.oasis-open.org/ubl/os-UBL-2.1/UBL-2.1.zip" \
47
48
  -o "$TMP_DIR/UBL-2.1.zip"
48
- mkdir -p "$UBL_DIR/xsd"
49
- unzip -qo "$TMP_DIR/UBL-2.1.zip" "os-UBL-2.1/xsd/*" -d "$TMP_DIR"
50
- cp -r "$TMP_DIR/os-UBL-2.1/xsd/"* "$UBL_DIR/xsd/"
49
+ mkdir -p "$UBL_DIR"
50
+ unzip -qo "$TMP_DIR/UBL-2.1.zip" "xsd/*" -d "$UBL_DIR"
51
51
  else
52
52
  echo " UBL XSD already present"
53
53
  fi
@@ -61,23 +61,31 @@ CII_DIR="$SCHEMAS_DIR/cii"
61
61
 
62
62
  if [ ! -f "$CII_DIR/CrossIndustryInvoice_100pD16B.xsd" ]; then
63
63
  echo " Downloading D16B SCRDM (Subset) CII..."
64
- CII_URL="https://unece.org/fileadmin/DAM/cefact/xml_schemas/D16B_SCRDM__Subset__CII.zip"
65
- curl -fsSL -A "$CURL_UA" "$CII_URL" -o "$TMP_DIR/cii-outer.zip" || {
66
- echo " WARN: Could not download CII XSD from UN/CEFACT."
67
- echo " Download manually from: $CII_URL"
68
- echo " Extract the 'uncoupled' XSD files into $CII_DIR/"
69
- }
70
-
71
- if [ -f "$TMP_DIR/cii-outer.zip" ]; then
72
- mkdir -p "$CII_DIR"
73
- unzip -qo "$TMP_DIR/cii-outer.zip" -d "$TMP_DIR/cii-outer"
74
- # The outer ZIP contains nested ZIPs — extract the uncoupled one
75
- UNCOUPLED_ZIP=$(find "$TMP_DIR/cii-outer" -name "*uncoupled.zip" -type f | head -1)
76
- if [ -n "$UNCOUPLED_ZIP" ]; then
77
- unzip -qo "$UNCOUPLED_ZIP" -d "$CII_DIR"
64
+ CII_URL="$ZUGPFERD_REPO/releases/download/v0.3.3/D16B_SCRDM__Subset__CII.zip"
65
+ curl -fsSL -A "$CURL_UA" "$CII_URL" -o "$TMP_DIR/cii-outer.zip"
66
+
67
+ mkdir -p "$CII_DIR"
68
+ unzip -qo "$TMP_DIR/cii-outer.zip" -d "$TMP_DIR/cii-outer"
69
+ # The outer ZIP contains nested ZIPs — extract the uncoupled one
70
+ UNCOUPLED_ZIP=$(find "$TMP_DIR/cii-outer" -name "*uncoupled.zip" -type f | head -1)
71
+ if [ -n "$UNCOUPLED_ZIP" ]; then
72
+ unzip -qo "$UNCOUPLED_ZIP" -d "$TMP_DIR/cii-uncoupled"
73
+ # XSDs are nested deep — move them flat into CII_DIR
74
+ XSD_DIR=$(find "$TMP_DIR/cii-uncoupled" -name "CrossIndustryInvoice_100pD16B.xsd" -type f -exec dirname {} \; | head -1)
75
+ if [ -n "$XSD_DIR" ]; then
76
+ cp -r "$XSD_DIR"/* "$CII_DIR/"
77
+ # Copy codelist XSDs (relative imports from main XSD)
78
+ CODELIST_DIR=$(find "$TMP_DIR/cii-uncoupled" -type d -name "codelist" | head -1)
79
+ if [ -n "$CODELIST_DIR" ]; then
80
+ cp -r "$CODELIST_DIR" "$CII_DIR/"
81
+ fi
78
82
  else
79
- echo " WARN: Could not find uncoupled ZIP inside CII archive"
83
+ echo " ERROR: Could not find CrossIndustryInvoice_100pD16B.xsd in extracted archive"
84
+ exit 1
80
85
  fi
86
+ else
87
+ echo " ERROR: Could not find uncoupled ZIP inside CII archive"
88
+ exit 1
81
89
  fi
82
90
  else
83
91
  echo " CII XSD already present"
@@ -122,7 +130,7 @@ XR_DIR="$SCHEMAS_DIR/schematron/xrechnung"
122
130
 
123
131
  if [ ! -f "$XR_DIR/schematron/ubl/XRechnung-UBL-validation.xsl" ]; then
124
132
  echo " Downloading xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip..."
125
- curl -fsSL -A "$CURL_UA" "https://github.com/itplr-kosit/xrechnung-schematron/releases/download/release-$XRECHNUNG_SCHEMATRON_VERSION/xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip" \
133
+ curl -fsSL -A "$CURL_UA" "https://github.com/itplr-kosit/xrechnung-schematron/releases/download/v$XRECHNUNG_SCHEMATRON_VERSION/xrechnung-$XRECHNUNG_SPEC_VERSION-schematron-$XRECHNUNG_SCHEMATRON_VERSION.zip" \
126
134
  -o "$TMP_DIR/xrechnung-schematron.zip"
127
135
  mkdir -p "$XR_DIR"
128
136
  unzip -qo "$TMP_DIR/xrechnung-schematron.zip" -d "$XR_DIR"
@@ -235,8 +235,8 @@ module Zugpferd
235
235
  xml["ram"].TaxTotalAmount(format_decimal(tax_breakdown.tax_amount),
236
236
  currencyID: tax_breakdown.currency_code)
237
237
  end
238
- xml["ram"].GrandTotalAmount format_decimal(totals.tax_inclusive_amount)
239
238
  xml["ram"].RoundingAmount format_decimal(totals.payable_rounding_amount) if totals.payable_rounding_amount
239
+ xml["ram"].GrandTotalAmount format_decimal(totals.tax_inclusive_amount)
240
240
  xml["ram"].TotalPrepaidAmount format_decimal(totals.prepaid_amount) if totals.prepaid_amount
241
241
  xml["ram"].DuePayableAmount format_decimal(totals.payable_amount)
242
242
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zugpferd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Zeitler
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2026-02-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -70,7 +69,6 @@ description: Read, write and convert XRechnung and ZUGFeRD electronic invoices (
70
69
  according to EN 16931. Supports UBL 2.1 and UN/CEFACT CII syntaxes with dedicated
71
70
  classes for Invoice, Credit Note, Corrected Invoice, Self-billed Invoice, Partial
72
71
  Invoice and Prepayment Invoice.
73
- email:
74
72
  executables: []
75
73
  extensions: []
76
74
  extra_rdoc_files: []
@@ -119,7 +117,6 @@ metadata:
119
117
  changelog_uri: https://github.com/alexzeitler/zugpferd/blob/master/CHANGELOG.md
120
118
  documentation_uri: https://www.rubydoc.info/gems/zugpferd
121
119
  bug_tracker_uri: https://github.com/alexzeitler/zugpferd/issues
122
- post_install_message:
123
120
  rdoc_options: []
124
121
  require_paths:
125
122
  - lib
@@ -134,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
131
  - !ruby/object:Gem::Version
135
132
  version: '0'
136
133
  requirements: []
137
- rubygems_version: 3.5.20
138
- signing_key:
134
+ rubygems_version: 3.6.9
139
135
  specification_version: 4
140
136
  summary: XRechnung & ZUGFeRD e-invoicing library for Ruby (UBL + CII)
141
137
  test_files: []