LitleOnline 10.1.1 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -6
  3. data/DESCRIPTION +2 -2
  4. data/LICENSE +1 -1
  5. data/README.md +8 -8
  6. data/Rakefile +6 -7
  7. data/SETUP.md +4 -4
  8. data/bin/Setup.rb +4 -4
  9. data/bin/sample_batch_driver.rb +1 -1
  10. data/bin/sample_driver.rb +1 -1
  11. data/lib/Communications.rb +5 -5
  12. data/lib/Configuration.rb +1 -1
  13. data/lib/LitleBatchRequest.rb +39 -1
  14. data/lib/LitleListeners.rb +2 -2
  15. data/lib/LitleOnline.rb +1 -1
  16. data/lib/LitleOnlineRequest.rb +22 -3
  17. data/lib/LitleRequest.rb +4 -4
  18. data/lib/LitleTransaction.rb +156 -47
  19. data/lib/LitleXmlMapper.rb +8 -1
  20. data/lib/XMLFields.rb +252 -51
  21. data/temp.xml +21 -0
  22. data/test/certification/certTest1_base.rb +52 -52
  23. data/test/certification/certTest2_authenhanced.rb +20 -20
  24. data/test/certification/certTest3_authreversal.rb +16 -16
  25. data/test/certification/certTest4_echeck.rb +18 -12
  26. data/test/certification/certTest5_token.rb +3 -3
  27. data/test/certification/certTest_batchAll.rb +9 -1
  28. data/test/certification/ts_all.rb +1 -1
  29. data/test/functional/test_activate.rb +34 -5
  30. data/test/functional/test_activateReversal.rb +23 -7
  31. data/test/functional/test_auth.rb +126 -17
  32. data/test/functional/test_authReversal.rb +5 -3
  33. data/test/functional/test_balanceInquiry.rb +30 -5
  34. data/test/functional/test_batch.rb +1 -1
  35. data/test/functional/test_batchStream.rb +1 -1
  36. data/test/functional/test_cancelSubscription.rb +5 -3
  37. data/test/functional/test_capture.rb +37 -2
  38. data/test/functional/test_captureGivenAuth.rb +54 -3
  39. data/test/functional/test_configuration.rb +1 -1
  40. data/test/functional/test_createPlan.rb +5 -3
  41. data/test/functional/test_credit.rb +17 -1
  42. data/test/functional/test_deactivate.rb +28 -5
  43. data/test/functional/test_deactivateReversal.rb +21 -7
  44. data/test/functional/test_depositReversal.rb +30 -18
  45. data/test/functional/test_echeckCredit.rb +29 -5
  46. data/test/functional/test_echeckRedeposit.rb +28 -3
  47. data/test/functional/test_echeckSale.rb +43 -7
  48. data/test/functional/test_echeckVerification.rb +34 -8
  49. data/test/functional/test_echeckVoid.rb +2 -2
  50. data/test/functional/test_forceCapture.rb +36 -8
  51. data/test/functional/test_fraudCheck.rb +12 -14
  52. data/test/functional/test_giftCardAuthReversal.rb +72 -0
  53. data/test/functional/test_giftCardCapture.rb +72 -0
  54. data/test/functional/test_giftCardCredit.rb +69 -0
  55. data/test/functional/test_litle_requests.rb +1 -1
  56. data/test/functional/test_load.rb +29 -5
  57. data/test/functional/test_loadReversal.rb +21 -7
  58. data/test/functional/test_override.rb +4 -3
  59. data/test/functional/test_queryTransaction.rb +24 -18
  60. data/test/functional/test_refundReversal.rb +21 -7
  61. data/test/functional/test_sale.rb +86 -9
  62. data/test/functional/test_token.rb +26 -11
  63. data/test/functional/test_unload.rb +29 -5
  64. data/test/functional/test_unloadReversal.rb +21 -7
  65. data/test/functional/test_updateCardValidationNumOnToken.rb +1 -1
  66. data/test/functional/test_updatePlan.rb +5 -3
  67. data/test/functional/test_updateSubscription.rb +5 -3
  68. data/test/functional/test_wallet.rb +1 -1
  69. data/test/functional/test_xmlfields.rb +9 -5
  70. data/test/functional/ts_all.rb +1 -1
  71. data/test/unit/test_LitleAUBatch.rb +1 -1
  72. data/test/unit/test_LitleBatchRequest.rb +1 -1
  73. data/test/unit/test_LitleOnlineRequest.rb +15 -57
  74. data/test/unit/test_LitleRequest.rb +1 -1
  75. data/test/unit/test_LitleTransaction.rb +3 -3
  76. data/test/unit/test_LitleXmlMapper.rb +139 -0
  77. data/test/unit/test_activate.rb +5 -5
  78. data/test/unit/test_activateReversal.rb +16 -4
  79. data/test/unit/test_auth.rb +50 -9
  80. data/test/unit/test_authReversal.rb +1 -1
  81. data/test/unit/test_balanceInquiry.rb +3 -3
  82. data/test/unit/test_cancelSubscription.rb +1 -1
  83. data/test/unit/test_capture.rb +27 -1
  84. data/test/unit/test_captureGivenAuth.rb +47 -1
  85. data/test/unit/test_createPlan.rb +1 -1
  86. data/test/unit/test_credit.rb +16 -3
  87. data/test/unit/test_deactivate.rb +20 -1
  88. data/test/unit/test_deactivateReversal.rb +16 -4
  89. data/test/unit/test_depositReversal.rb +18 -6
  90. data/test/unit/test_echeckCredit.rb +20 -1
  91. data/test/unit/test_echeckRedeposit.rb +16 -1
  92. data/test/unit/test_echeckSale.rb +20 -1
  93. data/test/unit/test_echeckVerification.rb +7 -4
  94. data/test/unit/test_echeckVoid.rb +1 -1
  95. data/test/unit/test_forceCapture.rb +19 -1
  96. data/test/unit/test_fraudCheck.rb +1 -1
  97. data/test/unit/test_giftCardAuthReversal.rb +58 -0
  98. data/test/unit/test_giftCardCapture.rb +57 -0
  99. data/test/unit/test_giftCardCredit.rb +57 -0
  100. data/test/unit/test_load.rb +3 -3
  101. data/test/unit/test_loadReversal.rb +16 -4
  102. data/test/unit/test_queryTransaction.rb +5 -22
  103. data/test/unit/test_refundReversal.rb +16 -4
  104. data/test/unit/test_sale.rb +90 -5
  105. data/test/unit/test_token.rb +35 -24
  106. data/test/unit/test_unload.rb +3 -3
  107. data/test/unit/test_unloadReversal.rb +16 -4
  108. data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
  109. data/test/unit/test_updatePlan.rb +1 -1
  110. data/test/unit/test_updateSubscription.rb +1 -1
  111. data/test/unit/test_wallet.rb +1 -1
  112. data/test/unit/test_xmlfields.rb +1 -1
  113. data/test/unit/ts_unit.rb +1 -1
  114. metadata +18 -10
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -47,8 +47,10 @@ module LitleOnline
47
47
  'id'=>'test',
