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
@@ -68,7 +68,8 @@ module LitleOnline
68
68
  'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
69
69
  },
70
70
  'signature' =>'sign',
71
- 'version' =>'1.0.0'
71
+ # 'version' =>'1'
72
+ 'version' =>'10000'
72
73
  }
73
74
  }
74
75
 
@@ -86,7 +87,7 @@ module LitleOnline
86
87
  'orderId'=>'12344',
87
88
  'amount'=>'106',
88
89
  'orderSource'=>'ecommerce',
89
- 'fraudCheck'=>{'authenticationTransactionId'=>'123'}, #for test
90
+ # 'fraudCheck'=>{'authenticationTransactionId'=>'123'}, #for test
90
91
  'card'=>{
91
92
  'type'=>'VI',
92
93
  'number' =>'4100000000000002',
@@ -255,7 +256,8 @@ module LitleOnline
255
256
  }
256
257
  }
257
258
 
258
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m), is_a(Hash))
259
+ XMLObject.expects(:new)
260
+ Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m),kind_of(Hash))
259
261
  LitleOnlineRequest.new.sale(hash)
260
262
  end
261
263
 
@@ -290,7 +292,8 @@ module LitleOnline
290
292
  'fraudFilterOverride'=> 'false'
291
293
  }
292
294
 
293
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m), is_a(Hash))
295
+ XMLObject.expects(:new)
296
+ Communications.expects(:http_post).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m),kind_of(Hash))
294
297
  LitleOnlineRequest.new.sale(hash)
295
298
  end
296
299
 
@@ -459,73 +462,5 @@ module LitleOnline
459
462
  LitleOnlineRequest.new.sale(hash)
460
463
  end
461
464
 
462
- def test_processingType
463
- hash = {
464
- 'merchantId' => '101',
465
- 'version'=>'8.8',
466
- 'reportGroup'=>'Planets',
467
- 'litleTxnId'=>'123456',
468
- 'orderId'=>'12344',
469
- 'amount'=>'106',
470
- 'orderSource'=>'ecommerce',
471
- 'card'=>
472
- {
473
- 'type'=>'MC',
474
- 'number' =>'5400000000000000',
475
- 'expDate' =>'1210'
476
- },
477
- 'processingType'=>'initialInstallment'
478
- }
479
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<processingType>initialInstallment<\/processingType>.*/m), is_a(Hash))
480
- LitleOnlineRequest.new.sale(hash)
481
- end
482
-
483
- def test_originalNetworkTransactionId_originalTransactionAmount_pin
484
- hash = {
485
- 'merchantId' => '101',
486
- 'version'=>'8.8',
487
- 'reportGroup'=>'Planets',
488
- 'litleTxnId'=>'123456',
489
- 'orderId'=>'12344',
490
- 'amount'=>'106',
491
- 'orderSource'=>'ecommerce',
492
- 'card'=>
493
- {
494
- 'type'=>'VI',
495
- 'number' =>'4100700000000000',
496
- 'expDate' =>'1210',
497
- 'pin'=>'1111'
498
- },
499
- 'originalNetworkTransactionId'=>'98765432109876543210',
500
- 'originalTransactionAmount'=>'7001'
501
- }
502
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<originalNetworkTransactionId>98765432109876543210<\/originalNetworkTransactionId><originalTransactionAmount>7001<\/originalTransactionAmount>.*/m), is_a(Hash))
503
- LitleOnlineRequest.new.sale(hash)
504
- end
505
-
506
- def test_wallet
507
- hash = {
508
- 'merchantId' => '101',
509
- 'version'=>'8.8',
510
- 'reportGroup'=>'Planets',
511
- 'litleTxnId'=>'123456',
512
- 'orderId'=>'12344',
513
- 'amount'=>'106',
514
- 'orderSource'=>'ecommerce',
515
- 'card'=>
516
- {
517
- 'type'=>'VI',
518
- 'number' =>'4100700000000000',
519
- 'expDate' =>'1210',
520
- },
521
- 'wallet'=>{
522
- 'walletSourceType'=>'VisaCheckout',
523
- 'walletSourceTypeId'=>'VCIND'
524
- }
525
- }
526
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<wallet><walletSourceType>VisaCheckout<\/walletSourceType><walletSourceTypeId>VCIND<\/walletSourceTypeId><\/wallet>.*/m), is_a(Hash))
527
- LitleOnlineRequest.new.sale(hash)
528
- end
529
-
530
465
  end
531
466
  end
@@ -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
@@ -43,7 +43,9 @@ module LitleOnline
43
43
  'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
44
44
  },
45
45
  'signature' =>'sign',
46
- 'version' =>'1.0.0'
46
+ # 'version' =>'1'
47
+ # SDL Ruby XML 10
48
+ 'version' =>'10000'
47
49
  }
48
50
  }
49
51
  LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/registerTokenRequest>.*?/m), is_a(Hash))
