issuer_response_codes 0.2.0 → 0.2.1

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: 0fdf114e3233ad8d9aa121a2c12bc2819e9c110c6671a4e364ae00f5a69987e9
4
- data.tar.gz: 9e22b8b8973d9577b47623b921ef0e2b2ea470b8175861b836656ec57fe35aac
3
+ metadata.gz: 02f7ca39c355badd05b7083f83789aa3d9271b0195d5955d2247548d8dd67d27
4
+ data.tar.gz: fad7b1f3758eb3211fd04a62155883d64939dc04382f4288ba45d2bc3aad8b59
5
5
  SHA512:
6
- metadata.gz: 238de0b95f1203dc1d93855c8badca49bd5792e3ad43c3ffb7d7df078cae4c68bf7bd28ae77204ffdf733d671a4c873e1e43a574169ce9185e720bdc26be44fc
7
- data.tar.gz: 5d537189d5e4c074ec9fd4b4cbce724f97b9c2d64697a103be37fa1d348ff469d92fd697fe3b3dcaab3b34eca21ff7486ae880a0310297e1f08e1dd5fe7944df
6
+ metadata.gz: c3896b85d20055b822c6d07bb30ea0cff9f091e559166135339c3e6e2b8ebb5a29574b22446c2635cfc13790175510435ebc9f9d24975daf17a548cca3905140
7
+ data.tar.gz: 4806b6ace9f4c153aa9e0f56d25c7d940fc8033eab73a569511244d74b207b683f2dc9da056ba980abaeda98255eafcf4f5acdb3cbdd7ec681b4b5f0c966ba15
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- issuer_response_codes (0.2.0)
4
+ issuer_response_codes (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -176,7 +176,7 @@ code = ::IssuerResponseCodes::Code.new(id: '59')
176
176
  code.behaviour #=> "Please contact your card issuer to get more details and try again later."
177
177
  ```
178
178
 
179
- ##### description
179
+ ##### description/humanize
180
180
 
181
181
  The `description` method (aliased as `humanize`) is a combination of both the `reason` and `behaviour` of a Issuer Response Code
182
182
 
@@ -219,14 +219,41 @@ You can choose the main target of these descriptions (certain details are hidden
219
219
 
220
220
  # fraud_notice is set to true by default when target = :merchant
221
221
  code = ::IssuerResponseCodes::TdsCode.new(id: '11')
222
- code.reason #=> "Suspected fraud"
222
+ code.reason #=> "Suspected fraud."
223
223
 
224
224
  code = ::IssuerResponseCodes::TdsCode.new(id: '11', target: :merchant)
225
- code.reason #=> "Suspected fraud"
225
+ code.reason #=> "Suspected fraud."
226
226
 
227
227
  # fraud_notice is set to false by default when target = :cardholder
228
228
  code = ::IssuerResponseCodes::TdsCode.new(id: '11', target: :cardholder)
229
- code.reason #=> "Card authentication failed"
229
+ code.reason #=> "Card authentication failed."
230
+ ```
231
+
232
+ ##### Fraud notice
233
+
234
+ Certain 3D-Secure status 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.
235
+
236
+ By default descriptions targeted at merchants have these warnings, while those targeted at cardholders omit them.
237
+
238
+ ```ruby
239
+ code = ::IssuerResponseCodes::TdsCode.new(id: '09', target: :merchant)
240
+ code.behaviour #=> "Please use a different card or contact issuer. Transactions with this code may be considered fraudulent."
241
+
242
+ # fraud_notice is set to false by default when target = :cardholder
243
+ code = ::IssuerResponseCodes::TdsCode.new(id: '09', target: :cardholder)
244
+ code.behaviour #=> "Please use a different card or contact issuer."
245
+ ```
246
+
247
+ This however can be overridden by explicitly passing the `fraud_notice` keyword parameter
248
+
249
+ ```ruby
250
+ # default options can be overridden
251
+ code = ::IssuerResponseCodes::TdsCode.new(id: '09', target: :merchant, fraud_notice: false)
252
+ code.behaviour #=> "Please use a different card or contact issuer."
253
+
254
+ # fraud_notice is set to false by default when target = :cardholder
255
+ code = ::IssuerResponseCodes::TdsCode.new(id: '09', target: :cardholder, fraud_notice: true)
256
+ code.behaviour #=> "Please use a different card or contact issuer. Transactions with this code may be considered fraudulent."
230
257
  ```
231
258
 
232
259
  ##### Locale
@@ -234,31 +261,61 @@ code.reason #=> "Card authentication failed"
234
261
  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.
235
262
 
236
263
  ```ruby
237
- code = ::IssuerResponseCodes::TdsCode.new(id: '11')
238
- code.reason #=> "Suspected fraud"
264
+ code = ::IssuerResponseCodes::TdsCode.new(id: '11', target: :cardholder)
265
+ code.reason #=> "Card authentication failed."
239
266
 
240
- code = ::IssuerResponseCodes::TdsCode.new(id: '11', locale: :en)
241
- code.reason #=> "Suspected fraud"
267
+ code = ::IssuerResponseCodes::TdsCode.new(id: '11', locale: :en, target: :cardholder)
268
+ code.reason #=> "Card authentication failed."
242
269
 
243
- code = ::IssuerResponseCodes::TdsCode.new(id: '11', locale: :pl)
244
- code.reason #=> "Podejrzenie oszustwa"
270
+ code = ::IssuerResponseCodes::TdsCode.new(id: '11', locale: :pl, target: :cardholder)
271
+ code.reason #=> "Negatywny wynik silnego uwierzytelnienia w systemie banku."
245
272
  ```
246
273
 
247
274
  #### Methods
248
275
 
249
- ##### description/reason
276
+ ##### reason
250
277
 
251
- The `description` (also aliased as `reason`) method returns a relatively short description of the main reason why the Issuer Response Code appeared in the first place.
278
+ The `reason` method returns a relatively short description of the main reason why the 3D-Secure status code appeared in the first place.
252
279
 
253
280
  ```ruby
254
- code = ::IssuerResponseCodes::TdsCode.new(id: '08')
255
- code.description #=> "No Card record"
281
+ code = ::IssuerResponseCodes::TdsCode.new(id: '01')
282
+ code.reason #=> "Card authentication failed."
256
283
 
257
- code = ::IssuerResponseCodes::TdsCode.new(id: '22')
258
- code.description #=> "ACS technical issue"
284
+ code = ::IssuerResponseCodes::TdsCode.new(id: '07')
285
+ code.reason #=> "Invalid transaction."
259
286
 
260
- code = ::IssuerResponseCodes::TdsCode.new(id: '26')
261
- code.description #=> "Authentication attempted but not performed by the cardholder"
287
+ code = ::IssuerResponseCodes::TdsCode.new(id: '20')
288
+ code.reason #=> "Non-Payment transaction not supported."
289
+ ```
290
+
291
+ ##### behaviour
292
+
293
+ The `behaviour` method returns a suggestion of what to do when the 3D-Secure status code appeared. Mainly for cardholders.
294
+
295
+ ```ruby
296
+ code = ::IssuerResponseCodes::TdsCode.new(id: '01')
297
+ code.behaviour #=> "Check entered data and try again."
298
+
299
+ code = ::IssuerResponseCodes::TdsCode.new(id: '07')
300
+ code.behaviour #=> "Please check funds on your account and try again later."
301
+
302
+ code = ::IssuerResponseCodes::TdsCode.new(id: '20')
303
+ code.behaviour #=> "Please contact your card issuer to get more details and try again later."
304
+ ```
305
+
306
+ ##### description/humanize
307
+
308
+ The `description` method (aliased as `humanize`) is a combination of both the `reason` and `behaviour` of a Issuer Response Code
309
+
310
+ ```ruby
311
+ code = ::IssuerResponseCodes::TdsCode.new(id: '01')
312
+ code.description #=> "Invalid card number. Check entered data and try again."
313
+
314
+ code = ::IssuerResponseCodes::TdsCode.new(id: '07')
315
+ code.description #=> "Insufficient funds. Please check funds on your account and try again later."
316
+
317
+ code = ::IssuerResponseCodes::TdsCode.new(id: '20')
318
+ code.description #=> "Your bank has declined this transaction. Please contact your card issuer to get more details and try again later."
262
319
  ```
263
320
 
264
321
  ##### fraudulent_code?
@@ -11,7 +11,7 @@ module IssuerResponseCodes
11
11
  class IllegalLocale < StandardError; end
12
12
 
13
13
  AVAILABLE_TARGETS = %i[merchant cardholder].freeze
14
- AVAILABLE_LOCALES = %i[en pl da ee lt lv sv].freeze
14
+ AVAILABLE_LOCALES = %i[en pl da de ee it lt lv sv].freeze
15
15
 
16
16
  LOCALE_LIBRARY = LocaleLibrary.new
17
17
  end
@@ -32,15 +32,15 @@ module IssuerResponseCodes
32
32
  LOCALE_LIBRARY.dig(path: id, scope: "issuer_response_codes.targeted.#{target}", locale: locale, default: :unknown)
33
33
  end
34
34
 
35
- def fraudulent_code?
36
- @fraudulent_code ||= LOCALE_LIBRARY.dig(path: id, scope: "issuer_response_codes.fraudulent_codes", locale: locale)
37
- end
38
-
39
35
  def behaviour
40
36
  behaviour_str = LOCALE_LIBRARY.dig(path: id, scope: "issuer_response_codes.behaviour", locale: locale, default: :unknown)
41
37
  return behaviour_str unless fraud_notice && fraudulent_code?
42
38
 
43
39
  "#{behaviour_str} #{LOCALE_LIBRARY.dig(path: 'issuer_response_codes.fraud_notice')}"
44
40
  end
41
+
42
+ def fraudulent_code?
43
+ @fraudulent_code ||= LOCALE_LIBRARY.dig(path: id, scope: "issuer_response_codes.fraudulent_codes", locale: locale)
44
+ end
45
45
  end
46
46
  end
@@ -1,33 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IssuerResponseCodes
4
- class TdsCode
5
- attr_reader :id, :target, :locale, :fraud_notice
6
-
7
- NOT_PROVIDED = ::Object.new
8
-
9
- def initialize(id:, target: :merchant, locale: :en, fraud_notice: NOT_PROVIDED)
10
- @id = id
11
- @target = target
12
- @locale = locale
13
-
14
- raise IllegalLocale, "No such locale: #{locale.inspect}" unless AVAILABLE_LOCALES.include?(locale)
15
- raise IllegalTarget, "No such target: #{target.inspect}" unless AVAILABLE_TARGETS.include?(target)
16
-
17
- if fraud_notice != NOT_PROVIDED
18
- @fraud_notice = fraud_notice
19
- return
20
- end
21
-
22
- @fraud_notice = target == :merchant
4
+ class TdsCode < Code
5
+ def humanize
6
+ "#{reason} #{behaviour}"
23
7
  end
24
8
 
9
+ alias description humanize
10
+
25
11
  def reason
26
12
  LOCALE_LIBRARY.dig(path: id, scope: "tds_status_codes.targeted.#{target}", locale: locale, default: :unknown)
27
13
  end
28
14
 
29
- alias humanize reason
30
- alias description reason
15
+ def behaviour
16
+ behaviour_str = LOCALE_LIBRARY.dig(path: id, scope: "tds_status_codes.behaviour", locale: locale, default: :unknown)
17
+ return behaviour_str unless fraud_notice && fraudulent_code?
18
+
19
+ "#{behaviour_str} #{LOCALE_LIBRARY.dig(path: 'tds_status_codes.fraud_notice')}"
20
+ end
31
21
 
32
22
  def fraudulent_code?
33
23
  @fraudulent_code ||= LOCALE_LIBRARY.dig(path: id, scope: "tds_status_codes.fraudulent_codes", locale: locale)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IssuerResponseCodes
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
data/lib/locale/da.yml CHANGED
@@ -4,43 +4,107 @@ da:
4
4
  '09': true
5
5
  '10': true
6
6
  '11': true
7
+ behaviour:
8
+ unknown: 'Please contact our support team.'
9
+ '01': Please try again.
10
+ '02': Please try again using a different device.
11
+ '03': Please try again using a different device.
12
+ '04': Please use a different card or contact your card issuer.
13
+ '05': Please use a different card.
14
+ '06': Please use a different card or check the card number.
15
+ '07': Please use a different card.
16
+ '08': Please use a different card.
17
+ '09': Please use a different card or contact issuer.
18
+ '10': Please use a different card or contact issuer.
19
+ '11': Please use a different card or contact issuer.
20
+ '12': Please use a different card or contact issuer.
21
+ '13': Please use a different card or contact issuer.
22
+ '14': Please try again or use a different card.
23
+ '15': Please use a different card or contact issuer.
24
+ '16': Please use a different card or contact issuer.
25
+ '17': Please use a different card or contact issuer.
26
+ '18': Please use a different card or contact issuer.
27
+ '19': Please use a different card or contact issuer.
28
+ '20': Please use a different card.
29
+ '21': Please use a different card.
30
+ '22': Please try again or use a different card.
31
+ '23': Please use a different card or contact issuer.
32
+ '24': Please try again or use a different card.
33
+ '25': Please try again or use a different card.
34
+ '26': Please try again or use a different card.
35
+ '80': Please use a different card.
36
+ '81': Please try again or use a different card.
37
+ '82': Please use a different card.
38
+ '83': Please use a different card.
39
+ '84': Please try again or use a different card.
40
+ '85': Please use a different card.
41
+ '86': Please use a different card.
42
+ '87': Please use a different card.
43
+ '88': Please use a different card.
7
44
  universal: &universal_tds_status_codes
8
45
  unknown: "Unknown reason."
9
- '01': Card authentication failed
10
- '02': Unknown Device
11
- '03': Unsupported Device
12
- '04': Exceeds authentication frequency limit
13
- '05': Expired card
14
- '06': Invalid card number
15
- '07': Invalid transaction
16
- '08': No Card record
17
- '12': Transaction not permitted to cardholder
18
- '13': Cardholder not enrolled in service
19
- '14': Transaction timed out at the ACS
20
- '15': Low confidence
21
- '16': Medium confidence
22
- '17': High confidence
23
- '18': Very High confidence
24
- '19': Exceeds ACS maximum challenges
25
- '20': Non-Payment transaction not supported
26
- '21': 3RI transaction not supported
27
- '22': ACS technical issue
28
- '23': Decoupled Authentication required by ACS but not requested by 3DS Requestor
29
- '24': 3DS Requestor Decoupled Max Expiry Time exceeded
30
- '25': Decoupled Authentication was provided insufficient time to authenticate cardholder. ACS will not make attempt
31
- '26': Authentication attempted but not performed by the cardholder
32
-
46
+ '01': Card authentication failed.
47
+ '02': Unknown Device.
48
+ '03': Unsupported Device.
49
+ '04': Exceeds authentication frequency limit.
50
+ '05': Expired card.
51
+ '06': Invalid card number.
52
+ '07': Invalid transaction.
53
+ '08': No Card record.
54
+ '15': Low confidence.
55
+ '16': Medium confidence.
56
+ '17': High confidence.
57
+ '18': Very High confidence.
58
+ '19': Exceeds ACS maximum challenges.
59
+ '20': Non-Payment transaction not supported.
33
60
  targeted:
34
- cardholder:
35
- <<: *universal_tds_status_codes
36
- '09': Card authentication failed # Security failure
37
- '10': Card authentication failed # Stolen card
38
- '11': Card authentication failed # Suspected fraud
39
61
  merchant:
40
62
  <<: *universal_tds_status_codes
41
- '09': Security failure
42
- '10': Stolen card
43
- '11': Suspected fraud
63
+ '09': Security failure.
64
+ '10': Stolen card.
65
+ '11': Suspected fraud.
66
+ '12': Transaction not permitted to cardholder.
67
+ '13': Cardholder not enrolled in service.
68
+ '14': Transaction timed out at the ACS.
69
+ '21': 3RI transaction not supported.
70
+ '22': ACS technical issue.
71
+ '23': Decoupled Authentication required by ACS but not requested by 3DS Requestor.
72
+ '24': 3DS Requestor Decoupled Max Expiry Time exceeded.
73
+ '25': Decoupled Authentication was provided insufficient time to authenticate cardholder. ACS will not make attempt.
74
+ '26': Authentication attempted but not performed by the cardholder.
75
+ '80': Error Connecting to ACS.
76
+ '81': ACS Timed Out.
77
+ '82': Invalid Response from ACS.
78
+ '83': System Error Response from ACS.
79
+ '84': Internal Error While Generating CAVV.
80
+ '85': VMID not eligible for requested program.
81
+ '86': Protocol Version Not Supported by ACS.
82
+ '87': Transaction is excluded from Attempts Processing (includes non- reloadable pre-paid cards and Non- Payments (NPA)).
83
+ '88': Requested program not supported by the ACS.
84
+ cardholder:
85
+ <<: *universal_tds_status_codes
86
+ '09': Card authentication failed. # Security failure
87
+ '10': Card authentication failed. # Stolen card
88
+ '11': Card authentication failed. # Suspected fraud
89
+ '12': Transaction not permitted to cardholder.
90
+ '13': Cardholder not enrolled in service.
91
+ '14': Card authentication failed.
92
+ '21': Card authentication failed.
93
+ '22': Issuer technical issue.
94
+ '23': Card authentication failed
95
+ '24': Card authentication failed
96
+ '25': Card authentication failed.
97
+ '26': Card authentication failed.
98
+ '80': Card authentication failed.
99
+ '81': Card authentication failed.
100
+ '82': Card authentication failed.
101
+ '83': Card authentication failed.
102
+ '84': Card authentication failed.
103
+ '85': Card authentication failed.
104
+ '86': Card authentication failed.
105
+ '87': Card authentication failed.
106
+ '88': Card authentication failed.
107
+
44
108
  issuer_response_codes:
45
109
  suggestion: 'Suggestion'
46
110
  fraud_notice: 'IMPORTANT NOTICE: It is forbidden to retry transactions that ended with this code. It may be recognized as a fraud attempt!'
@@ -49,40 +113,6 @@ da:
49
113
  '07': true
50
114
  '41': true
51
115
  '43': true
52
- universal: &issuer_response_code
53
- '00': "En fejl opstod. Transaktionen blev afvist af Elavon på grund af ikke-understøttet korttype eller forkerte kortdata, intet svar fra udsteder / bank eller inaktiv Merchant-konto."
54
- '05': "Banken har afvist transaktionen på grund af sikkerhedskontrol (brugt kort understøtter ikke tilbagebetalinger eller betaling uden CVV-kode), midlerne er blevet frosset eller grænsen overskredet, eller kortet understøtter ikke MOTO / internet-transaktioner."
55
- '13': "MOTO / eCommerce betalinger på kort er inaktive eller beløbsgrænse overstiger."
56
- '14': "Ugyldigt kortnummer."
57
- 'N7': "Negative CVV / CVC resultater."
58
- '51': "Ikke nok penge."
59
- '54': "Udgået kort."
60
- '57': "Banken har afvist transaktionen, da dette kreditkort ikke kan bruges til denne type transaktion (e-handel, MOTO eller tilbagevendende)."
61
- '61': "Banken har afvist transaktionen."
62
- '82': "Negative CVV / CVC resultater."
63
- # incomplete translations
64
- unknown: "Unknown reason."
65
- '01': "Authorization Error."
66
- '02': "Authorization Error."
67
- '03': "Authorization Error."
68
- '12': "No privileges to execute this transaction for your card."
69
- '30': "Your bank has declined this transaction"
70
- '58': "Your bank has declined this transaction as this credit card cannot be used for this type of transaction (eccommerce, MOTO or recurring)."
71
- '59': "Your bank has declined this transaction"
72
- '62': "Your card can be not supported due to restrictions placed on the card or Seller country exclusion (imposition an embargo), or bank blocked a card eg. due to unacceptable debit balance."
73
- '65': "Activity count limit exceeded."
74
- '75': "Invalid activity count limit exceeded."
75
- '78': "Inactive card."
76
- '91': "Temporary issuer error."
77
- '92': "Temporary issuer error."
78
- '94': "Temporary issuer error."
79
- '96': "Temporary issuer error."
80
- '98': "Temporary issuer error."
81
- 'E3': "Transaction not executed due to a 3D-Secure error."
82
- 'E4': "Transaction not executed due to a negative 3D-Secure confirmation from your bank."
83
- 'E5': "Temporary 3D-Secure error."
84
- 'R0': "Refused by Issuer because Customer requested stop of specific recurring payments."
85
- 'R1': "Refused by Issuer because Customer requested stop of all recurring payments."
86
116
  behaviour:
87
117
  '00': "Prøv igen senere, kontakt med sælger eller med Espago Support Team."
88
118
  '05': "Tjek venligst dine kortindstillinger for disse transaktionstyper eller brug et andet kort."
@@ -121,6 +151,40 @@ da:
121
151
  'E5': "Please try again later or contact your card issuer to get more details"
122
152
  'R0': "Please contact your card issuer to get more details and try again later."
123
153
  'R1': "Please contact your card issuer to get more details and try again later."
154
+ universal: &issuer_response_code
155
+ '00': "En fejl opstod. Transaktionen blev afvist af Elavon på grund af ikke-understøttet korttype eller forkerte kortdata, intet svar fra udsteder / bank eller inaktiv Merchant-konto."
156
+ '05': "Banken har afvist transaktionen på grund af sikkerhedskontrol (brugt kort understøtter ikke tilbagebetalinger eller betaling uden CVV-kode), midlerne er blevet frosset eller grænsen overskredet, eller kortet understøtter ikke MOTO / internet-transaktioner."
157
+ '13': "MOTO / eCommerce betalinger på kort er inaktive eller beløbsgrænse overstiger."
158
+ '14': "Ugyldigt kortnummer."
159
+ 'N7': "Negative CVV / CVC resultater."
160
+ '51': "Ikke nok penge."
161
+ '54': "Udgået kort."
162
+ '57': "Banken har afvist transaktionen, da dette kreditkort ikke kan bruges til denne type transaktion (e-handel, MOTO eller tilbagevendende)."
163
+ '61': "Banken har afvist transaktionen."
164
+ '82': "Negative CVV / CVC resultater."
165
+ # incomplete translations
166
+ unknown: "Unknown reason."
167
+ '01': "Authorization Error."
168
+ '02': "Authorization Error."
169
+ '03': "Authorization Error."
170
+ '12': "No privileges to execute this transaction for your card."
171
+ '30': "Your bank has declined this transaction"
172
+ '58': "Your bank has declined this transaction as this credit card cannot be used for this type of transaction (eccommerce, MOTO or recurring)."
173
+ '59': "Your bank has declined this transaction"
174
+ '62': "Your card can be not supported due to restrictions placed on the card or Seller country exclusion (imposition an embargo), or bank blocked a card eg. due to unacceptable debit balance."
175
+ '65': "Activity count limit exceeded."
176
+ '75': "Invalid activity count limit exceeded."
177
+ '78': "Inactive card."
178
+ '91': "Temporary issuer error."
179
+ '92': "Temporary issuer error."
180
+ '94': "Temporary issuer error."
181
+ '96': "Temporary issuer error."
182
+ '98': "Temporary issuer error."
183
+ 'E3': "Transaction not executed due to a 3D-Secure error."
184
+ 'E4': "Transaction not executed due to a negative 3D-Secure confirmation from your bank."
185
+ 'E5': "Temporary 3D-Secure error."
186
+ 'R0': "Refused by Issuer because Customer requested stop of specific recurring payments."
187
+ 'R1': "Refused by Issuer because Customer requested stop of all recurring payments."
124
188
  targeted:
125
189
  merchant:
126
190
  <<: *issuer_response_code