camt_parser 2.15.1 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf47570443ce3a304c5a90034e60d539dc7e610140818eeb1793e660c671966
4
- data.tar.gz: 299bd9ee5807d26c89ac2dd522959836e588ae3888043d5a747732f432f01d5c
3
+ metadata.gz: 4e1849513c8b589863c1b0bd446b964ff6957b772f45bd57f2f7e3cafabbe696
4
+ data.tar.gz: 41db32defa0244026f2f3b7b19f336e2aeb67b5ea234b4a0d6fa9606fd17b449
5
5
  SHA512:
6
- metadata.gz: d6d170663b314dfb467b609dcc72be2d0ad4038f2b6d9f9960b4dcda2d348b308dcdcfd0eb6911a4868b27db353ef94ba39a1b223cfe9058bcdbdb23b3b371d9
7
- data.tar.gz: fead7e44257cd34e028b90af6debf00718a25d569471d9252e4a011eae51f45528d8561e59322f470e495578483246474b1eb0bb3e304026a6dc3156c80aa312
6
+ metadata.gz: fe77e94484d8f3eddf0b5c9a6d0dffbe88cb1256a2018d28f547036dc6c0d373034cf8a25c42c7ca8be4bc1574e8e1a30ccec399fa4c3d5c96e96aa3a8daa84f
7
+ data.tar.gz: b516679dc70fbab597a6962105d9052f57acdd05f1b05c93f0c1cd8c6fc4c97dbec364befdf6bf09921d547b8e8578135833c4db66de922ff10f4a40796de1ef
@@ -28,5 +28,17 @@ module CamtParser
28
28
  def bank_name
29
29
  @bank_name ||= xml_data.xpath('RltdAgts/CdtrAgt/FinInstnId/Nm/text()').text
30
30
  end
31
+
32
+ # @return [CamtParser::PostalAddress, nil]
33
+ def postal_address # May be missing
34
+ postal_address = [
35
+ xml_data.xpath('RltdPties/Cdtr/PstlAdr'),
36
+ xml_data.xpath('RltdPties/Cdtr/Pty/PstlAdr'),
37
+ ].reject(&:empty?).first
38
+
39
+ return nil if postal_address == nil || postal_address.empty?
40
+
41
+ @address ||= CamtParser::PostalAddress.new(postal_address)
42
+ end
31
43
  end
32
44
  end
@@ -28,5 +28,17 @@ module CamtParser
28
28
  def bank_name
29
29
  @bank_name ||= xml_data.xpath('RltdAgts/DbtrAgt/FinInstnId/Nm/text()').text
30
30
  end
31
+
32
+ # @return [CamtParser::PostalAddress, nil]
33
+ def postal_address # May be missing
34
+ postal_address = [
35
+ xml_data.xpath('RltdPties/Dbtr/PstlAdr'),
36
+ xml_data.xpath('RltdPties/Dbtr/Pty/PstlAdr'),
37
+ ].reject(&:empty?).first
38
+
39
+ return nil if postal_address == nil || postal_address.empty?
40
+
41
+ @address ||= CamtParser::PostalAddress.new(postal_address)
42
+ end
31
43
  end
32
44
  end
@@ -51,6 +51,11 @@ module CamtParser
51
51
  @bank_reference ||= xml_data.xpath('AcctSvcrRef/text()').text
52
52
  end
53
53
 
54
+ # @return [String]
55
+ def reference # May be missing
56
+ @reference ||= xml_data.xpath('NtryRef/text()').text
57
+ end
58
+
54
59
  # @return [Array<CamtParser::Transaction>]
55
60
  def transactions
56
61
  @transactions ||= parse_transactions
@@ -0,0 +1,43 @@
1
+ module CamtParser
2
+ class PostalAddress
3
+
4
+ attr_reader :xml_data
5
+
6
+ def initialize(xml_data)
7
+ @xml_data = xml_data
8
+ end
9
+
10
+ # @return [Array<String>]
11
+ def lines # May be empty
12
+ xml_data.xpath('AdrLine').map do |x|
13
+ x.xpath('text()').text
14
+ end
15
+ end
16
+
17
+ # @return [String]
18
+ def street_name # May be missing
19
+ xml_data.xpath('StrtNm/text()').text
20
+ end
21
+
22
+ # @return [String]
23
+ def building_number # May be missing
24
+ xml_data.xpath('BldgNb/text()').text
25
+ end
26
+
27
+ # @return [String]
28
+ def postal_code # May be missing
29
+ xml_data.xpath('PstCd/text()').text
30
+ end
31
+
32
+ # @return [String]
33
+ def town_name # May be missing
34
+ xml_data.xpath('TwnNm/text()').text
35
+ end
36
+
37
+ # @return [String]
38
+ def country # May be missing
39
+ xml_data.xpath('Ctry/text()').text
40
+ end
41
+
42
+ end
43
+ end
@@ -42,6 +42,10 @@ module CamtParser
42
42
  credit? ? debitor.bic : creditor.bic
43
43
  end
44
44
 
45
+ def postal_address
46
+ credit? ? debitor.postal_address : creditor.postal_address
47
+ end
48
+
45
49
  def credit?
46
50
  !debit
47
51
  end
@@ -1,3 +1,3 @@
1
1
  module CamtParser
2
- VERSION = '2.15.1'.freeze
2
+ VERSION = '2.17.0'.freeze
3
3
  end
data/lib/camt_parser.rb CHANGED
@@ -16,6 +16,7 @@ require_relative "camt_parser/general/charges"
16
16
  require_relative "camt_parser/general/account"
17
17
  require_relative "camt_parser/general/batch_detail"
18
18
  require_relative "camt_parser/general/group_header"
19
+ require_relative "camt_parser/general/postal_address"
19
20
  require_relative "camt_parser/general/transaction"
20
21
  require_relative "camt_parser/general/type/builder"
21
22
  require_relative "camt_parser/general/type/code"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camt_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.1
4
+ version: 2.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schoknecht
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-07-31 00:00:00.000000000 Z
10
+ date: 2025-01-10 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -66,6 +65,20 @@ dependencies:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: bigdecimal
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
69
82
  description: A parser for the Camt file format
70
83
  email:
71
84
  - tobias.schoknecht@viafintech.com
@@ -90,6 +103,7 @@ files:
90
103
  - lib/camt_parser/general/debitor.rb
91
104
  - lib/camt_parser/general/entry.rb
92
105
  - lib/camt_parser/general/group_header.rb
106
+ - lib/camt_parser/general/postal_address.rb
93
107
  - lib/camt_parser/general/record.rb
94
108
  - lib/camt_parser/general/transaction.rb
95
109
  - lib/camt_parser/general/type/builder.rb
@@ -104,7 +118,6 @@ homepage: https://github.com/viafintech/camt_parser
104
118
  licenses:
105
119
  - MIT
106
120
  metadata: {}
107
- post_install_message:
108
121
  rdoc_options: []
109
122
  require_paths:
110
123
  - lib
@@ -119,8 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
132
  - !ruby/object:Gem::Version
120
133
  version: '0'
121
134
  requirements: []
122
- rubygems_version: 3.4.13
123
- signing_key:
135
+ rubygems_version: 3.6.2
124
136
  specification_version: 4
125
137
  summary: Gem for parsing camt files into a speaking object.
126
138
  test_files: []