issuer_response_codes 0.2.2 → 0.2.3

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: ad61b730d7f8151c677659149d3e2f9f52416a252978d330586e45468ec9a36c
4
- data.tar.gz: fdde772836f137b8824fd4722373b9a3c3269a2e0f3fa309bfe9aa0ea721aebd
3
+ metadata.gz: 48a86fdf7a496cf0d8c922c64ede30d1e01721e6838eb4b010624bf0d0730327
4
+ data.tar.gz: 96460d711e7886f3e70a4cd9aae0c6abf208c8f3cc50487e3ac536fa0dd640d2
5
5
  SHA512:
6
- metadata.gz: 6266292743bb5a74798642b73c8eb14516fe70827e3d2db872b3f04e82d601fc8c64a32a736e4eee1c53580a365fc119d8cab87112b3d6be050acde4fe02d0cb
7
- data.tar.gz: 4eedf727e8ba8f84072f9b36ca66f9b47772d4bf2c91cdcc858c945adf9c712573c6f463260f7095762e7ebb7df2840d15349ddcff3b3c501be294a6333edafa
6
+ metadata.gz: 1b07bb422b09284e992ffa9342e8057ccb1cf46ea7ac84e29b593023a538f80722a7a55ae9dd2c780eb2c4a1b024e0f60d4ab968d38b4f181e0dec110319a9c8
7
+ data.tar.gz: 4de04dd09115486f6a29b943d346dff426549277acf4f776a053311033d157e772cdd665cad2fe816335d3bedf350d6b135bda10d012f8efbc2ab94e03d188d3
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ issuer_response_codes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- issuer_response_codes (0.2.2)
4
+ issuer_response_codes (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -22,6 +22,40 @@ module IssuerResponseCodes
22
22
  result.gsub(/%{substitute}/, substitute)
23
23
  end
24
24
 
25
+ def issuer_response_codes(locale: :en)
26
+ behaviours = locale_hash.dig(locale, :issuer_response_codes, :behaviour)
27
+ cardholder_reasons = locale_hash.dig(locale, :issuer_response_codes, :targeted, :cardholder)
28
+ merchant_reasons = locale_hash.dig(locale, :issuer_response_codes, :targeted, :merchant)
29
+
30
+ merchant_reasons.map do |code, merchant_reason|
31
+ [
32
+ code,
33
+ {
34
+ merchant_reason: merchant_reason,
35
+ cardholder_reason: cardholder_reasons[code],
36
+ behaviour: behaviours[code]
37
+ }
38
+ ]
39
+ end.to_h
40
+ end
41
+
42
+ def tds_codes(locale: :en)
43
+ behaviours = locale_hash.dig(locale, :tds_status_codes, :behaviour)
44
+ cardholder_reasons = locale_hash.dig(locale, :tds_status_codes, :targeted, :cardholder)
45
+ merchant_reasons = locale_hash.dig(locale, :tds_status_codes, :targeted, :merchant)
46
+
47
+ merchant_reasons.map do |code, merchant_reason|
48
+ [
49
+ code,
50
+ {
51
+ merchant_reason: merchant_reason,
52
+ cardholder_reason: cardholder_reasons[code],
53
+ behaviour: behaviours[code]
54
+ }
55
+ ]
56
+ end.to_h
57
+ end
58
+
25
59
  def self.symbolize_keys(hash)
26
60
  h = hash.map do |k, v|
27
61
  v_sym = if v.instance_of? Hash
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IssuerResponseCodes
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: issuer_response_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Espago
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-09-06 00:00:00.000000000 Z
12
+ date: 2021-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -119,6 +119,7 @@ extra_rdoc_files: []
119
119
  files:
120
120
  - ".gitignore"
121
121
  - ".rubocop.yml"
122
+ - ".ruby-gemset"
122
123
  - ".ruby-version"
123
124
  - ".travis.yml"
124
125
  - ".vscode/extensions.json"