issuer_response_codes 0.1.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 +7 -0
- data/.byebug_history +38 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +75 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/.vscode/extensions.json +12 -0
- data/.vscode/settings.json +11 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +82 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +221 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/issuer_response_codes.gemspec +34 -0
- data/lib/issuer_response_codes.rb +16 -0
- data/lib/issuer_response_codes/code.rb +40 -0
- data/lib/issuer_response_codes/context.rb +28 -0
- data/lib/issuer_response_codes/locale_library.rb +65 -0
- data/lib/issuer_response_codes/version.rb +5 -0
- data/lib/locale/da.yml +89 -0
- data/lib/locale/ee.yml +89 -0
- data/lib/locale/en.yml +87 -0
- data/lib/locale/lt.yml +89 -0
- data/lib/locale/lv.yml +90 -0
- data/lib/locale/pl.yml +87 -0
- data/lib/locale/sv.yml +89 -0
- metadata +145 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7dbb167d16f432e8a8113006dc1d2591b05c96ed6141fc0c1532c9b1e241ebf
|
4
|
+
data.tar.gz: 3b5101d1027157edad887ee134551adffbd8a79210f238230d98091fd2b817df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b4d8a1836429d54ee6ed64f408f3fa6c108047f8266e1f91253e362e7234805ff27f66ccd0ea953cdfe0124f6ec30b903ec74eec4a280e843aef4b0273578b8
|
7
|
+
data.tar.gz: 1fb3f071324d4cdd7d1d63272ac82c86258f4509ba4cf2bf45cdb3245f85bd44ef7ae3ab70036213487dba5f4cbb1da0385ccb1ff9469e7eef185beb73baf396
|
data/.byebug_history
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
c
|
2
|
+
scope.empty?
|
3
|
+
scope
|
4
|
+
path
|
5
|
+
scope
|
6
|
+
default_path_array
|
7
|
+
default
|
8
|
+
exit
|
9
|
+
c
|
10
|
+
locale_hash.dig(*[:issuer_response_codes, :targeted, :merchant, :"04"])
|
11
|
+
locale_hash.dig()
|
12
|
+
full_path_array
|
13
|
+
result
|
14
|
+
c
|
15
|
+
IssuerResponseCodes::LOCALE_LIBRARY.locale[:da]
|
16
|
+
IssuerResponseCodes::LOCALE_LIBRARY.locale
|
17
|
+
IssuerResponseCodes::LOCALE_LIBRARY
|
18
|
+
c
|
19
|
+
hash
|
20
|
+
c
|
21
|
+
hash
|
22
|
+
c
|
23
|
+
exit
|
24
|
+
c
|
25
|
+
name
|
26
|
+
::YAML.load_file("lib/locale/#{name}.yml")
|
27
|
+
c
|
28
|
+
hash
|
29
|
+
exit
|
30
|
+
c
|
31
|
+
locale_hash.symbolize_keys
|
32
|
+
locale_hash
|
33
|
+
exit
|
34
|
+
IssuerResponseCodes::LOCALE_LIBRARY
|
35
|
+
LOCALE_LIBRARY
|
36
|
+
c
|
37
|
+
YAML.load_file('lib/locale/da.yml')
|
38
|
+
YAML.load_file('locale/da.yml')
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
Style/StringLiterals:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Layout/LineLength:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/Documentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Style/ClassAndModuleChildren:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Style/MethodCallWithArgsParentheses:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/ModuleFunction:
|
17
|
+
EnforcedStyle: 'extend_self'
|
18
|
+
|
19
|
+
Style/MissingElse:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Lint/NumberConversion:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Lint/ConstantResolution:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/RescueStandardError:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/FormatStringToken:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/FormatString:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/DocumentationMethod:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Style/Copyright:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Style/StringHashKeys:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Style/InlineComment:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Layout/FirstHashElementLineBreak:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Layout/FirstMethodArgumentLineBreak:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Style/ConstantVisibility:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Layout/FirstArrayElementLineBreak:
|
59
|
+
Enabled: false
|
60
|
+
|
61
|
+
Layout/MultilineMethodArgumentLineBreaks:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
Layout/MultilineAssignmentLayout:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
Bundler/GemComment:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
AllCops:
|
71
|
+
EnabledByDefault: true
|
72
|
+
Exclude:
|
73
|
+
- 'bin/*'
|
74
|
+
- 'spec/**/*'
|
75
|
+
- 'test/**/*'
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.2
|
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"recommendations": [
|
3
|
+
"codezombiech.gitignore",
|
4
|
+
"yzhang.markdown-all-in-one",
|
5
|
+
"rebornix.ruby",
|
6
|
+
"misogi.ruby-rubocop",
|
7
|
+
"wingrunr21.vscode-ruby",
|
8
|
+
"redhat.vscode-yaml",
|
9
|
+
"castwide.solargraph",
|
10
|
+
"streetsidesoftware.code-spell-checker"
|
11
|
+
]
|
12
|
+
}
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
issuer_response_codes (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
backport (1.1.2)
|
11
|
+
benchmark (0.1.1)
|
12
|
+
bundler-audit (0.8.0)
|
13
|
+
bundler (>= 1.2.0, < 3)
|
14
|
+
thor (~> 1.0)
|
15
|
+
byebug (11.1.3)
|
16
|
+
e2mmap (0.1.0)
|
17
|
+
jaro_winkler (1.5.4)
|
18
|
+
kramdown (2.3.1)
|
19
|
+
rexml
|
20
|
+
kramdown-parser-gfm (1.1.0)
|
21
|
+
kramdown (~> 2.0)
|
22
|
+
mini_portile2 (2.5.1)
|
23
|
+
minitest (5.14.4)
|
24
|
+
nokogiri (1.11.3)
|
25
|
+
mini_portile2 (~> 2.5.0)
|
26
|
+
racc (~> 1.4)
|
27
|
+
parallel (1.20.1)
|
28
|
+
parser (3.0.1.1)
|
29
|
+
ast (~> 2.4.1)
|
30
|
+
racc (1.5.2)
|
31
|
+
rainbow (3.0.0)
|
32
|
+
rake (12.3.3)
|
33
|
+
regexp_parser (2.1.1)
|
34
|
+
reverse_markdown (2.0.0)
|
35
|
+
nokogiri
|
36
|
+
rexml (3.2.5)
|
37
|
+
rubocop (1.14.0)
|
38
|
+
parallel (~> 1.10)
|
39
|
+
parser (>= 3.0.0.0)
|
40
|
+
rainbow (>= 2.2.2, < 4.0)
|
41
|
+
regexp_parser (>= 1.8, < 3.0)
|
42
|
+
rexml
|
43
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
44
|
+
ruby-progressbar (~> 1.7)
|
45
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
46
|
+
rubocop-ast (1.5.0)
|
47
|
+
parser (>= 3.0.1.1)
|
48
|
+
ruby-progressbar (1.11.0)
|
49
|
+
solargraph (0.40.4)
|
50
|
+
backport (~> 1.1)
|
51
|
+
benchmark
|
52
|
+
bundler (>= 1.17.2)
|
53
|
+
e2mmap
|
54
|
+
jaro_winkler (~> 1.5)
|
55
|
+
kramdown (~> 2.3)
|
56
|
+
kramdown-parser-gfm (~> 1.1)
|
57
|
+
parser (~> 3.0)
|
58
|
+
reverse_markdown (>= 1.0.5, < 3)
|
59
|
+
rubocop (>= 0.52)
|
60
|
+
thor (~> 1.0)
|
61
|
+
tilt (~> 2.0)
|
62
|
+
yard (~> 0.9, >= 0.9.24)
|
63
|
+
thor (1.1.0)
|
64
|
+
tilt (2.0.10)
|
65
|
+
unicode-display_width (2.0.0)
|
66
|
+
yard (0.9.26)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
ruby
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
bundler
|
73
|
+
bundler-audit
|
74
|
+
byebug
|
75
|
+
issuer_response_codes!
|
76
|
+
minitest (~> 5.0)
|
77
|
+
rake (~> 12.0)
|
78
|
+
rubocop
|
79
|
+
solargraph
|
80
|
+
|
81
|
+
BUNDLED WITH
|
82
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Espago
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Espago
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
# IssuerResponseCodes
|
2
|
+
|
3
|
+
This gem provides a quite comprehensive library of Issuer Response Code descriptions (for both cardholders and merchants) with suggested actions in 7 languages:
|
4
|
+
- Complete locales:
|
5
|
+
- en
|
6
|
+
- pl
|
7
|
+
|
8
|
+
- Incomplete locales:
|
9
|
+
- da
|
10
|
+
- ee
|
11
|
+
- lt
|
12
|
+
- lv
|
13
|
+
- sv
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'issuer_response_codes'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install issuer_response_codes
|
30
|
+
|
31
|
+
### Rails
|
32
|
+
|
33
|
+
For Rails projects, we highly encourage you to create a brand new initializer like `config/initializers/issuer_response_codes.rb`. You can then define your own context with the desired default options like so:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# config/initializers/issuer_response_codes.rb
|
37
|
+
# frozen_string_literal: true
|
38
|
+
|
39
|
+
ISSUER_RESPONSE_CODES = ::IssuerResponseCodes::Context.new(
|
40
|
+
default_target: :merchant,
|
41
|
+
default_locale: :en,
|
42
|
+
fraud_notice_by_default: false # decide whether fraud attempt warnings/notices should
|
43
|
+
# be added to code descriptions by default
|
44
|
+
)
|
45
|
+
```
|
46
|
+
|
47
|
+
Afterwards, all Issuer Response Codes you create using this context as a proxy will use these settings by default (You can always override them).
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
# app/models/some_model.rb
|
51
|
+
|
52
|
+
def response_code_description
|
53
|
+
::ISSUER_RESPONSE_CODES.code(id: '43').description
|
54
|
+
#=> "Stolen card. Please contact your card issuer to get more details and try again later."
|
55
|
+
|
56
|
+
::ISSUER_RESPONSE_CODES.code(id: '43', fraud_notice: true).description
|
57
|
+
#=> "Stolen card. Please contact your card issuer to get more details and try again later. IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!"
|
58
|
+
|
59
|
+
::ISSUER_RESPONSE_CODES.code(id: '43', locale: :pl).description
|
60
|
+
#=> "Karta oznaczona jako skradziona. Skontaktuj się z Twoim bankiem w celu wyjaśnienia przyczyny problemu."
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
## Usage
|
65
|
+
|
66
|
+
This gem provides an easy way of handling Issuer Response Codes. Whether you need detailed descriptions, short reasons or suggestions of what to do when a certain Code appeared, we've got you covered. Certain more explicit codes like `Stolen card' are masked behind more generic terms when you choose to target cardholders.
|
67
|
+
|
68
|
+
### IssuerResponseCodes::Code
|
69
|
+
#### Creation options
|
70
|
+
|
71
|
+
##### Targets
|
72
|
+
|
73
|
+
You can choose the main target of these descriptions (certain details are hidden for cardholders)
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
# Default values are as follows:
|
77
|
+
# target: :merchant, locale: :en, fraud_notice: true
|
78
|
+
|
79
|
+
# fraud_notice is set to true by default when target = :merchant
|
80
|
+
code = ::IssuerResponseCodes::Code.new(id: '43')
|
81
|
+
code.reason #=> "Stolen card."
|
82
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later. IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!"
|
83
|
+
|
84
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :merchant)
|
85
|
+
code.reason #=> "Stolen card."
|
86
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later. IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!"
|
87
|
+
|
88
|
+
# fraud_notice is set to false by default when target = :cardholder
|
89
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :cardholder)
|
90
|
+
code.reason #=> "Your bank has declined this transaction."
|
91
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later."
|
92
|
+
```
|
93
|
+
|
94
|
+
##### Fraud notice
|
95
|
+
|
96
|
+
Certain Issuer Response Codes may signify that the transaction may be viewed as a fraud attempt. As such this gem provides appropriate warnings. You can manually decide whether these warnings/notices should be added to descriptions or behaviour suggestions generated by this gem.
|
97
|
+
|
98
|
+
By default descriptions targeted at merchants have these warnings, while those targeted at cardholders omit them.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :merchant)
|
102
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later. IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!"
|
103
|
+
|
104
|
+
# fraud_notice is set to false by default when target = :cardholder
|
105
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :cardholder)
|
106
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later."
|
107
|
+
```
|
108
|
+
|
109
|
+
This however can be overridden by explicitly passing the `fraud_notice` keyword parameter
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
# default options can be overridden
|
113
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :merchant, fraud_notice: false)
|
114
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later."
|
115
|
+
|
116
|
+
# fraud_notice is set to false by default when target = :cardholder
|
117
|
+
code = ::IssuerResponseCodes::Code.new(id: '43', target: :cardholder, fraud_notice: true)
|
118
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later. IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!"
|
119
|
+
```
|
120
|
+
|
121
|
+
##### Locale
|
122
|
+
|
123
|
+
The default locale is `:en`. There are 7 in total: `%i[en pl da ee lt lv sv]`. Only the first two are complete, the rest are partially in English.
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
code = ::IssuerResponseCodes::Code.new(id: '54')
|
127
|
+
code.reason #=> "Expired card."
|
128
|
+
|
129
|
+
code = ::IssuerResponseCodes::Code.new(id: '54', locale: :en)
|
130
|
+
code.reason #=> "Expired card."
|
131
|
+
|
132
|
+
code = ::IssuerResponseCodes::Code.new(id: '54', locale: :pl)
|
133
|
+
code.reason #=> "Karta utraciła ważność."
|
134
|
+
```
|
135
|
+
|
136
|
+
#### Methods
|
137
|
+
|
138
|
+
##### Reason
|
139
|
+
|
140
|
+
The `reason` method returns a relatively short description of the main reason why the Issuer Response Code appeared in the first place.
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
code = ::IssuerResponseCodes::Code.new(id: '14')
|
144
|
+
code.reason #=> "Invalid card number."
|
145
|
+
|
146
|
+
code = ::IssuerResponseCodes::Code.new(id: '51')
|
147
|
+
code.reason #=> "Insufficient funds."
|
148
|
+
|
149
|
+
code = ::IssuerResponseCodes::Code.new(id: '59')
|
150
|
+
code.reason #=> "Your bank has declined this transaction"
|
151
|
+
```
|
152
|
+
|
153
|
+
##### Behaviour
|
154
|
+
|
155
|
+
The `behaviour` method returns a suggestion of what to do when the Issuer Response Code appeared. Mainly for cardholders.
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
code = ::IssuerResponseCodes::Code.new(id: '14')
|
159
|
+
code.behaviour #=> "Check entered data and try again."
|
160
|
+
|
161
|
+
code = ::IssuerResponseCodes::Code.new(id: '51')
|
162
|
+
code.behaviour #=> "Please check funds on your account and try again later."
|
163
|
+
|
164
|
+
code = ::IssuerResponseCodes::Code.new(id: '59')
|
165
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later."
|
166
|
+
```
|
167
|
+
|
168
|
+
##### Description
|
169
|
+
|
170
|
+
The `description` method is a combination of both the `reason` and `behaviour` of a Issuer Response Code
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
code = ::IssuerResponseCodes::Code.new(id: '14')
|
174
|
+
code.description #=> "Invalid card number. Check entered data and try again."
|
175
|
+
|
176
|
+
code = ::IssuerResponseCodes::Code.new(id: '51')
|
177
|
+
code.description #=> "Insufficient funds. Please check funds on your account and try again later."
|
178
|
+
|
179
|
+
code = ::IssuerResponseCodes::Code.new(id: '59')
|
180
|
+
code.description #=> "Your bank has declined this transaction. Please contact your card issuer to get more details and try again later."
|
181
|
+
```
|
182
|
+
|
183
|
+
### Custom default configuration
|
184
|
+
|
185
|
+
You can make use of the `Context` class to easily create your own default configurations. Contexts work as proxies which create codes for you.
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
# non-standard default configuration
|
189
|
+
ISSUER_RESPONSE_CODES = ::IssuerResponseCodes::Context.new(
|
190
|
+
default_target: :cardholder,
|
191
|
+
default_locale: :pl,
|
192
|
+
fraud_notice_by_default: true # decide whether fraud attempt warnings/notices should
|
193
|
+
# be added to code descriptions by default
|
194
|
+
)
|
195
|
+
|
196
|
+
# now just use this object as a proxy
|
197
|
+
code = ISSUER_RESPONSE_CODE.code(id: '43')
|
198
|
+
code.reason #=> "Bank odrzucił autoryzację."
|
199
|
+
code.behaviour #=> "Skontaktuj się z Twoim bankiem w celu wyjaśnienia przyczyny problemu. UWAGA: Nie należy powtarzać obciążeń dla tej karty! Może to zostać uznane za próbę oszustwa!"
|
200
|
+
|
201
|
+
# these can always be overridden
|
202
|
+
code = ISSUER_RESPONSE_CODE.code(id: '43', locale: :en, target: :merchant, fraud_notice: false)
|
203
|
+
code.reason #=> "Stolen card."
|
204
|
+
code.behaviour #=> "Please contact your card issuer to get more details and try again later."
|
205
|
+
```
|
206
|
+
|
207
|
+
|
208
|
+
## Development
|
209
|
+
|
210
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
211
|
+
|
212
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
213
|
+
|
214
|
+
## Contributing
|
215
|
+
|
216
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/espago/issuer_response_codes.
|
217
|
+
|
218
|
+
|
219
|
+
## License
|
220
|
+
|
221
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|