issuer_response_codes 0.2.1 → 0.2.5

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: 02f7ca39c355badd05b7083f83789aa3d9271b0195d5955d2247548d8dd67d27
4
- data.tar.gz: fad7b1f3758eb3211fd04a62155883d64939dc04382f4288ba45d2bc3aad8b59
3
+ metadata.gz: 37ba4c8ea618ac92cad2812d33718b65dc667a9cd33c74f9022682490c6c262a
4
+ data.tar.gz: ce06e7107a1138c0c681a78bf03e8336eaa5ef9745c58c9781dedf221e1b9c14
5
5
  SHA512:
6
- metadata.gz: c3896b85d20055b822c6d07bb30ea0cff9f091e559166135339c3e6e2b8ebb5a29574b22446c2635cfc13790175510435ebc9f9d24975daf17a548cca3905140
7
- data.tar.gz: 4806b6ace9f4c153aa9e0f56d25c7d940fc8033eab73a569511244d74b207b683f2dc9da056ba980abaeda98255eafcf4f5acdb3cbdd7ec681b4b5f0c966ba15
6
+ metadata.gz: fc4cc8e087f2c0b4d44a14de3cb4ba06b171880fe0a77ed65677fea7d8b26ebbb4a6ec3e53e55ca41ff3c71e131cc59c4f00a3f66356a97f24fd995bc098c5fd
7
+ data.tar.gz: dde8649dc04e1243d070774403c28697b4e0cdd33ebbc8f8b37f8ed6cafbe16b134fdb9c38cc54c96863bcdc7b33c94357360d4b846ea8eae30973e8cee62454
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.1)
4
+ issuer_response_codes (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # IssuerResponseCodes
2
2
 
3
- This gem provides a quite comprehensive library of Issuer Response Code and 3D-Secure Status Code descriptions (for both cardholders and merchants) with suggested actions in 7 languages:
3
+ This gem provides a quite comprehensive library of Issuer Response Code and 3D-Secure Status Code descriptions (for both cardholders and merchants) with suggested actions in 9 languages:
4
4
  - Complete locales:
5
5
  - en
6
6
  - pl
7
7
 
8
8
  - Incomplete locales:
9
9
  - da
10
+ - de
10
11
  - ee
12
+ - it
11
13
  - lt
12
14
  - lv
13
15
  - sv
@@ -11,7 +11,7 @@ module IssuerResponseCodes
11
11
  @target = target
12
12
  @locale = locale
13
13
 
14
- raise IllegalLocale, "No such locale: #{locale.inspect}" unless AVAILABLE_LOCALES.include?(locale)
14
+ @locale = :en unless AVAILABLE_LOCALES.include?(locale)
15
15
  raise IllegalTarget, "No such target: #{target.inspect}" unless AVAILABLE_TARGETS.include?(target)
16
16
 
17
17
  if fraud_notice != NOT_PROVIDED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yaml'
4
- require 'byebug'
5
4
 
6
5
  module IssuerResponseCodes
7
6
  class LocaleLibrary
@@ -23,6 +22,44 @@ module IssuerResponseCodes
23
22
  result.gsub(/%{substitute}/, substitute)
24
23
  end
25
24
 
25
+ def issuer_response_codes(locale: :en)
26
+ fraudulent_codes = locale_hash.dig(locale, :issuer_response_codes, :fraudulent_codes)
27
+ behaviours = locale_hash.dig(locale, :issuer_response_codes, :behaviour)
28
+ cardholder_reasons = locale_hash.dig(locale, :issuer_response_codes, :targeted, :cardholder)
29
+ merchant_reasons = locale_hash.dig(locale, :issuer_response_codes, :targeted, :merchant)
30
+
31
+ merchant_reasons.map do |code, merchant_reason|
32
+ [
33
+ code,
34
+ {
35
+ merchant_reason: merchant_reason,
36
+ cardholder_reason: cardholder_reasons[code],
37
+ behaviour: behaviours[code],
38
+ fraudulent: fraudulent_codes[code] == true
39
+ }
40
+ ]
41
+ end.to_h
42
+ end
43
+
44
+ def tds_codes(locale: :en)
45
+ fraudulent_codes = locale_hash.dig(locale, :tds_status_codes, :fraudulent_codes)
46
+ behaviours = locale_hash.dig(locale, :tds_status_codes, :behaviour)
47
+ cardholder_reasons = locale_hash.dig(locale, :tds_status_codes, :targeted, :cardholder)
48
+ merchant_reasons = locale_hash.dig(locale, :tds_status_codes, :targeted, :merchant)
49
+
50
+ merchant_reasons.map do |code, merchant_reason|
51
+ [
52
+ code,
53
+ {
54
+ merchant_reason: merchant_reason,
55
+ cardholder_reason: cardholder_reasons[code],
56
+ behaviour: behaviours[code],
57
+ fraudulent: fraudulent_codes[code] == true
58
+ }
59
+ ]
60
+ end.to_h
61
+ end
62
+
26
63
  def self.symbolize_keys(hash)
27
64
  h = hash.map do |k, v|
28
65
  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.1'
4
+ VERSION = '0.2.5'
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: issuer_response_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Espago
8
8
  - Mateusz Drewniak
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-07-08 00:00:00.000000000 Z
12
+ date: 2021-09-08 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"
@@ -153,7 +154,7 @@ licenses:
153
154
  metadata:
154
155
  homepage_uri: https://github.com/espago/issuer_response_codes
155
156
  source_code_uri: https://github.com/espago/issuer_response_codes
156
- post_install_message:
157
+ post_install_message:
157
158
  rdoc_options: []
158
159
  require_paths:
159
160
  - lib
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  version: '0'
170
171
  requirements: []
171
172
  rubygems_version: 3.1.4
172
- signing_key:
173
+ signing_key:
173
174
  specification_version: 4
174
175
  summary: Issuer Response Code descriptions for cardholders and merchants
175
176
  test_files: []