hps 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -8
- data/LICENSE.txt +32 -32
- data/PRIVACY.txt +65 -65
- data/README.md +40 -40
- data/Rakefile +15 -15
- data/hps.gemspec +26 -26
- data/lib/hps/configuration.rb +16 -16
- data/lib/hps/entities/hps_account_verify.rb +8 -8
- data/lib/hps/entities/hps_address.rb +6 -6
- data/lib/hps/entities/hps_authorization.rb +12 -12
- data/lib/hps/entities/hps_batch.rb +6 -6
- data/lib/hps/entities/hps_cardholder.rb +10 -6
- data/lib/hps/entities/hps_charge.rb +8 -8
- data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
- data/lib/hps/entities/hps_credit_card.rb +32 -32
- data/lib/hps/entities/hps_refund.rb +8 -8
- data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
- data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
- data/lib/hps/entities/hps_reversal.rb +10 -10
- data/lib/hps/entities/hps_token_data.rb +10 -10
- data/lib/hps/entities/hps_transaction.rb +161 -161
- data/lib/hps/entities/hps_transaction_details.rb +6 -6
- data/lib/hps/entities/hps_transaction_header.rb +8 -8
- data/lib/hps/entities/hps_transaction_type.rb +16 -16
- data/lib/hps/entities/hps_void.rb +8 -8
- data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
- data/lib/hps/infrastructure/authentication_exception.rb +11 -11
- data/lib/hps/infrastructure/card_exception.rb +15 -15
- data/lib/hps/infrastructure/exceptions.json +468 -468
- data/lib/hps/infrastructure/hps_exception.rb +25 -25
- data/lib/hps/infrastructure/hps_exception_mapper.rb +134 -134
- data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
- data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
- data/lib/hps/services/hps_batch_service.rb +29 -29
- data/lib/hps/services/hps_charge_service.rb +634 -634
- data/lib/hps/services/hps_service.rb +128 -128
- data/lib/hps/version.rb +3 -3
- data/lib/hps.rb +45 -45
- data/tests/amex_tests.rb +230 -230
- data/tests/cert_tests.rb +80 -80
- data/tests/discover_tests.rb +324 -324
- data/tests/exception_mapper_tests.rb +244 -244
- data/tests/general_tests.rb +58 -58
- data/tests/hps_token_service.rb +56 -56
- data/tests/mastercard_tests.rb +325 -325
- data/tests/secret_key.rb +11 -11
- data/tests/test_data.rb +127 -127
- data/tests/test_helper.rb +108 -92
- data/tests/token_tests.rb +513 -513
- data/tests/visa_tests.rb +378 -378
- metadata +4 -6
- data/.DS_Store +0 -0
- data/.gitignore +0 -24
data/tests/secret_key.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_helper" )
|
2
|
-
|
3
|
-
describe "Secret Key Tests" do
|
4
|
-
|
5
|
-
it "can charge with secret key" do
|
6
|
-
Hps::TestHelper.configure_hps_module_secret_key()
|
7
|
-
service = Hps::HpsChargeService.new()
|
8
|
-
charge = service.charge(1.00, "usd", Hps::TestData.valid_visa, Hps::TestData.valid_cardholder)
|
9
|
-
expect(charge.response_code).to eql("00")
|
10
|
-
end
|
11
|
-
|
1
|
+
require File.join( File.dirname(__FILE__), "test_helper" )
|
2
|
+
|
3
|
+
describe "Secret Key Tests" do
|
4
|
+
|
5
|
+
it "can charge with secret key" do
|
6
|
+
Hps::TestHelper.configure_hps_module_secret_key()
|
7
|
+
service = Hps::HpsChargeService.new()
|
8
|
+
charge = service.charge(1.00, "usd", Hps::TestData.valid_visa, Hps::TestData.valid_cardholder)
|
9
|
+
expect(charge.response_code).to eql("00")
|
10
|
+
end
|
11
|
+
|
12
12
|
end
|
data/tests/test_data.rb
CHANGED
@@ -1,128 +1,128 @@
|
|
1
|
-
require 'hps'
|
2
|
-
|
3
|
-
module Hps
|
4
|
-
module TestData
|
5
|
-
|
6
|
-
# card holders
|
7
|
-
|
8
|
-
def self.valid_cardholder
|
9
|
-
result = HpsCardHolder.new()
|
10
|
-
result.first_name = "Bill"
|
11
|
-
result.last_name = "Johnson"
|
12
|
-
result.address = HpsAddress.new
|
13
|
-
result.address.address = "One Heartland Way"
|
14
|
-
result.address.city = "Jeffersonville"
|
15
|
-
result.address.state = "IN"
|
16
|
-
result.address.zip = "47130"
|
17
|
-
result.address.country = "United States"
|
18
|
-
result
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.cert_cardholder_shortzip
|
22
|
-
result = HpsCardHolder.new()
|
23
|
-
result.first_name = "Bill"
|
24
|
-
result.last_name = "Johnson"
|
25
|
-
result.address = HpsAddress.new
|
26
|
-
result.address.address = "6860 Dallas Pkwy"
|
27
|
-
result.address.city = "Irvine"
|
28
|
-
result.address.state = "TX"
|
29
|
-
result.address.zip = "75024"
|
30
|
-
result.address.country = "United States"
|
31
|
-
result
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.cert_cardholder_shortzip_no_street
|
35
|
-
result = HpsCardHolder.new()
|
36
|
-
result.first_name = "Bill"
|
37
|
-
result.last_name = "Johnson"
|
38
|
-
result.address = HpsAddress.new
|
39
|
-
result.address.city = "Irvine"
|
40
|
-
result.address.state = "TX"
|
41
|
-
result.address.zip = "75024"
|
42
|
-
result.address.country = "United States"
|
43
|
-
result
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.cert_cardholder_longzip
|
47
|
-
result = HpsCardHolder.new()
|
48
|
-
result.first_name = "Bill"
|
49
|
-
result.last_name = "Johnson"
|
50
|
-
result.address = HpsAddress.new
|
51
|
-
result.address.address = "6860 Dallas Pkwy"
|
52
|
-
result.address.city = "Irvine"
|
53
|
-
result.address.state = "TX"
|
54
|
-
result.address.zip = "750241234"
|
55
|
-
result.address.country = "United States"
|
56
|
-
result
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.cert_cardholder_longzip_no_street
|
60
|
-
result = HpsCardHolder.new()
|
61
|
-
result.first_name = "Bill"
|
62
|
-
result.last_name = "Johnson"
|
63
|
-
result.address = HpsAddress.new
|
64
|
-
result.address.city = "Irvine"
|
65
|
-
result.address.state = "TX"
|
66
|
-
result.address.zip = "750241234"
|
67
|
-
result.address.country = "United States"
|
68
|
-
result
|
69
|
-
end
|
70
|
-
|
71
|
-
# credit cards
|
72
|
-
|
73
|
-
def self.valid_visa
|
74
|
-
result = HpsCreditCard.new
|
75
|
-
result.cvv = 123
|
76
|
-
result.exp_month = 12
|
77
|
-
result.exp_year = 2015
|
78
|
-
result.number = 4012002000060016
|
79
|
-
result
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.valid_mastercard
|
83
|
-
result = HpsCreditCard.new
|
84
|
-
result.cvv = 123
|
85
|
-
result.exp_month = 12
|
86
|
-
result.exp_year = 2015
|
87
|
-
result.number = 5473500000000014
|
88
|
-
result
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.valid_discover
|
92
|
-
result = HpsCreditCard.new
|
93
|
-
result.cvv = 123
|
94
|
-
result.exp_month = 12
|
95
|
-
result.exp_year = 2015
|
96
|
-
result.number = 6011000990156527
|
97
|
-
result
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.valid_amex
|
101
|
-
result = HpsCreditCard.new
|
102
|
-
result.cvv = 1234
|
103
|
-
result.exp_month = 12
|
104
|
-
result.exp_year = 2015
|
105
|
-
result.number = 372700699251018
|
106
|
-
result
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.valid_jcb
|
110
|
-
result = HpsCreditCard.new
|
111
|
-
result.cvv = 123
|
112
|
-
result.exp_month = 12
|
113
|
-
result.exp_year = 2015
|
114
|
-
result.number = 3566007770007321
|
115
|
-
result
|
116
|
-
end
|
117
|
-
|
118
|
-
def self.invalid_card
|
119
|
-
result = HpsCreditCard.new
|
120
|
-
result.cvv = 123
|
121
|
-
result.exp_month = 12
|
122
|
-
result.exp_year = 2015
|
123
|
-
result.number = 12345
|
124
|
-
result
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
1
|
+
require 'hps'
|
2
|
+
|
3
|
+
module Hps
|
4
|
+
module TestData
|
5
|
+
|
6
|
+
# card holders
|
7
|
+
|
8
|
+
def self.valid_cardholder
|
9
|
+
result = HpsCardHolder.new()
|
10
|
+
result.first_name = "Bill"
|
11
|
+
result.last_name = "Johnson"
|
12
|
+
result.address = HpsAddress.new
|
13
|
+
result.address.address = "One Heartland Way"
|
14
|
+
result.address.city = "Jeffersonville"
|
15
|
+
result.address.state = "IN"
|
16
|
+
result.address.zip = "47130"
|
17
|
+
result.address.country = "United States"
|
18
|
+
result
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.cert_cardholder_shortzip
|
22
|
+
result = HpsCardHolder.new()
|
23
|
+
result.first_name = "Bill"
|
24
|
+
result.last_name = "Johnson"
|
25
|
+
result.address = HpsAddress.new
|
26
|
+
result.address.address = "6860 Dallas Pkwy"
|
27
|
+
result.address.city = "Irvine"
|
28
|
+
result.address.state = "TX"
|
29
|
+
result.address.zip = "75024"
|
30
|
+
result.address.country = "United States"
|
31
|
+
result
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.cert_cardholder_shortzip_no_street
|
35
|
+
result = HpsCardHolder.new()
|
36
|
+
result.first_name = "Bill"
|
37
|
+
result.last_name = "Johnson"
|
38
|
+
result.address = HpsAddress.new
|
39
|
+
result.address.city = "Irvine"
|
40
|
+
result.address.state = "TX"
|
41
|
+
result.address.zip = "75024"
|
42
|
+
result.address.country = "United States"
|
43
|
+
result
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.cert_cardholder_longzip
|
47
|
+
result = HpsCardHolder.new()
|
48
|
+
result.first_name = "Bill"
|
49
|
+
result.last_name = "Johnson"
|
50
|
+
result.address = HpsAddress.new
|
51
|
+
result.address.address = "6860 Dallas Pkwy"
|
52
|
+
result.address.city = "Irvine"
|
53
|
+
result.address.state = "TX"
|
54
|
+
result.address.zip = "750241234"
|
55
|
+
result.address.country = "United States"
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.cert_cardholder_longzip_no_street
|
60
|
+
result = HpsCardHolder.new()
|
61
|
+
result.first_name = "Bill"
|
62
|
+
result.last_name = "Johnson"
|
63
|
+
result.address = HpsAddress.new
|
64
|
+
result.address.city = "Irvine"
|
65
|
+
result.address.state = "TX"
|
66
|
+
result.address.zip = "750241234"
|
67
|
+
result.address.country = "United States"
|
68
|
+
result
|
69
|
+
end
|
70
|
+
|
71
|
+
# credit cards
|
72
|
+
|
73
|
+
def self.valid_visa
|
74
|
+
result = HpsCreditCard.new
|
75
|
+
result.cvv = 123
|
76
|
+
result.exp_month = 12
|
77
|
+
result.exp_year = 2015
|
78
|
+
result.number = 4012002000060016
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.valid_mastercard
|
83
|
+
result = HpsCreditCard.new
|
84
|
+
result.cvv = 123
|
85
|
+
result.exp_month = 12
|
86
|
+
result.exp_year = 2015
|
87
|
+
result.number = 5473500000000014
|
88
|
+
result
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.valid_discover
|
92
|
+
result = HpsCreditCard.new
|
93
|
+
result.cvv = 123
|
94
|
+
result.exp_month = 12
|
95
|
+
result.exp_year = 2015
|
96
|
+
result.number = 6011000990156527
|
97
|
+
result
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.valid_amex
|
101
|
+
result = HpsCreditCard.new
|
102
|
+
result.cvv = 1234
|
103
|
+
result.exp_month = 12
|
104
|
+
result.exp_year = 2015
|
105
|
+
result.number = 372700699251018
|
106
|
+
result
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.valid_jcb
|
110
|
+
result = HpsCreditCard.new
|
111
|
+
result.cvv = 123
|
112
|
+
result.exp_month = 12
|
113
|
+
result.exp_year = 2015
|
114
|
+
result.number = 3566007770007321
|
115
|
+
result
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.invalid_card
|
119
|
+
result = HpsCreditCard.new
|
120
|
+
result.cvv = 123
|
121
|
+
result.exp_month = 12
|
122
|
+
result.exp_year = 2015
|
123
|
+
result.number = 12345
|
124
|
+
result
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
128
|
end
|
data/tests/test_helper.rb
CHANGED
@@ -1,92 +1,108 @@
|
|
1
|
-
require File.join( File.dirname(__FILE__), "test_data.rb" )
|
2
|
-
require "hps"
|
3
|
-
require "rspec"
|
4
|
-
|
5
|
-
module Hps
|
6
|
-
module TestHelper
|
7
|
-
|
8
|
-
def self.configure_hps_module
|
9
|
-
Hps.configure do |config|
|
10
|
-
config.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
config.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
|
1
|
+
require File.join( File.dirname(__FILE__), "test_data.rb" )
|
2
|
+
require "hps"
|
3
|
+
require "rspec"
|
4
|
+
|
5
|
+
module Hps
|
6
|
+
module TestHelper
|
7
|
+
|
8
|
+
def self.configure_hps_module
|
9
|
+
Hps.configure do |config|
|
10
|
+
config.service_uri = "https://posgateway.cert.secureexchange.net/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
|
11
|
+
config.user_name = "777700004035"
|
12
|
+
config.password = "$Test1234"
|
13
|
+
config.developer_id = 123456
|
14
|
+
config.version_number = 1234
|
15
|
+
config.license_id = 20855
|
16
|
+
config.device_id = 1519321
|
17
|
+
config.site_id = 20856
|
18
|
+
config.site_trace = "trace0001"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def self.configure_hps_module_secret_key
|
24
|
+
Hps.configure do |config|
|
25
|
+
config.secret_api_key = "skapi_uat_MXZOAAC7LmEFVeOYGlVHe_WhvRf_UzWzJq5VJ8A-jA"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.configure_hps_module_for_certification
|
30
|
+
Hps.configure do |config|
|
31
|
+
config.service_uri = "https://posgateway.cert.secureexchange.net/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
|
32
|
+
config.user_name = "777700005412"
|
33
|
+
config.password = "$Test1234"
|
34
|
+
config.developer_id = 123456
|
35
|
+
config.version_number = 1234
|
36
|
+
config.license_id = 20994
|
37
|
+
config.device_id = 1522326
|
38
|
+
config.site_id = 20995
|
39
|
+
config.site_trace = "trace0001"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.charge_valid_amex(amount)
|
44
|
+
TestHelper.configure_hps_module()
|
45
|
+
service = Hps::HpsChargeService.new()
|
46
|
+
service.charge(amount, "usd", TestData.valid_amex, TestData.valid_cardholder)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.charge_valid_discover(amount)
|
50
|
+
TestHelper.configure_hps_module()
|
51
|
+
service = Hps::HpsChargeService.new()
|
52
|
+
service.charge(amount, "usd", TestData.valid_discover, TestData.valid_cardholder)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.charge_valid_mastercard(amount)
|
56
|
+
TestHelper.configure_hps_module()
|
57
|
+
service = Hps::HpsChargeService.new()
|
58
|
+
service.charge(amount, "usd", TestData.valid_mastercard, TestData.valid_cardholder)
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.charge_valid_visa(amount)
|
62
|
+
TestHelper.configure_hps_module()
|
63
|
+
service = Hps::HpsChargeService.new()
|
64
|
+
service.charge(amount, "usd", TestData.valid_visa, TestData.valid_cardholder)
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.charge_token(token_value,multi_use=false)
|
68
|
+
TestHelper.valid_multi_use_config
|
69
|
+
service = Hps::HpsChargeService.new()
|
70
|
+
service.charge(50, "usd", token_value, TestData.valid_cardholder,multi_use)
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.auth_token(token_value,multi_use=false)
|
74
|
+
TestHelper.valid_multi_use_config
|
75
|
+
service = Hps::HpsChargeService.new()
|
76
|
+
service.authorize(50, "usd", token_value, TestData.valid_cardholder,multi_use)
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.verify_token(token_value,multi_use=false)
|
80
|
+
TestHelper.valid_multi_use_config
|
81
|
+
service = Hps::HpsChargeService.new()
|
82
|
+
service.verify(token_value, TestData.valid_cardholder,multi_use)
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.refund_token(token_value)
|
86
|
+
TestHelper.valid_multi_use_config
|
87
|
+
service = Hps::HpsChargeService.new()
|
88
|
+
service.refund(50,'usd',token_value, TestData.valid_cardholder)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.reverse_token(token_value)
|
92
|
+
TestHelper.valid_multi_use_config
|
93
|
+
service = Hps::HpsChargeService.new()
|
94
|
+
service.reverse(token_value,50,'usd')
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.valid_multi_use_public_key
|
98
|
+
'pkapi_cert_MrSafdEKB2dIHQEzDk'
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.valid_multi_use_config
|
102
|
+
Hps.configure do |config|
|
103
|
+
config.secret_api_key ='skapi_cert_MfBSAADtSBcAJQ9cYzNXr2nQRONdeylsOqnWHRi1_Q'
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|