CnpOnline 8.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +139 -0
  3. data/CONTRIBUTORS +2 -0
  4. data/DESCRIPTION +5 -0
  5. data/LICENSE +22 -0
  6. data/README.md +72 -0
  7. data/Rakefile +89 -0
  8. data/Rakefile~ +89 -0
  9. data/SETUP.md +46 -0
  10. data/bin/Setup.rb +124 -0
  11. data/bin/sample_batch_driver.rb +123 -0
  12. data/bin/sample_driver.rb +49 -0
  13. data/lib/Communications.rb +85 -0
  14. data/lib/Configuration.rb +67 -0
  15. data/lib/EnvironmentVariables.rb +22 -0
  16. data/lib/LitleBatchRequest.rb +562 -0
  17. data/lib/LitleListeners.rb +142 -0
  18. data/lib/LitleOnline.rb +62 -0
  19. data/lib/LitleOnlineRequest.rb +297 -0
  20. data/lib/LitleRequest.rb +494 -0
  21. data/lib/LitleTransaction.rb +463 -0
  22. data/lib/LitleXmlMapper.rb +64 -0
  23. data/lib/XMLFields.rb +1869 -0
  24. data/lib/cacert.pem +3331 -0
  25. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  26. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  27. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  28. data/samples/Batch/AccountUpdate.rb +64 -0
  29. data/samples/Batch/SampleBatchDriver.rb +94 -0
  30. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  31. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  32. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  33. data/samples/Capture/LitlePartialCapture.rb +16 -0
  34. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  35. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  36. data/samples/Other/LitleAvsTransaction.rb +34 -0
  37. data/samples/Other/LitleVoidTransaction.rb +18 -0
  38. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  39. data/samples/Run_all.rb +17 -0
  40. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  41. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  42. data/test/certification/certTest1_base.rb +945 -0
  43. data/test/certification/certTest2_authenhanced.rb +573 -0
  44. data/test/certification/certTest3_authreversal.rb +185 -0
  45. data/test/certification/certTest4_echeck.rb +278 -0
  46. data/test/certification/certTest5_token.rb +204 -0
  47. data/test/certification/certTest_batchAll.rb +337 -0
  48. data/test/certification/ts_all.rb +33 -0
  49. data/test/functional/test_activate.rb +100 -0
  50. data/test/functional/test_activateReversal.rb +56 -0
  51. data/test/functional/test_auth.rb +298 -0
  52. data/test/functional/test_authReversal.rb +69 -0
  53. data/test/functional/test_balanceInquiry.rb +80 -0
  54. data/test/functional/test_batch.rb +164 -0
  55. data/test/functional/test_batchStream.rb +145 -0
  56. data/test/functional/test_cancelSubscription.rb +55 -0
  57. data/test/functional/test_capture.rb +84 -0
  58. data/test/functional/test_captureGivenAuth.rb +235 -0
  59. data/test/functional/test_configuration.rb +89 -0
  60. data/test/functional/test_createPlan.rb +85 -0
  61. data/test/functional/test_credit.rb +174 -0
  62. data/test/functional/test_deactivate.rb +80 -0
  63. data/test/functional/test_deactivateReversal.rb +56 -0
  64. data/test/functional/test_depositReversal.rb +56 -0
  65. data/test/functional/test_echeckCredit.rb +134 -0
  66. data/test/functional/test_echeckRedeposit.rb +88 -0
  67. data/test/functional/test_echeckSale.rb +177 -0
  68. data/test/functional/test_echeckVerification.rb +127 -0
  69. data/test/functional/test_echeckVoid.rb +41 -0
  70. data/test/functional/test_forceCapture.rb +183 -0
  71. data/test/functional/test_litle_requests.rb +356 -0
  72. data/test/functional/test_load.rb +82 -0
  73. data/test/functional/test_loadReversal.rb +56 -0
  74. data/test/functional/test_override.rb +64 -0
  75. data/test/functional/test_refundReversal.rb +56 -0
  76. data/test/functional/test_sale.rb +259 -0
  77. data/test/functional/test_token.rb +115 -0
  78. data/test/functional/test_unload.rb +82 -0
  79. data/test/functional/test_unloadReversal.rb +56 -0
  80. data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
  81. data/test/functional/test_updatePlan.rb +58 -0
  82. data/test/functional/test_updateSubscription.rb +76 -0
  83. data/test/functional/test_xmlfields.rb +427 -0
  84. data/test/functional/ts_all.rb +66 -0
  85. data/test/unit/test_LitleAUBatch.rb +216 -0
  86. data/test/unit/test_LitleBatchRequest.rb +643 -0
  87. data/test/unit/test_LitleOnlineRequest.rb +295 -0
  88. data/test/unit/test_LitleRequest.rb +316 -0
  89. data/test/unit/test_LitleTransaction.rb +397 -0
  90. data/test/unit/test_activate.rb +92 -0
  91. data/test/unit/test_activateReversal.rb +44 -0
  92. data/test/unit/test_auth.rb +421 -0
  93. data/test/unit/test_authReversal.rb +82 -0
  94. data/test/unit/test_balanceInquiry.rb +52 -0
  95. data/test/unit/test_cancelSubscription.rb +43 -0
  96. data/test/unit/test_capture.rb +73 -0
  97. data/test/unit/test_captureGivenAuth.rb +188 -0
  98. data/test/unit/test_createPlan.rb +52 -0
  99. data/test/unit/test_credit.rb +342 -0
  100. data/test/unit/test_deactivate.rb +52 -0
  101. data/test/unit/test_deactivateReversal.rb +44 -0
  102. data/test/unit/test_depositReversal.rb +44 -0
  103. data/test/unit/test_echeckCredit.rb +71 -0
  104. data/test/unit/test_echeckRedeposit.rb +94 -0
  105. data/test/unit/test_echeckSale.rb +71 -0
  106. data/test/unit/test_echeckVerification.rb +71 -0
  107. data/test/unit/test_echeckVoid.rb +54 -0
  108. data/test/unit/test_forceCapture.rb +145 -0
  109. data/test/unit/test_load.rb +53 -0
  110. data/test/unit/test_loadReversal.rb +44 -0
  111. data/test/unit/test_refundReversal.rb +44 -0
  112. data/test/unit/test_sale.rb +465 -0
  113. data/test/unit/test_token.rb +144 -0
  114. data/test/unit/test_unload.rb +53 -0
  115. data/test/unit/test_unloadReversal.rb +44 -0
  116. data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
  117. data/test/unit/test_updatePlan.rb +45 -0
  118. data/test/unit/test_updateSubscription.rb +172 -0
  119. data/test/unit/test_xmlfields.rb +2930 -0
  120. data/test/unit/ts_unit.rb +65 -0
  121. metadata +255 -0
