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,69 @@
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 TestAuthReversal < Test::Unit::TestCase
30
+ def test_simple_auth_reversal
31
+ hash = {
32
+ 'merchantId' => '101',
33
+ 'version'=>'8.8',
34
+ 'reportGroup'=>'Planets',
35
+ 'litleTxnId'=>'12345678000',
36
+ 'amount'=>'106',
37
+ 'payPalNotes'=>'Notes'
38
+ }
39
+ response= LitleOnlineRequest.new.auth_reversal(hash)
40
+ assert_equal('Valid Format', response.message)
41
+ end
42
+
43
+ def test_fields_out_of_order
44
+ hash = {
45
+ 'merchantId' => '101',
46
+ 'version'=>'8.8',
47
+ 'litleTxnId'=>'12345000',
48
+ 'payPalNotes'=>'Notes',
49
+ 'amount'=>'106',
50
+ 'reportGroup'=>'Planets',
51
+ }
52
+ response= LitleOnlineRequest.new.auth_reversal(hash)
53
+ assert_equal('Valid Format', response.message)
54
+ end
55
+
56
+ def test_no_litle_txn_id
57
+ hash = {
58
+ 'merchantId' => '101',
59
+ 'version'=>'8.8',
60
+ 'reportGroup'=>'12345678',
61
+ 'amount'=>'106',
62
+ 'payPalNotes'=>'Notes'
63
+ }
64
+ response= LitleOnlineRequest.new.auth_reversal(hash)
65
+ assert(response.message =~ /Error validating xml data against the schema/)
66
+ end
67
+
68
+ end
69
+ end
@@ -0,0 +1,80 @@
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 BalanceInquiry Transaction
29
+ module LitleOnline
30
+ class TestBalanceInquiry < 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
+ 'orderSource' =>'ecommerce',
39
+ 'card'=>{
40
+ 'type'=>'VI',
41
+ 'number' =>'4100000000000001',
42
+ 'expDate' =>'1210'
43
+ }
44
+ }
45
+
46
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
47
+ assert_equal('Valid Format', response.message)
48
+ end
49
+
50
+ def test_simple_out_of_order
51
+ hash = {
52
+ 'merchantId' => '101',
53
+ 'version'=>'8.8',
54
+ 'reportGroup'=>'Planets',
55
+ 'orderSource' =>'ecommerce',
56
+ 'orderId' =>'1001',
57
+ 'card'=>{
58
+ 'type'=>'VI',
59
+ 'number' =>'4100000000000001',
60
+ 'expDate' =>'1210'
61
+ }
62
+ }
63
+
64
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
65
+ assert_equal('Valid Format', response.message)
66
+ end
67
+
68
+ def test_simple_error
69
+ hash = {
70
+ 'merchantId' => '101',
71
+ 'version'=>'8.8',
72
+ 'reportGroup'=>'Planets',
73
+ 'amount' =>'500',
74
+ }
75
+
76
+ response= LitleOnlineRequest.new.balance_inquiry(hash)
77
+ assert(response.message =~ /Error validating xml data against the schema/)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,164 @@
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
+ require 'fileutils'
28
+
29
+ #test Authorization Transaction
30
+ module LitleOnline
31
+ class TestBatch < Test::Unit::TestCase
32
+
33
+ def setup
34
+ dir = '/tmp/litle-sdk-for-ruby-test'
35
+ FileUtils.rm_rf dir
36
+ Dir.mkdir dir
37
+ end
38
+
39
+ def test_batch_file_creation
40
+ dir = '/tmp'
41
+
42
+ batch = LitleBatchRequest.new
43
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
44
+
45
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
46
+
47
+ assert_equal entries.length, 4
48
+ entries.sort!
49
+ assert_not_nil entries[2] =~ /batch_\d+\z/
50
+ assert_not_nil entries[3] =~ /batch_\d+_txns\z/
51
+ end
52
+
53
+ def test_batch_file_creation_account_update
54
+ dir = '/tmp'
55
+
56
+ batch = LitleBatchRequest.new
57
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
58
+
59
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
60
+
61
+ assert_equal entries.length, 4
62
+ entries.sort!
63
+ assert_not_nil entries[2] =~ /batch_\d+\z/
64
+ assert_not_nil entries[3] =~ /batch_\d+_txns\z/
65
+
66
+ accountUpdateHash = {
67
+ 'reportGroup'=>'Planets',
68
+ 'id'=>'12345',
69
+ 'customerId'=>'0987',
70
+ 'card'=>{
71
+ 'type'=>'VI',
72
+ 'number' =>'4100000000000001',
73
+ 'expDate' =>'1210'
74
+ }}
75
+ batch.account_update(accountUpdateHash)
76
+
77
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
78
+ assert_equal entries.length, 6
79
+ entries.sort!
80
+ assert_not_nil entries[2] =~ /batch_\d+\z/
81
+ assert_not_nil entries[3] =~ /batch_\d+_txns\z/
82
+ assert_not_nil entries[4] =~ /batch_\d+\z/
83
+ assert_not_nil entries[5] =~ /batch_\d+_txns\z/
84
+ end
85
+
86
+ def test_batch_file_creation_on_file
87
+ dir = '/tmp'
88
+
89
+ File.open(dir + '/litle-sdk-for-ruby-test/test_batch_file_creation_on_file', 'a+') do |file|
90
+ file.puts("")
91
+ end
92
+
93
+ assert_raise ArgumentError do
94
+ batch = LitleBatchRequest.new
95
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test/test_batch_file_creation_on_file')
96
+ end
97
+ end
98
+
99
+ def test_batch_file_rename_and_remove
100
+ dir = '/tmp'
101
+
102
+ batch = LitleBatchRequest.new
103
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
104
+ assert_equal Dir.entries(dir+'/litle-sdk-for-ruby-test').size, 4
105
+ batch.close_batch
106
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
107
+ assert_equal entries.size, 3
108
+ entries.sort!
109
+ assert_not_nil entries[2] =~ /batch_\d+.closed-\d+\z/
110
+ end
111
+
112
+ def test_batch_file_create_new_dir
113
+ dir = '/tmp'
114
+ batch = LitleBatchRequest.new
115
+ assert !File.directory?(dir + '/litle-sdk-for-ruby-test/test_batch_file_create_new_dir')
116
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test/test_batch_file_create_new_dir')
117
+ assert File.directory?(dir + '/litle-sdk-for-ruby-test/test_batch_file_create_new_dir')
118
+ end
119
+
120
+ def test_batch_open_existing
121
+ dir = '/tmp'
122
+ batch = LitleBatchRequest.new
123
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
124
+
125
+ hash = {
126
+ 'merchantId' => '101',
127
+ 'version'=>'8.8',
128
+ 'reportGroup'=>'Planets',
129
+ 'litleTxnId'=>'123456',
130
+ 'orderId'=>'12344',
131
+ 'amount'=>'106',
132
+ 'orderSource'=>'ecommerce',
133
+ 'card'=>{
134
+ 'type'=>'VI',
135
+ 'number' =>'4100000000000002',
136
+ 'expDate' =>'1210'
137
+ }}
138
+
139
+ batch.sale(hash)
140
+
141
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
142
+ entries.sort!
143
+
144
+ batch2 = LitleBatchRequest.new
145
+ batch2.open_existing_batch(dir + '/litle-sdk-for-ruby-test/' + entries[2])
146
+ assert_equal batch.get_counts_and_amounts, batch2.get_counts_and_amounts
147
+ end
148
+
149
+ def test_batch_open_existing_closed
150
+ dir = '/tmp'
151
+ batch = LitleBatchRequest.new
152
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
153
+ batch.close_batch
154
+
155
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
156
+ entries.sort!
157
+
158
+ batch2 = LitleBatchRequest.new
159
+ assert_raise ArgumentError do
160
+ batch2.open_existing_batch(dir + '/litle-sdk-for-ruby-test/' + entries[2])
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,145 @@
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
+ require 'fileutils'
28
+
29
+ module LitleOnline
30
+ class TestLitleBatchStream < Test::Unit::TestCase
31
+
32
+ def setup
33
+ dir = '/tmp/litle-sdk-for-ruby-test'
34
+ FileUtils.rm_rf dir
35
+ Dir.mkdir dir
36
+ end
37
+
38
+ def test_full_flow
39
+ saleHash = {
40
+ 'reportGroup'=>'Planets',
41
+ 'id' => '006',
42
+ 'orderId'=>'12344',
43
+ 'amount'=>'6000',
44
+ 'orderSource'=>'ecommerce',
45
+ 'card'=>{
46
+ 'type'=>'VI',
47
+ 'number' =>'4100000000000001',
48
+ 'expDate' =>'1210'
49
+ }}
50
+
51
+ dir = '/tmp'
52
+
53
+ request = LitleRequest.new()
54
+ request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
55
+
56
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
57
+ entries.sort!
58
+
59
+ assert_equal entries.size, 4
60
+ assert_not_nil entries[2] =~ /request_\d+\z/
61
+ assert_not_nil entries[3] =~ /request_\d+_batches\z/
62
+
63
+ #create five batches, each with 10 sales
64
+
65
+ batch = LitleBatchRequest.new
66
+ batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
67
+
68
+ cancelSubscriptionHash =
69
+ {
70
+ 'subscriptionId'=>'100'
71
+ }
72
+ batch.cancel_subscription(cancelSubscriptionHash)
73
+
74
+ updateSubscriptionHash =
75
+ {
76
+ 'subscriptionId'=>'1000'
77
+ }
78
+ batch.update_subscription(updateSubscriptionHash)
79
+
80
+ createPlanHash ={
81
+ 'merchantId' => '101',
82
+ 'version'=>'8.8',
83
+ 'reportGroup'=>'Planets',
84
+ 'planCode'=>'createPlanCodeString',
85
+ 'name'=>'nameString',
86
+ 'description'=>'descriptionString',
87
+ 'intervalType'=>'ANNUAL',
88
+ 'amount'=>'500',
89
+ 'numberOfPayments'=>'2',
90
+ 'trialNumberOfIntervals'=>'1',
91
+ 'trialIntervalType'=>'MONTH',
92
+ 'active'=>'true'
93
+ }
94
+ batch.create_plan(createPlanHash)
95
+
96
+ updatePlanHash ={
97
+ 'merchantId' => '101',
98
+ 'version'=>'8.8',
99
+ 'reportGroup'=>'Planets',
100
+ 'planCode'=>'updatePlanCodeString',
101
+ 'active'=>'true'
102
+ }
103
+
104
+ batch.update_plan(updatePlanHash)
105
+
106
+ #close the batch, indicating we plan to add no more transactions
107
+ batch.close_batch()
108
+
109
+
110
+ #add the batch to the LitleRequest
111
+ request.commit_batch(batch)
112
+
113
+ #finish the Litle Request, indicating we plan to add no more batches
114
+ request.finish_request
115
+ entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
116
+ assert_equal entries.length, 3
117
+ entries.sort!
118
+ assert_not_nil entries[2] =~ /request_\d+.complete\z/
119
+
120
+ #send the batch files at the given directory over sFTP
121
+ request.send_to_litle_stream
122
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
123
+ type = transaction["type"]
124
+
125
+ if(type == "cancelSubscriptionResponse") then
126
+ assert_equal "100" ,transaction["subscriptionId"]
127
+ end
128
+
129
+ if(type == "updateSubscriptionResponse") then
130
+ assert_equal "1000" ,transaction["subscriptionId"]
131
+ end
132
+
133
+ if(type == "createPlanResponse") then
134
+ assert_equal "createPlanCodeString" ,transaction["planCode"]
135
+ end
136
+
137
+ if(type == "updatePlanResponse") then
138
+ assert_equal "updatePlanCodeString" ,transaction["planCode"]
139
+ end
140
+
141
+ end})
142
+
143
+ end
144
+ end
145
+ end