48
48
  'reportGroup'=>'Planets',
49
49
  }
50
- response = LitleOnlineRequest.new.echeck_credit(hash)
51
- assert_match /The content of element 'echeckCredit' is not complete/, response.message
50
+ #Get exceptions
51
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
52
+ #Test
53
+ assert(exception.message =~ /Error validating xml data against the schema/)
52
54
  end
53
55
 
54
56
  def test_echeck_credit_with_echeck
@@ -116,8 +118,10 @@ module LitleOnline
116
118
  'orderId'=>'12345',
117
119
  'orderSource'=>'ecommerce',
118
120
  }
119
- response= LitleOnlineRequest.new.echeck_credit(hash)
120
- assert(response.message =~ /Error validating xml data against the schema/)
121
+ #Get exceptions
122
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
123
+ #Test
124
+ assert(exception.message =~ /Error validating xml data against the schema/)
121
125
  end
122
126
 
123
127
  def test_echeck_credit_with_secondaryAmount
@@ -151,5 +155,25 @@ module LitleOnline
151
155
  response= LitleOnlineRequest.new.echeck_credit(hash)
152
156
  assert_equal('Valid Format', response.message)
153
157
  end
158
+
159
+ def test_echeck_credit_with_customIdentifier
160
+ hash = {
161
+ 'merchantId' => '101',
162
+ 'version'=>'8.8',
163
+ 'id'=>'test',
164
+ 'reportGroup'=>'Planets',
165
+ 'amount'=>'123456',
166
+ 'verify'=>'true',
167
+ 'orderId'=>'12345',
168
+ 'orderSource'=>'ecommerce',
169
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
170
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
171
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
172
+ 'merchantData'=>{'campaign'=>'camping'},
173
+ 'customIdentifier' =>'identifier',
174
+ }
175
+ response= LitleOnlineRequest.new.echeck_credit(hash)
176
+ assert_equal('Valid Format', response.message)
177
+ end
154
178
  end
