modulr-api 0.0.46 → 0.0.48

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: 45f16a01e7450ae71621e53a850720a9679124c4bc22db243da24916eee09229
4
- data.tar.gz: 1b67cded77fa55969e1024dfc676f06b5cd77cfd35153a801b9492c980f4e334
3
+ metadata.gz: 1ca930d3b546bcbb757139678544570bc83d2cc6503326e6d63edcf2fcc6466a
4
+ data.tar.gz: 918f36ba8ee50005ba51018e0cdfb66c823cc6223fc4a9a0f12e632381c31ad8
5
5
  SHA512:
6
- metadata.gz: a859137b06dd2fce7562b8e1f044991e9a53c0f529cb1390e182e5dab67eb30b68d3adec9f55b38d371458438287f64ed81c1b9b7522ee2412981b3e8c35d571
7
- data.tar.gz: 3b4fe0303298bebe102ea330c4b183f937304bac3ed548e0b0743c704fd92dbf495747c8463dec193d4ae7adb64cf4d7739fb2d62c491962412d4855e1bc23f7
6
+ metadata.gz: 14a434481e2c23bc2eff552068e2b71f37f83d06ee69b510daf9094d04bb16bf672ca0ffe5d72b75229d3d2a9792809e3eb8b7bf4a999807dc5137b6038c6c89
7
+ data.tar.gz: d28b6784863fd6e19420d84f5e2a6d1bdfd2cf1cdd50438bcd5c231a5cab1fa7c03cbc2a34e1708672891713f34a0055a49a2abcca2358546938d6c2654d6840
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulr-api (0.0.46)
4
+ modulr-api (0.0.48)
5
5
  faraday (~> 1.0)
6
6
  faraday_middleware (~> 1.0)
7
7
 
@@ -82,7 +82,7 @@ GEM
82
82
  rb-inotify (0.10.1)
83
83
  ffi (~> 1.0)
84
84
  regexp_parser (2.5.0)
85
- rexml (3.2.5)
85
+ rexml (3.4.2)
86
86
  rspec (3.10.0)
87
87
  rspec-core (~> 3.10.0)
88
88
  rspec-expectations (~> 3.10.0)
@@ -131,6 +131,7 @@ PLATFORMS
131
131
  arm64-darwin-21
132
132
  arm64-darwin-22
133
133
  arm64-darwin-23
134
+ arm64-darwin-25
134
135
  x86_64-darwin-20
135
136
  x86_64-darwin-22
136
137
  x86_64-linux
@@ -42,15 +42,27 @@ module Modulr
42
42
  return unless doc
43
43
 
44
44
  doc_type = doc.dig(:header, :type)
45
- key = doc_type.downcase.to_sym
45
+ credit_transfer = customer_credit_transfer(doc, doc_type)
46
+ end_to_end_id_from(doc_type, credit_transfer)
47
+ end
48
+
49
+ private def customer_credit_transfer(doc, doc_type)
50
+ return unless doc_type
51
+
52
+ document = doc.dig(doc_type.downcase.to_sym, :document)
53
+ return unless document
54
+
55
+ document[:fitoFICstmrCdtTrf] || document[:FIToFICstmrCdtTrf]
56
+ end
57
+
58
+ private def end_to_end_id_from(doc_type, credit_transfer)
59
+ return unless credit_transfer
46
60
 
47
61
  case doc_type
48
62
  when "IFCCTRNS" # SEPA instant
49
- doc.dig(key, :document, :fitoFICstmrCdtTrf, :cdtTrfTxInf, :pmtId, :endToEndId)
63
+ credit_transfer.dig(:cdtTrfTxInf, :pmtId, :endToEndId)
50
64
  when "FFCCTRNS" # SEPA regular
51
- doc.dig(key, :document, :fitoFICstmrCdtTrf, :cdtTrfTxInf).first&.dig(:pmtId, :endToEndId)
52
- when "PRTRN" # SEPA REVERSAL
53
- nil
65
+ credit_transfer[:cdtTrfTxInf]&.first&.dig(:pmtId, :endToEndId)
54
66
  end
55
67
  end
56
68
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modulr
4
- VERSION = "0.0.46"
4
+ VERSION = "0.0.48"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulr-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.46
4
+ version: 0.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aitor García Rey