LitleOnline 9.12.0 → 10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +7 -16
  3. data/CONTRIBUTORS +0 -0
  4. data/DESCRIPTION +2 -2
  5. data/LICENSE +1 -1
  6. data/README.md +9 -9
  7. data/Rakefile +9 -8
  8. data/SETUP.md +3 -3
  9. data/bin/Setup.rb +4 -4
  10. data/bin/sample_batch_driver.rb +1 -1
  11. data/bin/sample_driver.rb +1 -1
  12. data/lib/Communications.rb +7 -7
  13. data/lib/Configuration.rb +1 -1
  14. data/lib/EnvironmentVariables.rb +0 -0
  15. data/lib/LitleBatchRequest.rb +22 -8
  16. data/lib/LitleListeners.rb +9 -9
  17. data/lib/LitleOnline.rb +2 -2
  18. data/lib/LitleOnlineRequest.rb +16 -10
  19. data/lib/LitleRequest.rb +10 -10
  20. data/lib/LitleTransaction.rb +66 -64
  21. data/lib/LitleXmlMapper.rb +4 -9
  22. data/lib/XMLFields.rb +129 -116
  23. data/lib/cacert.pem +0 -0
  24. data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
  25. data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
  26. data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
  27. data/samples/Batch/AccountUpdate.rb +1 -0
  28. data/samples/Batch/SampleBatchDriver.rb +2 -1
  29. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
  30. data/samples/Capture/LitleCaptureTransaction.rb +2 -2
  31. data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
  32. data/samples/Capture/LitlePartialCapture.rb +3 -3
  33. data/samples/Credit/LitleCreditTransaction.rb +2 -2
  34. data/samples/Credit/LitleRefundTransaction.rb +2 -1
  35. data/samples/Other/LitleAvsTransaction.rb +2 -1
  36. data/samples/Other/LitleVoidTransaction.rb +2 -1
  37. data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
  38. data/samples/Run_all.rb +0 -0
  39. data/samples/Sale/LitleSaleTransaction.rb +2 -1
  40. data/samples/Sale/SampleSaleTransaction.rb +2 -1
  41. data/test/certification/certTest1_base.rb +53 -52
  42. data/test/certification/certTest2_authenhanced.rb +16 -15
  43. data/test/certification/certTest3_authreversal.rb +16 -15
  44. data/test/certification/certTest4_echeck.rb +11 -10
  45. data/test/certification/certTest5_token.rb +2 -1
  46. data/test/certification/certTest_batchAll.rb +40 -16
  47. data/test/certification/ts_all.rb +1 -1
  48. data/test/functional/test_activate.rb +8 -9
  49. data/test/functional/test_activateReversal.rb +4 -7
  50. data/test/functional/test_auth.rb +50 -113
  51. data/test/functional/test_authReversal.rb +6 -5
  52. data/test/functional/test_balanceInquiry.rb +5 -5
  53. data/test/functional/test_batch.rb +1 -1
  54. data/test/functional/test_batchStream.rb +3 -5
  55. data/test/functional/test_cancelSubscription.rb +3 -5
  56. data/test/functional/test_capture.rb +6 -34
  57. data/test/functional/test_captureGivenAuth.rb +13 -55
  58. data/test/functional/test_configuration.rb +1 -1
  59. data/test/functional/test_createPlan.rb +3 -5
  60. data/test/functional/test_credit.rb +10 -17
  61. data/test/functional/test_deactivate.rb +5 -5
  62. data/test/functional/test_deactivateReversal.rb +4 -5
  63. data/test/functional/test_depositReversal.rb +5 -5
  64. data/test/functional/test_echeckCredit.rb +17 -13
  65. data/test/functional/test_echeckRedeposit.rb +7 -5
  66. data/test/functional/test_echeckSale.rb +42 -21
  67. data/test/functional/test_echeckVerification.rb +19 -20
  68. data/test/functional/test_echeckVoid.rb +3 -2
  69. data/test/functional/test_forceCapture.rb +16 -30
  70. data/test/functional/test_litle_requests.rb +5 -9
  71. data/test/functional/test_load.rb +5 -5
  72. data/test/functional/test_loadReversal.rb +4 -5
  73. data/test/functional/test_override.rb +3 -0
  74. data/test/functional/test_queryTransaction.rb +146 -0
  75. data/test/functional/test_refundReversal.rb +4 -5
  76. data/test/functional/test_sale.rb +94 -170
  77. data/test/functional/test_token.rb +9 -18
  78. data/test/functional/test_unload.rb +5 -5
  79. data/test/functional/test_unloadReversal.rb +5 -6
  80. data/test/functional/test_updateCardValidationNumOnToken.rb +2 -1
  81. data/test/functional/test_updatePlan.rb +4 -5
  82. data/test/functional/test_updateSubscription.rb +5 -5
  83. data/test/functional/test_wallet.rb +74 -0
  84. data/test/functional/test_xmlfields.rb +25 -10
  85. data/test/functional/ts_all.rb +4 -2
  86. data/test/unit/test_LitleAUBatch.rb +1 -1
  87. data/test/unit/test_LitleBatchRequest.rb +4 -4
  88. data/test/unit/test_LitleOnlineRequest.rb +54 -37
  89. data/test/unit/test_LitleRequest.rb +3 -4
  90. data/test/unit/test_LitleTransaction.rb +35 -6
  91. data/test/unit/test_activate.rb +21 -1
  92. data/test/unit/test_activateReversal.rb +1 -1
  93. data/test/unit/test_auth.rb +16 -55
  94. data/test/unit/test_authReversal.rb +1 -1
  95. data/test/unit/test_balanceInquiry.rb +1 -1
  96. data/test/unit/test_cancelSubscription.rb +1 -1
  97. data/test/unit/test_capture.rb +1 -27
  98. data/test/unit/test_captureGivenAuth.rb +18 -44
  99. data/test/unit/test_createPlan.rb +1 -1
  100. data/test/unit/test_credit.rb +3 -16
  101. data/test/unit/test_deactivate.rb +1 -1
  102. data/test/unit/test_deactivateReversal.rb +1 -1
  103. data/test/unit/test_depositReversal.rb +1 -1
  104. data/test/unit/test_echeckCredit.rb +1 -1
  105. data/test/unit/test_echeckRedeposit.rb +1 -1
  106. data/test/unit/test_echeckSale.rb +2 -2
  107. data/test/unit/test_echeckVerification.rb +1 -1
  108. data/test/unit/test_echeckVoid.rb +1 -1
  109. data/test/unit/test_forceCapture.rb +2 -20
  110. data/test/unit/test_load.rb +1 -1
  111. data/test/unit/test_loadReversal.rb +1 -1
  112. data/test/unit/test_queryTransaction.rb +122 -0
  113. data/test/unit/test_refundReversal.rb +1 -1
  114. data/test/unit/test_sale.rb +8 -73
  115. data/test/unit/test_token.rb +8 -15
  116. data/test/unit/test_unload.rb +1 -1
  117. data/test/unit/test_unloadReversal.rb +1 -1
  118. data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
  119. data/test/unit/test_updatePlan.rb +1 -1
  120. data/test/unit/test_updateSubscription.rb +1 -1
  121. data/test/unit/test_wallet.rb +262 -0
  122. data/test/unit/test_xmlfields.rb +1 -1
  123. data/test/unit/ts_unit.rb +3 -3
  124. metadata +15 -16
  125. data/temp.xml +0 -21
  126. data/test/functional/test_fraudCheck.rb +0 -77
  127. data/test/functional/test_utf8.rb +0 -44
  128. data/test/unit/test_LitleXmlMapper.rb +0 -136
  129. data/test/unit/test_fraudCheck.rb +0 -45
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2017 Vantiv eCommerce
2
+ Copyright (c) 2012 Litle & Co.
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
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright (c) 2017 Vantiv eCommerce
2
+ Copyright (c) 2011 Litle & Co.
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
@@ -25,7 +25,6 @@ OTHER DEALINGS IN THE SOFTWARE.
25
25
  require 'test/unit'
