hps 1.0.2 → 2.1.2

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -8
  3. data/LICENSE.txt +32 -32
  4. data/PRIVACY.txt +65 -65
  5. data/README.md +214 -41
  6. data/Rakefile +15 -15
  7. data/hps.gemspec +28 -26
  8. data/lib/hps.rb +48 -45
  9. data/lib/hps/configuration.rb +16 -16
  10. data/lib/hps/entities/hps_account_verify.rb +8 -8
  11. data/lib/hps/entities/hps_address.rb +6 -6
  12. data/lib/hps/entities/hps_authorization.rb +12 -12
  13. data/lib/hps/entities/hps_batch.rb +6 -6
  14. data/lib/hps/entities/hps_cardholder.rb +6 -10
  15. data/lib/hps/entities/hps_charge.rb +8 -8
  16. data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
  17. data/lib/hps/entities/hps_credit_card.rb +34 -33
  18. data/lib/hps/entities/hps_direct_market_data.rb +5 -0
  19. data/lib/hps/entities/hps_encryption_data.rb +6 -0
  20. data/lib/hps/entities/hps_refund.rb +8 -8
  21. data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
  22. data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
  23. data/lib/hps/entities/hps_reversal.rb +10 -10
  24. data/lib/hps/entities/hps_token_data.rb +10 -10
  25. data/lib/hps/entities/hps_track_data.rb +5 -0
  26. data/lib/hps/entities/hps_transaction.rb +161 -161
  27. data/lib/hps/entities/hps_transaction_details.rb +6 -6
  28. data/lib/hps/entities/hps_transaction_header.rb +8 -8
  29. data/lib/hps/entities/hps_transaction_type.rb +16 -16
  30. data/lib/hps/entities/hps_void.rb +8 -8
  31. data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
  32. data/lib/hps/infrastructure/authentication_exception.rb +11 -11
  33. data/lib/hps/infrastructure/card_exception.rb +15 -15
  34. data/lib/hps/infrastructure/exceptions.json +468 -468
  35. data/lib/hps/infrastructure/hps_exception.rb +25 -25
  36. data/lib/hps/infrastructure/hps_exception_mapper.rb +134 -134
  37. data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
  38. data/lib/hps/infrastructure/hps_track_data_method.rb +6 -0
  39. data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
  40. data/lib/hps/services/hps_batch_service.rb +29 -29
  41. data/lib/hps/services/hps_charge_service.rb +735 -635
  42. data/lib/hps/services/hps_service.rb +127 -128
  43. data/lib/hps/version.rb +3 -3
  44. data/tests/amex_tests.rb +292 -231
  45. data/tests/cert_tests.rb +80 -80
  46. data/tests/certification/card_present_spec.rb +320 -0
  47. data/tests/discover_tests.rb +386 -325
  48. data/tests/exception_mapper_tests.rb +244 -244
  49. data/tests/general_tests.rb +65 -57
  50. data/tests/hps_token_service.rb +56 -56
  51. data/tests/mastercard_tests.rb +387 -326
  52. data/tests/secret_key.rb +11 -11
  53. data/tests/test_data.rb +128 -128
  54. data/tests/test_helper.rb +115 -108
  55. data/tests/token_tests.rb +512 -512
  56. data/tests/visa_tests.rb +445 -378
  57. metadata +36 -3
