sepa_file_parser 0.4.0 → 0.5.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: dc1b49342df2ec9e64acf292db190c7a0f18faa8ac3b687f0411abdc09b17095
4
- data.tar.gz: 44a28b13cbff5ec5d953f990d51ba927dd4851c12e661097126529c13bf4c922
3
+ metadata.gz: d849a3d8a2c14d65f90cd313e59ea45d6a61fe9c8a4e2ab4adbdc92b74e2ee44
4
+ data.tar.gz: 39b96e5ed8cab2969e2c81aa1c89a6993c519181da677cb3e103e3ff7f6dee79
5
5
  SHA512:
6
- metadata.gz: b5e447b025c72c012230d773d67ce6d55cbbc6cf3c88da7c9c3c97e9cc8b112d8eea2c56a1b199826f63c92f1446bccd36258cd22a0fa43aa7dbc5fec883d198
7
- data.tar.gz: 0eab576311fa01993d1499ca6050330ebd373075f4a0165071b527df5f2fb79d6ea81c77c51d2335d7785df4131d633b005b32bb5edf88ab918312c45490caa4
6
+ metadata.gz: 52abe875f8007897411b0dfa7d2ef163ff57b94e925afdee25c508e63176418f9a054ab400bdcac35c29dbb51369fac2ca6fc03351e97b2bbd40fc1499c2c20b
7
+ data.tar.gz: 016deaaaad4a9ec7cdb922ce4f340033e7772bfb7dd0815d9d899c6f7c52b5bced82233e7f2114e1dfe5de9d2f95697093a0ee049085a00b75448584a0014950
@@ -40,7 +40,10 @@ module SepaFileParser
40
40
 
41
41
  def opening_balance
42
42
  @opening_balance ||= begin
43
- bal = xml_data.xpath('Bal/Tp//Cd[contains(text(), "PRCD")]').first.ancestors('Bal')
43
+ openingNode = xml_data.xpath('Bal/Tp//Cd[contains(text(), "PRCD")]').first ||
44
+ xml_data.xpath('Bal/Tp//Cd[contains(text(), "OPBD")]').first
45
+
46
+ bal = openingNode.ancestors('Bal')
44
47
  date = bal.xpath('Dt/Dt/text()').text
45
48
  credit = bal.xpath('CdtDbtInd/text()').text == 'CRDT'
46
49
  currency = bal.xpath('Amt').attribute('Ccy').value
@@ -115,7 +115,10 @@ module SepaFileParser
115
115
  end
116
116
 
117
117
  def creditor_identifier # May be missing
118
- @creditor_identifier ||= xml_data.xpath('RltdPties/Cdtr/Id/PrvtId/Othr/Id/text()').text
118
+ @creditor_identifier ||= [
119
+ xml_data.xpath('RltdPties/Cdtr/Id/PrvtId/Othr/Id/text()'),
120
+ xml_data.xpath('RltdPties/Cdtr/Pty/Id/PrvtId/Othr/Id/text()'),
121
+ ].reject(&:empty?).first.text
119
122
  end
120
123
 
121
124
  def payment_information # May be missing
@@ -5,6 +5,7 @@ require_relative './xml'
5
5
  # Add registrations
6
6
  ## CAMT052
7
7
  SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:camt.052.001.02', :camt052)
8
+ SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:camt.052.001.08', :camt052)
8
9
 
9
10
  ## CAMT053
10
11
  SepaFileParser::Xml.register('urn:iso:std:iso:20022:tech:xsd:camt.053.001.02', :camt053)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SepaFileParser
4
- VERSION = '0.4.0'.freeze
4
+ VERSION = '0.5.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa_file_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Schoknecht
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-15 00:00:00.000000000 Z
10
+ date: 2025-03-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake