CnpOnline 12.3.0 → 12.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/Rakefile +1 -1
- data/lib/CnpBatchRequest.rb +17 -8
- data/lib/CnpOnline.rb +2 -0
- data/lib/CnpOnlineRequest.rb +30 -2
- data/lib/CnpRequest.rb +24 -4
- data/lib/CnpTransaction.rb +70 -7
- data/lib/CommManager.rb +185 -0
- data/lib/Communications.rb +7 -3
- data/lib/EnvironmentVariables.rb +8 -0
- data/lib/RequestTarget.rb +10 -0
- data/lib/XMLFields.rb +148 -11
- data/out/production/cnp-sdk-for-ruby/CnpBatchRequest.rb +787 -0
- data/out/production/cnp-sdk-for-ruby/CnpListeners.rb +265 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnline.rb +65 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnlineRequest.rb +370 -0
- data/out/production/cnp-sdk-for-ruby/CnpRequest.rb +670 -0
- data/out/production/cnp-sdk-for-ruby/CnpTransaction.rb +831 -0
- data/out/production/cnp-sdk-for-ruby/CnpXmlMapper.rb +71 -0
- data/out/production/cnp-sdk-for-ruby/CommManager.rb +185 -0
- data/out/production/cnp-sdk-for-ruby/Communications.rb +90 -0
- data/out/production/cnp-sdk-for-ruby/Configuration.rb +75 -0
- data/out/production/cnp-sdk-for-ruby/EnvironmentVariables.rb +33 -0
- data/out/production/cnp-sdk-for-ruby/RequestTarget.rb +10 -0
- data/out/production/cnp-sdk-for-ruby/Setup.rb +147 -0
- data/out/production/cnp-sdk-for-ruby/XMLFields.rb +2638 -0
- data/out/production/cnp-sdk-for-ruby/cacert.pem +3331 -0
- data/out/production/cnp-sdk-for-ruby/sample_batch_driver.rb +123 -0
- data/out/production/cnp-sdk-for-ruby/sample_driver.rb +49 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest1_base.rb +948 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest2_authenhanced.rb +577 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest3_authreversal.rb +190 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest4_echeck.rb +288 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest5_token.rb +209 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest_batchAll.rb +610 -0
- data/out/test/cnp-sdk-for-ruby/certification/ts_all.rb +33 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activate.rb +133 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activateReversal.rb +73 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_auth.rb +478 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_authReversal.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_balanceInquiry.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batch.rb +264 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batchStream.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_cancelSubscription.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_capture.rb +147 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_captureGivenAuth.rb +352 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_commManager.rb +302 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_configuration.rb +89 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_createPlan.rb +87 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_credit.rb +222 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_ctx.rb +124 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivate.rb +105 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivateReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_depositReversal.rb +70 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckCredit.rb +179 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckRedeposit.rb +117 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckSale.rb +255 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVerification.rb +160 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVoid.rb +42 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fastAccessFunding.rb +177 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_forceCapture.rb +272 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fraudCheck.rb +76 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardAuthReversal.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCapture.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCredit.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_litle_requests.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_load.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_loadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_override.rb +68 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_pgp_cnp_requests.rb +295 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_queryTransaction.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_refundReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_sale.rb +459 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_token.rb +137 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_translateToken.rb +203 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unload.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unloadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateCardValidationNumOnToken.rb +44 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updatePlan.rb +61 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateSubscription.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_wallet.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_xmlfields.rb +429 -0
- data/out/test/cnp-sdk-for-ruby/functional/ts_all.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleAUBatch.rb +244 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleBatchRequest.rb +791 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleOnlineRequest.rb +253 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleRequest.rb +317 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleTransaction.rb +426 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleXmlMapper.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activate.rb +92 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_auth.rb +463 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_authReversal.rb +82 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_balanceInquiry.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_cancelSubscription.rb +43 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_capture.rb +99 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_captureGivenAuth.rb +234 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_createPlan.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_credit.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivate.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_depositReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckCredit.rb +103 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckRedeposit.rb +109 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckSale.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVerification.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVoid.rb +54 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_forceCapture.rb +163 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_fraudCheck.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardAuthReversal.rb +58 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCapture.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCredit.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_load.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_loadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_pgp_CnpRequest.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_queryTransaction.rb +106 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_refundReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_sale.rb +551 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_token.rb +159 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unload.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unloadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updatePlan.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateSubscription.rb +172 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_wallet.rb +262 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_xmlfields.rb +2930 -0
- data/out/test/cnp-sdk-for-ruby/unit/ts_unit.rb +67 -0
- data/test/certification/certTest2_authenhanced.rb +28 -27
- data/test/functional/test_batch.rb +106 -1
- data/test/functional/test_batchStream.rb +3 -2
- data/test/functional/test_captureGivenAuth.rb +24 -0
- data/test/functional/test_commManager.rb +302 -0
- data/test/functional/test_ctx.rb +124 -0
- data/test/functional/test_fastAccessFunding.rb +21 -0
- data/test/functional/test_forceCapture.rb +21 -0
- data/test/functional/test_xmlfields.rb +20 -1
- metadata +122 -4
@@ -0,0 +1,76 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test FraudCheck Transaction
|
29
|
+
module CnpOnline
|
30
|
+
class TestFraudCheck < Test::Unit::TestCase
|
31
|
+
def test_fraud_check_happy_path
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'10.1',
|
35
|
+
'id' => '127',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'advancedFraudChecks' => {
|
38
|
+
'threatMetrixSessionId' => 'test1-BXXXXXX003',
|
39
|
+
'customAttribute1' => 'pass',
|
40
|
+
'customAttribute2' => '55',
|
41
|
+
'customAttribute3' => '5'}
|
42
|
+
}
|
43
|
+
response = CnpOnlineRequest.new.fraud_check_request(hash)
|
44
|
+
assert_equal('0', response.response)
|
45
|
+
assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
|
46
|
+
#sandbox is being updated to handle this correctly
|
47
|
+
assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
|
48
|
+
assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
|
49
|
+
assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_fraud_check_session_id
|
53
|
+
hash = {
|
54
|
+
'merchantId' => '101',
|
55
|
+
'version'=>'10.1',
|
56
|
+
'id' => '127',
|
57
|
+
'reportGroup'=>'Planets',
|
58
|
+
'advancedFraudChecks' => {
|
59
|
+
'threatMetrixSessionId' => 'test2-BXXXXXX003'
|
60
|
+
}
|
61
|
+
}
|
62
|
+
response = CnpOnlineRequest.new.fraud_check_request(hash)
|
63
|
+
assert_equal('0', response.response)
|
64
|
+
assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
|
65
|
+
assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
|
66
|
+
# kind of a hack to get around the variable # of triggered rule elements. ie. 1 element is added as a string not
|
67
|
+
# an Array. Fix is to write an unmarshaller or custom node class in XMLFields.rb
|
68
|
+
if(response.fraudCheckResponse.advancedFraudResults.triggeredRule.is_a?(Array))
|
69
|
+
assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
|
70
|
+
elsif
|
71
|
+
assert_equal('triggered_rule_default', response.fraudCheckResponse.advancedFraudResults.triggeredRule)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardAuthReversal Transaction
|
29
|
+
module CnpOnline
|
30
|
+
class TestGiftCardAuthReversal < Test::Unit::TestCase
|
31
|
+
def test_giftCardAuthReversal
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'id'=>'test',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'cnpTxnId' =>'5000',
|
38
|
+
'card'=>{
|
39
|
+
'type'=>'GC',
|
40
|
+
'number' =>'400000000000000',
|
41
|
+
'expDate' =>'0150',
|
42
|
+
'pin' => '1234',
|
43
|
+
'cardValidationNum' => '411'
|
44
|
+
},
|
45
|
+
'originalRefCode' => '101',
|
46
|
+
'originalAmount' => '34561',
|
47
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
48
|
+
'originalSystemTraceId' => '33',
|
49
|
+
'originalSequenceNumber' => '111111',
|
50
|
+
}
|
51
|
+
|
52
|
+
response= CnpOnlineRequest.new.giftCardAuth_reversal(hash)
|
53
|
+
assert_equal('000', response.giftCardAuthReversalResponse.response)
|
54
|
+
assert_equal('0', response.giftCardAuthReversalResponse.giftCardResponse.systemTraceId)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_simple_error
|
58
|
+
hash = {
|
59
|
+
'merchantId' => '101',
|
60
|
+
'version'=>'8.8',
|
61
|
+
'id'=>'test',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
}
|
64
|
+
|
65
|
+
#Get exceptions
|
66
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardAuth_reversal(hash)}
|
67
|
+
#Test
|
68
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardCapture Transaction
|
29
|
+
module CnpOnline
|
30
|
+
class TestGiftCardCapture < Test::Unit::TestCase
|
31
|
+
def test_giftCardCapture
|
32
|
+
hash = {
|
33
|
+
'captureAmount'=>'1000',
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'id'=>'test',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'cnpTxnId' =>'5000',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'GC',
|
41
|
+
'number' =>'400000000000000',
|
42
|
+
'expDate' =>'0150',
|
43
|
+
'pin' => '1234',
|
44
|
+
'cardValidationNum' => '411'
|
45
|
+
},
|
46
|
+
'originalRefCode' => '101',
|
47
|
+
'originalAmount' => '34561',
|
48
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
response= CnpOnlineRequest.new.giftCardCapture(hash)
|
53
|
+
assert_equal('000', response.giftCardCaptureResponse.response)
|
54
|
+
assert_equal('0', response.giftCardCaptureResponse.giftCardResponse.systemTraceId)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_simple_error
|
58
|
+
hash = {
|
59
|
+
'merchantId' => '101',
|
60
|
+
'version'=>'8.8',
|
61
|
+
'id'=>'test',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
}
|
64
|
+
|
65
|
+
#Get exceptions
|
66
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardCapture(hash)}
|
67
|
+
#Test
|
68
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardCapture Transaction
|
29
|
+
module CnpOnline
|
30
|
+
class TestGiftCardCredit < Test::Unit::TestCase
|
31
|
+
def test_giftCardCredit
|
32
|
+
hash = {
|
33
|
+
'id'=>'test',
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'cnpTxnId' => '5000',
|
37
|
+
'creditAmount' =>'1000',
|
38
|
+
#'orderId' =>'1230',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'GC',
|
41
|
+
'number' =>'400000000000000',
|
42
|
+
'expDate' =>'0150',
|
43
|
+
'pin' => '1234',
|
44
|
+
'cardValidationNum' => '411'
|
45
|
+
},
|
46
|
+
'reportGroup'=>'Planets',
|
47
|
+
}
|
48
|
+
|
49
|
+
response= CnpOnlineRequest.new.giftCardCredit(hash)
|
50
|
+
assert_equal('000', response.giftCardCreditResponse.response)
|
51
|
+
assert_equal('0', response.giftCardCreditResponse.giftCardResponse.systemTraceId)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_simple_error
|
55
|
+
hash = {
|
56
|
+
'merchantId' => '101',
|
57
|
+
'version'=>'8.8',
|
58
|
+
'id'=>'test',
|
59
|
+
'reportGroup'=>'Planets',
|
60
|
+
}
|
61
|
+
|
62
|
+
#Get exceptions
|
63
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardCredit(hash)}
|
64
|
+
#Test
|
65
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,355 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
15
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
17
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
=end
|
22
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
23
|
+
require 'test/unit'
|
24
|
+
require 'fileutils'
|
25
|
+
|
26
|
+
CNP_SDK_TEST_FOLDER = '/cnp-sdk-for-ruby-test'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestCnpRequest < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def setup
|
32
|
+
dir = '/tmp' + CNP_SDK_TEST_FOLDER
|
33
|
+
FileUtils.rm_rf dir
|
34
|
+
Dir.mkdir dir
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_request_creation
|
38
|
+
dir = '/tmp'
|
39
|
+
|
40
|
+
request = CnpRequest.new()
|
41
|
+
request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
|
42
|
+
|
43
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
44
|
+
entries.sort!
|
45
|
+
|
46
|
+
assert_equal 4, entries.size
|
47
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
48
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_commit_batch_with_path
|
52
|
+
dir = '/tmp'
|
53
|
+
|
54
|
+
batch = CnpBatchRequest.new
|
55
|
+
batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
|
56
|
+
batch.close_batch
|
57
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
58
|
+
|
59
|
+
assert_equal 3, entries.length
|
60
|
+
entries.sort!
|
61
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
62
|
+
|
63
|
+
request = CnpRequest.new
|
64
|
+
request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
|
65
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
66
|
+
entries.sort!
|
67
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
68
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
69
|
+
assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
70
|
+
|
71
|
+
request.commit_batch(batch.get_batch_name)
|
72
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
73
|
+
entries.sort!
|
74
|
+
assert_equal 4,entries.length
|
75
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
76
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_commit_batch_with_batch
|
80
|
+
dir = '/tmp'
|
81
|
+
|
82
|
+
batch = CnpBatchRequest.new
|
83
|
+
batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
|
84
|
+
batch.close_batch
|
85
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
86
|
+
|
87
|
+
assert_equal 3, entries.length
|
88
|
+
entries.sort!
|
89
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
90
|
+
|
91
|
+
request = CnpRequest.new
|
92
|
+
request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
|
93
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
94
|
+
entries.sort!
|
95
|
+
assert_equal 5, entries.length
|
96
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
97
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
98
|
+
assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
99
|
+
|
100
|
+
request.commit_batch(batch)
|
101
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
102
|
+
entries.sort!
|
103
|
+
assert_equal 4, entries.length
|
104
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
105
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_commit_batch_with_batch_and_au
|
109
|
+
dir = '/tmp'
|
110
|
+
|
111
|
+
batch = CnpBatchRequest.new
|
112
|
+
batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
|
113
|
+
accountUpdateHash = {
|
114
|
+
'reportGroup'=>'Planets',
|
115
|
+
'id'=>'12345',
|
116
|
+
'customerId'=>'0987',
|
117
|
+
'card'=>{
|
118
|
+
'type'=>'VI',
|
119
|
+
'number' =>'4100000000000001',
|
120
|
+
'expDate' =>'1210'
|
121
|
+
}}
|
122
|
+
batch.account_update(accountUpdateHash)
|
123
|
+
batch.close_batch
|
124
|
+
|
125
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
126
|
+
|
127
|
+
assert_equal 4, entries.length
|
128
|
+
entries.sort!
|
129
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
130
|
+
assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
|
131
|
+
|
132
|
+
request = CnpRequest.new
|
133
|
+
request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
|
134
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
135
|
+
entries.sort!
|
136
|
+
assert_equal 6, entries.length
|
137
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
|
138
|
+
assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
|
139
|
+
assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
140
|
+
assert_not_nil entries[5] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
141
|
+
|
142
|
+
request.commit_batch(batch)
|
143
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
144
|
+
entries.sort!
|
145
|
+
assert_equal 4, entries.length
|
146
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
147
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_finish_request
|
151
|
+
dir = '/tmp'
|
152
|
+
|
153
|
+
request = CnpRequest.new()
|
154
|
+
request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
|
155
|
+
|
156
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
157
|
+
entries.sort!
|
158
|
+
|
159
|
+
assert_equal 4, entries.size
|
160
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
161
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
162
|
+
|
163
|
+
request.finish_request
|
164
|
+
|
165
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
166
|
+
entries.sort!
|
167
|
+
|
168
|
+
assert_equal 3, entries.size
|
169
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_add_rfr
|
173
|
+
@config_hash = Configuration.new.config
|
174
|
+
|
175
|
+
dir = '/tmp'
|
176
|
+
temp = dir + CNP_SDK_TEST_FOLDER + '/'
|
177
|
+
|
178
|
+
request = CnpRequest.new()
|
179
|
+
request.add_rfr_request({'cnpSessionId' => '137813712'}, temp)
|
180
|
+
|
181
|
+
entries = Dir.entries(temp)
|
182
|
+
entries.sort!
|
183
|
+
|
184
|
+
assert_equal 3, entries.size
|
185
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_send_to_cnp
|
189
|
+
@config_hash = Configuration.new.config
|
190
|
+
|
191
|
+
dir = '/tmp'
|
192
|
+
|
193
|
+
request = CnpRequest.new()
|
194
|
+
request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
|
195
|
+
request.finish_request
|
196
|
+
request.send_to_cnp
|
197
|
+
|
198
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
199
|
+
entries.sort!
|
200
|
+
assert_equal 3, entries.size
|
201
|
+
puts entries[2]
|
202
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
|
203
|
+
|
204
|
+
uploaded_file = entries[2]
|
205
|
+
|
206
|
+
options = {}
|
207
|
+
username = get_config(:sftp_username, options)
|
208
|
+
password = get_config(:sftp_password, options)
|
209
|
+
url = get_config(:sftp_url, options)
|
210
|
+
|
211
|
+
Net::SFTP.start(url, username, :password => password) do |sftp|
|
212
|
+
# clear out the sFTP outbound dir prior to checking for new files, avoids leaving files on the server
|
213
|
+
# if files are left behind we are not counting then towards the expected total
|
214
|
+
ents = []
|
215
|
+
handle = sftp.opendir!('/inbound/')
|
216
|
+
files_on_srv = sftp.readdir!(handle)
|
217
|
+
files_on_srv.each {|file|
|
218
|
+
ents.push(file.name)
|
219
|
+
}
|
220
|
+
assert_equal 3,ents.size
|
221
|
+
ents.sort!
|
222
|
+
assert_equal ents[2], uploaded_file.gsub(SENT_FILE_SUFFIX, '.asc')
|
223
|
+
sftp.remove('/inbound/' + ents[2])
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_send_to_cnp_stream
|
228
|
+
@config_hash = Configuration.new.config
|
229
|
+
|
230
|
+
dir = '/tmp'
|
231
|
+
|
232
|
+
request = CnpRequest.new()
|
233
|
+
request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
|
234
|
+
request.finish_request
|
235
|
+
request.send_to_cnp_stream
|
236
|
+
|
237
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
238
|
+
entries.sort!
|
239
|
+
|
240
|
+
assert_equal 4, entries.size
|
241
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
|
242
|
+
File.delete(dir + CNP_SDK_TEST_FOLDER + '/' + entries[2])
|
243
|
+
|
244
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
|
245
|
+
entries.sort!
|
246
|
+
|
247
|
+
assert_equal 3, entries.size
|
248
|
+
assert_not_nil entries[2] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}\z/
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_full_flow
|
253
|
+
saleHash = {
|
254
|
+
'reportGroup'=>'Planets',
|
255
|
+
'id' => '006',
|
256
|
+
'orderId'=>'12344',
|
257
|
+
'amount'=>'6000',
|
258
|
+
'orderSource'=>'ecommerce',
|
259
|
+
'card'=>{
|
260
|
+
'type'=>'VI',
|
261
|
+
'number' =>'4100000000000001',
|
262
|
+
'expDate' =>'1210'
|
263
|
+
}}
|
264
|
+
|
265
|
+
dir = '/tmp'
|
266
|
+
|
267
|
+
request = CnpRequest.new()
|
268
|
+
request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
|
269
|
+
|
270
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
271
|
+
entries.sort!
|
272
|
+
|
273
|
+
assert_equal 4, entries.size
|
274
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
275
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
276
|
+
|
277
|
+
#create five batches, each with 10 sales
|
278
|
+
5.times{
|
279
|
+
batch = CnpBatchRequest.new
|
280
|
+
batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
|
281
|
+
|
282
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
283
|
+
|
284
|
+
assert_equal 6, entries.length
|
285
|
+
entries.sort!
|
286
|
+
assert_not_nil entries[2] =~ /batch_\d+\z/
|
287
|
+
assert_not_nil entries[3] =~ /batch_\d+_txns\z/
|
288
|
+
assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
289
|
+
assert_not_nil entries[5] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
290
|
+
#add the same sale ten times
|
291
|
+
10.times{
|
292
|
+
#batch.account_update(accountUpdateHash)
|
293
|
+
saleHash['card']['number']= (saleHash['card']['number'].to_i + 1).to_s
|
294
|
+
batch.sale(saleHash)
|
295
|
+
}
|
296
|
+
|
297
|
+
#close the batch, indicating we plan to add no more transactions
|
298
|
+
batch.close_batch()
|
299
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
300
|
+
|
301
|
+
assert_equal 5, entries.length
|
302
|
+
entries.sort!
|
303
|
+
assert_not_nil entries[2] =~ /batch_\d+.closed-\d+\z/
|
304
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
305
|
+
assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
306
|
+
|
307
|
+
#add the batch to the CnpRequest
|
308
|
+
request.commit_batch(batch)
|
309
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
310
|
+
assert_equal 4, entries.length
|
311
|
+
entries.sort!
|
312
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
|
313
|
+
assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
|
314
|
+
}
|
315
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
316
|
+
request.finish_request
|
317
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
318
|
+
assert_equal 3, entries.length
|
319
|
+
entries.sort!
|
320
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+.complete\z/
|
321
|
+
|
322
|
+
#send the batch files at the given directory over sFTP
|
323
|
+
request.send_to_cnp
|
324
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
325
|
+
assert_equal entries.length, 3
|
326
|
+
entries.sort!
|
327
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
|
328
|
+
#grab the expected number of responses from the sFTP server and save them to the given path
|
329
|
+
request.get_responses_from_server()
|
330
|
+
#process the responses from the server with a listener which applies the given block
|
331
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction| end})
|
332
|
+
|
333
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
|
334
|
+
assert_equal 4, entries.length # 3 -> 4
|
335
|
+
entries.sort!
|
336
|
+
assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
|
337
|
+
File.delete(dir + CNP_SDK_TEST_FOLDER + '/' + entries[2])
|
338
|
+
|
339
|
+
entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + entries[3])
|
340
|
+
entries.sort!
|
341
|
+
assert_equal 3, entries.length
|
342
|
+
assert_not_nil entries[2] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}.processed\z/
|
343
|
+
end
|
344
|
+
|
345
|
+
def get_config(field, options)
|
346
|
+
if options[field.to_s] == nil and options[field] == nil then
|
347
|
+
return @config_hash[field.to_s]
|
348
|
+
elsif options[field.to_s] != nil then
|
349
|
+
return options[field.to_s]
|
350
|
+
else
|
351
|
+
return options[field]
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|