@@ -1,245 +1,245 @@
1
- require 'hps'
2
-
3
-
4
- describe "ExceptionMapper Tests" do
5
-
6
- before(:all) do
7
- @mapper = Hps::ExceptionMapper.new
8
- end
9
-
10
-
11
- it "mapping version number accessible" do
12
- expect(@mapper.version_number).to eq("1.0.0")
13
- end
14
-
15
- # Issuer Exceptions
16
-
17
- it "issuer card declined test codes" do
18
-
19
- [ "02", "03", "04", "05", "41", "43", "44", "51", "56", "61", "62", "63", "65", "78" ].each { |code|
20
-
21
- result = @mapper.map_issuer_exception(1, code, "")
22
- expect(result.transaction_id).to eq(1)
23
- expect(result.code).to eq("card_declined")
24
- expect(result.message).to eq(message_for_code("Exception_Message_CardDeclined"))
25
- }
26
-
27
- end
28
-
29
- it "issuer processing error test codes" do
30
-
31
- [ "06", "07", "12", "15", "19", "12", "52", "53", "57", "58", "76", "77", "91", "96", "EC" ].each { |code|
32
-
33
- result = @mapper.map_issuer_exception(2, code, "")
34
- expect(result.transaction_id).to eq(2)
35
- expect(result.code).to eq("processing_error")
36
- expect(result.message).to eq(message_for_code("Exception_Message_ProcessingError"))
37
- }
38
-
39
- end
40
-
41
- it "issuer invalid amount test" do
42
- result = @mapper.map_issuer_exception(3, "13", "")
43
- expect(result.transaction_id).to eq(3)
44
- expect(result.code).to eq("invalid_amount")
45
- expect(result.message).to eq(message_for_code("Exception_Message_ChargeAmount"))
46
- end
47
-
48
- it "issuer incorrect number test" do
49
- result = @mapper.map_issuer_exception(4, "14", "")
50
- expect(result.transaction_id).to eq(4)
51
- expect(result.code).to eq("incorrect_number")
52
- expect(result.message).to eq(message_for_code("Exception_Message_IncorrectNumber"))
53
- end
54
-
55
- it "issuer expired card test" do
56
- result = @mapper.map_issuer_exception(5, "54", "")
57
- expect(result.transaction_id).to eq(5)
58
- expect(result.code).to eq("expired_card")
59
- expect(result.message).to eq(message_for_code("Exception_Message_CardExpired"))
60
- end
61
-
62
- it "issuer invalid pin test" do
63
- result = @mapper.map_issuer_exception(6, "55", "")
64
- expect(result.transaction_id).to eq(6)
65
- expect(result.code).to eq("invalid_pin")
66
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidPin"))
67
- end
68
-
69
- it "issuer pin retries exceeded test" do
70
- result = @mapper.map_issuer_exception(7, "75", "")
71
- expect(result.transaction_id).to eq(7)
72
- expect(result.code).to eq("pin_retries_exceeded")
73
- expect(result.message).to eq(message_for_code("Exception_Message_PinExceeded"))
74
- end
75
-
76
- it "issuer invalid expiry test" do
77
- result = @mapper.map_issuer_exception(8, "80", "")
78
- expect(result.transaction_id).to eq(8)
79
- expect(result.code).to eq("invalid_expiry")
80
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidExpiry"))
81
- end
82
-
83
- it "issuer pin verification test" do
84
- result = @mapper.map_issuer_exception(9, "86", "")
85
- expect(result.transaction_id).to eq(9)
86
- expect(result.code).to eq("pin_verification")
87
- expect(result.message).to eq(message_for_code("Exception_Message_PinVerification"))
88
- end
89
-
90
- it "issuer incorrect cvc test" do
91
- [ "EB", "N7" ].each { |code|
92
- result = @mapper.map_issuer_exception(10, code, "")
93
- expect(result.transaction_id).to eq(10)
94
- expect(result.code).to eq("incorrect_cvc")
95
- expect(result.message).to eq(message_for_code("Exception_Message_IncorrectCvc"))
96
- }
97
- end
98
-
99
- it "issuer unknown test" do
100
- result = @mapper.map_issuer_exception(11, "Foo", "Foo")
101
- expect(result.transaction_id).to eq(11)
102
- expect(result.code).to eq("unknown_card_exception")
103
- expect(result.message).to eq("Foo")
104
- end
105
-
106
- it "issuer nil test" do
107
- result = @mapper.map_issuer_exception(0, nil, nil)
108
- expect(result.transaction_id).to eq(0)
109
- expect(result.code).to eq("unknown_card_exception")
110
- expect(result.message).to eq("Hps::CardException")
111
- end
112
-
113
- # Gateway exceptions
114
-
115
- it "gateway authentication exception test" do
116
- result = @mapper.map_gateway_exception(0, "-2", nil)
117
- expect(result.code).to eq("unknown")
118
- expect(result.message).to eq(message_for_code("Exception_Message_AuthenticationError"))
119
- end
120
-
121
- it "gateway invalid request exception cpc test" do
122
- result = @mapper.map_gateway_exception(0, "12", nil)
123
- expect(result.param).to eq("card")
124
- expect(result.code).to eq("invalid_cpc_data")
125
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidCpcData"))
126
- end
127
-
128
- it "gateway invalid request exception card data test" do
129
- result = @mapper.map_gateway_exception(0, "13", nil)
130
- expect(result.param).to eq("card")
131
- expect(result.code).to eq("invalid_card_data")
132
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidCardData"))
133
- end
134
-
135
- it "gateway card exception test" do
136
- result = @mapper.map_gateway_exception(0, "14", nil)
137
- expect(result.code).to eq("invalid_number")
138
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidNumber"))
139
- end
140
-
141
- it "gateway message passthrough test" do
142
- result = @mapper.map_gateway_exception(0, "1", "Foo")
143
- expect(result.code).to eq("unknown")
144
- expect(result.message).to eq("Foo")
145
- end
146
-
147
- it "gateway invalid original transaction test" do
148
- result = @mapper.map_gateway_exception(0, "3", "Foo")
149
- expect(result.code).to eq("invalid_original_transaction")
150
- expect(result.message).to eq("Foo")
151
- end
152
-
153
- it "gateway no open batch test" do
154
- result = @mapper.map_gateway_exception(0, "5", "Foo")
155
- expect(result.code).to eq("no_open_batch")
156
- expect(result.message).to eq("Foo")
157
- end
158
-
159
- it "gateway timeout test" do
160
- result = @mapper.map_gateway_exception(0, "30", nil)
161
- expect(result.code).to eq("unknown")
162
- expect(result.message).to eq(message_for_code("Exception_Message_GatewayTimedOut"))
163
- end
164
-
165
- it "gateway unknown test" do
166
- result = @mapper.map_gateway_exception(0, "Foo", "Foo")
167
- expect(result.code).to eq("unknown")
168
- expect(result.message).to eq("Foo")
169
- end
170
-
171
- # Sdk Exceptions
172
-
173
- it "sdk invalid transaction id test" do
174
- result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_transaction_id, nil)
175
- expect(result.param).to eq("gatewayTransactionId")
176
- expect(result.code).to eq("invalid_transaction_id")
177
- expect(result.message).to eq(message_for_code("Exception_Message_TransactionIdLessThanEqualZero"))
178
- end
179
-
180
- it "sdk invalid gateway url test" do
181
- result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_gateway_url, nil)
182
- expect(result.param).to eq("HpsServiceUri")
183
- expect(result.code).to eq("sdk_exception")
184
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidGatewayUrl"))
185
- end
186
-
187
- it "sdk unable to process transaction test" do
188
- result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_gateway_url, nil)
189
- expect(result.param).to eq("HpsServiceUri")
190
- expect(result.code).to eq("sdk_exception")
191
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidGatewayUrl"))
192
- end
193
-
194
- it "sdk missing currency" do
195
- result = @mapper.map_sdk_exception(Hps::SdkCodes.missing_currency, nil)
196
- expect(result.param).to eq("currency")
197
- expect(result.code).to eq("missing_currency")
198
- expect(result.message).to eq(message_for_code("Exception_Message_ArgumentNull"))
199
- end
200
-
201
- it "sdk invalid currency" do
202
- result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_currency, nil)
203
- expect(result.param).to eq("currency")
204
- expect(result.code).to eq("invalid_currency")
205
- expect(result.message).to eq(message_for_code("Exception_Message_InvalidCurrency"))
206
- end
207
-
208
- it "sdk invalid amount" do
209
- result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_amount, nil)
210
- expect(result.param).to eq("amount")
211
- expect(result.code).to eq("invalid_amount")
212
- expect(result.message).to eq(message_for_code("Exception_Message_ChargeAmount"))
213
- end
214
-
215
- it "sdk reversal error after gateway timeout" do
216
- result = @mapper.map_sdk_exception(Hps::SdkCodes.reversal_error_after_gateway_timeout, nil)
217
- expect(result.code).to eq("gateway_timeout")
218
- expect(result.message).to eq(message_for_code("Exception_Message_UnableToReverseTransactionAfterGatewayTimeout"))
219
- end
220
-
221
- it "sdk reversal error after issuer timeout" do
222
- result = @mapper.map_sdk_exception(Hps::SdkCodes.reversal_error_after_issuer_timeout, nil)
223
- expect(result.code).to eq("issuer_timeout")
224
- expect(result.message).to eq(message_for_code("Exception_Message_UnableToReverseTransactionAfterIssuerTimeout"))
225
- end
226
-
227
- it "sdk processing error" do
228
- result = @mapper.map_sdk_exception(Hps::SdkCodes.processing_error, nil)
229
- expect(result.code).to eq("processing_error")
230
- expect(result.message).to eq(message_for_code("Exception_Message_ProcessingError"))
231
- end
232
-
233
- # Helper methods
234
-
235
- def message_for_code(code)
236
-
237
- mapping = @mapper.exceptions["exception_messages"].detect { |message|
238
- message["code"] == code
239
- }
240
-
241
- mapping["message"] unless mapping.nil?
242
-
243
- end
244
-
1
+ require 'hps'
2
+
3
+
4
+ describe "ExceptionMapper Tests" do
5
+
6
+ before(:all) do
7
+ @mapper = Hps::ExceptionMapper.new
8
+ end
9
+
10
+
11
+ it "mapping version number accessible" do
12
+ expect(@mapper.version_number).to eq("1.0.0")
13
+ end
14
+
15
+ # Issuer Exceptions
16
+
17
+ it "issuer card declined test codes" do
18
+
19
+ [ "02", "03", "04", "05", "41", "43", "44", "51", "56", "61", "62", "63", "65", "78" ].each { |code|
20
+
21
+ result = @mapper.map_issuer_exception(1, code, "")
22
+ expect(result.transaction_id).to eq(1)
23
+ expect(result.code).to eq("card_declined")
24
+ expect(result.message).to eq(message_for_code("Exception_Message_CardDeclined"))
25
+ }
26
+
27
+ end
28
+
29
+ it "issuer processing error test codes" do
30
+
31
+ [ "06", "07", "12", "15", "19", "12", "52", "53", "57", "58", "76", "77", "91", "96", "EC" ].each { |code|
32
+
33
+ result = @mapper.map_issuer_exception(2, code, "")
34
+ expect(result.transaction_id).to eq(2)
35
+ expect(result.code).to eq("processing_error")
36
+ expect(result.message).to eq(message_for_code("Exception_Message_ProcessingError"))
37
+ }
38
+
39
+ end
40
+
41
+ it "issuer invalid amount test" do
42
+ result = @mapper.map_issuer_exception(3, "13", "")
43
+ expect(result.transaction_id).to eq(3)
44
+ expect(result.code).to eq("invalid_amount")
45
+ expect(result.message).to eq(message_for_code("Exception_Message_ChargeAmount"))
46
+ end
47
+
48
+ it "issuer incorrect number test" do
49
+ result = @mapper.map_issuer_exception(4, "14", "")
50
+ expect(result.transaction_id).to eq(4)
51
+ expect(result.code).to eq("incorrect_number")
52
+ expect(result.message).to eq(message_for_code("Exception_Message_IncorrectNumber"))
53
+ end
54
+
55
+ it "issuer expired card test" do
56
+ result = @mapper.map_issuer_exception(5, "54", "")
57
+ expect(result.transaction_id).to eq(5)
58
+ expect(result.code).to eq("expired_card")
59
+ expect(result.message).to eq(message_for_code("Exception_Message_CardExpired"))
60
+ end
61
+
62
+ it "issuer invalid pin test" do
63
+ result = @mapper.map_issuer_exception(6, "55", "")
64
+ expect(result.transaction_id).to eq(6)
65
+ expect(result.code).to eq("invalid_pin")
66
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidPin"))
67
+ end
68
+
69
+ it "issuer pin retries exceeded test" do
70
+ result = @mapper.map_issuer_exception(7, "75", "")
71
+ expect(result.transaction_id).to eq(7)
72
+ expect(result.code).to eq("pin_retries_exceeded")
73
+ expect(result.message).to eq(message_for_code("Exception_Message_PinExceeded"))
74
+ end
75
+
76
+ it "issuer invalid expiry test" do
77
+ result = @mapper.map_issuer_exception(8, "80", "")
78
+ expect(result.transaction_id).to eq(8)
79
+ expect(result.code).to eq("invalid_expiry")
80
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidExpiry"))
81
+ end
82
+
83
+ it "issuer pin verification test" do
84
+ result = @mapper.map_issuer_exception(9, "86", "")
85
+ expect(result.transaction_id).to eq(9)
86
+ expect(result.code).to eq("pin_verification")
87
+ expect(result.message).to eq(message_for_code("Exception_Message_PinVerification"))
88
+ end
89
+
90
+ it "issuer incorrect cvc test" do
91
+ [ "EB", "N7" ].each { |code|
92
+ result = @mapper.map_issuer_exception(10, code, "")
93
+ expect(result.transaction_id).to eq(10)
94
+ expect(result.code).to eq("incorrect_cvc")
95
+ expect(result.message).to eq(message_for_code("Exception_Message_IncorrectCvc"))
96
+ }
97
+ end
98
+
99
+ it "issuer unknown test" do
100
+ result = @mapper.map_issuer_exception(11, "Foo", "Foo")
101
+ expect(result.transaction_id).to eq(11)
102
+ expect(result.code).to eq("unknown_card_exception")
103
+ expect(result.message).to eq("Foo")
104
+ end
105
+
106
+ it "issuer nil test" do
107
+ result = @mapper.map_issuer_exception(0, nil, nil)
108
+ expect(result.transaction_id).to eq(0)
109
+ expect(result.code).to eq("unknown_card_exception")
110
+ expect(result.message).to eq("Hps::CardException")
111
+ end
112
+
113
+ # Gateway exceptions
114
+
115
+ it "gateway authentication exception test" do
116
+ result = @mapper.map_gateway_exception(0, "-2", nil)
117
+ expect(result.code).to eq("unknown")
118
+ expect(result.message).to eq(message_for_code("Exception_Message_AuthenticationError"))
119
+ end
120
+
121
+ it "gateway invalid request exception cpc test" do
122
+ result = @mapper.map_gateway_exception(0, "12", nil)
123
+ expect(result.param).to eq("card")
124
+ expect(result.code).to eq("invalid_cpc_data")
125
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidCpcData"))
126
+ end
127
+
128
+ it "gateway invalid request exception card data test" do
129
+ result = @mapper.map_gateway_exception(0, "13", nil)
130
+ expect(result.param).to eq("card")
131
+ expect(result.code).to eq("invalid_card_data")
132
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidCardData"))
133
+ end
134
+
135
+ it "gateway card exception test" do
136
+ result = @mapper.map_gateway_exception(0, "14", nil)
137
+ expect(result.code).to eq("invalid_number")
138
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidNumber"))
139
+ end
140
+
141
+ it "gateway message passthrough test" do
142
+ result = @mapper.map_gateway_exception(0, "1", "Foo")
143
+ expect(result.code).to eq("unknown")
144
+ expect(result.message).to eq("Foo")
145
+ end
146
+
147
+ it "gateway invalid original transaction test" do
148
+ result = @mapper.map_gateway_exception(0, "3", "Foo")
149
+ expect(result.code).to eq("invalid_original_transaction")
150
+ expect(result.message).to eq("Foo")
151
+ end
152
+
153
+ it "gateway no open batch test" do
154
+ result = @mapper.map_gateway_exception(0, "5", "Foo")
155
+ expect(result.code).to eq("no_open_batch")
156
+ expect(result.message).to eq("Foo")
157
+ end
158
+
159
+ it "gateway timeout test" do
160
+ result = @mapper.map_gateway_exception(0, "30", nil)
161
+ expect(result.code).to eq("unknown")
162
+ expect(result.message).to eq(message_for_code("Exception_Message_GatewayTimedOut"))
163
+ end
164
+
165
+ it "gateway unknown test" do
166
+ result = @mapper.map_gateway_exception(0, "Foo", "Foo")
167
+ expect(result.code).to eq("unknown")
168
+ expect(result.message).to eq("Foo")
169
+ end
170
+
171
+ # Sdk Exceptions
172
+
173
+ it "sdk invalid transaction id test" do
174
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_transaction_id, nil)
175
+ expect(result.param).to eq("gatewayTransactionId")
176
+ expect(result.code).to eq("invalid_transaction_id")
177
+ expect(result.message).to eq(message_for_code("Exception_Message_TransactionIdLessThanEqualZero"))
178
+ end
179
+
180
+ it "sdk invalid gateway url test" do
181
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_gateway_url, nil)
182
+ expect(result.param).to eq("HpsServiceUri")
183
+ expect(result.code).to eq("sdk_exception")
184
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidGatewayUrl"))
185
+ end
186
+
187
+ it "sdk unable to process transaction test" do
188
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_gateway_url, nil)
189
+ expect(result.param).to eq("HpsServiceUri")
190
+ expect(result.code).to eq("sdk_exception")
191
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidGatewayUrl"))
192
+ end
193
+
194
+ it "sdk missing currency" do
195
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.missing_currency, nil)
196
+ expect(result.param).to eq("currency")
197
+ expect(result.code).to eq("missing_currency")
198
+ expect(result.message).to eq(message_for_code("Exception_Message_ArgumentNull"))
199
+ end
200
+
201
+ it "sdk invalid currency" do
202
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_currency, nil)
203
+ expect(result.param).to eq("currency")
204
+ expect(result.code).to eq("invalid_currency")
205
+ expect(result.message).to eq(message_for_code("Exception_Message_InvalidCurrency"))
206
+ end
207
+
208
+ it "sdk invalid amount" do
209
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.invalid_amount, nil)
210
+ expect(result.param).to eq("amount")
211
+ expect(result.code).to eq("invalid_amount")
212
+ expect(result.message).to eq(message_for_code("Exception_Message_ChargeAmount"))
213
+ end
214
+
215
+ it "sdk reversal error after gateway timeout" do
216
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.reversal_error_after_gateway_timeout, nil)
217
+ expect(result.code).to eq("gateway_timeout")
218
+ expect(result.message).to eq(message_for_code("Exception_Message_UnableToReverseTransactionAfterGatewayTimeout"))
219
+ end
220
+
221
+ it "sdk reversal error after issuer timeout" do
222
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.reversal_error_after_issuer_timeout, nil)
223
+ expect(result.code).to eq("issuer_timeout")
224
+ expect(result.message).to eq(message_for_code("Exception_Message_UnableToReverseTransactionAfterIssuerTimeout"))
225
+ end
226
+
227
+ it "sdk processing error" do
228
+ result = @mapper.map_sdk_exception(Hps::SdkCodes.processing_error, nil)
229
+ expect(result.code).to eq("processing_error")
230
+ expect(result.message).to eq(message_for_code("Exception_Message_ProcessingError"))
231
+ end
232
+
233
+ # Helper methods
234
+
235
+ def message_for_code(code)
236
+
237
+ mapping = @mapper.exceptions["exception_messages"].detect { |message|
238
+ message["code"] == code
239
+ }
240
+
241
+ mapping["message"] unless mapping.nil?
242
+
243
+ end
244
+
245
245
  end