LitleOnline 8.25.1 → 8.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +10 -2
  3. data/README.md +2 -22
  4. data/Rakefile +2 -2
  5. data/accurev_plugin.log +1037 -0
  6. data/bin/sample_batch_driver.rb +1 -0
  7. data/bin/sample_driver.rb +4 -4
  8. data/lib/Configuration.rb +2 -2
  9. data/lib/EnvironmentVariables.rb +2 -1
  10. data/lib/LitleBatchRequest.rb +16 -3
  11. data/lib/LitleOnlineRequest.rb +2 -2
  12. data/lib/LitleRequest.rb +8 -4
  13. data/lib/LitleTransaction.rb +10 -6
  14. data/lib/XMLFields.rb +203 -159
  15. data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
  16. data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
  17. data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
  18. data/samples/Batch/AccountUpdate.rb +64 -0
  19. data/samples/Batch/SampleBatchDriver.rb +94 -0
  20. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
  21. data/samples/Capture/LitleCaptureTransaction.rb +14 -0
  22. data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
  23. data/samples/Capture/LitlePartialCapture.rb +16 -0
  24. data/samples/Credit/LitleCreditTransaction.rb +16 -0
  25. data/samples/Credit/LitleRefundTransaction.rb +29 -0
  26. data/samples/Other/LitleAvsTransaction.rb +34 -0
  27. data/samples/Other/LitleVoidTransaction.rb +18 -0
  28. data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
  29. data/samples/Run_all.rb +17 -0
  30. data/samples/Sale/LitleSaleTransaction.rb +29 -0
  31. data/samples/Sale/SampleSaleTransaction.rb +24 -0
  32. data/test/functional/test_auth.rb +54 -30
  33. data/test/functional/test_captureGivenAuth.rb +41 -18
  34. data/test/functional/test_credit.rb +17 -0
  35. data/test/functional/test_echeckCredit.rb +23 -6
  36. data/test/functional/test_echeckSale.rb +27 -10
  37. data/test/functional/test_forceCapture.rb +19 -0
  38. data/test/functional/test_sale.rb +44 -19
  39. data/test/functional/test_token.rb +27 -5
  40. data/test/unit/test_LitleOnlineRequest.rb +2 -2
  41. data/test/unit/test_activate.rb +1 -1
  42. data/test/unit/test_activateReversal.rb +1 -1
  43. data/test/unit/test_auth.rb +104 -41
  44. data/test/unit/test_balanceInquiry.rb +1 -1
  45. data/test/unit/test_cancelSubscription.rb +1 -1
  46. data/test/unit/test_captureGivenAuth.rb +31 -22
  47. data/test/unit/test_createPlan.rb +1 -1
  48. data/test/unit/test_credit.rb +61 -39
  49. data/test/unit/test_deactivate.rb +1 -1
  50. data/test/unit/test_deactivateReversal.rb +1 -1
  51. data/test/unit/test_depositReversal.rb +1 -1
  52. data/test/unit/test_echeckCredit.rb +18 -5
  53. data/test/unit/test_echeckRedeposit.rb +1 -1
  54. data/test/unit/test_echeckSale.rb +14 -1
  55. data/test/unit/test_echeckVerification.rb +1 -1
  56. data/test/unit/test_echeckVoid.rb +1 -1
  57. data/test/unit/test_forceCapture.rb +11 -0
  58. data/test/unit/test_load.rb +1 -1
  59. data/test/unit/test_loadReversal.rb +1 -1
  60. data/test/unit/test_refundReversal.rb +1 -1
  61. data/test/unit/test_sale.rb +113 -55
  62. data/test/unit/test_token.rb +53 -7
  63. data/test/unit/test_unload.rb +1 -1
  64. data/test/unit/test_unloadReversal.rb +1 -1
  65. data/test/unit/test_updateCardValidationNumOnToken.rb +1 -1
  66. data/test/unit/test_updatePlan.rb +1 -1
  67. data/test/unit/test_xmlfields.rb +2 -2
  68. metadata +22 -4
@@ -0,0 +1,15 @@
1
+ require_relative '../../lib/LitleOnline'
2
+
3
+ #Auth Reversal
4
+ #litleTxnId contains the Litle Transaction Id returned on the authorization
5
+ reversal_info = {'litleTxnId' => '100000000000000001'}
6
+ reversal_response = LitleOnline::LitleOnlineRequest.new.auth_reversal(reversal_info)
7
+
8
+ #display results
9
+ puts "Response: " + reversal_response.authReversalResponse.response
10
+ puts "Message: " + reversal_response.authReversalResponse.message
11
+ puts "Litle Transaction ID: " + reversal_response .authReversalResponse.litleTxnId
12
+
13
+ if (!reversal_response.authReversalResponse.message.eql?'Approved')
14
+ raise ArgumentError, "LitleAuthReversalTransaction has not been Approved", caller
15
+ end
@@ -0,0 +1,31 @@
1
+ require_relative '../../lib/LitleOnline'
2
+
3
+ #Authorization
4
+ auth_info = {
5
+ 'orderId' => '1',
6
+ 'amount' => '10010',
7
+ 'orderSource'=>'ecommerce',
8
+ 'billToAddress'=>{
9
+ 'name' => 'John Smith',
10
+ 'addressLine1' => '1 Main St.',
11
+ 'city' => 'Burlington',
12
+ 'state' => 'MA',
13
+ 'zip' => '01803-3747',
14
+ 'country' => 'US'},
15
+ 'card'=>{
16
+ 'number' =>'4**************9',
17
+ 'expDate' => '0112',
18
+ 'cardValidationNum' => '349',
19
+ 'type' => 'VI'}
20
+ }
21
+ auth_response = LitleOnline::LitleOnlineRequest.new.authorization(auth_info)
22
+
23
+ #display results
24
+ puts "Response: " + auth_response.authorizationResponse.response
25
+ puts "Message: " + auth_response.authorizationResponse.message
26
+ puts "Litle Transaction ID: " + auth_response.authorizationResponse.litleTxnId
27
+
28
+ if (!auth_response.authorizationResponse.message.eql?'Approved')
29
+ raise ArgumentError, "LitleAuthorizationTransaction has not been Approved", caller
30
+ end
31
+
@@ -0,0 +1,47 @@
1
+ require_relative '../../lib/LitleOnline'
2
+
3
+ #Authorization
4
+ #Puts a hold on the funds
5
+ auth_hash = {
6
+ 'orderId' => '1',
7
+ 'amount' => '10010',
8
+ 'orderSource'=>'ecommerce',
9
+ 'billToAddress'=>{
10
+ 'name' => 'John Smith',
11
+ 'addressLine1' => '1 Main St.',
12
+ 'city' => 'Burlington',
13
+ 'state' => 'MA',
14
+ 'zip' => '01803-3747',
15
+ 'country' => 'US'},
16
+ 'card'=>{
17
+ 'number' =>'4**************9',
18
+ 'expDate' => '0112',
19
+ 'cardValidationNum' => '349',
20
+ 'type' => 'VI'}
21
+ }
22
+ auth_response = LitleOnline::LitleOnlineRequest.new.authorization(auth_hash)
23
+
24
+ #Capture
25
+ #Captures the authorization and results in money movement
26
+ capture_hash = {'litleTxnId' => auth_response.authorizationResponse.litleTxnId}
27
+ capture_response = LitleOnline::LitleOnlineRequest.new.capture(capture_hash)
28
+
29
+ if (!capture_response.captureResponse.message.eql?'Approved')
30
+ raise ArgumentError, "LitlePaymentFullLifeCycle's Capture Transaction has not been Approved", caller
31
+ end
32
+ #Credit
33
+ #Refund the customer
34
+ credit_hash = {'litleTxnId' => capture_response.captureResponse.litleTxnId}
35
+ credit_response = LitleOnline::LitleOnlineRequest.new.credit(credit_hash)
36
+
37
+ if (!credit_response.creditResponse.message.eql?'Approved')
38
+ raise ArgumentError, "LitlePaymentFullLifeCycle's credit Transaction has not been Approved", caller
39
+ end
40
+ #Void
41
+ #Cancel the refund, note that a deposit can be Voided as well
42
+ void_hash = {'litleTxnId' => credit_response.creditResponse.litleTxnId}
43
+ void_response = LitleOnline::LitleOnlineRequest.new.void(void_hash)
44
+
45
+ if (!void_response.voidResponse.message.eql?'Approved')
46
+ raise ArgumentError, "LitlePaymentFullLifeCycle's Void Transaction has not been Approved", caller
47
+ end
@@ -0,0 +1,64 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ accountUpdateHash = {
3
+ 'reportGroup'=>'Planets',
4
+ 'id'=>'12345',
5
+ 'customerId'=>'0987',
6
+ 'orderId'=>'1234',
7
+ 'card'=>{
8
+ 'type'=>'VI',
9
+ 'number' =>'4100000000000001',
10
+ 'expDate' =>'1210'
11
+ }}
12
+
13
+ saleHash = {
14
+ 'reportGroup'=>'Planets',
15
+ 'id' => '006',
16
+ 'orderId'=>'12344',
17
+ 'amount'=>'6000',
18
+ 'orderSource'=>'ecommerce',
19
+ 'card'=>{
20
+ 'type'=>'VI',
21
+ 'number' =>'4100000000000001',
22
+ 'expDate' =>'1210'
23
+ }}
24
+
25
+ authReversalHash = {
26
+ 'merchantId' => '101',
27
+ 'version'=>'8.8',
28
+ 'reportGroup'=>'Planets',
29
+ 'litleTxnId'=>'12345678000',
30
+ 'amount'=>'106',
31
+ 'payPalNotes'=>'Notes'
32
+ }
33
+ path = Dir.pwd
34
+
35
+ request = LitleOnline::LitleRequest.new({'sessionId'=>'8675309'})
36
+
37
+ request.create_new_litle_request(path)
38
+ puts "Created new LitleRequest at location: " + path
39
+ start = Time::now
40
+ #create five batches, each with 10 sales
41
+
42
+ batch = LitleOnline::LitleBatchRequest.new
43
+ batch.create_new_batch(path)
44
+
45
+ #add the same sale ten times
46
+
47
+ batch.account_update(accountUpdateHash)
48
+
49
+ #close the batch, indicating we plan to add no more transactions
50
+ batch.close_batch()
51
+ #add the batch to the LitleRequest
52
+ request.commit_batch(batch)
53
+
54
+
55
+ request.finish_request
56
+ puts "Generated final XML markup of the LitleRequest"
57
+
58
+ #send the batch files at the given directory over sFTP
59
+ request.send_to_litle
60
+ puts "Dropped off the XML of the LitleRequest over FTP"
61
+ #grab the expected number of responses from the sFTP server and save them to the given path
62
+ request.get_responses_from_server()
63
+ puts "Received the LitleRequest responses from the server"
64
+
@@ -0,0 +1,94 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ saleHash = {
3
+ 'reportGroup'=>'Planets',
4
+ 'id' => '006',
5
+ 'orderId'=>'12344',
6
+ 'amount'=>'6000',
7
+ 'orderSource'=>'ecommerce',
8
+ 'card'=>{
9
+ 'type'=>'VI',
10
+ 'number' =>'4100000000000001',
11
+ 'expDate' =>'1210'
12
+ }}
13
+
14
+ updateCardHash = {
15
+ 'merchantId' => '101',
16
+ 'version'=>'8.8',
17
+ 'reportGroup'=>'Planets',
18
+ 'id'=>'12345',
19
+ 'customerId'=>'0987',
20
+ 'orderId'=>'12344',
21
+ 'litleToken'=>'1233456789103801',
22
+ 'cardValidationNum'=>'123'
23
+ }
24
+
25
+ accountUpdateHash = {
26
+ 'reportGroup'=>'Planets',
27
+ 'id'=>'12345',
28
+ 'customerId'=>'0987',
29
+ 'orderId'=>'1234',
30
+ 'card'=>{
31
+ 'type'=>'VI',
32
+ 'number' =>'4100000000000001',
33
+ 'expDate' =>'1210'
34
+ }}
35
+
36
+ path = Dir.pwd
37
+
38
+ request = LitleOnline::LitleRequest.new({'sessionId'=>'8675309'})
39
+
40
+ request.create_new_litle_request(path)
41
+ puts "Created new LitleRequest at location: " + path
42
+ start = Time::now
43
+ #create five batches, each with 10 sales
44
+ 5.times{
45
+ batch = LitleOnline::LitleBatchRequest.new
46
+ batch.create_new_batch(path)
47
+
48
+ #add the same sale ten times
49
+ 10.times{
50
+ batch.sale(saleHash)
51
+ }
52
+
53
+ #close the batch, indicating we plan to add no more transactions
54
+ batch.close_batch()
55
+ #add the batch to the LitleRequest
56
+ request.commit_batch(batch)
57
+ }
58
+
59
+ # puts "Finished adding batches to LitleRequest at " + request.get_path_to_batches
60
+ #finish the Litle Request, indicating we plan to add no more batches
61
+ request.finish_request
62
+ puts "Generated final XML markup of the LitleRequest"
63
+
64
+ #send the batch files at the given directory over sFTP
65
+ request.send_to_litle
66
+ puts "Dropped off the XML of the LitleRequest over FTP"
67
+ #grab the expected number of responses from the sFTP server and save them to the given path
68
+ request.get_responses_from_server()
69
+ puts "Received the LitleRequest responses from the server"
70
+ #process the responses from the server with a listener which applies the given block
71
+ start = Time::now
72
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
73
+ type = transaction["type"]
74
+ #if we're dealing with a saleResponse (check the Litle XML Reference Guide!)
75
+ if(type == "saleResponse") then
76
+ #grab an attribute of the parent of the response
77
+ puts "Report Group: " + transaction["reportGroup"]
78
+
79
+ #grab some child elements of the transaction
80
+ puts "Litle Txn Id: " + transaction["litleTxnId"]
81
+ puts "Order Id: " + transaction["orderId"]
82
+ puts "Response: " + transaction["response"]
83
+
84
+ #grab a child element of a child element of the transation
85
+ puts "AVS Result: " + transaction["fraudResult"]["avsResult"]
86
+ puts "Token Response Message: " + transaction["tokenResponse"]["tokenMessage"]
87
+ if (!transaction["message"].eql?'Approved')
88
+ raise ArgumentError, "SampleBatchDriver has not been Approved", caller
89
+ end
90
+ end
91
+ end})
92
+ stop = Time::now
93
+ puts "Total time: " + (stop - start).to_s
94
+
@@ -0,0 +1,30 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Capture Given Auth
3
+ capture_given_auth_info = {
4
+ 'merchantId' => '101',
5
+ 'version'=>'8.8',
6
+ 'reportGroup'=>'Planets',
7
+ 'orderId'=>'12344',
8
+ 'amount'=>'106',
9
+ 'authInformation' => {
10
+ 'authDate'=>'2002-10-09',
11
+ 'authCode'=>'543216',
12
+ 'authAmount'=>'12345'
13
+ },
14
+ 'orderSource'=>'ecommerce',
15
+ 'card'=>{
16
+ 'type'=>'VI',
17
+ 'number' =>'4100000000000001',
18
+ 'expDate' =>'1210'
19
+ }
20
+ }
21
+ response = LitleOnline::LitleOnlineRequest.new.capture_given_auth(capture_given_auth_info)
22
+
23
+ #display results
24
+ puts "Response: " + response.captureGivenAuthResponse.response
25
+ puts "Message: " + response.captureGivenAuthResponse.message
26
+ puts "Litle Transaction ID: " + response.captureGivenAuthResponse.litleTxnId
27
+
28
+ if (!response.captureGivenAuthResponse.message.eql?'Approved')
29
+ raise ArgumentError, "LitleCaptureGivenAuthTransaction has not been Approved", caller
30
+ end
@@ -0,0 +1,14 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Capture
3
+ #litleTxnId contains the Litle Transaction Id returned on the authorization
4
+ capture_info = {'litleTxnId' => '100000000000000001'}
5
+ capture_response = LitleOnline::LitleOnlineRequest.new.capture(capture_info)
6
+
7
+ #display results
8
+ puts "Response: " + capture_response.captureResponse.response
9
+ puts "Message: " + capture_response.captureResponse.message
10
+ puts "Litle Transaction ID: " + capture_response .captureResponse.litleTxnId
11
+
12
+ if (!capture_response.captureResponse.message.eql?'Approved')
13
+ raise ArgumentError, "LitleCaptureTransaction has not been Approved", caller
14
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Force Capture
3
+ force_capture_info = {
4
+ 'merchantId' => '101',
5
+ 'version'=>'8.8',
6
+ 'reportGroup'=>'Planets',
7
+ 'litleTxnId'=>'123456',
8
+ 'orderId'=>'12344',
9
+ 'amount'=>'106',
10
+ 'orderSource'=>'ecommerce',
11
+ 'card'=>{
12
+ 'type'=>'VI',
13
+ 'number' =>'4100000000000001',
14
+ 'expDate' =>'1210'
15
+ }
16
+ }
17
+ response= LitleOnline::LitleOnlineRequest.new.force_capture(force_capture_info)
18
+
19
+ #display results
20
+ puts "Response: " + response.forceCaptureResponse.response
21
+ puts "Message: " + response.forceCaptureResponse.message
22
+ puts "Litle Transaction ID: " + response.forceCaptureResponse.litleTxnId
23
+
24
+ if (!response.forceCaptureResponse.message.eql?'Approved')
25
+ raise ArgumentError, "LitleForceCaptureTransaction has not been Approved", caller
26
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Partial Capture
3
+ #litleTxnId contains the Litle Transaction Id returned as part of the authorization
4
+ #submit the amount to capture which is less than the authorization amount
5
+ #to generate a partial capture
6
+ capture_info = {'litleTxnId' => '320000000000000001', 'amount' => '5005'}
7
+ capture_response = LitleOnline::LitleOnlineRequest.new.capture(capture_info)
8
+
9
+ #display results
10
+ puts "Response: " + capture_response.captureResponse.response
11
+ puts "Message: " + capture_response.captureResponse.message
12
+ puts "Litle Transaction ID: " + capture_response.captureResponse.litleTxnId
13
+
14
+ if (!capture_response.captureResponse.message.eql?'Approved')
15
+ raise ArgumentError, "LitlePartialCapture has not been Approved", caller
16
+ end
@@ -0,0 +1,16 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Credit
3
+ #litleTxnId contains the Litle Transaction Id returned on
4
+ #the capture or sale transaction being credited
5
+ #the amount is optional, if it isn't submitted the full amount will be credited
6
+ credit_info = {'litleTxnId' => '100000000000000002', 'amount' => '1010'}
7
+ credit_response = LitleOnline::LitleOnlineRequest.new.credit(credit_info)
8
+
9
+ #display results
10
+ puts "Response: " + credit_response.creditResponse.response
11
+ puts "Message: " + credit_response.creditResponse.message
12
+ puts "Litle Transaction ID: " + credit_response.creditResponse.litleTxnId
13
+
14
+ if (!credit_response.creditResponse.message.eql?'Approved')
15
+ raise ArgumentError, "LitleCreditTransaction has not been Approved", caller
16
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ #Stand alone credit
3
+ credit_info = {
4
+ 'orderId' => '1',
5
+ 'amount' => '1010',
6
+ 'orderSource'=>'ecommerce',
7
+ 'billToAddress'=>{
8
+ 'name' => 'John Smith',
9
+ 'addressLine1' => '1 Main St.',
10
+ 'city' => 'Burlington',
11
+ 'state' => 'MA',
12
+ 'zip' => '01803-3747',
13
+ 'country' => 'US'},
14
+ 'card'=>{
15
+ 'number' =>'4**************9',
16
+ 'expDate' => '0112',
17
+ 'cardValidationNum' => '349',
18
+ 'type' => 'VI'}
19
+ }
20
+ credit_response= LitleOnline::LitleOnlineRequest.new.credit(credit_info)
21
+
22
+ #display results
23
+ puts "Response: " + credit_response.creditResponse.response
24
+ puts "Message: " + credit_response.creditResponse.response
25
+ puts "Litle Transaction ID: " + credit_response.creditResponse.litleTxnId
26
+
27
+ if (!credit_response.creditResponse.message.eql?'Approved')
28
+ raise ArgumentError, "LitleRefundTransaction has not been Approved", caller
29
+ end
@@ -0,0 +1,34 @@
1
+ require_relative '../../lib/LitleOnline'
2
+ @@merchant_hash = {'reportGroup'=>'Planets','id'=>'321','customerId'=>'123',
3
+ 'merchantId'=>'101'
4
+ }
5
+ #AVS Only
6
+ auth_info = {
7
+ 'orderId' => '1',
8
+ 'amount' => '10010',
9
+ 'orderSource'=>'ecommerce',
10
+ 'billToAddress'=>{
11
+ 'name' => 'John Smith',
12
+ 'addressLine1' => '1 Main St.',
13
+ 'city' => 'Burlington',
14
+ 'state' => 'MA',
15
+ 'zip' => '01803-3747',
16
+ 'country' => 'US'},
17
+ 'card'=>{
18
+ 'number' =>'4457010000000009',
19
+ 'expDate' => '0112',
20
+ 'cardValidationNum' => '349',
21
+ 'type' => 'VI'}
22
+ }
23
+ hash = auth_info.merge(@@merchant_hash)
24
+ auth_response = LitleOnline::LitleOnlineRequest.new.authorization(hash)
25
+
26
+ #display results
27
+ puts "Response: " + auth_response.authorizationResponse.response
28
+ puts "Message: " + auth_response.authorizationResponse.message
29
+ puts "Litle Transaction ID: " + auth_response.authorizationResponse.litleTxnId
30
+ puts "AVS Match: " + auth_response.authorizationResponse.fraudResult.avsResult
31
+
32
+ if (!auth_response.authorizationResponse.message.eql?'Approved')
33
+ raise ArgumentError, "LitleAvsTransaction has not been Approved", caller
34
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../../lib/LitleOnline'
2
+
3
+ #Void
4
+ void_info = {
5
+ #litleTxnId contains the Litle Transaction Id returned on the deposit/refund
6
+ 'litleTxnId' => '100000000000000001',
7
+ }
8
+
9
+ response = LitleOnline::LitleOnlineRequest.new.void(void_info)
10
+
11
+ #display results
12
+ puts "Response: " + response.voidResponse.response
13
+ puts "Message: " + response.voidResponse.message
14
+ puts "Litle Transaction ID: " + response.voidResponse.litleTxnId
15
+
16
+ if (!response.voidResponse.message.eql?'Approved')
17
+ raise ArgumentError, "LitleVoidTransaction has not been Approved", caller
18
+ end