sepa_file_parser 0.8.0 → 0.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e40fc8a0165c3f5b1aba430178939203b07da1a0b6f21b91e48423ffb4bcb1b0
|
|
4
|
+
data.tar.gz: d37ea47f3cbe7a854e7b9f0ac2d3d016118e9dbf5303d87bf7d07ca220899b54
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '02799607e177916a7a18302cee158c19761b5192bf5aaf783df67d975a43c96511aedf7179bd83a7441ad2049e95a8f436d3b2d56ab9850fe5d6b1b7ed4204d4'
|
|
7
|
+
data.tar.gz: a2b9649705ecf4c765cf4dd58cf151206034fd73f9d5f76877c7b36ccf46af95fa9477c7f207d051a5c7b9c766c0e60d0f86005c2510b20cbc405ba561694c8c
|
|
@@ -32,6 +32,14 @@ module SepaFileParser
|
|
|
32
32
|
@debitor ||= SepaFileParser::Debitor.new(xml_data)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
def ultimate_debitor
|
|
36
|
+
if xml_data.xpath('RltdPties/UltmtDbtr').any?
|
|
37
|
+
@ultimate_debitor ||= SepaFileParser::UltimateDebitor.new(xml_data)
|
|
38
|
+
else
|
|
39
|
+
nil
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
35
43
|
def name
|
|
36
44
|
credit? ? debitor.name : creditor.name
|
|
37
45
|
end
|
|
@@ -144,17 +152,17 @@ module SepaFileParser
|
|
|
144
152
|
end
|
|
145
153
|
|
|
146
154
|
def parse_amount
|
|
147
|
-
if xml_data.xpath('Amt').any?
|
|
155
|
+
if xml_data.xpath('Amt/text()').any?
|
|
148
156
|
xml_data.xpath('Amt/text()').text
|
|
149
|
-
elsif xml_data.xpath('AmtDtls').any?
|
|
157
|
+
elsif xml_data.xpath('AmtDtls//Amt/text()').any?
|
|
150
158
|
xml_data.xpath('AmtDtls//Amt/text()').first.text
|
|
151
159
|
end
|
|
152
160
|
end
|
|
153
161
|
|
|
154
162
|
def parse_currency
|
|
155
|
-
if xml_data.xpath('Amt').any?
|
|
163
|
+
if xml_data.xpath('Amt/@Ccy').any?
|
|
156
164
|
xml_data.xpath('Amt/@Ccy').text
|
|
157
|
-
elsif xml_data.xpath('AmtDtls').any?
|
|
165
|
+
elsif xml_data.xpath('AmtDtls//Amt/@Ccy').any?
|
|
158
166
|
xml_data.xpath('AmtDtls//Amt/@Ccy').first.text
|
|
159
167
|
end
|
|
160
168
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SepaFileParser
|
|
4
|
+
class UltimateDebitor
|
|
5
|
+
|
|
6
|
+
attr_reader :xml_data
|
|
7
|
+
|
|
8
|
+
def initialize(xml_data)
|
|
9
|
+
@xml_data = xml_data
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def name
|
|
13
|
+
@name ||= [
|
|
14
|
+
xml_data.xpath('RltdPties/UltmtDbtr/Nm/text()').text,
|
|
15
|
+
xml_data.xpath('RltdPties/UltmtDbtr/Pty/Nm/text()').text,
|
|
16
|
+
].reject(&:empty?).first.to_s
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @return [SepaFileParser::PostalAddress, nil]
|
|
20
|
+
def postal_address # May be missing
|
|
21
|
+
postal_address = [
|
|
22
|
+
xml_data.xpath('RltdPties/Dbtr/PstlAdr'),
|
|
23
|
+
xml_data.xpath('RltdPties/Dbtr/Pty/PstlAdr'),
|
|
24
|
+
].reject(&:empty?).first
|
|
25
|
+
|
|
26
|
+
return nil if postal_address == nil || postal_address.empty?
|
|
27
|
+
|
|
28
|
+
@address ||= SepaFileParser::PostalAddress.new(postal_address)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/sepa_file_parser.rb
CHANGED
|
@@ -22,6 +22,7 @@ require_relative 'sepa_file_parser/general/transaction'
|
|
|
22
22
|
require_relative 'sepa_file_parser/general/type/builder'
|
|
23
23
|
require_relative 'sepa_file_parser/general/type/code'
|
|
24
24
|
require_relative 'sepa_file_parser/general/type/proprietary'
|
|
25
|
+
require_relative 'sepa_file_parser/general/ultimate_debitor'
|
|
25
26
|
require_relative 'sepa_file_parser/camt052/report'
|
|
26
27
|
require_relative 'sepa_file_parser/camt052/base'
|
|
27
28
|
require_relative 'sepa_file_parser/camt053/statement'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sepa_file_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Schoknecht
|
|
@@ -124,6 +124,7 @@ files:
|
|
|
124
124
|
- lib/sepa_file_parser/general/type/builder.rb
|
|
125
125
|
- lib/sepa_file_parser/general/type/code.rb
|
|
126
126
|
- lib/sepa_file_parser/general/type/proprietary.rb
|
|
127
|
+
- lib/sepa_file_parser/general/ultimate_debitor.rb
|
|
127
128
|
- lib/sepa_file_parser/misc.rb
|
|
128
129
|
- lib/sepa_file_parser/pain001/base.rb
|
|
129
130
|
- lib/sepa_file_parser/pain001/payment_information.rb
|
|
@@ -157,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
157
158
|
- !ruby/object:Gem::Version
|
|
158
159
|
version: '0'
|
|
159
160
|
requirements: []
|
|
160
|
-
rubygems_version:
|
|
161
|
+
rubygems_version: 4.0.3
|
|
161
162
|
specification_version: 4
|
|
162
163
|
summary: Gem for parsing camt, pain, ... files into a speaking object.
|
|
163
164
|
test_files: []
|