155
179
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -59,7 +59,8 @@ module LitleOnline
59
59
  'id'=>'test',
60
60
  'reportGroup'=>'Planets',
61
61
  'litleTxnId'=>'123456',
62
- 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'}
62
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
63
+
63
64
  }
64
65
  response= LitleOnlineRequest.new.echeck_redeposit(hash)
65
66
  assert_equal('Valid Format', response.message)
@@ -85,8 +86,32 @@ module LitleOnline
85
86
  'version'=>'8.8',
86
87
  'reportGroup'=>'Planets',
87
88
  }
89
+ #Get exceptions
90
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
91
+ #Test
92
+ assert(exception.message =~ /Error validating xml data against the schema/)
93
+ end
94
+
95
+ def test_echeck_Redeposit_with_customIdentifier
96
+ hash = {
97
+ 'merchantId' => '101',
98
+ 'version'=>'8.8',
99
+ 'id'=>'test',
100
+ 'reportGroup'=>'Planets',
101
+ 'amount'=>'123456',
102
+ 'verify'=>'true',
103
+ 'orderId'=>'12345',
104
+ 'litleTxnId'=>'123456',
105
+ 'orderSource'=>'ecommerce',
106
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
107
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
108
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
109
+ 'merchantData'=>{'campaign'=>'camping'},
110
+ 'customIdentifier' =>'identifier',
111
+ }
88
112
  response= LitleOnlineRequest.new.echeck_redeposit(hash)
89
- assert(response.message =~ /Error validating xml data against the schema/)
113
+ assert_equal('Valid Format', response.message)
90
114
  end
115
+
91
116
  end
92
117
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -51,8 +51,10 @@ module LitleOnline
51
51
  'id'=>'test',
52
52
  'reportGroup'=>'Planets'
53
53
  }
54
- response = LitleOnlineRequest.new.echeck_sale(hash)
55
- assert_match /The content of element 'echeckSale' is not complete/, response.message
54
+ #Get exceptions
55
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
56
+ #Test
57
+ assert(exception.message =~ /The content of element 'echeckSale' is not complete/)
56
58
  end
57
59
 
58
60
  def test_echeck_sale_with_echeck1
@@ -139,8 +141,10 @@ module LitleOnline
139
141
  'orderId'=>'12345',
140
142
  'orderSource'=>'ecommerce',
141
143
  }
142
- response= LitleOnlineRequest.new.echeck_sale(hash)
143
- assert(response.message =~ /Error validating xml data against the schema/)
144
+ #Get exceptions
145
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
146
+ #Test
147
+ assert(exception.message =~ /Error validating xml data against the schema/)
144
148
  end
145
149
 
146
150
  def test_simple_echeck_sale
@@ -148,7 +152,12 @@ module LitleOnline
148
152
  'reportGroup'=>'Planets',
149
153
  'id'=>'test',
150
154
  'litleTxnId'=>'123456789101112',
151
- 'amount'=>'12'
155
+ 'orderId'=>'12345',
156
+ 'amount'=>'12',
157
+ 'orderSource'=>'ecommerce',
158
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
159
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
160
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
152
161
  }