26
26
  require File.expand_path("../../../lib/LitleOnline",__FILE__)
27
27
 
28
-
29
28
  require_relative 'test_xmlfields'
30
29
  require_relative 'test_captureGivenAuth'
31
30
  require_relative 'test_sale'
@@ -62,5 +61,6 @@ require_relative 'test_refundReversal'
62
61
  require_relative 'test_loadReversal'
63
62
  require_relative 'test_unloadReversal'
64
63
  require_relative 'test_deactivateReversal'
65
- require_relative 'test_fraudCheck'
64
+ require_relative 'test_wallet'
65
+ require_relative 'test_queryTransaction'
66
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LitleOnline
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.12.0
4
+ version: '10.1'
5
5
  platform: ruby
6
6
  authors:
7
- - Vantiv eCommerce
7
+ - Litle & Co
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-27 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xml-object
@@ -95,12 +95,12 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: |+
98
- Vantiv eCommerce Ruby SDK created for version 9.10 of Vantiv eCommerce XML format, see the XSD schema for specific fields that are supported by this format.
98
+ Litle Online Ruby SDK created for version 9.3 of Litle XML format, see the XSD schema for specific fields that are supported by this format.
99
99
 
100
- This gem contains an application interface in the Ruby programming language created by Vantiv eCommerce.
100
+ This gem contains an application interface in the Ruby programming language created by Litle & Co.
101
101
 