@@ -0,0 +1,115 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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
+ module LitleOnline
29
+ class TestToken < Test::Unit::TestCase
30
+ def test_simple_token
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'orderId'=>'12344',
36
+ 'accountNumber'=>'1233456789103801'
37
+ }
38
+ response= LitleOnlineRequest.new.register_token_request(hash)
39
+ assert_equal('Valid Format', response.message)
40
+ end
41
+
42
+ def test_simple_token_with_paypage
43
+ hash = {
44
+ 'merchantId' => '101',
45
+ 'version'=>'8.8',
46
+ 'reportGroup'=>'Planets',
47
+ 'orderId'=>'12344',
48
+ 'paypageRegistrationId'=>'QU1pTFZnV2NGQWZrZzRKeTNVR0lzejB1K2Q5VDdWMTVqb2J5WFJ2Snh4U0U4eTBxaFg2cEVWaDBWSlhtMVZTTw=='
49
+ }
50
+ response= LitleOnlineRequest.new.register_token_request(hash)
51
+ assert_equal('Valid Format', response.message)
52
+ assert_equal('1111222233334444', response.registerTokenResponse.litleToken)
53
+ end
54
+
55
+ def test_simple_token_with_applepay
56
+ hash = {
57
+ 'merchantId' => '101',
58
+ 'version'=>'8.8',
59
+ 'reportGroup'=>'Planets',
60
+ 'orderId'=>'12344',
61
+ 'applepay'=>{
62
+ 'data'=>'1234',
63
+ 'header'=>{
64
+ 'applicationData'=>'454657413164',
65
+ 'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
66
+ 'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
67
+ 'transactionId'=>'1234'
68
+ },
69
+ 'signature' =>'1',
70
+ 'version'=>'12345'
71
+ }
72
+ }
73
+ response= LitleOnlineRequest.new.register_token_request(hash)
74
+ assert_equal('Valid Format', response.message)
75
+ end
76
+
77
+ def test_simple_token_echeck
78
+ hash = {
79
+ 'reportGroup'=>'Planets',
80
+ 'merchantId' => '101',
81
+ 'version'=>'8.8',
82
+ 'orderId'=>'12344',
83
+ 'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
84
+ }
85
+ response= LitleOnlineRequest.new.register_token_request(hash)
86
+ assert_equal('Valid Format', response.message)
87
+ end
88
+
89
+ def test_fields_out_of_order
90
+ hash = {
91
+ 'merchantId' => '101',
92
+ 'version'=>'8.8',
93
+ 'orderId'=>'12344',
94
+ 'accountNumber'=>'1233456789103801',
95
+ 'reportGroup'=>'Planets',
96
+ }
97
+ response= LitleOnlineRequest.new.register_token_request(hash)
98
+ assert_equal('Valid Format', response.message)
99
+ end
100
+
101
+ def test_invalid_field
102
+ hash = {
103
+ 'merchantId' => '101',
104
+ 'version'=>'8.8',
105
+ 'NOSUCHFIELD'=>'none',
106
+ 'orderId'=>'12344',
107
+ 'accountNumber'=>'1233456789103801',
108
+ 'reportGroup'=>'Planets',
109
+ }
110
+ response= LitleOnlineRequest.new.register_token_request(hash)
111
+ assert_equal('Valid Format', response.message)
112
+ end
113
+ end
114
+
115
+ end
@@ -0,0 +1,82 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 Unload Transaction
29
+ module LitleOnline
30
+ class TestUnload < Test::Unit::TestCase
31
+
32
+ def test_simple_happy
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'orderId' =>'1001',
38
+ 'amount' =>'500',
39
+ 'orderSource' =>'ecommerce',
40
+ 'card'=>{
41
+ 'type'=>'VI',
42
+ 'number' =>'4100000000000001',
43
+ 'expDate' =>'1210'
44
+ }
45
+ }
46
+
47
+ response= LitleOnlineRequest.new.unload_request(hash)
48
+ assert_equal('Valid Format', response.message)
49
+ end
50
+
51
+ def test_simple_out_of_order
52
+ hash = {
53
+ 'merchantId' => '101',
54
+ 'version'=>'8.8',
55
+ 'reportGroup'=>'Planets',
56
+ 'amount' =>'500',
57
+ 'orderId' =>'1001',
58
+ 'orderSource' =>'ecommerce',
59
+ 'card'=>{
60
+ 'type'=>'VI',
61
+ 'number' =>'4100000000000001',
62
+ 'expDate' =>'1210'
63
+ }
64
+ }
65
+
66
+ response= LitleOnlineRequest.new.unload_request(hash)
67
+ assert_equal('Valid Format', response.message)
68
+ end
69
+
70
+ def test_simple_error
71
+ hash = {
72
+ 'merchantId' => '101',
73
+ 'version'=>'8.8',
74
+ 'reportGroup'=>'Planets',
75
+ 'amount' =>'500',
76
+ }
77
+
78
+ response= LitleOnlineRequest.new.unload_request(hash)
79
+ assert(response.message =~ /Error validating xml data against the schema/)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,56 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 unloadReversal Transaction
29
+ module LitleOnline
30
+ class TestUnloadReversal < Test::Unit::TestCase
31
+
32
+ def test_simple
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'litleTxnId' =>'5000'
38
+ }
39
+
40
+ response= LitleOnlineRequest.new.unload_reversal(hash)
41
+ assert_equal('Valid Format', response.message)
42
+ end
43
+
44
+
45
+ def test_simple_error
46
+ hash = {
47
+ 'merchantId' => '101',
48
+ 'version'=>'8.8',
49
+ 'reportGroup'=>'Planets',
50
+ }
51
+
52
+ response= LitleOnlineRequest.new.unload_reversal(hash)
53
+ assert(response.message =~ /Error validating xml data against the schema/)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,43 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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
+ module LitleOnline
29
+ class TestUpdateCardValidationNumOnToken < Test::Unit::TestCase
30
+ def test_simple
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'orderId'=>'12344',
36
+ 'litleToken'=>'1233456789103801',
37
+ 'cardValidationNum'=>'123'
38
+ }
39
+ response= LitleOnlineRequest.new.update_card_validation_num_on_token(hash)
40
+ assert_equal('Valid Format', response.message)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,58 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 UpdatePlan Transaction
29
+ module LitleOnline
30
+ class TestUpdatePlan < Test::Unit::TestCase
31
+
32
+ def test_simple_happy
33
+ hash ={
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'planCode'=>'planCodeString',
38
+ 'active'=>'true'
39
+ }
40
+
41
+ response= LitleOnlineRequest.new.update_plan(hash)
42
+ assert_equal('Valid Format', response.message)
43
+ end
44
+
45
+
46
+ def test_simple_error
47
+ hash = {
48
+ 'merchantId' => '101',
49
+ 'version'=>'8.8',
50
+ 'reportGroup'=>'Planets',
51
+ 'planCode'=>'planCodeString',
52
+ }
53
+
54
+ response= LitleOnlineRequest.new.update_plan(hash)
55
+ assert(response.message =~ /Error validating xml data against the schema/)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,76 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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 Authorization Transaction
29
+ module LitleOnline
30
+ class TestUpdateSubscription < Test::Unit::TestCase
31
+
32
+ def test_simple_happy
33
+ hash = {
34
+ 'merchantId' => '101',
35
+ 'version'=>'8.8',
36
+ 'reportGroup'=>'Planets',
37
+ 'subscriptionId' =>'1001'
38
+ }
39
+
40
+ response= LitleOnlineRequest.new.update_subscription(hash)
41
+ assert_equal('Valid Format', response.message)
42
+ end
43
+
44
+ def test_simple_out_of_order
45
+ hash = {
46
+ 'merchantId' => '101',
47
+ 'version'=>'8.8',
48
+ 'reportGroup'=>'Planets',
49
+ 'subscriptionId' =>'1001',
50
+ 'billingDate'=>'2014-03-11',
51
+ 'planCode'=>'planCodeString',
52
+ 'deleteDiscount'=>[{'discountCode'=>'discCode3'},{'discountCode'=>'discCode33'}],
53
+ 'updateAddOn'=>[
54
+ {
55
+ 'addOnCode'=>'addOnCode2',
56
+ }],
57
+ 'deleteAddOn'=>[{'addOnCode'=>'addOnCode3'}]
58
+
59
+ }
60
+
61
+ response= LitleOnlineRequest.new.update_subscription(hash)
62
+ assert_equal('Valid Format', response.message)
63
+ end
64
+
65
+ def test_simple_error
66
+ hash = {
67
+ 'merchantId' => '101',
68
+ 'version'=>'8.8',
69
+ 'reportGroup'=>'Planets',
70
+ }
71
+
72
+ response= LitleOnlineRequest.new.update_subscription(hash)
73
+ assert(response.message =~ /Error validating xml data against the schema/)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,427 @@
1
+ =begin
2
+ Copyright (c) 2012 Litle & Co.
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
+ module LitleOnline
29
+ class TestXmlfields < Test::Unit::TestCase
30
+ def test_card_no_required_type_or_track
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'123456',
36
+ 'orderId'=>'12344',
37
+ 'amount'=>'106',
38
+ 'orderSource'=>'ecommerce',
39
+ 'card'=>{
40
+ 'number' =>'4100000000000001',
41
+ 'expDate' =>'1210',
42
+ 'cardValidationNum'=> '123'
43
+ }}
44
+ response= LitleOnlineRequest.new.sale(hash)
45
+ assert(response.message =~ /Error validating xml data against the schema/)
46
+ end
47
+
48
+ def test_simple_custom_billing
49
+ hash = {
50
+ 'merchantId' => '101',
51
+ 'version'=>'8.8',
52
+ 'reportGroup'=>'Planets',
53
+ 'litleTxnId'=>'123456',
54
+ 'orderId'=>'12344',
55
+ 'amount'=>'106',
56
+ 'orderSource'=>'ecommerce',
57
+ 'customBilling'=>{'phone'=>'123456789','descriptor'=>'good'},
58
+ 'card'=>{
59
+ 'type'=>'VI',
60
+ 'number' =>'4100000000000000',
61
+ 'expDate' =>'1210'
62
+ }}
63
+ response= LitleOnlineRequest.new.sale(hash)
64
+ assert_equal('Valid Format', response.message)
65
+ end
66
+
67
+ def test_bill_me_later
68
+ hash = {
69
+ 'merchantId' => '101',
70
+ 'version'=>'8.8',
71
+ 'reportGroup'=>'Planets',
72
+ 'litleTxnId'=>'123456',
73
+ 'orderId'=>'12344',
74
+ 'amount'=>'106',
75
+ 'orderSource'=>'ecommerce',
76
+ 'billMeLaterRequest'=>{'bmlMerchantId'=>'12345','preapprovalNumber'=>'12345678909023',
77
+ 'customerPhoneChnaged'=>'False','itemCategoryCode'=>'2'},
78
+ 'card'=>{
79
+ 'type'=>'VI',
80
+ 'number' =>'4100000000000000',
81
+ 'expDate' =>'1210'
82
+ }}
83
+ response= LitleOnlineRequest.new.sale(hash)
84
+ assert_equal('000', response.saleResponse.response)
85
+ end
86
+
87
+ def test__customer_info
88
+ hash = {
89
+ 'merchantId' => '101',
90
+ 'version'=>'8.8',
91
+ 'reportGroup'=>'Planets',
92
+ 'litleTxnId'=>'123456',
93
+ 'orderId'=>'12344',
94
+ 'amount'=>'106',
95
+ 'orderSource'=>'ecommerce',
96
+ 'CustomerInfo'=>{'ssn'=>'12345','incomeAmount'=>'12345','incomeCurrency'=>'dollar','yearsAtResidence'=>'2'},
97
+ 'card'=>{
98
+ 'type'=>'VI',
99
+ 'number' =>'4100000000000000',
100
+ 'expDate' =>'1210'
101
+ }}
102
+ response= LitleOnlineRequest.new.sale(hash)
103
+ assert_equal('Valid Format', response.message)
104
+ end
105
+
106
+ def test_simple_bill_to_address
107
+ hash = {
108
+ 'merchantId' => '101',
109
+ 'version'=>'8.8',
110
+ 'reportGroup'=>'Planets',
111
+ 'orderId'=>'12344',
112
+ 'amount'=>'106',
113
+ 'orderSource'=>'ecommerce',
114
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
115
+ 'card'=>{
116
+ 'type'=>'VI',
117
+ 'number' =>'4100000000000000',
118
+ 'expDate' =>'1210'
119
+ }}
120
+ response= LitleOnlineRequest.new.authorization(hash)
121
+ assert_equal('Valid Format', response.message)
122
+ end
123
+
124
+ def test_processing_instructions
125
+ hash = {
126
+ 'merchantId' => '101',
127
+ 'version'=>'8.8',
128
+ 'reportGroup'=>'Planets',
129
+ 'orderId'=>'12344',
130
+ 'amount'=>'106',
131
+ 'orderSource'=>'ecommerce',
132
+ 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
133
+ 'card'=>{
134
+ 'type'=>'VI',
135
+ 'number' =>'4100000000000000',
136
+ 'expDate' =>'1210'
137
+ }}
138
+ response= LitleOnlineRequest.new.authorization(hash)
139
+ assert_equal('Valid Format', response.message)
140
+ end
141
+
142
+ def test_pos
143
+ hash = {
144
+ 'merchantId' => '101',
145
+ 'version'=>'8.8',
146
+ 'reportGroup'=>'Planets',
147
+ 'orderId'=>'12344',
148
+ 'amount'=>'106',
149
+ 'orderSource'=>'ecommerce',
150
+ 'pos'=>{'capability'=>'notused','entryMode'=>'track1','cardholderId'=>'pin'},
151
+ 'card'=>{
152
+ 'type'=>'VI',
153
+ 'number' =>'4100000000000000',
154
+ 'expDate' =>'1210'
155
+ }}
156
+ response= LitleOnlineRequest.new.authorization(hash)
157
+ assert_equal('Valid Format', response.message)
158
+ end
159
+
160
+ def test_amex_data
161
+ hash = {
162
+ 'merchantId' => '101',
163
+ 'version'=>'8.8',
164
+ 'reportGroup'=>'Planets',
165
+ 'orderId'=>'12344',
166
+ 'amount'=>'106',
167
+ 'card'=>{
168
+ 'type'=>'VI',
169
+ 'number' =>'4100000000000000',
170
+ 'expDate' =>'1210'},
171
+ 'orderSource'=>'ecommerce',
172
+ 'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234','sellerId'=>'1234Id'}
173
+ }
174
+ response= LitleOnlineRequest.new.credit(hash)
175
+ assert_equal('Valid Format', response.message)
176
+ end
177
+
178
+ def test_amex_data_missing_seller_id
179
+ hash = {
180
+ 'merchantId' => '101',
181
+ 'version'=>'8.8',
182
+ 'reportGroup'=>'Planets',
183
+ 'orderId'=>'12344',
184
+ 'amount'=>'106',
185
+ 'orderSource'=>'ecommerce',
186
+ 'card'=>{
187
+ 'type'=>'VI',
188
+ 'number' =>'4100000000000001',
189
+ 'expDate' =>'1210'},
190
+ 'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234'}
191
+ }
192
+ response= LitleOnlineRequest.new.credit(hash)
193
+ assert(response.message =~ /Error validating xml data against the schema/)
194
+ end
195
+
196
+ def test_simple_enhanced_data
197
+ hash = {
198
+ 'merchantId' => '101',
199
+ 'version'=>'8.8',
200
+ 'reportGroup'=>'Planets',
201
+ 'orderId'=>'12344',
202
+ 'amount'=>'106',
203
+ 'card'=>{
204
+ 'type'=>'VI',
205
+ 'number' =>'4100000000000000',
206
+ 'expDate' =>'1210'},
207
+ 'orderSource'=>'ecommerce',
208
+ 'enhancedData'=>{
209
+ 'customerReference'=>'Litle',
210
+ 'salesTax'=>'50',
211
+ 'deliveryType'=>'TBD',
212
+ 'restriction'=>'DIG',
213
+ 'shipFromPostalCode'=>'01741',
214
+ 'destinationPostalCode'=>'01742'}
215
+ }
216
+ response= LitleOnlineRequest.new.credit(hash)
217
+ assert_equal('Valid Format', response.message)
218
+ end
219
+
220
+ def test_enhanced_data_with_detail_tax
221
+ hash = {
222
+ 'merchantId' => '101',
223
+ 'version'=>'8.8',
224
+ 'reportGroup'=>'Planets',
225
+ 'orderId'=>'12344',
226
+ 'amount'=>'106',
227
+ 'card'=>{
228
+ 'type'=>'VI',
229
+ 'number' =>'4100000000000000',
230
+ 'expDate' =>'1210'},
231
+ 'orderSource'=>'ecommerce',
232
+ 'enhancedData'=>{
233
+ 'detailtax'=>{'taxAmount'=>'1234','tax'=>'50'},
234
+ 'customerReference'=>'Litle',
235
+ 'salesTax'=>'50',
236
+ 'deliveryType'=>'TBD',
237
+ 'restriction'=>'DIG',
238
+ 'shipFromPostalCode'=>'01741',
239
+ 'destinationPostalCode'=>'01742'}
240
+ }
241
+ response= LitleOnlineRequest.new.credit(hash)
242
+ assert_equal('Valid Format', response.message)
243
+ end
244
+
245
+ def test_enhanced_data_with_line_item
246
+ hash = {
247
+ 'merchantId' => '101',
248
+ 'version'=>'8.8',
249
+ 'reportGroup'=>'Planets',
250
+ 'orderId'=>'12344',
251
+ 'amount'=>'106',
252
+ 'card'=>{
253
+ 'type'=>'VI',
254
+ 'number' =>'4100000000000000',
255
+ 'expDate' =>'1210'}, 'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
256
+ 'orderSource'=>'ecommerce',
257
+ 'lineItemData'=>{
258
+ 'itemSequenceNumber'=>'98765',
259
+ 'itemDescription'=>'VERYnice',
260
+ 'productCode'=>'10010100',
261
+ 'quantity'=>'7',
262
+ 'unitOfMeasure'=>'pounds',
263
+ 'enhancedData'=>{
264
+ 'detailtax'=>{'taxAmount'=>'1234','tax'=>'50'}},
265
+ 'customerReference'=>'Litle',
266
+ 'salesTax'=>'50',
267
+ 'deliveryType'=>'TBD',
268
+ 'restriction'=>'DIG',
269
+ 'shipFromPostalCode'=>'01741',
270
+ 'destinationPostalCode'=>'01742'}
271
+ }
272
+ response= LitleOnlineRequest.new.credit(hash)
273
+ assert_equal('Valid Format', response.message)
274
+ end
275
+
276
+ def test_simple_token
277
+ hash = {
278
+ 'merchantId' => '101',
279
+ 'version'=>'8.8',
280
+ 'reportGroup'=>'Planets',
281
+ 'orderId'=>'12344',
282
+ 'amount'=>'106',
283
+ 'orderSource'=>'ecommerce',
284
+ 'token'=> {
285
+ 'litleToken'=>'123456789101112',
286
+ 'expDate'=>'1210',
287
+ 'cardValidationNum'=>'555',
288
+ 'type'=>'VI'
289
+ }}
290
+ response= LitleOnlineRequest.new.credit(hash)
291
+ assert_equal('Valid Format', response.message)
292
+ end
293
+
294
+ def test_token_missing_exp_dat_and_valid_num
295
+ hash = {
296
+ 'merchantId' => '101',
297
+ 'version'=>'8.8',
298
+ 'reportGroup'=>'Planets',
299
+ 'orderId'=>'12344',
300
+ 'amount'=>'106',
301
+ 'orderSource'=>'ecommerce',
302
+ 'token'=> {
303
+ 'litleToken'=>'123456789101112',
304
+ 'type'=>'VI'
305
+ }}
306
+ response= LitleOnlineRequest.new.credit(hash)
307
+ assert_equal('Valid Format', response.message)
308
+ end
309
+
310
+ def test_simple_paypage
311
+ hash = {
312
+ 'merchantId' => '101',
313
+ 'version'=>'8.8',
314
+ 'reportGroup'=>'Planets',
315
+ 'orderId'=>'12344',
316
+ 'amount'=>'106',
317
+ 'orderSource'=>'ecommerce',
318
+ 'paypage'=> {
319
+ 'paypageRegistrationId'=>'123456789101112',
320
+ 'expDate'=>'1210',
321
+ 'cardValidationNum'=>'555',
322
+ 'type'=>'VI'
323
+ }}
324
+ response= LitleOnlineRequest.new.credit(hash)
325
+ assert_equal('Valid Format', response.message)
326
+ end
327
+
328
+ def test_paypage_missing_exp_dat_and_valid_num
329
+ hash = {
330
+ 'merchantId' => '101',
331
+ 'version'=>'8.8',
332
+ 'reportGroup'=>'Planets',
333
+ 'orderId'=>'12344',
334
+ 'amount'=>'106',
335
+ 'orderSource'=>'ecommerce',
336
+ 'paypage'=> {
337
+ 'paypageRegistrationId'=>'123456789101112',
338
+ 'type'=>'VI'
339
+ }}
340
+ response= LitleOnlineRequest.new.credit(hash)
341
+ assert_equal('Valid Format', response.message)
342
+ end
343
+
344
+ def test_line_item_data
345
+ hash = {
346
+ 'merchantId' => '101',
347
+ 'version'=>'8.8',
348
+ 'reportGroup'=>'Planets',
349
+ 'orderId'=>'1',
350
+ 'amount'=>'2',
351
+ 'orderSource'=>'ecommerce',
352
+ 'card'=>{
353
+ 'type'=>'VI',
354
+ 'number' =>'4100000000000001',
355
+ 'expDate' =>'1210'
356
+ },
357
+ 'enhancedData'=>
358
+ {
359
+ 'lineItemData'=>[
360
+ {'itemSequenceNumber'=>'1', 'itemDescription'=>'desc1'},
361
+ {'itemSequenceNumber'=>'2', 'itemDescription'=>'desc2'}
362
+ ]
363
+ }
364
+ }
365
+ response= LitleOnlineRequest.new.authorization(hash)
366
+ assert_equal('Valid Format', response.message)
367
+ end
368
+
369
+ def test_detail_tax
370
+ hash = {
371
+ 'merchantId' => '101',
372
+ 'version'=>'8.8',
373
+ 'reportGroup'=>'Planets',
374
+ 'orderId'=>'1',
375
+ 'amount'=>'2',
376
+ 'orderSource'=>'ecommerce',
377
+ 'card'=>{
378
+ 'type'=>'VI',
379
+ 'number' =>'4100000000000001',
380
+ 'expDate' =>'1210'
381
+ },
382
+ 'enhancedData'=>
383
+ {
384
+ 'detailTax'=>[
385
+ {'taxIncludedInTotal'=>'true', 'taxAmount'=>'0'},
386
+ {'taxIncludedInTotal'=>'false', 'taxAmount'=>'1'}
387
+ ]
388
+ }
389
+ }
390
+ response= LitleOnlineRequest.new.authorization(hash)
391
+ assert_equal('Valid Format', response.message)
392
+ end
393
+
394
+ def test_detail_tax_in_lineItem
395
+ hash = {
396
+ 'merchantId' => '101',
397
+ 'version'=>'8.8',
398
+ 'reportGroup'=>'Planets',
399
+ 'orderId'=>'1',
400
+ 'amount'=>'2',
401
+ 'orderSource'=>'ecommerce',
402
+ 'card'=>{
403
+ 'type'=>'VI',
404
+ 'number' =>'4100000000000001',
405
+ 'expDate' =>'1210'
406
+ },
407
+ 'enhancedData'=>
408
+ {
409
+ 'lineItemData'=>[
410
+ {'itemSequenceNumber'=>'1', 'itemDescription'=>'desc1','detailTax'=>[
411
+ {'taxAmount'=>'1'},
412
+ {'taxAmount'=>'2'}]
413
+ },
414
+ {'itemSequenceNumber'=>'2', 'itemDescription'=>'desc2','detailTax'=>[
415
+ {'taxAmount'=>'3'},
416
+ {'taxAmount'=>'4'}]
417
+ }],
418
+ 'detailTax'=>[
419
+ {'taxAmount'=>'5'},
420
+ {'taxAmount'=>'6'}
421
+ ]}
422
+ }
423
+ response= LitleOnlineRequest.new.authorization(hash)
424
+ assert_equal('Valid Format', response.message)
425
+ end
426
+ end
427
+ end