153
162
  response= LitleOnlineRequest.new.echeck_sale(hash)
154
163
  assert_equal('Valid Format', response.message)
@@ -159,7 +168,12 @@ module LitleOnline
159
168
  'reportGroup'=>'Planets',
160
169
  'id'=>'test',
161
170
  'litleTxnId'=>'123456',
171
+ 'orderId'=>'12345',
162
172
  'amount'=>'10',
173
+ 'orderSource'=>'ecommerce',
174
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
175
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
176
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
163
177
  }
164
178
  response= LitleOnlineRequest.new.echeck_sale(hash)
165
179
  assert_equal('Valid Format', response.message)
@@ -211,8 +225,30 @@ module LitleOnline
211
225
  'amount'=>'12',
212
226
  'secondaryAmount'=>'50'
213
227
  }
228
+ #Get exceptions
229
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
230
+ #Test
231
+ assert(exception.message =~ /Error validating xml data against the schema/)
232
+ end
233
+
234
+ def test_echeck_sale_with_customIdentifier
235
+ hash = {
236
+ 'merchantId' => '101',
237
+ 'version'=>'8.8',
238
+ 'id'=>'test',
239
+ 'reportGroup'=>'Planets',
240
+ 'amount'=>'123456',
241
+ 'verify'=>'true',
242
+ 'orderId'=>'12345',
243
+ 'orderSource'=>'ecommerce',
244
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
245
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
246
+ 'shipToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
247
+ 'merchantData'=>{'campaign'=>'camping'},
248
+ 'customIdentifier' =>'identifier',
249
+ }
214
250
  response= LitleOnlineRequest.new.echeck_sale(hash)
215
- assert(response.message=~/Error validating xml data against the schema.*/)
251
+ assert_equal('Valid Format', response.message)
216
252
  end
217
253
 
218
254
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -89,8 +89,10 @@ module LitleOnline
89
89
  'orderId'=>'12345',
90
90
  'orderSource'=>'ecommerce',
91
91
  }
92
- response= LitleOnlineRequest.new.echeck_verification(hash)
93
- assert(response.message =~ /Error validating xml data against the schema/)
92
+ #Get exceptions
93
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
94
+ #Test
95
+ assert(exception.message =~ /Error validating xml data against the schema/)
94
96
  end
95
97
 
96
98
  def test_no_amount
@@ -101,8 +103,10 @@ module LitleOnline
101
103
  'reportGroup'=>'Planets',
102
104
  'orderId'=>'12345'
103
105
  }
104
- response= LitleOnlineRequest.new.echeck_verification(hash)
105
- assert(response.message =~ /Error validating xml data against the schema/)
106
+ #Get exceptions
107
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
108
+ #Test
109
+ assert(exception.message =~ /Error validating xml data against the schema/)
106
110
  end
107
111
 
108
112
  def test_no_order_id
@@ -112,8 +116,10 @@ module LitleOnline
112
116
  'id'=>'test',
113
117
  'reportGroup'=>'Planets',
114
118
  }
115
- response= LitleOnlineRequest.new.echeck_verification(hash)
116
- assert(response.message =~ /Error validating xml data against the schema/)
119
+ #Get exceptions
120
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
121
+ #Test
122
+ assert(exception.message =~ /Error validating xml data against the schema/)
117
123
  end
118
124
 
119
125
  def test_no_order_source
@@ -125,8 +131,28 @@ module LitleOnline
125
131
  'amount'=>'123456',
126
132
  'orderId'=>'12345'
127
133
  }
134
+ #Get exceptions
135
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
136
+ #Test
137
+ assert(exception.message =~ /Error validating xml data against the schema/)
138
+ end
139
+
140
+ def test_no_litleTxnId
141
+ hash = {
142
+ 'merchantId' => '101',
143
+ 'version'=>'8.8',
144
+ 'id'=>'test',
145
+ 'reportGroup'=>'Planets',
146
+ 'amount'=>'123',
147
+ 'invalidfield'=>'nonexistant',
148
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
149
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
150
+ 'orderId'=>'12345',
151
+ 'orderSource'=>'ecommerce',
152
+ #'litleTxnId'=>'123456',
153
+ }
128
154
  response= LitleOnlineRequest.new.echeck_verification(hash)