102
102
 
103
- email: sdksupport@vantiv.com
103
+ email: sdksupport@litle.com
104
104
  executables:
105
105
  - sample_driver.rb
106
106
  - Setup.rb
@@ -146,7 +146,6 @@ files:
146
146
  - samples/Run_all.rb
147
147
  - samples/Sale/LitleSaleTransaction.rb
148
148
  - samples/Sale/SampleSaleTransaction.rb
149
- - temp.xml
150
149
  - test/certification/certTest1_base.rb
151
150
  - test/certification/certTest2_authenhanced.rb
152
151
  - test/certification/certTest3_authreversal.rb
@@ -176,11 +175,11 @@ files:
176
175
  - test/functional/test_echeckVerification.rb
177
176
  - test/functional/test_echeckVoid.rb
178
177
  - test/functional/test_forceCapture.rb
179
- - test/functional/test_fraudCheck.rb
180
178
  - test/functional/test_litle_requests.rb
181
179
  - test/functional/test_load.rb
182
180
  - test/functional/test_loadReversal.rb
183
181
  - test/functional/test_override.rb
182
+ - test/functional/test_queryTransaction.rb
184
183
  - test/functional/test_refundReversal.rb
185
184
  - test/functional/test_sale.rb
186
185
  - test/functional/test_token.rb
@@ -189,7 +188,7 @@ files:
189
188
  - test/functional/test_updateCardValidationNumOnToken.rb
190
189
  - test/functional/test_updatePlan.rb
191
190
  - test/functional/test_updateSubscription.rb
192
- - test/functional/test_utf8.rb
191
+ - test/functional/test_wallet.rb
193
192
  - test/functional/test_xmlfields.rb
194
193
  - test/functional/ts_all.rb
195
194
  - test/unit/test_LitleAUBatch.rb
@@ -197,7 +196,6 @@ files:
197
196
  - test/unit/test_LitleOnlineRequest.rb
198
197
  - test/unit/test_LitleRequest.rb
199
198
  - test/unit/test_LitleTransaction.rb
200
- - test/unit/test_LitleXmlMapper.rb
201
199
  - test/unit/test_activate.rb
202
200
  - test/unit/test_activateReversal.rb
203
201
  - test/unit/test_auth.rb
@@ -217,9 +215,9 @@ files:
217
215
  - test/unit/test_echeckVerification.rb
218
216
  - test/unit/test_echeckVoid.rb
219
217
  - test/unit/test_forceCapture.rb
220
- - test/unit/test_fraudCheck.rb
221
218
  - test/unit/test_load.rb
222
219
  - test/unit/test_loadReversal.rb
220
+ - test/unit/test_queryTransaction.rb
223
221
  - test/unit/test_refundReversal.rb
224
222
  - test/unit/test_sale.rb
225
223
  - test/unit/test_token.rb
@@ -228,9 +226,10 @@ files:
228
226
  - test/unit/test_updateCardValidationNumOnToken.rb
229
227
  - test/unit/test_updatePlan.rb
230
228
  - test/unit/test_updateSubscription.rb
229
+ - test/unit/test_wallet.rb
231
230
  - test/unit/test_xmlfields.rb
232
231
  - test/unit/ts_unit.rb
233
- homepage: http://www.vantiv.com/developers
232
+ homepage: https://www.vantiv.com/developers/ecommerce-payments#sdk-ruby
234
233
  licenses: []
235
234
  metadata: {}
236
235
  post_install_message:
@@ -241,19 +240,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
240
  requirements:
242
241
  - - '>='
243
242
  - !ruby/object:Gem::Version
244
- version: 2.2.0
243
+ version: 2.0.0
245
244
  required_rubygems_version: !ruby/object:Gem::Requirement
246
245
  requirements:
247
246
  - - '>='
248
247
  - !ruby/object:Gem::Version
249
248
  version: '0'
250
249
  requirements:
251
- - Contact sdksupport@vantiv.com for more information
250
+ - Contact sdksupport@litle.com for more information
252
251
  rubyforge_project:
253
252
  rubygems_version: 2.4.8
254
253
  signing_key:
255
254
  specification_version: 4
256
- summary: Ruby SDK produced by Vantiv eCommerce for transaction processing using Vantiv
257
- eCommerce XML format v9.12
255
+ summary: Ruby SDK produced by Vantiv eCommerce for transaction processing using Litle
256
+ XML format v10.1
258
257
  test_files:
259
258
  - test/unit/ts_unit.rb
data/temp.xml DELETED
@@ -1,21 +0,0 @@
1
- <litleOnlineRequest merchantId="101" merchantSdk="Ruby;11.0" version="11.0" xmlns="http://www.litle.com/schema">
2
- <authentication>
3
- <user>demo</user>
4
- <password>demo</password>
5
- </authentication>
6
- <depositReversal id="test" reportGroup="Planets">
7
- <litleTxnId>5000</litleTxnId>
8
- <card>
9
- <type>GC</type>
10
- <number>400000000000001</number>
11
- <expDate>0150</expDate>
12
- <cardValidationNum>411</cardValidationNum>
13
- <pin>1234</pin>
14
- </card>
15
- <originalRefCode>101</originalRefCode>
16
- <originalAmount>34561</originalAmount>
17
- <originalTxnTime>2017-01-24T09:00:00</originalTxnTime>
18
- <originalSystemTraceId>33</originalSystemTraceId>
19
- <originalSequenceNumber>111111</originalSequenceNumber>
20
- </depositReversal>
21
- </litleOnlineRequest>
@@ -1,77 +0,0 @@
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 FraudCheck Transaction
29
- module LitleOnline
30
- class TestFraudCheck < Test::Unit::TestCase
31
- def test_fraud_check_happy_path
32
- hash = {
33
- 'merchantId' => '101',
34
- 'version'=>'10.1',
35
- 'id' => '127',
36
- 'reportGroup'=>'Planets',
37
- 'advancedFraudChecks' => {
38
- 'threatMetrixSessionId' => 'test1-BXXXXXX003',
39
- 'customAttribute1' => 'pass',
40
- 'customAttribute2' => '55',
41
- 'customAttribute3' => '5'}
42
- }
43
- response = LitleOnlineRequest.new.fraud_check_request(hash)
44
- assert_equal('000', response.fraudCheckResponse.response)
45
- assert_equal('Approved', response.fraudCheckResponse.message)
46
- assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
47
- assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
48
- assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
49
- assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
50
- end
51
-
52
- def test_fraud_check_session_id
53
- hash = {
54
- 'merchantId' => '101',
55
- 'version'=>'10.1',
56
- 'id' => '127',
57
- 'reportGroup'=>'Planets',
58
- 'advancedFraudChecks' => {
59
- 'threatMetrixSessionId' => 'test2-BXXXXXX003'
60
- }
61
- }
62
- response = LitleOnlineRequest.new.fraud_check_request(hash)
63
- assert_equal('000', response.fraudCheckResponse.response)
64
- assert_equal('Approved', response.fraudCheckResponse.message)
65
- assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
66
- assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
67
- # kind of a hack to get around the variable # of triggered rule elements. ie. 1 element is added as a string not
68
- # an Array. Fix is to write an unmarshaller or custom node class in XMLFields.rb
69
- if(response.fraudCheckResponse.advancedFraudResults.triggeredRule.is_a?(Array))
70
- assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
71
- elsif
72
- assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule)
73
- end
74
- end
75
-
76
- end
77
- end
@@ -1,44 +0,0 @@
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 ActivateReversal Transaction
29
- module LitleOnline
30
- class TestActivateReversal < Test::Unit::TestCase
31
-
32
- def test_simple
33
- hash = {
34
- 'merchantId' => '101',
35
- 'version'=>'8.8',
36
- 'reportGroup'=>'русский中文',
37
- 'litleTxnId' =>'5000'
38
- }
39
-
40
- response= LitleOnlineRequest.new.activate_reversal(hash)
41
- assert_equal('Valid Format', response.message)
42
- end
43
- end
44
- end
@@ -1,136 +0,0 @@
1
- =begin
2
- Copyright (c) 2017 Vantiv eCommerce
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
- OTHER DEALINGS IN THE SOFTWARE.
21
- =end
22
-
23
-
24
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
- require 'test/unit'
26
- require 'mocha/setup'
27
-
28
- module LitleOnline
29
- class TestLitleXmlMapper < Test::Unit::TestCase
30
-
31
- def test_LitleXmlMapper_request_xml_response_0
32
- hash =
33
- {
34
- 'merchantId' => '101',
35
- 'id' => 'test',
36
- 'version'=>'8.8',
37
- 'reportGroup'=>'Planets',
38
- 'litleTxnId'=>'123456',
39
- }
40
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"0\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
41
- response = LitleXmlMapper.request("","")
42
- assert_equal('0',response.response)
43
- end
44
-
45
- def test_LitleXmlMapper_request_xml_response_1
46
- hash =
47
- {
48
- 'merchantId' => '101',
49
- 'id' => 'test',
50
- 'version'=>'8.8',
51
- 'reportGroup'=>'Planets',
52
- 'litleTxnId'=>'123456',
53
- }
54
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"1\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
55
- #Get exceptions
56
- exception = assert_raise(RuntimeError){
57
- LitleXmlMapper.request("","")
58
- }
59
- #Test
60
- assert(exception.message =~ /Error with http response, code: 1/)
61
- end
62
-
63
- def test_LitleXmlMapper_request_xml_response_2
64
- hash =
65
- {
66
- 'merchantId' => '101',
67
- 'id' => 'test',
68
- 'version'=>'8.8',
69
- 'reportGroup'=>'Planets',
70
- 'litleTxnId'=>'123456',
71
- }
72
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"2\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
73
- #Get exceptions
74
- exception = assert_raise(RuntimeError){
75
- LitleXmlMapper.request("","")
76
- }
77
- #Test
78
- assert(exception.message =~ /Error with http response, code: 2/)
79
- end
80
-
81
- def test_LitleXmlMapper_request_xml_response_3
82
- hash =
83
- {
84
- 'merchantId' => '101',
85
- 'id' => 'test',
86
- 'version'=>'8.8',
87
- 'reportGroup'=>'Planets',
88
- 'litleTxnId'=>'123456',
89
- }
90
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"3\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
91
- #Get exceptions
92
- exception = assert_raise(RuntimeError){
93
- LitleXmlMapper.request("","")
94
- }
95
- #Test
96
- assert(exception.message =~ /Error with http response, code: 3/)
97
- end
98
-
99
- def test_LitleXmlMapper_request_xml_response_4
100
- hash =
101
- {
102
- 'merchantId' => '101',
103
- 'id' => 'test',
104
- 'version'=>'8.8',
105
- 'reportGroup'=>'Planets',
106
- 'litleTxnId'=>'123456',
107
- }
108
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"4\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
109
- #Get exceptions
110
- exception = assert_raise(RuntimeError){
111
- LitleXmlMapper.request("","")
112
- }
113
- #Test
114
- assert(exception.message =~ /Error with http response, code: 4/)
115
- end
116
-
117
- def test_LitleXmlMapper_request_xml_response_5
118
- hash =
119
- {
120
- 'merchantId' => '101',
121
- 'id' => 'test',
122
- 'version'=>'8.8',
123
- 'reportGroup'=>'Planets',
124
- 'litleTxnId'=>'123456',
125
- }
126
- Communications.expects(:http_post).returns("<litleOnlineResponse version=\"1.0\" xmlns=\"http://www.litle.com/schema/online\" response=\"5\" message=\"Invalid credentials. Contact support@litle.com.\"></litleOnlineResponse>")
127
- #Get exceptions
128
- exception = assert_raise(RuntimeError){
129
- LitleXmlMapper.request("","")
130
- }
131
- #Test
132
- assert(exception.message =~ /Error with http response, code: 5/)
133
- end
134
-
135
- end
136
- end
@@ -1,45 +0,0 @@
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
- require 'mocha/setup'
28
-
29
- #test FraudCheck Transaction
30
- module LitleOnline
31
- class TestFraudCheck < Test::Unit::TestCase
32
- def test_success_fraud_check
33
- hash = {
34
- 'merchantId' => '101',
35
- 'version'=>'10.1',
36
- 'id' => '127',
37
- 'reportGroup'=>'Planets',
38
- 'advancedFraudChecks' => {'threatMetrixSessionId' => 'test2-BXXXXXX003'},
39
- }
40
-
41
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<threatMetrixSessionId>test2-BXXXXXX003<\/threatMetrixSessionId>.*/m), is_a(Hash))
42
- LitleOnlineRequest.new.fraud_check_request(hash)
43
- end
44
- end
45
- end