hps 1.0.2 → 2.1.2

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -8
  3. data/LICENSE.txt +32 -32
  4. data/PRIVACY.txt +65 -65
  5. data/README.md +214 -41
  6. data/Rakefile +15 -15
  7. data/hps.gemspec +28 -26
  8. data/lib/hps.rb +48 -45
  9. data/lib/hps/configuration.rb +16 -16
  10. data/lib/hps/entities/hps_account_verify.rb +8 -8
  11. data/lib/hps/entities/hps_address.rb +6 -6
  12. data/lib/hps/entities/hps_authorization.rb +12 -12
  13. data/lib/hps/entities/hps_batch.rb +6 -6
  14. data/lib/hps/entities/hps_cardholder.rb +6 -10
  15. data/lib/hps/entities/hps_charge.rb +8 -8
  16. data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
  17. data/lib/hps/entities/hps_credit_card.rb +34 -33
  18. data/lib/hps/entities/hps_direct_market_data.rb +5 -0
  19. data/lib/hps/entities/hps_encryption_data.rb +6 -0
  20. data/lib/hps/entities/hps_refund.rb +8 -8
  21. data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
  22. data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
  23. data/lib/hps/entities/hps_reversal.rb +10 -10
  24. data/lib/hps/entities/hps_token_data.rb +10 -10
  25. data/lib/hps/entities/hps_track_data.rb +5 -0
  26. data/lib/hps/entities/hps_transaction.rb +161 -161
  27. data/lib/hps/entities/hps_transaction_details.rb +6 -6
  28. data/lib/hps/entities/hps_transaction_header.rb +8 -8
  29. data/lib/hps/entities/hps_transaction_type.rb +16 -16
  30. data/lib/hps/entities/hps_void.rb +8 -8
  31. data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
  32. data/lib/hps/infrastructure/authentication_exception.rb +11 -11
  33. data/lib/hps/infrastructure/card_exception.rb +15 -15
  34. data/lib/hps/infrastructure/exceptions.json +468 -468
  35. data/lib/hps/infrastructure/hps_exception.rb +25 -25
  36. data/lib/hps/infrastructure/hps_exception_mapper.rb +134 -134
  37. data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
  38. data/lib/hps/infrastructure/hps_track_data_method.rb +6 -0
  39. data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
  40. data/lib/hps/services/hps_batch_service.rb +29 -29
  41. data/lib/hps/services/hps_charge_service.rb +735 -635
  42. data/lib/hps/services/hps_service.rb +127 -128
  43. data/lib/hps/version.rb +3 -3
  44. data/tests/amex_tests.rb +292 -231
  45. data/tests/cert_tests.rb +80 -80
  46. data/tests/certification/card_present_spec.rb +320 -0
  47. data/tests/discover_tests.rb +386 -325
  48. data/tests/exception_mapper_tests.rb +244 -244
  49. data/tests/general_tests.rb +65 -57
  50. data/tests/hps_token_service.rb +56 -56
  51. data/tests/mastercard_tests.rb +387 -326
  52. data/tests/secret_key.rb +11 -11
  53. data/tests/test_data.rb +128 -128
  54. data/tests/test_helper.rb +115 -108
  55. data/tests/token_tests.rb +512 -512
  56. data/tests/visa_tests.rb +445 -378
  57. metadata +36 -3
@@ -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
@@ -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
128
- 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 = 2025
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 = 2025
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 = 2025
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 = 2025
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 = 2025
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 = 2025
123
+ result.number = 12345
124
+ result
125
+ end
126
+
127
+ end
128
+ end
@@ -1,108 +1,115 @@
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
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://cert.api2.heartlandportico.com/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_secret_key_with_spaces
30
+ Hps.configure do |config|
31
+ #config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
32
+ config.secret_api_key = " skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ "
33
+ end
34
+ end
35
+
36
+ def self.configure_hps_module_for_certification
37
+ Hps.configure do |config|
38
+ config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
39
+ config.user_name = "777700005412"
40
+ config.password = "$Test1234"
41
+ config.developer_id = 123456
42
+ config.version_number = 1234
43
+ config.license_id = 20994
44
+ config.device_id = 1522326
45
+ config.site_id = 20995
46
+ config.site_trace = "trace0001"
47
+ end
48
+ end
49
+
50
+ def self.charge_valid_amex(amount)
51
+ TestHelper.configure_hps_module()
52
+ service = Hps::HpsChargeService.new()
53
+ service.charge(amount, "usd", TestData.valid_amex, TestData.valid_cardholder)
54
+ end
55
+
56
+ def self.charge_valid_discover(amount)
57
+ TestHelper.configure_hps_module()
58
+ service = Hps::HpsChargeService.new()
59
+ service.charge(amount, "usd", TestData.valid_discover, TestData.valid_cardholder)
60
+ end
61
+
62
+ def self.charge_valid_mastercard(amount)
63
+ TestHelper.configure_hps_module()
64
+ service = Hps::HpsChargeService.new()
65
+ service.charge(amount, "usd", TestData.valid_mastercard, TestData.valid_cardholder)
66
+ end
67
+
68
+ def self.charge_valid_visa(amount)
69
+ TestHelper.configure_hps_module()
70
+ service = Hps::HpsChargeService.new()
71
+ service.charge(amount, "usd", TestData.valid_visa, TestData.valid_cardholder)
72
+ end
73
+
74
+ def self.charge_token(token_value,multi_use=false)
75
+ TestHelper.valid_multi_use_config
76
+ service = Hps::HpsChargeService.new()
77
+ service.charge(50, "usd", token_value, TestData.valid_cardholder,multi_use)
78
+ end
79
+
80
+ def self.auth_token(token_value,multi_use=false)
81
+ TestHelper.valid_multi_use_config
82
+ service = Hps::HpsChargeService.new()
83
+ service.authorize(50, "usd", token_value, TestData.valid_cardholder,multi_use)
84
+ end
85
+
86
+ def self.verify_token(token_value,multi_use=false)
87
+ TestHelper.valid_multi_use_config
88
+ service = Hps::HpsChargeService.new()
89
+ service.verify(token_value, TestData.valid_cardholder,multi_use)
90
+ end
91
+
92
+ def self.refund_token(token_value)
93
+ TestHelper.valid_multi_use_config
94
+ service = Hps::HpsChargeService.new()
95
+ service.refund(50,'usd',token_value, TestData.valid_cardholder)
96
+ end
97
+
98
+ def self.reverse_token(token_value)
99
+ TestHelper.valid_multi_use_config
100
+ service = Hps::HpsChargeService.new()
101
+ service.reverse(token_value,50,'usd')
102
+ end
103
+
104
+ def self.valid_multi_use_public_key
105
+ 'pkapi_cert_MrSafdEKB2dIHQEzDk'
106
+ end
107
+
108
+ def self.valid_multi_use_config
109
+ Hps.configure do |config|
110
+ config.secret_api_key ='skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'
111
+ end
112
+ end
113
+
114
+ end
115
+ end