129
- assert(response.message =~ /Error validating xml data against the schema/)
155
+ assert_equal('Valid Format', response.message)
130
156
  end
131
157
 
132
158
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -36,7 +36,7 @@ module LitleOnline
36
36
  'litleTxnId'=>'12345678000',
37
37
  }
38
38
  response= LitleOnlineRequest.new.echeck_void(hash)
39
- assert_equal('Transaction Received', response.echeckVoidResponse.message)
39
+ assert_equal('0', response.response)
40
40
  end
41
41
  end
42
42
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -43,7 +43,9 @@ module LitleOnline
43
43
  'expDate' =>'1210'
44
44
  }}
45
45
  response= LitleOnlineRequest.new.force_capture(hash)
46
- assert_equal('001', response.forceCaptureResponse.response)
46
+
47
+ assert_equal('0', response.response)
48
+
47
49
  end
48
50
 
49
51
  def test_simple_force_capture_with_token
@@ -121,8 +123,10 @@ module LitleOnline
121
123
  'cardValidationNum'=>'555',
122
124
  'type'=>'VI'
123
125
  }}
124
- response= LitleOnlineRequest.new.force_capture(hash)
125
- assert(response.message =~ /Error validating xml data against the schema/)
126
+ #Get exceptions
127
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
128
+ #Test
129
+ assert(exception.message =~ /Error validating xml data against the schema/)
126
130
  end
127
131
 
128
132
  def test_no_order_source
@@ -139,8 +143,10 @@ module LitleOnline
139
143
  'number' =>'4100000000000001',
140
144
  'expDate' =>'1210'
141
145
  }}
142
- response= LitleOnlineRequest.new.force_capture(hash)
143
- assert(response.message =~ /Error validating xml data against the schema/)
146
+ #Get exceptions
147
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
148
+ #Test
149
+ assert(exception.message =~ /Error validating xml data against the schema/)
144
150
  end
145
151
 
146
152
  def test_simple_forceCapture_with_mpos
@@ -163,7 +169,8 @@ module LitleOnline
163
169
  }
164
170
  }
165
171
  response= LitleOnlineRequest.new.force_capture(hash)
166
- assert_equal('001', response.forceCaptureResponse.response)
172
+ assert_equal('0', response.response)
173
+
167
174
  end
168
175
 
169
176
  def test_simple_force_capture_with_secondaryAmount
@@ -183,7 +190,28 @@ module LitleOnline
183
190
  'expDate' =>'1210'
184
191
  }}
185
192
  response= LitleOnlineRequest.new.force_capture(hash)
186
- assert_equal('001', response.forceCaptureResponse.response)
193
+ assert_equal('000', response.forceCaptureResponse.response)
194
+ end
195
+
196
+ def test_simple_force_capture_with_processing_type
197
+ hash = {
198
+ 'merchantId' => '101',
199
+ 'id' => 'test',
200
+ 'version'=>'8.8',
201
+ 'reportGroup'=>'Planets',
202
+ 'orderId'=>'12344',
203
+ 'amount'=>'106',
204
+ 'orderSource'=>'ecommerce',
205
+ 'processingType'=>'accountFunding',
206
+ 'card'=>{
207
+ 'type'=>'VI',
208
+ 'number' =>'4100000000000001',
209
+ 'expDate' =>'1210'
210
+ }}
211
+ response= LitleOnlineRequest.new.force_capture(hash)
212
+
213
+ assert_equal('0', response.response)
214
+
187
215
  end
188
216
 
189
217
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2012 Litle & Co.
2
+ Copyright (c) 2017 Vantiv eCommerce
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person
5
5
  obtaining a copy of this software and associated documentation
@@ -41,12 +41,11 @@ module LitleOnline
41
41
  'customAttribute3' => '5'}
42
42
  }
43
43
  response = LitleOnlineRequest.new.fraud_check_request(hash)