@@ -66,7 +68,9 @@ module LitleOnline
66
68
  'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
67
69
  },
68
70
  'signature' =>'sign',
69
- 'version' =>'1.0.0'
71
+ # 'version' =>'1'
72
+ # SDL Ruby XML 10
73
+ 'version' =>'10000'
70
74
  }
71
75
  }
72
76
  exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
@@ -138,18 +142,7 @@ module LitleOnline
138
142
  LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
139
143
  LitleOnlineRequest.new.register_token_request(hash)
140
144
  end
141
-
142
- def test_androidpay
143
- hash = {
144
- 'merchantId' => '101',
145
- 'version'=>'8.8',
146
- 'reportGroup'=>'Planets',
147
- 'orderId'=>'androidpay',
148
- 'accountNumber'=>'1233456789103801'
149
- }
150
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<orderId>androidpay<\/orderId>.*<accountNumber>1233456789103801<\/accountNumber>.*/m), is_a(Hash))
151
- LitleOnlineRequest.new.register_token_request(hash)
152
- end
153
145
 
154
146
  end
147
+
155
148
  end
@@ -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) 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) 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) 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) 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
@@ -0,0 +1,262 @@
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
+
26
+
27
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
28
+ require 'test/unit'
29
+ require 'mocha/setup'
30
+
31
+ # TESTING THE WALLET FEATURE FOR SALE TRANSACTION
32
+ # TYPE 1 - Success Scenarios
33
+ # TYPE 2 - Error Scenarios
34
+
35
+ module LitleOnline
36
+ =begin
37
+ Definition: Class Definition for the Testing Class TestWallet
38
+ Created on: 01-29-2016
39
+ Reason: To test the incorporation new features developed in Ruby SDK as per XML 10.1 schema.
40
+ =end
41
+
42
+ class TestWallet < Test::Unit::TestCase
43
+
44
+ =begin
45
+ Name - test_sale_wallet_no_sourcetype
46
+ Type - 2
47
+ Description - To validate request without providing a walletSourceType node
48
+ Expected Response - Error messgae -If wallet is specified, it must have a walletSourceType.
49
+ =end
50
+ def test_sale_wallet_no_sourcetype
51
+ hash =
52
+ {
53
+ 'merchantId' => '101',
54
+ 'id' => 'test',
55
+ 'version'=>'8.8',
56
+ 'reportGroup'=>'Planets',
57
+ 'litleTxnId'=>'123456',
58
+ 'orderId'=>'12344',
59
+ 'amount'=>'106',
60
+ 'orderSource'=>'ecommerce',
61
+ 'paypal'=>
62
+ {
63
+ 'payerId'=>'1234',
64
+ 'token'=>'1234',
65
+ 'transactionId'=>'123456'
66
+ },
67
+ 'wallet'=>
68
+ {
69
+ 'walletSourceTypeId' => '102'
70
+ }
71
+ }
72
+
73
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
74
+ assert_match /If wallet is specified, it must have a walletSourceType/, exception.message
75
+
76
+ end
77
+
78
+ =begin
79
+ Name - test_sale_wallet_no_sourcetypeid
80
+ Type - 2
81
+ Description - To validate request without providing a walletSourceTypeId node
82
+ Expected Response - Error messgae -If wallet is specified, it must have a walletSourceTypeId.
83
+ =end
84
+ def test_sale_wallet_no_sourcetypeid
85
+ hash =
86
+ {
87
+ 'merchantId' => '101',
88
+ 'id' => 'test',
89
+ 'version'=>'8.8',
90
+ 'reportGroup'=>'Planets',
91
+ 'litleTxnId'=>'123456',
92
+ 'orderId'=>'12344',
93
+ 'amount'=>'106',
94
+ 'orderSource'=>'ecommerce',
95
+ 'paypal'=>
96
+ {
97
+ 'payerId'=>'1234',
98
+ 'token'=>'1234',
99
+ 'transactionId'=>'123456'
100
+ },
101
+
102
+ 'wallet'=>
103
+ {
104
+ 'walletSourceType' => 'MasterPass'
105
+ }
106
+ }
107
+
108
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
109
+ assert_match /If wallet is specified, it must have a walletSourceTypeId/, exception.message
110
+
111
+ end
112
+
113
+
114
+ =begin
115
+ Name - test_success_sale_wallet
116
+ Type - 1
117
+ Description - To validate request by providing both walletSourceTypeId and walletSourceType nodes
118
+ Expected Response - Success Request.
119
+ =end
120
+ def test_success_sale_wallet
121
+ hash =
122
+ {
123
+ 'merchantId' => '101',
124
+ 'id' => 'test',
125
+ 'version'=>'8.8',
126
+ 'reportGroup'=>'Planets',
127
+ 'litleTxnId'=>'123456',
128
+ 'orderId'=>'12344',
129
+ 'amount'=>'106',
130
+ 'orderSource'=>'ecommerce',
131
+ 'paypal'=>
132
+ {
133
+ 'payerId'=>'1234',
134
+ 'token'=>'1234',
135
+ 'transactionId'=>'123456'
136
+ },
137
+
138
+ 'wallet'=>
139
+ {
140
+ 'walletSourceType' => 'MasterPass',
141
+ 'walletSourceTypeId' => '102'
142
+ }
143
+ }
144
+
145
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<sale.*?<wallet>.*?<walletSourceType>MasterPass<\/walletSourceType>.*?<\/wallet>.*?<\/sale>.*?/m), is_a(Hash))
146
+ LitleOnlineRequest.new.sale(hash)
147
+ end
148
+
149
+
150
+ # TESTING THE WALLET FEATURE FOR AUTHORIZATION TRANSACTION
151
+ # TYPE 1 - Success Scenarios
152
+ # TYPE 2 - Error Scenarios
153
+
154
+ =begin
155
+ Name - test_success_auth_wallet
156
+ Type - 1
157
+ Description - To validate request by providing both walletSourceTypeId and walletSourceType nodes
158
+ Expected Response - Success Request.
159
+ =end
160
+ def test_success_auth_wallet
161
+ hash =
162
+ {
163
+ 'merchantId' => '101',
164
+ 'version'=>'8.8',
165
+ 'reportGroup'=>'Planets',
166
+ 'orderId'=>'12344',
167
+ 'amount'=>'106',
168
+ 'orderSource'=>'ecommerce',
169
+ 'applepay'=>
170
+ {
171
+ 'data'=>'user',
172
+ 'header'=>
173
+ {
174
+ 'applicationData'=>'454657413164',
175
+ 'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
176
+ 'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
177
+ 'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
178
+ },
179
+
180
+ 'signature' =>'sign',
181
+ 'version' =>'10000'
182
+ },
183
+ 'wallet'=>
184
+ {
185
+ 'walletSourceType' => 'MasterPass',
186
+ 'walletSourceTypeId' => '102'
187
+ }
188
+ }
189
+
190
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<authorization.*?<wallet>.*?<walletSourceType>MasterPass<\/walletSourceType><walletSourceTypeId>102<\/walletSourceTypeId>.*?<\/wallet>.*?<\/authorization>.*?/m), is_a(Hash))
191
+ LitleOnlineRequest.new.authorization(hash)
192
+ end
193
+
194
+ =begin
195
+ Name - test_auth_wallet_no_sourcetype
196
+ Type - 2
197
+ Description - To validate request without providing a walletSourceType node
198
+ Expected Response - Error messgae -If wallet is specified, it must have a walletSourceType.
199
+ =end
200
+ def test_auth_wallet_no_sourcetype
201
+ hash = {
202
+ 'merchantId' => '101',
203
+ 'version'=>'8.8',
204
+ 'reportGroup'=>'Planets',
205
+ 'orderId'=>'12344',
206
+ 'amount'=>'106',
207
+ 'orderSource'=>'ecommerce',
208
+ 'applepay'=>{
209
+ 'data'=>'user',
210
+ 'header'=>{
211
+ 'applicationData'=>'454657413164',
212
+ 'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
213
+ 'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
214
+ 'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
215
+ },
216
+ 'signature' =>'sign',
217
+ 'version' =>'10000'
218
+ },
219
+ 'wallet'=> {
220
+ 'walletSourceTypeId' => '102'
221
+ }
222
+ }
223
+
224
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
225
+ assert_match /If wallet is specified, it must have a walletSourceType/, exception.message
226
+ end
227
+
228
+ =begin
229
+ Name - test_auth_wallet_no_sourcetypeid
230
+ Type - 2
231
+ Description - To validate request without providing a walletSourceTypeId node
232
+ Expected Response - Error messgae -If wallet is specified, it must have a walletSourceTypeId.
233
+ =end
234
+ def test_auth_wallet_no_sourcetypeid
235
+ hash = {
236
+ 'merchantId' => '101',
237
+ 'version'=>'8.8',
238
+ 'reportGroup'=>'Planets',
239
+ 'orderId'=>'12344',
240
+ 'amount'=>'106',
241
+ 'orderSource'=>'ecommerce',
242
+ 'applepay'=>{
243
+ 'data'=>'user',
244
+ 'header'=>{
245
+ 'applicationData'=>'454657413164',
246
+ 'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
247
+ 'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
248
+ 'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
249
+ },
250
+ 'signature' =>'sign',
251
+ 'version' =>'10000'
252
+ },
253
+ 'wallet'=> {
254
+ 'walletSourceType' => 'MasterPass',
255
+ }
256
+ }
257
+
258
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
259
+ assert_match /If wallet is specified, it must have a walletSourceTypeId/, exception.message
260
+ end
261
+ end
262
+ end