norma43_parser 4.1.0 → 4.2.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: 70aa150ed65a01abcb09b13665b3969c94e3715d40ee499a5d4e33332820f046
4
- data.tar.gz: 86fb452b32c9b3cdd7732334ecbdc2e49bb4b051947789f0307a9e3314f3cd04
3
+ metadata.gz: 6a576ebd4936bf3b9f7c190dd6f9024f6581efabca4141d8383ebdd16c4cdb9d
4
+ data.tar.gz: '079b2f02c83c570abe052d635d82d7ad78919b18341de0d81fe2f22e62a64108'
5
5
  SHA512:
6
- metadata.gz: 2edf9e870901979eef621ec3e70b62257ee3f762d778940c5a75c5ccde57e466f1fde49d1a9d68074381358755e569c326a1f404a1ea4b8619d7c3d27d7315ef
7
- data.tar.gz: '085513b1e92b678eb0a7f5eaefb10a09728056516ef011d93cda4e299de39998e30a95cf5c6e7af25e9c5c9657deeed1b7f4aa29a8cc907bc95bef87d81fd739'
6
+ metadata.gz: 5b54505e514e0f3e226b6d910963570a753686db02f8bc6229fcb2f6586b79153fb914f8a2ed0c0ad73a4381a72c7f1ff5e9f2333c6d21ee3dd6e9bdecc03151
7
+ data.tar.gz: cffc3991bef02c3fe166d711db5e9c7d5d3d804eeb9b02d1188679fcfd84d46b511de0ce064c2eded074bdffd9d925817385f545553383459e8c428dd0f2006b
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -12,7 +12,7 @@ jobs:
12
12
  ruby-version: ["3.3", "3.2", "3.1", "3.0", "jruby-head"]
13
13
 
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v4
16
16
  - name: Set up Ruby ${{ matrix.ruby-version }}
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
@@ -7,14 +7,14 @@ jobs:
7
7
  release:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
- - uses: GoogleCloudPlatform/release-please-action@v3
10
+ - uses: GoogleCloudPlatform/release-please-action@v4
11
11
  id: release
12
12
  with:
13
13
  release-type: ruby
14
14
  package-name: norma43_parser
15
15
  bump-minor-pre-major: true
16
16
  version-file: 'lib/norma43/version.rb'
17
- - uses: actions/checkout@v2
17
+ - uses: actions/checkout@v4
18
18
  if: ${{ steps.release.outputs.release_created }}
19
19
  - uses: ruby/setup-ruby@v1
20
20
  with:
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@
7
7
  * Soft-deprecate `Norma43::Models::Document#transaction_date`, use transaction_date in transactions instead
8
8
 
9
9
 