44
- assert_equal('001', response.fraudCheckResponse.response)
45
- assert_equal('Transaction Received', response.fraudCheckResponse.message)
46
- assert_equal('pass', response.fraudCheckResponse.advancedFraudResult.deviceReviewStatus)
47
- assert_equal('55', response.fraudCheckResponse.advancedFraudResult.deviceReputationScore)
48
- assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResult.triggeredRule[0])
49
- assert_equal(5, response.fraudCheckResponse.advancedFraudResult.triggeredRule.size())
44
+ assert_equal('0', response.response)
45
+ assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
46
+ assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
47
+ assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
48
+ assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
50
49
  end
51
50
 
52
51
  def test_fraud_check_session_id
@@ -60,16 +59,15 @@ module LitleOnline
60
59
  }
61
60
  }
62
61
  response = LitleOnlineRequest.new.fraud_check_request(hash)
63
- assert_equal('001', response.fraudCheckResponse.response)
64
- assert_equal('Transaction Received', response.fraudCheckResponse.message)
65
- assert_equal('pass', response.fraudCheckResponse.advancedFraudResult.deviceReviewStatus)
66
- assert_equal('42', response.fraudCheckResponse.advancedFraudResult.deviceReputationScore)
62
+ assert_equal('0', response.response)
63
+ assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
64
+ assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
67
65
  # kind of a hack to get around the variable # of triggered rule elements. ie. 1 element is added as a string not
68
66
  # an Array. Fix is to write an unmarshaller or custom node class in XMLFields.rb
69
- if(response.fraudCheckResponse.advancedFraudResult.triggeredRule.is_a?(Array))
70
- assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResult.triggeredRule[0])
67
+ if(response.fraudCheckResponse.advancedFraudResults.triggeredRule.is_a?(Array))
68
+ assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
71
69
  elsif
72
- assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResult.triggeredRule)
70
+ assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule)
73
71
  end
74
72
  end
75
73
 
@@ -0,0 +1,72 @@
1
+ =begin
2
+ Copyright (c) 2017 Vantiv eCommerce
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation
6
+ files (the "Software"), to deal in the Software without
7
+ restriction, including without limitation the rights to use,
8
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
+ OTHER DEALINGS IN THE SOFTWARE.
24
+ =end
25
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require 'test/unit'
27
+
28
+ #test GiftCardAuthReversal Transaction
29
+ module LitleOnline
30
+ class TestGiftCardAuthReversal < Test::Unit::TestCase
31
+ def test_giftCardAuthReversal
32
+ hash = {
33
+ 'merchantId' => '101',
34
+ 'version'=>'8.8',
35
+ 'id'=>'test',
36
+ 'reportGroup'=>'Planets',
37
+ 'litleTxnId' =>'5000',
38
+ 'card'=>{
39
+ 'type'=>'GC',
40
+ 'number' =>'400000000000000',
41
+ 'expDate' =>'0150',
42
+ 'pin' => '1234',
43
+ 'cardValidationNum' => '411'
44
+ },
45
+ 'originalRefCode' => '101',
46
+ 'originalAmount' => '34561',
47
+ 'originalTxnTime' => '2017-01-24T09:00:00',
48
+ 'originalSystemTraceId' => '33',
49
+ 'originalSequenceNumber' => '111111',
50
+ }
51
+
52
+ response= LitleOnlineRequest.new.giftCardAuth_reversal(hash)
53
+ assert_equal('000', response.giftCardAuthReversalResponse.response)
54
+ assert_equal('0', response.giftCardAuthReversalResponse.giftCardResponse.systemTraceId)
55
+ end
56
+
57
+ def test_simple_error
58
+ hash = {
59
+ 'merchantId' => '101',
60
+ 'version'=>'8.8',
61
+ 'id'=>'test',
62
+ 'reportGroup'=>'Planets',
63
+ }
64
+
65
+ #Get exceptions
66
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardAuth_reversal(hash)}
67
+ #Test
68
+ assert(exception.message =~ /Error validating xml data against the schema/)
69
+ end
70
+
71
+ end
72
+ end