camt_parser 2.12.0 → 2.14.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: 450aa5c4c5b4b16c77da3a86e7b5d9ab5e9a7aca8afe6e7bcaf786b6cf113eb2
4
- data.tar.gz: 788cc86a10e854d71195d3471076e8391f97a6fd2557767e38b1b1fb47cdaa48
3
+ metadata.gz: 5a14cf208512428c2b5598f13c736e42e36e8d821cf74fdc9b729545387b1243
4
+ data.tar.gz: faeb2af47c98f82135430e9586bf962ff2db1ea38b67720dd358b43156831a32
5
5
  SHA512:
6
- metadata.gz: d2ba043b5611080cb8ecd5d06419f4bdaa4a430dc5c62f5117882deb8e1ed01f836b9ebd771f3b3900ba0b99e194d322c4764602a45092f8ea2458465767267c
7
- data.tar.gz: d7c7d4724a22548d74f46929511849e264f4e29cc125aa097688cfb055d6b4059dee8d0053dbcc1a271d42053c16160f867a4a001c5f52c3ebe3d54f3d57afb6
6
+ metadata.gz: 841652ca51bd7e936feadd3f7b38a5df2bd5d18088d22bad9fc6e35c60a4519cfc4effa415c3985304a5cc3bea5943d9f9d713e659927af72cf5c760b93c24e4
7
+ data.tar.gz: 0f8a1bfa248544999e7849d581b4eb2a88d7c80cb153d74b9a56a974c67d8e9525c54ff522c5f724799195fe7d5cb0a2366380f98975c9cf8334d58310b0b02b
@@ -37,8 +37,9 @@ module CamtParser
37
37
  @opening_balance ||= begin
38
38
  bal = @xml_data.xpath('Bal/Tp//Cd[contains(text(), "PRCD")]').first.ancestors('Bal')
39
39
  date = bal.xpath('Dt/Dt/text()').text
40
+ credit = bal.xpath('CdtDbtInd/text()').text == 'CRDT'
40
41
  currency = bal.xpath('Amt').attribute('Ccy').value
41
- CamtParser::AccountBalance.new bal.xpath('Amt/text()').text, currency, date, true
42
+ CamtParser::AccountBalance.new bal.xpath('Amt/text()').text, currency, date, credit
42
43
  end
43
44
  end
44
45
  alias_method :opening_or_intermediary_balance, :opening_balance
@@ -47,8 +48,9 @@ module CamtParser
47
48
  @closing_balance ||= begin
48
49
  bal = @xml_data.xpath('Bal/Tp//Cd[contains(text(), "CLBD")]').first.ancestors('Bal')
49
50
  date = bal.xpath('Dt/Dt/text()').text
51
+ credit = bal.xpath('CdtDbtInd/text()').text == 'CRDT'
50
52
  currency = bal.xpath('Amt').attribute('Ccy').value
51
- CamtParser::AccountBalance.new bal.xpath('Amt/text()').text, currency, date, true
53
+ CamtParser::AccountBalance.new bal.xpath('Amt/text()').text, currency, date, credit
52
54
  end
53
55
  end
54
56
  alias_method :closing_or_intermediary_balance, :closing_balance
@@ -41,18 +41,19 @@ module CamtParser
41
41
  @opening_balance ||= begin
42
42
  bal = @xml_data.xpath('Bal/Tp//Cd[contains(text(), "OPBD") or contains(text(), "PRCD")]').first.ancestors('Bal')
43
43
  date = bal.xpath('Dt/Dt/text()').text
44
+ credit = bal.xpath('CdtDbtInd/text()').text == 'CRDT'
44
45
  currency = bal.xpath('Amt').attribute('Ccy').value
45
- AccountBalance.new bal.xpath('Amt/text()').text, currency, date, true
46
+ AccountBalance.new bal.xpath('Amt/text()').text, currency, date, credit
46
47
  end
47
48
  end
48
- alias_method :opening_or_intermediary_balance, :opening_balance
49
49
 
50
50
  def closing_balance
51
51
  @closing_balance ||= begin
52
52
  bal = @xml_data.xpath('Bal/Tp//Cd[contains(text(), "CLBD")]').first.ancestors('Bal')
53
53
  date = bal.xpath('Dt/Dt/text()').text
54
+ credit = bal.xpath('CdtDbtInd/text()').text == 'CRDT'
54
55
  currency = bal.xpath('Amt').attribute('Ccy').value
55
- AccountBalance.new bal.xpath('Amt/text()').text, currency, date, true
56
+ AccountBalance.new bal.xpath('Amt/text()').text, currency, date, credit
56
57
  end
57
58
  end
58
59
  alias_method :closing_or_intermediary_balance, :closing_balance
@@ -32,6 +32,10 @@ module CamtParser
32
32
  CamtParser::Misc.to_amount_in_cents(@amount)
33
33
  end
34
34
 
35
+ def signed_amount
36
+ amount * sign
37
+ end
38
+
35
39
  def to_h
36
40
  {
37
41
  'amount' => amount,
@@ -13,7 +13,7 @@ module CamtParser
13
13
  def to_amount(value)
14
14
  return nil if value == nil || value.strip == ''
15
15
 
16
- BigDecimal(value.gsub(',', '.'))
16
+ BigDecimal(value.tr(',', '.'))
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module CamtParser
2
- VERSION = '2.12.0'.freeze
2
+ VERSION = '2.14.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camt_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schoknecht
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 13.0.1
19
+ version: 13.0.6
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 13.0.1
26
+ version: 13.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -100,11 +100,11 @@ files:
100
100
  - lib/camt_parser/string.rb
101
101
  - lib/camt_parser/version.rb
102
102
  - lib/camt_parser/xml.rb
103
- homepage: https://github.com/Barzahlen/camt_parser
103
+ homepage: https://github.com/viafintech/camt_parser
104
104
  licenses:
105
105
  - MIT
106
106
  metadata: {}
107
- post_install_message:
107
+ post_install_message:
108
108
  rdoc_options: []
109
109
  require_paths:
110
110
  - lib
@@ -119,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.0.3.1
123
- signing_key:
122
+ rubygems_version: 3.1.6
123
+ signing_key:
124
124
  specification_version: 4
125
125
  summary: Gem for parsing camt files into a speaking object.
126
126
  test_files: []