CnpChargeback 2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +2 -0
- data/CONTRIBUTORS +0 -0
- data/DESCRIPTION +5 -0
- data/LICENSE +44 -0
- data/README.md +70 -0
- data/Rakefile +90 -0
- data/SETUP.md +44 -0
- data/bin/Setup.rb +97 -0
- data/lib/ChargebackDocument.rb +67 -0
- data/lib/ChargebackRetrieval.rb +85 -0
- data/lib/ChargebackUpdate.rb +97 -0
- data/lib/CnpChargeback.rb +61 -0
- data/lib/Communications.rb +314 -0
- data/lib/Configuration.rb +75 -0
- data/lib/EnvironmentVariables.rb +15 -0
- data/lib/XMLFields.rb +36 -0
- data/lib/cacert.pem +3331 -0
- data/test/certification/certTest.rb +158 -0
- data/test/certification/ts_all.rb +29 -0
- data/test/functional/test_chargeback_document.rb +87 -0
- data/test/functional/test_chargeback_retrieval.rb +83 -0
- data/test/functional/test_chargeback_update.rb +71 -0
- data/test/functional/ts_all.rb +32 -0
- data/test/unit/ts_unit.rb +29 -0
- metadata +186 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
require File.expand_path("../../../lib/CnpChargeback", __FILE__)
|
2
|
+
#require 'Cnp_activemerchant'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
module CnpOnline
|
6
|
+
class Cnp_certTest < Test::Unit::TestCase
|
7
|
+
@@config_hash = Configuration.new.config
|
8
|
+
@@config_hash['url'] = 'https://services.vantivprelive.com/services/chargebacks/'
|
9
|
+
CYCLE_FIRST_CHARGEBACK = "First Chargeback"
|
10
|
+
CYCLE_PRE_ARB_CHARGEBACK = "Pre-Arbitration"
|
11
|
+
CYCLE_ARBITRATION_CHARGEBACK = "VISA Pre-Arbitration/Arbitration"
|
12
|
+
CYCLE_ISSUER_DECLINE_PRESAB = "Issuer Declined Pre-Arbitration"
|
13
|
+
ACTIVITY_MERCHANT_REPRESENT = "Merchant Represent"
|
14
|
+
ACTIVITY_MERCHANT_ACCEPTS_LIABILITY = "Merchant Accepts Liability"
|
15
|
+
ACTIVITY_ADD_NOTE = "Add Note"
|
16
|
+
|
17
|
+
def test_1
|
18
|
+
response = ChargebackRetrieval.new.get_chargebacks_by_date(activity_date: "2013-01-01", config: @@config_hash)
|
19
|
+
cases = response['chargebackCase']
|
20
|
+
#test_chargeback_case(cases[0], "1111111111", CYCLE_FIRST_CHARGEBACK)
|
21
|
+
test_chargeback_case(cases[1], "2222222222", CYCLE_FIRST_CHARGEBACK)
|
22
|
+
test_chargeback_case(cases[2], "3333333333", CYCLE_FIRST_CHARGEBACK)
|
23
|
+
test_chargeback_case(cases[3], "4444444444", CYCLE_FIRST_CHARGEBACK)
|
24
|
+
test_chargeback_case(cases[4], "5555555550", CYCLE_PRE_ARB_CHARGEBACK)
|
25
|
+
test_chargeback_case(cases[5], "5555555551", CYCLE_PRE_ARB_CHARGEBACK)
|
26
|
+
test_chargeback_case(cases[6], "5555555552", CYCLE_PRE_ARB_CHARGEBACK)
|
27
|
+
test_chargeback_case(cases[7], "6666666660", CYCLE_ARBITRATION_CHARGEBACK)
|
28
|
+
test_chargeback_case(cases[8], "7777777770", CYCLE_ISSUER_DECLINE_PRESAB)
|
29
|
+
test_chargeback_case(cases[9], "7777777771", CYCLE_ISSUER_DECLINE_PRESAB)
|
30
|
+
test_chargeback_case(cases[10], "7777777772", CYCLE_ISSUER_DECLINE_PRESAB)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_2
|
34
|
+
case_id = get_case_id_for_arn("1111111111")
|
35
|
+
ChargebackUpdate.new.add_note_to_case(case_id: case_id, note: "Cert test2", config: @@config_hash)
|
36
|
+
activity = get_last_activity(case_id)
|
37
|
+
|
38
|
+
assert_equal(ACTIVITY_ADD_NOTE, activity['activityType'])
|
39
|
+
assert_equal("Cert test2", activity['notes'])
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_3_1
|
43
|
+
case_id = get_case_id_for_arn("2222222222")
|
44
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test3_1", config: @@config_hash)
|
45
|
+
activity = get_last_activity(case_id)
|
46
|
+
|
47
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
48
|
+
assert_equal("Cert test3_1", activity['notes'])
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_3_2
|
52
|
+
case_id = get_case_id_for_arn("3333333333")
|
53
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test3_2", config: @@config_hash)
|
54
|
+
activity = get_last_activity(case_id)
|
55
|
+
|
56
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
57
|
+
assert_equal("Cert test3_2", activity['notes'])
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_4_and_5_1
|
61
|
+
case_id = get_case_id_for_arn("4444444444")
|
62
|
+
ChargebackUpdate.new.assume_liability(case_id: case_id, note: "Cert test4", config: @@config_hash)
|
63
|
+
activity = get_last_activity(case_id)
|
64
|
+
|
65
|
+
assert_equal(ACTIVITY_MERCHANT_ACCEPTS_LIABILITY, activity['activityType'])
|
66
|
+
assert_equal("Cert test4", activity['notes'])
|
67
|
+
|
68
|
+
exception = assert_raise(RuntimeError){ChargebackUpdate.new.assume_liability(case_id: case_id, note: "Cert test5_1", config: @@config_hash)}
|
69
|
+
assert_equal("Error with http http_post_request, code:400", exception.message)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test5_2
|
73
|
+
exception = assert_raise(RuntimeError){ChargebackRetrieval.new.get_chargeback_by_case_id(case_id: "12345", config: @@config_hash)}
|
74
|
+
assert_equal("Error with http http_post_request, code:404", exception.message)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_6_1
|
78
|
+
case_id = get_case_id_for_arn("5555555550")
|
79
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test6_1", config: @@config_hash)
|
80
|
+
activity = get_last_activity(case_id)
|
81
|
+
|
82
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
83
|
+
assert_equal("Cert test6_1", activity['notes'])
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_6_2
|
87
|
+
case_id = get_case_id_for_arn("5555555551")
|
88
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test6_2", representment_amount: 10051, config: @@config_hash)
|
89
|
+
activity = get_last_activity(case_id)
|
90
|
+
|
91
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
92
|
+
assert_equal(10051, activity['settlementAmount'])
|
93
|
+
assert_equal("Cert test6_2", activity['notes'])
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_7
|
97
|
+
case_id = get_case_id_for_arn("5555555552")
|
98
|
+
ChargebackUpdate.new.assume_liability(case_id: case_id, note: "Cert test7", config: @@config_hash)
|
99
|
+
activity = get_last_activity(case_id)
|
100
|
+
|
101
|
+
assert_equal(ACTIVITY_MERCHANT_ACCEPTS_LIABILITY, activity['activityType'])
|
102
|
+
assert_equal("Cert test7", activity['notes'])
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_8
|
106
|
+
case_id = get_case_id_for_arn("6666666660")
|
107
|
+
ChargebackUpdate.new.assume_liability(case_id: case_id, note: "Cert test8", config: @@config_hash)
|
108
|
+
activity = get_last_activity(case_id)
|
109
|
+
|
110
|
+
assert_equal(ACTIVITY_MERCHANT_ACCEPTS_LIABILITY, activity['activityType'])
|
111
|
+
assert_equal("Cert test8", activity['notes'])
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_9_1
|
115
|
+
case_id = get_case_id_for_arn("7777777770")
|
116
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test9_1", config: @@config_hash)
|
117
|
+
activity = get_last_activity(case_id)
|
118
|
+
|
119
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
120
|
+
assert_equal("Cert test9_1", activity['notes'])
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_9_2
|
124
|
+
case_id = get_case_id_for_arn("7777777771")
|
125
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test9_2", representment_amount: 10071, config: @@config_hash)
|
126
|
+
activity = get_last_activity(case_id)
|
127
|
+
|
128
|
+
assert_equal(ACTIVITY_MERCHANT_REPRESENT, activity['activityType'])
|
129
|
+
assert_equal(10071, actvity['settlementAmount'])
|
130
|
+
assert_equal("Cert test9_2", activity['notes'])
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_10
|
134
|
+
case_id = get_case_id_for_arn("7777777772")
|
135
|
+
ChargebackUpdate.new.represent_case(case_id: case_id, note: "Cert test10", config: @@config_hash)
|
136
|
+
activity = get_last_activity(case_id)
|
137
|
+
|
138
|
+
assert_equal(ACTIVITY_MERCHANT_ACCEPTS_LIABILITY, activity['activityType'])
|
139
|
+
assert_equal("Cert test10", activity['notes'])
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_chargeback_case(chargeback_case, arn, chargeback_cycle)
|
143
|
+
assert_equal(arn, chargeback_case['acquirerReferenceNumber'])
|
144
|
+
assert_equal(chargeback_cycle, chargeback_case['cycle'])
|
145
|
+
end
|
146
|
+
|
147
|
+
def get_case_id_for_arn(arn)
|
148
|
+
response = ChargebackRetrieval.new.get_chargebacks_by_arn(arn: arn, config: @@config_hash)
|
149
|
+
return response['chargebackCase']['caseId']
|
150
|
+
end
|
151
|
+
|
152
|
+
def get_last_activity(case_id)
|
153
|
+
response = ChargebackRetrieval.new.get_chargeback_by_case_id(case_id: case_id, config: @@config_hash)
|
154
|
+
chargeback_case = response['chargebackCase']
|
155
|
+
return chargeback_case['activity'][0]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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/CnpChargeback", __FILE__)
|
26
|
+
|
27
|
+
|
28
|
+
#test driver for running all tests
|
29
|
+
require_relative 'certTest'
|
@@ -0,0 +1,87 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2018 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/CnpChargeback", __FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestChargebackUpdate < Test::Unit::TestCase
|
30
|
+
def setup
|
31
|
+
@package_root = Dir.pwd
|
32
|
+
@document_to_upload1 = @package_root + "/test/doc.tiff"
|
33
|
+
@document_to_upload2 = @package_root + "/test/test.txt"
|
34
|
+
@document_to_upload3 = @package_root + "/test/test.jpg"
|
35
|
+
|
36
|
+
open(@document_to_upload1, "w+").close
|
37
|
+
open(@document_to_upload2, "w+").close
|
38
|
+
open(@document_to_upload3, "w+").close
|
39
|
+
end
|
40
|
+
|
41
|
+
def teardown
|
42
|
+
File.delete(@document_to_upload1)
|
43
|
+
File.delete(@document_to_upload2)
|
44
|
+
File.delete(@document_to_upload3)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_retrieve_chargebackDocument
|
48
|
+
ChargebackDocument.new.retrieve_document(case_id: "10000000", document_id: "document.jpg", document_path: "test.tiff")
|
49
|
+
assert_true(File.exist?("test.tiff"))
|
50
|
+
File.delete("test.tiff")
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_upload_chargebackDocument
|
54
|
+
response = ChargebackDocument.new.upload_document(case_id: "10000", document_path: @document_to_upload3)
|
55
|
+
assert_equal('013', response.responseCode)
|
56
|
+
assert_equal('Invalid File Content', response.responseMessage)
|
57
|
+
assert_equal('test.jpg', response.documentId)
|
58
|
+
assert_equal('10000', response.caseId)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_replace_chargebackDocument
|
62
|
+
response = ChargebackDocument.new.replace_document(case_id: "10000", document_id: "logo.tiff", document_path: @document_to_upload3)
|
63
|
+
assert_equal('013', response.responseCode)
|
64
|
+
assert_equal('Invalid File Content', response.responseMessage)
|
65
|
+
assert_equal('logo.tiff', response.documentId)
|
66
|
+
assert_equal('10000', response.caseId)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_delete_chargebackDocument
|
70
|
+
response = ChargebackDocument.new.delete_document(case_id: "10000", document_id: "logo.tiff")
|
71
|
+
assert_equal('000', response.responseCode)
|
72
|
+
assert_equal('Success', response.responseMessage)
|
73
|
+
assert_equal('logo.tiff', response.documentId)
|
74
|
+
assert_equal('10000', response.caseId)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_list_chargebackDocument
|
78
|
+
response = ChargebackDocument.new.list_documents(case_id: "10000")
|
79
|
+
assert_equal('000', response.responseCode)
|
80
|
+
assert_equal('Success', response.responseMessage)
|
81
|
+
assert_equal('10000', response.caseId)
|
82
|
+
document_list = response.documentId
|
83
|
+
assert_includes(document_list, "logo.tiff")
|
84
|
+
assert_includes(document_list, "doc.tiff")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2018 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/CnpChargeback", __FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestChargebackRetrieval < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_activity_date
|
32
|
+
response= ChargebackRetrieval.new.get_chargebacks_by_date(activity_date: "2018-01-01")
|
33
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
34
|
+
assert_match(/\d+/, response.transactionId)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_activity_date_financial_impact
|
38
|
+
response= ChargebackRetrieval.new.get_chargebacks_by_financial_impact(activity_date: "2018-01-01", financial_impact:"true")
|
39
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
40
|
+
assert_match(/\d+/, response.transactionId)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_actionable
|
44
|
+
response= ChargebackRetrieval.new.get_actionable_chargebacks(actionable: "true")
|
45
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
46
|
+
assert_match(/\d+/, response.transactionId)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_case_id
|
50
|
+
response= ChargebackRetrieval.new.get_chargeback_by_case_id(case_id: "1333078000")
|
51
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
52
|
+
assert_match(/\d+/, response.transactionId)
|
53
|
+
assert_equal("1333078000", response.chargebackCase.caseId)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_token
|
57
|
+
response= ChargebackRetrieval.new.get_chargebacks_by_token(token: "1000000")
|
58
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
59
|
+
assert_match(/\d+/, response.transactionId)
|
60
|
+
assert_equal("1000000", response.chargebackCase.token)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_card_number
|
64
|
+
response= ChargebackRetrieval.new.get_chargebacks_by_card_number(card_number: "1111000011110000", expiration_date: "0118")
|
65
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
66
|
+
assert_match(/\d+/, response.transactionId)
|
67
|
+
assert_equal("0000", response.chargebackCase.cardNumberLast4)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_arn
|
71
|
+
response= ChargebackRetrieval.new.get_chargebacks_by_arn(arn: "1111111111")
|
72
|
+
assert_match(/\d+/, response.chargebackCase.caseId)
|
73
|
+
assert_match(/\d+/, response.transactionId)
|
74
|
+
assert_equal("1111111111", response.chargebackCase.acquirerReferenceNumber)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_get_case_id
|
78
|
+
exception = assert_raise(RuntimeError){ChargebackRetrieval.new.get_chargeback_by_case_id(case_id: "404")}
|
79
|
+
assert_equal("Error with http response, code:404", exception.message)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2018 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/CnpChargeback", __FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestChargebackUpdate < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_assign_case_to_user
|
32
|
+
response = ChargebackUpdate.new.assign_case_to_user(case_id: 10000, user_id: "jdeo@company.com", note: "Test note")
|
33
|
+
assert_match(/\d+/, response.transactionId)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_add_note_to_case
|
37
|
+
response = ChargebackUpdate.new.add_note_to_case(case_id: 10000, note: "Test note")
|
38
|
+
assert_match(/\d+/, response.transactionId)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_assume_liability
|
42
|
+
response = ChargebackUpdate.new.assume_liability(case_id: 10000, note: "Test note")
|
43
|
+
assert_match(/\d+/, response.transactionId)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_represent_case
|
47
|
+
response = ChargebackUpdate.new.represent_case(case_id: 10000, note: "Test note", representment_amount: 12000)
|
48
|
+
assert_match(/\d+/, response.transactionId)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_represent_case_full
|
52
|
+
response = ChargebackUpdate.new.represent_case(case_id: 10000, note: "Test note")
|
53
|
+
assert_match(/\d+/, response.transactionId)
|
54
|
+
end
|
55
|
+
|
56
|
+
def respond_to_retrieval_request
|
57
|
+
response = ChargebackUpdate.new.respond_to_retrieval_request(case_id: 10000, note: "Test note")
|
58
|
+
assert_match(/\d+/, response.transactionId)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_request_arbitration
|
62
|
+
response = ChargebackUpdate.new.request_arbitration(case_id: 10000, note: "Test note")
|
63
|
+
assert_match(/\d+/, response.transactionId)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_add_not_to_case
|
67
|
+
exception = assert_raise(RuntimeError){ChargebackUpdate.new.add_note_to_case(case_id: 404, note: "ErrorResponse")}
|
68
|
+
assert_equal("Error with http response, code:404", exception.message)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
|
26
|
+
require File.expand_path("../../../lib/CnpChargeback", __FILE__)
|
27
|
+
|
28
|
+
|
29
|
+
#test driver for running all tests
|
30
|
+
require_relative 'test_chargeback_document'
|
31
|
+
require_relative 'test_chargeback_retrieval'
|
32
|
+
require_relative 'test_chargeback_update'
|