CnpOnline 11.4.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -164
- data/CHANGELOG~ +0 -0
- data/CONTRIBUTORS +0 -2
- data/DESCRIPTION +1 -1
- data/LICENSE +0 -0
- data/README.md +13 -15
- data/Rakefile +3 -2
- data/Rakefile~ +4 -3
- data/SETUP.md +13 -10
- data/bin/Setup.rb +26 -22
- data/bin/sample_batch_driver.rb +15 -15
- data/bin/sample_driver.rb +5 -5
- data/lib/{LitleBatchRequest.rb → CnpBatchRequest.rb} +68 -66
- data/lib/{LitleListeners.rb → CnpListeners.rb} +48 -40
- data/lib/{LitleOnline.rb → CnpOnline.rb} +8 -7
- data/lib/{LitleOnlineRequest.rb → CnpOnlineRequest.rb} +53 -53
- data/lib/{LitleRequest.rb → CnpRequest.rb} +186 -192
- data/lib/{LitleTransaction.rb → CnpTransaction.rb} +53 -52
- data/lib/{LitleXmlMapper.rb → CnpXmlMapper.rb} +7 -7
- data/lib/Communications.rb +8 -7
- data/lib/Configuration.rb +7 -6
- data/lib/EnvironmentVariables.rb +2 -2
- data/lib/XMLFields.rb +98 -108
- data/lib/cacert.pem +0 -0
- data/samples/Auth/CnpAuthReversalTransaction.rb +15 -0
- data/samples/Auth/{LitleAuthorizationTransaction.rb → CnpAuthorizationTransaction.rb} +4 -4
- data/samples/Auth/{LitlePaymentFullLifeCycle.rb → CnpPaymentFullLifeCycle.rb} +11 -11
- data/samples/Batch/AccountUpdate.rb +11 -11
- data/samples/Batch/SampleBatchDriver.rb +16 -16
- data/samples/Capture/{LitleCaptureGivenAuthTransaction.rb → CnpCaptureGivenAuthTransaction.rb} +4 -4
- data/samples/Capture/CnpCaptureTransaction.rb +14 -0
- data/samples/Capture/{LitleForceCaptureTransaction.rb → CnpForceCaptureTransaction.rb} +5 -5
- data/samples/Capture/CnpPartialCapture.rb +16 -0
- data/samples/Credit/CnpCreditTransaction.rb +16 -0
- data/samples/Credit/{LitleRefundTransaction.rb → CnpRefundTransaction.rb} +4 -4
- data/samples/Other/{LitleAvsTransaction.rb → CnpAvsTransaction.rb} +4 -4
- data/samples/Other/CnpVoidTransaction.rb +19 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +16 -16
- data/samples/Run_all.rb +12 -12
- data/samples/Sale/{LitleSaleTransaction.rb → CnpSaleTransaction.rb} +4 -4
- data/samples/Sale/SampleSaleTransaction.rb +5 -5
- data/test/certification/certTest1_base.rb +104 -103
- data/test/certification/certTest2_authenhanced.rb +90 -88
- data/test/certification/certTest3_authreversal.rb +29 -28
- data/test/certification/certTest4_echeck.rb +22 -20
- data/test/certification/certTest5_token.rb +51 -49
- data/test/certification/certTest_batchAll.rb +60 -60
- data/test/certification/ts_all.rb +1 -1
- data/test/functional/test_activate.rb +9 -8
- data/test/functional/test_activateReversal.rb +5 -5
- data/test/functional/test_auth.rb +31 -30
- data/test/functional/test_authReversal.rb +8 -8
- data/test/functional/test_balanceInquiry.rb +6 -6
- data/test/functional/test_batch.rb +32 -32
- data/test/functional/test_batchStream.rb +14 -14
- data/test/functional/test_cancelSubscription.rb +4 -4
- data/test/functional/test_capture.rb +14 -14
- data/test/functional/test_captureGivenAuth.rb +16 -16
- data/test/functional/test_configuration.rb +26 -26
- data/test/functional/test_createPlan.rb +5 -5
- data/test/functional/test_credit.rb +13 -33
- data/test/functional/test_deactivate.rb +6 -6
- data/test/functional/test_deactivateReversal.rb +5 -5
- data/test/functional/test_depositReversal.rb +5 -5
- data/test/functional/test_echeckCredit.rb +20 -20
- data/test/functional/test_echeckRedeposit.rb +16 -16
- data/test/functional/test_echeckSale.rb +35 -35
- data/test/functional/test_echeckVerification.rb +17 -17
- data/test/functional/test_echeckVoid.rb +4 -4
- data/test/functional/test_forceCapture.rb +21 -21
- data/test/functional/test_fraudCheck.rb +6 -5
- data/test/functional/test_giftCardAuthReversal.rb +5 -5
- data/test/functional/test_giftCardCapture.rb +5 -5
- data/test/functional/test_giftCardCredit.rb +5 -5
- data/test/functional/test_litle_requests.rb +101 -99
- data/test/functional/test_load.rb +6 -6
- data/test/functional/test_loadReversal.rb +5 -5
- data/test/functional/test_override.rb +9 -9
- data/test/functional/{test_pgp_litle_requests.rb → test_pgp_cnp_requests.rb} +61 -60
- data/test/functional/test_queryTransaction.rb +10 -10
- data/test/functional/test_refundReversal.rb +5 -5
- data/test/functional/test_sale.rb +36 -36
- data/test/functional/test_token.rb +10 -10
- data/test/functional/test_unload.rb +6 -6
- data/test/functional/test_unloadReversal.rb +5 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +4 -4
- data/test/functional/test_updatePlan.rb +4 -4
- data/test/functional/test_updateSubscription.rb +5 -5
- data/test/functional/test_wallet.rb +5 -5
- data/test/functional/test_xmlfields.rb +29 -69
- data/test/functional/ts_all.rb +2 -2
- data/test/unit/test_LitleAUBatch.rb +15 -15
- data/test/unit/test_LitleBatchRequest.rb +42 -76
- data/test/unit/test_LitleOnlineRequest.rb +38 -38
- data/test/unit/test_LitleRequest.rb +47 -47
- data/test/unit/test_LitleTransaction.rb +34 -34
- data/test/unit/test_LitleXmlMapper.rb +27 -27
- data/test/unit/test_activate.rb +8 -8
- data/test/unit/test_activateReversal.rb +5 -5
- data/test/unit/test_auth.rb +43 -43
- data/test/unit/test_authReversal.rb +14 -14
- data/test/unit/test_balanceInquiry.rb +4 -4
- data/test/unit/test_cancelSubscription.rb +4 -4
- data/test/unit/test_capture.rb +20 -20
- data/test/unit/test_captureGivenAuth.rb +22 -22
- data/test/unit/test_createPlan.rb +4 -4
- data/test/unit/test_credit.rb +43 -43
- data/test/unit/test_deactivate.rb +6 -6
- data/test/unit/test_deactivateReversal.rb +5 -5
- data/test/unit/test_depositReversal.rb +5 -5
- data/test/unit/test_echeckCredit.rb +16 -16
- data/test/unit/test_echeckRedeposit.rb +19 -19
- data/test/unit/test_echeckSale.rb +16 -16
- data/test/unit/test_echeckVerification.rb +11 -11
- data/test/unit/test_echeckVoid.rb +8 -8
- data/test/unit/test_forceCapture.rb +19 -19
- data/test/unit/test_fraudCheck.rb +4 -4
- data/test/unit/test_giftCardAuthReversal.rb +5 -5
- data/test/unit/test_giftCardCapture.rb +5 -5
- data/test/unit/test_giftCardCredit.rb +5 -5
- data/test/unit/test_load.rb +4 -4
- data/test/unit/test_loadReversal.rb +5 -5
- data/test/unit/{test_pgp_LitleRequest → test_pgp_CnpRequest.rb} +32 -32
- data/test/unit/test_queryTransaction.rb +8 -8
- data/test/unit/test_refundReversal.rb +5 -5
- data/test/unit/test_sale.rb +64 -64
- data/test/unit/test_token.rb +13 -13
- data/test/unit/test_unload.rb +4 -4
- data/test/unit/test_unloadReversal.rb +5 -5
- data/test/unit/test_updateCardValidationNumOnToken.rb +16 -16
- data/test/unit/test_updatePlan.rb +4 -4
- data/test/unit/test_updateSubscription.rb +11 -11
- data/test/unit/test_wallet.rb +13 -13
- data/test/unit/test_xmlfields.rb +119 -119
- data/test/unit/ts_unit.rb +6 -6
- metadata +35 -26
- data/samples/Auth/LitleAuthReversalTransaction.rb +0 -15
- data/samples/Capture/LitleCaptureTransaction.rb +0 -14
- data/samples/Capture/LitlePartialCapture.rb +0 -16
- data/samples/Credit/LitleCreditTransaction.rb +0 -16
- data/samples/Other/LitleVoidTransaction.rb +0 -19
@@ -24,112 +24,112 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
=end
|
25
25
|
|
26
26
|
|
27
|
-
require File.expand_path("../../../lib/
|
27
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
28
28
|
require 'test/unit'
|
29
29
|
require 'mocha/setup'
|
30
30
|
|
31
|
-
module
|
32
|
-
class
|
31
|
+
module CnpOnline
|
32
|
+
class TestCnpXmlMapper < Test::Unit::TestCase
|
33
33
|
|
34
|
-
def
|
34
|
+
def test_CnpXmlMapper_request_xml_response_0
|
35
35
|
hash =
|
36
36
|
{
|
37
37
|
'merchantId' => '101',
|
38
38
|
'id' => 'test',
|
39
39
|
'version'=>'8.8',
|
40
40
|
'reportGroup'=>'Planets',
|
41
|
-
'
|
41
|
+
'cnpTxnId'=>'123456',
|
42
42
|
}
|
43
|
-
Communications.expects(:http_post).returns("<
|
44
|
-
response =
|
43
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"0\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
44
|
+
response = CnpXmlMapper.request("","")
|
45
45
|
assert_equal('0',response.response)
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def test_CnpXmlMapper_request_xml_response_1
|
49
49
|
hash =
|
50
50
|
{
|
51
51
|
'merchantId' => '101',
|
52
52
|
'id' => 'test',
|
53
53
|
'version'=>'8.8',
|
54
54
|
'reportGroup'=>'Planets',
|
55
|
-
'
|
55
|
+
'cnpTxnId'=>'123456',
|
56
56
|
}
|
57
|
-
Communications.expects(:http_post).returns("<
|
57
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"1\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
58
58
|
#Get exceptions
|
59
59
|
exception = assert_raise(RuntimeError){
|
60
|
-
|
60
|
+
CnpXmlMapper.request("","")
|
61
61
|
}
|
62
62
|
#Test
|
63
63
|
assert(exception.message =~ /Error with http response, code: 1/)
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
66
|
+
def test_CnpXmlMapper_request_xml_response_2
|
67
67
|
hash =
|
68
68
|
{
|
69
69
|
'merchantId' => '101',
|
70
70
|
'id' => 'test',
|
71
71
|
'version'=>'8.8',
|
72
72
|
'reportGroup'=>'Planets',
|
73
|
-
'
|
73
|
+
'cnpTxnId'=>'123456',
|
74
74
|
}
|
75
|
-
Communications.expects(:http_post).returns("<
|
75
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"2\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
76
76
|
#Get exceptions
|
77
77
|
exception = assert_raise(RuntimeError){
|
78
|
-
|
78
|
+
CnpXmlMapper.request("","")
|
79
79
|
}
|
80
80
|
#Test
|
81
81
|
assert(exception.message =~ /Error with http response, code: 2/)
|
82
82
|
end
|
83
83
|
|
84
|
-
def
|
84
|
+
def test_CnpXmlMapper_request_xml_response_3
|
85
85
|
hash =
|
86
86
|
{
|
87
87
|
'merchantId' => '101',
|
88
88
|
'id' => 'test',
|
89
89
|
'version'=>'8.8',
|
90
90
|
'reportGroup'=>'Planets',
|
91
|
-
'
|
91
|
+
'cnpTxnId'=>'123456',
|
92
92
|
}
|
93
|
-
Communications.expects(:http_post).returns("<
|
93
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"3\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
94
94
|
#Get exceptions
|
95
95
|
exception = assert_raise(RuntimeError){
|
96
|
-
|
96
|
+
CnpXmlMapper.request("","")
|
97
97
|
}
|
98
98
|
#Test
|
99
99
|
assert(exception.message =~ /Error with http response, code: 3/)
|
100
100
|
end
|
101
101
|
|
102
|
-
def
|
102
|
+
def test_CnpXmlMapper_request_xml_response_4
|
103
103
|
hash =
|
104
104
|
{
|
105
105
|
'merchantId' => '101',
|
106
106
|
'id' => 'test',
|
107
107
|
'version'=>'8.8',
|
108
108
|
'reportGroup'=>'Planets',
|
109
|
-
'
|
109
|
+
'cnpTxnId'=>'123456',
|
110
110
|
}
|
111
|
-
Communications.expects(:http_post).returns("<
|
111
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"4\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
112
112
|
#Get exceptions
|
113
113
|
exception = assert_raise(RuntimeError){
|
114
|
-
|
114
|
+
CnpXmlMapper.request("","")
|
115
115
|
}
|
116
116
|
#Test
|
117
117
|
assert(exception.message =~ /Error with http response, code: 4/)
|
118
118
|
end
|
119
119
|
|
120
|
-
def
|
120
|
+
def test_CnpXmlMapper_request_xml_response_5
|
121
121
|
hash =
|
122
122
|
{
|
123
123
|
'merchantId' => '101',
|
124
124
|
'id' => 'test',
|
125
125
|
'version'=>'8.8',
|
126
126
|
'reportGroup'=>'Planets',
|
127
|
-
'
|
127
|
+
'cnpTxnId'=>'123456',
|
128
128
|
}
|
129
|
-
Communications.expects(:http_post).returns("<
|
129
|
+
Communications.expects(:http_post).returns("<cnpOnlineResponse version=\"1.0\" xmlns=\"http://www.vantivcnp.com/schema/online\" response=\"5\" message=\"Invalid credentials. Contact support@cnp.com.\"></cnpOnlineResponse>")
|
130
130
|
#Get exceptions
|
131
131
|
exception = assert_raise(RuntimeError){
|
132
|
-
|
132
|
+
CnpXmlMapper.request("","")
|
133
133
|
}
|
134
134
|
#Test
|
135
135
|
assert(exception.message =~ /Error with http response, code: 5/)
|
data/test/unit/test_activate.rb
CHANGED
@@ -22,10 +22,10 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
22
22
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
23
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
=end
|
25
|
-
require File.expand_path("../../../lib/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'mocha/setup'
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class TestActivate < Test::Unit::TestCase
|
30
30
|
|
31
31
|
def test_simple_card
|
@@ -44,8 +44,8 @@ module LitleOnline
|
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>GC<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
48
|
+
CnpOnlineRequest.new.activate(hash)
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_simple_card1
|
@@ -64,8 +64,8 @@ module LitleOnline
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>GC<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
68
|
+
CnpOnlineRequest.new.activate(hash)
|
69
69
|
end
|
70
70
|
|
71
71
|
def test_simple_virtualGiftcard
|
@@ -83,8 +83,8 @@ module LitleOnline
|
|
83
83
|
}
|
84
84
|
}
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><virtualGiftCard><accountNumberLength>13<\/accountNumberLength><giftCardBin>giftCardBinString<\/giftCardBin><\/virtualGiftCard><\/activate>.*/m), is_a(Hash))
|
87
|
+
CnpOnlineRequest.new.activate(hash)
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
@@ -22,10 +22,10 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
22
22
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
23
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
=end
|
25
|
-
require File.expand_path("../../../lib/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'mocha/setup'
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class TestActivateReversal < Test::Unit::TestCase
|
30
30
|
|
31
31
|
def test_simple
|
@@ -33,7 +33,7 @@ module LitleOnline
|
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'
|
36
|
+
'cnpTxnId' => '5000',
|
37
37
|
'card'=>{
|
38
38
|
'type'=>'GC',
|
39
39
|
'number' =>'400000000000001',
|
@@ -48,8 +48,8 @@ module LitleOnline
|
|
48
48
|
'originalSequenceNumber' => '111111',
|
49
49
|
}
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>5000<\/cnpTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
CnpOnlineRequest.new.deposit_reversal(hash)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
data/test/unit/test_auth.rb
CHANGED
@@ -22,23 +22,23 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
22
22
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
23
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
=end
|
25
|
-
require File.expand_path("../../../lib/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'mocha/setup'
|
28
28
|
|
29
29
|
#test Authorization Transaction
|
30
|
-
module
|
30
|
+
module CnpOnline
|
31
31
|
class TestAuth < Test::Unit::TestCase
|
32
32
|
def test_success_re_auth
|
33
33
|
hash = {
|
34
34
|
'merchantId' => '101',
|
35
35
|
'version'=>'8.8',
|
36
36
|
'reportGroup'=>'Planets',
|
37
|
-
'
|
37
|
+
'cnpTxnId'=>'123456'
|
38
38
|
}
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>123456<\/cnpTxnId>.*/m), is_a(Hash))
|
41
|
+
CnpOnlineRequest.new.authorization(hash)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_success_applepay
|
@@ -62,8 +62,8 @@ module LitleOnline
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*?<cnpOnlineRequest.*?<authorization.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/authorization>.*?/m), is_a(Hash))
|
66
|
+
CnpOnlineRequest.new.authorization(hash)
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_both_choices_card_and_applepay
|
@@ -91,7 +91,7 @@ module LitleOnline
|
|
91
91
|
'version' =>'10000'
|
92
92
|
}}
|
93
93
|
|
94
|
-
exception = assert_raise(RuntimeError){
|
94
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
95
95
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
96
96
|
end
|
97
97
|
|
@@ -114,7 +114,7 @@ module LitleOnline
|
|
114
114
|
'transactionId'=>'123456'
|
115
115
|
}}
|
116
116
|
|
117
|
-
exception = assert_raise(RuntimeError){
|
117
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
118
118
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
119
119
|
end
|
120
120
|
|
@@ -141,7 +141,7 @@ module LitleOnline
|
|
141
141
|
'token'=>'1234',
|
142
142
|
'transactionId'=>'123456'
|
143
143
|
}}
|
144
|
-
exception = assert_raise(RuntimeError){
|
144
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
145
145
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
146
146
|
end
|
147
147
|
|
@@ -170,13 +170,13 @@ module LitleOnline
|
|
170
170
|
'token'=>'1234',
|
171
171
|
'transactionId'=>'123456'},
|
172
172
|
'token'=> {
|
173
|
-
'
|
173
|
+
'cnpToken'=>'1234567890123',
|
174
174
|
'expDate'=>'1210',
|
175
175
|
'cardValidationNum'=>'555',
|
176
176
|
'type'=>'VI'
|
177
177
|
}}
|
178
178
|
|
179
|
-
exception = assert_raise(RuntimeError){
|
179
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
180
180
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
181
181
|
end
|
182
182
|
|
@@ -193,8 +193,8 @@ module LitleOnline
|
|
193
193
|
}
|
194
194
|
}
|
195
195
|
|
196
|
-
|
197
|
-
|
196
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<merchantData>.*?<campaign>foo<\/campaign>.*?<\/merchantData>.*/m), is_a(Hash))
|
197
|
+
CnpOnlineRequest.new.authorization(hash)
|
198
198
|
end
|
199
199
|
|
200
200
|
def test_fraud_filter_override
|
@@ -208,8 +208,8 @@ module LitleOnline
|
|
208
208
|
'fraudFilterOverride'=> 'true'
|
209
209
|
}
|
210
210
|
|
211
|
-
|
212
|
-
|
211
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*?<fraudFilterOverride>true<\/fraudFilterOverride>.*?<\/authorization>.*/m), is_a(Hash))
|
212
|
+
CnpOnlineRequest.new.authorization(hash)
|
213
213
|
end
|
214
214
|
|
215
215
|
|
@@ -229,7 +229,7 @@ module LitleOnline
|
|
229
229
|
'number' =>'4100000000000001',
|
230
230
|
'expDate' =>'1210'
|
231
231
|
}}
|
232
|
-
exception = assert_raise(RuntimeError){
|
232
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
233
233
|
assert_match /If pos is specified, it must have a capability/, exception.message
|
234
234
|
end
|
235
235
|
|
@@ -245,7 +245,7 @@ module LitleOnline
|
|
245
245
|
'token'=>'1234',
|
246
246
|
'transactionId'=>'123456'
|
247
247
|
}}
|
248
|
-
exception = assert_raise(RuntimeError){
|
248
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
249
249
|
assert_match /If paypal is specified, it must have a payerId/, exception.message
|
250
250
|
end
|
251
251
|
|
@@ -261,7 +261,7 @@ module LitleOnline
|
|
261
261
|
'token'=>'1234',
|
262
262
|
'payerId'=>'123456'
|
263
263
|
}}
|
264
|
-
exception = assert_raise(RuntimeError){
|
264
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
265
265
|
assert_match /If paypal is specified, it must have a transactionId/, exception.message
|
266
266
|
end
|
267
267
|
|
@@ -279,7 +279,7 @@ module LitleOnline
|
|
279
279
|
'number' =>'4100000000000001',
|
280
280
|
'expDate' =>'1210'
|
281
281
|
}}
|
282
|
-
exception = assert_raise(RuntimeError){
|
282
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.authorization(hash)}
|
283
283
|
assert_match /If pos is specified, it must have a entryMode/, exception.message
|
284
284
|
end
|
285
285
|
|
@@ -296,8 +296,8 @@ module LitleOnline
|
|
296
296
|
'fraudFilterOverride'=> 'true'
|
297
297
|
}
|
298
298
|
|
299
|
-
|
300
|
-
|
299
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authentication.*?<user>UNIT<\/user>.*?<\/authentication>.*/m), is_a(Hash))
|
300
|
+
CnpOnlineRequest.new.authorization(hash)
|
301
301
|
end
|
302
302
|
|
303
303
|
def test_auth_override_password
|
@@ -313,8 +313,8 @@ module LitleOnline
|
|
313
313
|
'fraudFilterOverride'=> 'true'
|
314
314
|
}
|
315
315
|
|
316
|
-
|
317
|
-
|
316
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authentication.*?<password>TEST<\/password>.*?<\/authentication>.*/m), is_a(Hash))
|
317
|
+
CnpOnlineRequest.new.authorization(hash)
|
318
318
|
end
|
319
319
|
|
320
320
|
def test_logged_in_user
|
@@ -323,12 +323,12 @@ module LitleOnline
|
|
323
323
|
'merchantId' => '101',
|
324
324
|
'version'=>'8.8',
|
325
325
|
'reportGroup'=>'Planets',
|
326
|
-
'
|
326
|
+
'cnpTxnId'=>'123456',
|
327
327
|
'loggedInUser'=>'gdake'
|
328
328
|
}
|
329
329
|
|
330
|
-
|
331
|
-
|
330
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
331
|
+
CnpOnlineRequest.new.authorization(hash)
|
332
332
|
end
|
333
333
|
|
334
334
|
def test_surcharge_amount
|
@@ -339,8 +339,8 @@ module LitleOnline
|
|
339
339
|
'orderSource' => 'ecommerce',
|
340
340
|
'reportGroup' => 'Planets'
|
341
341
|
}
|
342
|
-
|
343
|
-
|
342
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
343
|
+
CnpOnlineRequest.new.authorization(hash)
|
344
344
|
end
|
345
345
|
|
346
346
|
def test_secondary_amount
|
@@ -351,8 +351,8 @@ module LitleOnline
|
|
351
351
|
'orderSource' => 'ecommerce',
|
352
352
|
'reportGroup' => 'Planets'
|
353
353
|
}
|
354
|
-
|
355
|
-
|
354
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
355
|
+
CnpOnlineRequest.new.authorization(hash)
|
356
356
|
end
|
357
357
|
|
358
358
|
def test_surcharge_amount_optional
|
@@ -362,8 +362,8 @@ module LitleOnline
|
|
362
362
|
'orderSource' => 'ecommerce',
|
363
363
|
'reportGroup' => 'Planets'
|
364
364
|
}
|
365
|
-
|
366
|
-
|
365
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
366
|
+
CnpOnlineRequest.new.authorization(hash)
|
367
367
|
end
|
368
368
|
|
369
369
|
def test_method_of_payment_allows_giftcard
|
@@ -377,8 +377,8 @@ module LitleOnline
|
|
377
377
|
'type' => 'GC'
|
378
378
|
}
|
379
379
|
}
|
380
|
-
|
381
|
-
|
380
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<card><type>GC<\/type><number>4141000000000000<\/number><expDate>1210<\/expDate><\/card>.*/m), is_a(Hash))
|
381
|
+
CnpOnlineRequest.new.authorization(hash)
|
382
382
|
end
|
383
383
|
|
384
384
|
def test_advanced_fraud_check
|
@@ -393,8 +393,8 @@ module LitleOnline
|
|
393
393
|
},
|
394
394
|
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
395
395
|
}
|
396
|
-
|
397
|
-
|
396
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
397
|
+
CnpOnlineRequest.new.authorization(hash)
|
398
398
|
end
|
399
399
|
|
400
400
|
def test_mpos
|
@@ -411,8 +411,8 @@ module LitleOnline
|
|
411
411
|
'track2Status'=>'0'
|
412
412
|
}
|
413
413
|
}
|
414
|
-
|
415
|
-
|
414
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<mpos><ksn>ksnString<\/ksn><formatId>30<\/formatId><encryptedTrack>encryptedTrackString<\/encryptedTrack><track1Status>0<\/track1Status><track2Status>0<\/track2Status><\/mpos>.*/m), is_a(Hash))
|
415
|
+
CnpOnlineRequest.new.authorization(hash)
|
416
416
|
end
|
417
417
|
|
418
418
|
def test_processingType_originalNetworkTransactionId_originalTransactionAmount
|
@@ -429,8 +429,8 @@ module LitleOnline
|
|
429
429
|
'originalNetworkTransactionId' => '9876543210',
|
430
430
|
'originalTransactionAmount' => '536981'
|
431
431
|
}
|
432
|
-
|
433
|
-
|
432
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<processingType>initialInstallment<\/processingType><originalNetworkTransactionId>9876543210<\/originalNetworkTransactionId><originalTransactionAmount>536981<\/originalTransactionAmount>.*/m), is_a(Hash))
|
433
|
+
CnpOnlineRequest.new.authorization(hash)
|
434
434
|
end
|
435
435
|
|
436
436
|
def test_processingType_wallet
|
@@ -455,8 +455,8 @@ module LitleOnline
|
|
455
455
|
'walletSourceTypeId' => 'VCIND'
|
456
456
|
}
|
457
457
|
}
|
458
|
-
|
459
|
-
|
458
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<wallet><walletSourceType>VisaCheckout<\/walletSourceType><walletSourceTypeId>VCIND<\/walletSourceTypeId><\/wallet>.*/m), is_a(Hash))
|
459
|
+
CnpOnlineRequest.new.authorization(hash)
|
460
460
|
end
|
461
461
|
|
462
462
|
end
|