10
+ ## [4.2.0](https://github.com/sequra/norma43_parser/compare/v4.1.0...v4.2.0) (2025-03-25)
11
+
12
+
13
+ ### Features
14
+
15
+ * [PAY-1007] Parse `reference_1` as string to be able to filter lines ([#42](https://github.com/sequra/norma43_parser/issues/42)) ([f60f4e4](https://github.com/sequra/norma43_parser/commit/f60f4e4f396e0e4ccfba22e59018a8e97a39dd47))
16
+
10
17
  ## [4.0.0](https://github.com/sequra/norma43_parser/compare/3.0.0...v4.0.0) (2024-06-18)
11
18
 
12
19
  ### ⚠ BREAKING CHANGES
@@ -24,7 +31,6 @@
24
31
 
25
32
  - Drop Ruby support below 2.6.
26
33
 
27
-
28
34
  ## v2.1.1 (2020-03-13)
29
35
 
30
36
  ### Enhancements
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- norma43_parser (4.1.0)
4
+ norma43_parser (4.2.0)
5
5
  zeitwerk (~> 2.0)
6
6
 
7
7
  GEM
@@ -21,8 +21,7 @@ GEM
21
21
  rainbow (3.1.1)
22
22
  rake (13.2.1)
23
23
  regexp_parser (2.9.2)
24
- rexml (3.3.0)
25
- strscan
24
+ rexml (3.3.9)
26
25
  rspec (3.13.0)
27
26
  rspec-core (~> 3.13.0)
28
27
  rspec-expectations (~> 3.13.0)
@@ -53,8 +52,6 @@ GEM
53
52
  rubocop (>= 1.48.1, < 2.0)
54
53
  rubocop-ast (>= 1.31.1, < 2.0)
55
54
  ruby-progressbar (1.13.0)
56
- strscan (3.1.0)
57
- strscan (3.1.0-java)
58
55
  unicode-display_width (2.5.0)
59
56
  zeitwerk (2.6.15)
60
57
 
data/README.md CHANGED
@@ -62,7 +62,7 @@ amount_code=2,
62
62
  document_number=0,
63
63
  origin_branch_code=123,
64
64
  own_item=16,
65
- reference_1=0,
65
+ reference_1=nil,
66
66
  reference_2=nil,
67
67
  shared_item=4,
68
68
  transaction_date=Tue, 04 Feb 2016,
@@ -11,7 +11,7 @@ module Norma43
11
11
  field :amount_code, 27, :integer
12
12
  field :amount, 28..41, :integer
13
13
  field :document_number, 42..51, :integer
14
- field :reference_1, 52..63, :integer
14
+ field :reference_1, 52..63
15
15
  field :reference_2, 64..79
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Norma43
4
- VERSION = "4.1.0"
4
+ VERSION = "4.2.0"
5
5
  end
@@ -58,7 +58,7 @@ RSpec.describe Norma43 do
58
58
  "amount_code" => 2,
59
59
  "amount" => 1234,
60
60
  "document_number" => 0,
61
- "reference_1" => 0,
61
+ "reference_1" => nil,
62
62
  "reference_2" => nil,
63
63
  )
64
64
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "norma43"
4
+
5
+ RSpec.describe Norma43 do
6
+ describe "parse" do
7
+ let(:document) do
8
+ file = File.open(File.join(__dir__, "fixtures/example2.n43"),
9
+ encoding: "iso-8859-1")
10
+ Norma43.parse file
11
+ end
12
+
13
+ it "finds one account" do
14
+ expect(document.accounts.size).to eq 1
15
+ end
16
+
17
+ describe "first account" do
18
+ let(:account) { document.accounts.first }
19
+
20
+ it "stores expected attributes from AccountStart parser" do
21
+ expect(account).to have_attributes(
22
+ "bank_code" => 81,
23
+ "branch_code" => 4797,
24
+ "account_number" => 6995216857,
25
+ "start_date" => Date.parse("2025-03-17"),
26
+ "end_date" => Date.parse("2025-03-17"),
27
+ "currency_code" => 978,
28
+ "information_mode_code" => 3,
29
+ "abbreviated_name" => "SEQURA WORLDWIDE S.A.",
30
+ )
31
+ end
32
+
33
+ it "stores expected attributes from AccountEnd parser" do
34
+ expect(account).to have_attributes(
35
+ "balance_code" => 2,
36
+ "balance_amount" => 8614571,
37
+ "debit_entries" => nil,
38
+ "debit_amount" => nil,
39
+ "credit_entries" => nil,
40
+ "credit_amount" => nil,
41
+ )
42
+ end
43
+
44
+ describe "transactions" do
45
+ it "finds all transactions" do
46
+ expect(account.transactions.size).to eq 4
47
+ end
48
+
49
+ describe "first transaction" do
50
+ let(:transaction) { account.transactions[0] }
51
+ it "stores expected attributes" do
52
+ expect(transaction).to have_attributes(
53
+ "origin_branch_code" => 7013,
54
+ "transaction_date" => Date.parse("2025-03-17"),
55
+ "value_date" => Date.parse("2025-03-14"),
56
+ "shared_item" => 4,
57
+ "own_item" => 7,
58
+ "amount_code" => 2,
59
+ "amount" => 9726,
60
+ "document_number" => 6871166755,
61
+ "reference_1" => "TRANSFERENCI",
62
+ "reference_2" => "A48555633617",
63
+ )
64
+ end
65
+ end
66
+
67
+ it "each transaction has 5 additional_items as a maximum" do
68
+ account.transactions.each do |transaction|
69
+ expect(transaction.additional_items.size).to be <= 5
70
+ end
71
+ end
72
+
73
+ describe "first additional item" do
74
+ let(:additional_item) { account.transactions[0].additional_items[0] }
75
+ it "stores expected attributes" do
76
+ expect(additional_item).to have_attributes(
77
+ "data_code" => 1,
78
+ "item_1" => "MARIA NARANJO ENFLOR",
79
+ "item_2" => "A48555633617"
80
+ )
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,13 @@
1
+ 110081479769952168572503172503172000000086145719783SEQURA WORLDWIDE S.A.
2
+ 2201827013250317250314040072000000000097266871166755TRANSFERENCIA48555633617
3
+ 2301MARIA NARANJO ENFLOR A48555633617
4
+ 2302 01826874
5
+ 2201827013250317250317040072000000000074332011157110TRANSFERENCISEQURA
6
+ 2301LAURA MARTINEZ PEREZ
7
+ 2302 01822011
8
+ 2201828510250317250317990512000000000082250000000000BIZUM
9
+ 2301NAYARA;MARTINEZ RODRIGUEZ PEDIDO 322200000000
10
+ 2302 15830001
11
+ 2201828510250317250317990512000000000088940000000000BIZUM
12
+ 2301DANIEL GARCIA GARCIA PEDIDO 322254909000
13
+ 2302 21000900
@@ -42,7 +42,7 @@ module Norma43
42
42
  end
43
43
 
44
44
  it "parses the reference 1" do
45
- expect(transaction.reference_1).to eq 0
45
+ expect(transaction.reference_1).to be_nil
46
46
  end
47
47
 
48
48
  it "parses the reference 2" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: norma43_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sequra engineering
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-20 00:00:00.000000000 Z
11
+ date: 2025-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.9'
55
- description:
55
+ description:
56
56
  email:
57
57
  - dev@sequra.es
58
58
  executables: []
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - ".github/ISSUE_TEMPLATE.md"
63
63
  - ".github/PULL_REQUEST_TEMPLATE.md"
64
+ - ".github/dependabot.yml"
64
65
  - ".github/workflows/ci.yml"
65
66
  - ".github/workflows/release.yml"
66
67
  - ".rspec"
@@ -100,7 +101,9 @@ files:
100
101
  - lib/norma43/version.rb
101
102
  - norma43_parser.gemspec
102
103
  - spec/example1_parse_spec.rb
104
+ - spec/example2_parse_spec.rb
103
105
  - spec/fixtures/example1.n43
106
+ - spec/fixtures/example2.n43
104
107
  - spec/norma43/line_parsers/account_end_spec.rb
105
108
  - spec/norma43/line_parsers/account_start_spec.rb
106
109
  - spec/norma43/line_parsers/additional_currency_spec.rb
@@ -128,7 +131,7 @@ homepage: https://github.com/sequra/norma43_parser
128
131
  licenses:
129
132
  - MIT
130
133
  metadata: {}
131
- post_install_message:
134
+ post_install_message:
132
135
  rdoc_options: []
133
136
  require_paths:
134
137
  - lib
@@ -144,12 +147,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
147
  version: '0'
145
148
  requirements: []
146
149
  rubygems_version: 3.4.19
147
- signing_key:
150
+ signing_key:
148
151
  specification_version: 4
149
152
  summary: Parses banks transactions files specified in rule 43
150
153
  test_files:
151
154
  - spec/example1_parse_spec.rb
155
+ - spec/example2_parse_spec.rb
152
156
  - spec/fixtures/example1.n43
157
+ - spec/fixtures/example2.n43
153
158
  - spec/norma43/line_parsers/account_end_spec.rb
154
159
  - spec/norma43/line_parsers/account_start_spec.rb
155
160
  - spec/norma43/line_parsers/additional_currency_spec.rb