hps 2.3.2 → 2.4.0

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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/Gemfile.lock +59 -0
  4. data/LICENSE.md +264 -264
  5. data/PRIVACY.txt +65 -65
  6. data/README.md +213 -213
  7. data/Rakefile +15 -15
  8. data/examples/sinatra-verify-only/Gemfile +4 -4
  9. data/examples/sinatra-verify-only/app.rb +32 -32
  10. data/examples/sinatra-verify-only/views/index.erb +478 -478
  11. data/examples/sinatra-verify-only/views/result.erb +39 -39
  12. data/hps.gemspec +28 -27
  13. data/lib/hps/configuration.rb +17 -17
  14. data/lib/hps/entities/hps_account_verify.rb +8 -8
  15. data/lib/hps/entities/hps_address.rb +6 -6
  16. data/lib/hps/entities/hps_authorization.rb +12 -12
  17. data/lib/hps/entities/hps_batch.rb +6 -6
  18. data/lib/hps/entities/hps_cardholder.rb +6 -6
  19. data/lib/hps/entities/hps_charge.rb +8 -8
  20. data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
  21. data/lib/hps/entities/hps_check.rb +18 -18
  22. data/lib/hps/entities/hps_check_holder.rb +10 -10
  23. data/lib/hps/entities/hps_check_response.rb +45 -45
  24. data/lib/hps/entities/hps_check_response_details.rb +9 -9
  25. data/lib/hps/entities/hps_credit_card.rb +34 -34
  26. data/lib/hps/entities/hps_direct_market_data.rb +5 -5
  27. data/lib/hps/entities/hps_encryption_data.rb +6 -6
  28. data/lib/hps/entities/hps_gift_card.rb +133 -133
  29. data/lib/hps/entities/hps_manage_tokens.rb +8 -8
  30. data/lib/hps/entities/hps_refund.rb +8 -8
  31. data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
  32. data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
  33. data/lib/hps/entities/hps_reversal.rb +10 -10
  34. data/lib/hps/entities/hps_token_data.rb +10 -10
  35. data/lib/hps/entities/hps_track_data.rb +5 -5
  36. data/lib/hps/entities/hps_transaction.rb +161 -161
  37. data/lib/hps/entities/hps_transaction_details.rb +6 -6
  38. data/lib/hps/entities/hps_transaction_header.rb +8 -8
  39. data/lib/hps/entities/hps_transaction_type.rb +16 -16
  40. data/lib/hps/entities/hps_void.rb +8 -8
  41. data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
  42. data/lib/hps/infrastructure/authentication_exception.rb +11 -11
  43. data/lib/hps/infrastructure/card_exception.rb +15 -15
  44. data/lib/hps/infrastructure/exceptions.json +547 -547
  45. data/lib/hps/infrastructure/hps_account_type.rb +11 -11
  46. data/lib/hps/infrastructure/hps_check_exception.rb +13 -13
  47. data/lib/hps/infrastructure/hps_check_type.rb +11 -11
  48. data/lib/hps/infrastructure/hps_data_entry_mode.rb +11 -11
  49. data/lib/hps/infrastructure/hps_exception.rb +25 -25
  50. data/lib/hps/infrastructure/hps_exception_mapper.rb +145 -145
  51. data/lib/hps/infrastructure/hps_gateway_response_validation.rb +20 -20
  52. data/lib/hps/infrastructure/hps_input_validation.rb +13 -13
  53. data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
  54. data/lib/hps/infrastructure/hps_sec_code.rb +27 -27
  55. data/lib/hps/infrastructure/hps_track_data_method.rb +6 -6
  56. data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
  57. data/lib/hps/services/hps_batch_service.rb +29 -29
  58. data/lib/hps/services/hps_charge_service.rb +773 -773
  59. data/lib/hps/services/hps_check_service.rb +110 -110
  60. data/lib/hps/services/hps_gift_card_service.rb +301 -301
  61. data/lib/hps/services/hps_service.rb +141 -136
  62. data/lib/hps/version.rb +3 -3
  63. data/lib/hps.rb +63 -63
  64. data/tests/amex_tests.rb +292 -292
  65. data/tests/cert_tests.rb +80 -80
  66. data/tests/certification/card_present_spec.rb +320 -320
  67. data/tests/certification/gift_card_certification_test.rb +106 -106
  68. data/tests/certification/gift_card_certification_tests.rb +107 -107
  69. data/tests/check_tests.rb +50 -50
  70. data/tests/discover_tests.rb +386 -386
  71. data/tests/exception_mapper_tests.rb +311 -311
  72. data/tests/general_tests.rb +140 -140
  73. data/tests/giftcard_tests.rb +212 -212
  74. data/tests/hps_token_service.rb +56 -56
  75. data/tests/mastercard_tests.rb +387 -387
  76. data/tests/secret_key.rb +11 -11
  77. data/tests/test_check.rb +77 -77
  78. data/tests/test_data.rb +138 -138
  79. data/tests/test_helper.rb +179 -179
  80. data/tests/token_tests.rb +512 -512
  81. data/tests/visa_tests.rb +445 -445
  82. metadata +31 -11
data/tests/test_helper.rb CHANGED
@@ -1,179 +1,179 @@
1
- require File.join( File.dirname(__FILE__), "test_data.rb" )
2
- require File.join( File.dirname(__FILE__), "test_check.rb" )
3
- require "hps"
4
- require "rspec"
5
-
6
- module Hps
7
- module TestHelper
8
-
9
- def self.configure_hps_module
10
- Hps.configure do |config|
11
- config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
12
- config.user_name = "777700004035"
13
- config.password = "$Test1234"
14
- config.developer_id = 123456
15
- config.version_number = 1234
16
- config.license_id = 20855
17
- config.device_id = 1519321
18
- config.site_id = 20856
19
- config.site_trace = "trace0001"
20
- end
21
- end
22
-
23
-
24
- def self.configure_hps_module_secret_key
25
- Hps.configure do |config|
26
- config.secret_api_key = "skapi_uat_MXZOAAC7LmEFVeOYGlVHe_WhvRf_UzWzJq5VJ8A-jA"
27
- end
28
- end
29
-
30
- def self.configure_hps_module_secret_key_with_spaces
31
- Hps.configure do |config|
32
- #config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
33
- config.secret_api_key = " skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ "
34
- end
35
- end
36
-
37
- def self.configure_hps_module_for_certification
38
- Hps.configure do |config|
39
- config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
40
- config.user_name = "777700005412"
41
- config.password = "$Test1234"
42
- config.developer_id = 123456
43
- config.version_number = 1234
44
- config.license_id = 20994
45
- config.device_id = 1522326
46
- config.site_id = 20995
47
- config.site_trace = "trace0001"
48
- end
49
- end
50
-
51
- def self.charge_valid_amex(amount)
52
- TestHelper.configure_hps_module()
53
- service = Hps::HpsChargeService.new()
54
- service.charge(amount, "usd", TestData.valid_amex, TestData.valid_cardholder)
55
- end
56
-
57
- def self.charge_valid_discover(amount)
58
- TestHelper.configure_hps_module()
59
- service = Hps::HpsChargeService.new()
60
- service.charge(amount, "usd", TestData.valid_discover, TestData.valid_cardholder)
61
- end
62
-
63
- def self.charge_valid_mastercard(amount)
64
- TestHelper.configure_hps_module()
65
- service = Hps::HpsChargeService.new()
66
- service.charge(amount, "usd", TestData.valid_mastercard, TestData.valid_cardholder)
67
- end
68
-
69
- def self.charge_valid_visa(amount)
70
- TestHelper.configure_hps_module()
71
- service = Hps::HpsChargeService.new()
72
- service.charge(amount, "usd", TestData.valid_visa, TestData.valid_cardholder)
73
- end
74
-
75
- def self.charge_token(token_value,multi_use=false)
76
- TestHelper.valid_multi_use_config
77
- service = Hps::HpsChargeService.new()
78
- service.charge(50, "usd", token_value, TestData.valid_cardholder,multi_use)
79
- end
80
-
81
- def self.auth_token(token_value,multi_use=false)
82
- TestHelper.valid_multi_use_config
83
- service = Hps::HpsChargeService.new()
84
- service.authorize(50, "usd", token_value, TestData.valid_cardholder,multi_use)
85
- end
86
-
87
- def self.verify_token(token_value,multi_use=false)
88
- TestHelper.valid_multi_use_config
89
- service = Hps::HpsChargeService.new()
90
- service.verify(token_value, TestData.valid_cardholder,multi_use)
91
- end
92
-
93
- def self.refund_token(token_value)
94
- TestHelper.valid_multi_use_config
95
- service = Hps::HpsChargeService.new()
96
- service.refund(50,'usd',token_value, TestData.valid_cardholder)
97
- end
98
-
99
- def self.reverse_token(token_value)
100
- TestHelper.valid_multi_use_config
101
- service = Hps::HpsChargeService.new()
102
- service.reverse(token_value,50,'usd')
103
- end
104
-
105
- def self.valid_multi_use_public_key
106
- 'pkapi_cert_MrSafdEKB2dIHQEzDk'
107
- end
108
-
109
- def self.valid_multi_use_config
110
- Hps.configure do |config|
111
- config.secret_api_key ='skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'
112
- end
113
- end
114
-
115
- # =============
116
- # = Giftcards =
117
- # =============
118
- def self.balance_valid_gift_card
119
- TestHelper.valid_multi_use_config
120
- service = Hps::HpsGiftCardService.new
121
- service.balance( TestData.valid_gift_card_not_encrypted )
122
- end # balance_valid_gift_card
123
-
124
- def self.activate_valid_gift_card(amount)
125
- TestHelper.valid_multi_use_config
126
- service = Hps::HpsGiftCardService.new
127
- service.activate( TestData.valid_gift_card_not_encrypted, amount, 'USD' )
128
- end # activate_valid_gift_card
129
-
130
- def self.add_value_to_valid_gift_card(amount)
131
- TestHelper.valid_multi_use_config
132
- service = Hps::HpsGiftCardService.new
133
- service.add_value( TestData.valid_gift_card_not_encrypted, amount, 'USD' )
134
- end # add_value_to_valid_gift_card
135
-
136
- def self.deactivate_valid_gift_card
137
- TestHelper.valid_multi_use_config
138
- service = Hps::HpsGiftCardService.new
139
- service.deactivate( TestData.valid_gift_card_not_encrypted )
140
- end # deactivate_valid_gift_card
141
-
142
- def self.replace_valid_gift_card
143
- TestHelper.valid_multi_use_config
144
- service = Hps::HpsGiftCardService.new
145
- service.replace( TestData.valid_gift_card_not_encrypted, TestData.valid_gift_card_not_encrypted )
146
- end # replace_valid_gift_card
147
-
148
- def self.reward_valid_gift_card(amount, currency = "USD", gratuity = nil, tax = nil)
149
- TestHelper.valid_multi_use_config
150
- service = Hps::HpsGiftCardService.new
151
- service.reward( TestData.valid_gift_card_not_encrypted, amount, 'USD', gratuity, tax )
152
- end # reward_valid_gift_card
153
-
154
- def self.sale_valid_gift_card(amount, currency = "USD", gratuity = nil, tax = nil, random_card = true)
155
- TestHelper.valid_multi_use_config
156
- service = Hps::HpsGiftCardService.new
157
- service.sale( TestData.valid_gift_card_not_encrypted(random_card), amount, currency, gratuity, tax)
158
- end # sale_valid_gift_card
159
-
160
- def self.void_gift_card_sale(txn_id)
161
- TestHelper.valid_multi_use_config
162
- service = Hps::HpsGiftCardService.new
163
- service.void( txn_id )
164
- end # void_gift_card_sale
165
-
166
- def self.reverse_gift_card_sale(amount, txn_id = TestData.valid_gift_card_not_encrypted(false))
167
- TestHelper.valid_multi_use_config
168
- service = Hps::HpsGiftCardService.new
169
- service.reverse( txn_id, amount )
170
- end # reverse_gift_card_sale
171
-
172
- # Testing exceptions from transactions
173
- def self.gift_card_transaction_exception(amount, method = :sale)
174
- TestHelper.valid_multi_use_config
175
- service = Hps::HpsGiftCardService.new
176
- service.send(method, TestData.valid_gift_card_not_encrypted, amount )
177
- end # gift_card_sale_with_invaid_pin
178
- end
179
- end
1
+ require File.join( File.dirname(__FILE__), "test_data.rb" )
2
+ require File.join( File.dirname(__FILE__), "test_check.rb" )
3
+ require "hps"
4
+ require "rspec"
5
+
6
+ module Hps
7
+ module TestHelper
8
+
9
+ def self.configure_hps_module
10
+ Hps.configure do |config|
11
+ config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
12
+ config.user_name = "777700004035"
13
+ config.password = "$Test1234"
14
+ config.developer_id = 123456
15
+ config.version_number = 1234
16
+ config.license_id = 20855
17
+ config.device_id = 1519321
18
+ config.site_id = 20856
19
+ config.site_trace = "trace0001"
20
+ end
21
+ end
22
+
23
+
24
+ def self.configure_hps_module_secret_key
25
+ Hps.configure do |config|
26
+ config.secret_api_key = "skapi_uat_MXZOAAC7LmEFVeOYGlVHe_WhvRf_UzWzJq5VJ8A-jA"
27
+ end
28
+ end
29
+
30
+ def self.configure_hps_module_secret_key_with_spaces
31
+ Hps.configure do |config|
32
+ #config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
33
+ config.secret_api_key = " skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ "
34
+ end
35
+ end
36
+
37
+ def self.configure_hps_module_for_certification
38
+ Hps.configure do |config|
39
+ config.service_uri = "https://cert.api2.heartlandportico.com/Hps.Exchange.PosGateway/PosGatewayService.asmx?wsdl"
40
+ config.user_name = "777700005412"
41
+ config.password = "$Test1234"
42
+ config.developer_id = 123456
43
+ config.version_number = 1234
44
+ config.license_id = 20994
45
+ config.device_id = 1522326
46
+ config.site_id = 20995
47
+ config.site_trace = "trace0001"
48
+ end
49
+ end
50
+
51
+ def self.charge_valid_amex(amount)
52
+ TestHelper.configure_hps_module()
53
+ service = Hps::HpsChargeService.new()
54
+ service.charge(amount, "usd", TestData.valid_amex, TestData.valid_cardholder)
55
+ end
56
+
57
+ def self.charge_valid_discover(amount)
58
+ TestHelper.configure_hps_module()
59
+ service = Hps::HpsChargeService.new()
60
+ service.charge(amount, "usd", TestData.valid_discover, TestData.valid_cardholder)
61
+ end
62
+
63
+ def self.charge_valid_mastercard(amount)
64
+ TestHelper.configure_hps_module()
65
+ service = Hps::HpsChargeService.new()
66
+ service.charge(amount, "usd", TestData.valid_mastercard, TestData.valid_cardholder)
67
+ end
68
+
69
+ def self.charge_valid_visa(amount)
70
+ TestHelper.configure_hps_module()
71
+ service = Hps::HpsChargeService.new()
72
+ service.charge(amount, "usd", TestData.valid_visa, TestData.valid_cardholder)
73
+ end
74
+
75
+ def self.charge_token(token_value,multi_use=false)
76
+ TestHelper.valid_multi_use_config
77
+ service = Hps::HpsChargeService.new()
78
+ service.charge(50, "usd", token_value, TestData.valid_cardholder,multi_use)
79
+ end
80
+
81
+ def self.auth_token(token_value,multi_use=false)
82
+ TestHelper.valid_multi_use_config
83
+ service = Hps::HpsChargeService.new()
84
+ service.authorize(50, "usd", token_value, TestData.valid_cardholder,multi_use)
85
+ end
86
+
87
+ def self.verify_token(token_value,multi_use=false)
88
+ TestHelper.valid_multi_use_config
89
+ service = Hps::HpsChargeService.new()
90
+ service.verify(token_value, TestData.valid_cardholder,multi_use)
91
+ end
92
+
93
+ def self.refund_token(token_value)
94
+ TestHelper.valid_multi_use_config
95
+ service = Hps::HpsChargeService.new()
96
+ service.refund(50,'usd',token_value, TestData.valid_cardholder)
97
+ end
98
+
99
+ def self.reverse_token(token_value)
100
+ TestHelper.valid_multi_use_config
101
+ service = Hps::HpsChargeService.new()
102
+ service.reverse(token_value,50,'usd')
103
+ end
104
+
105
+ def self.valid_multi_use_public_key
106
+ 'pkapi_cert_MrSafdEKB2dIHQEzDk'
107
+ end
108
+
109
+ def self.valid_multi_use_config
110
+ Hps.configure do |config|
111
+ config.secret_api_key ='skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'
112
+ end
113
+ end
114
+
115
+ # =============
116
+ # = Giftcards =
117
+ # =============
118
+ def self.balance_valid_gift_card
119
+ TestHelper.valid_multi_use_config
120
+ service = Hps::HpsGiftCardService.new
121
+ service.balance( TestData.valid_gift_card_not_encrypted )
122
+ end # balance_valid_gift_card
123
+
124
+ def self.activate_valid_gift_card(amount)
125
+ TestHelper.valid_multi_use_config
126
+ service = Hps::HpsGiftCardService.new
127
+ service.activate( TestData.valid_gift_card_not_encrypted, amount, 'USD' )
128
+ end # activate_valid_gift_card
129
+
130
+ def self.add_value_to_valid_gift_card(amount)
131
+ TestHelper.valid_multi_use_config
132
+ service = Hps::HpsGiftCardService.new
133
+ service.add_value( TestData.valid_gift_card_not_encrypted, amount, 'USD' )
134
+ end # add_value_to_valid_gift_card
135
+
136
+ def self.deactivate_valid_gift_card
137
+ TestHelper.valid_multi_use_config
138
+ service = Hps::HpsGiftCardService.new
139
+ service.deactivate( TestData.valid_gift_card_not_encrypted )
140
+ end # deactivate_valid_gift_card
141
+
142
+ def self.replace_valid_gift_card
143
+ TestHelper.valid_multi_use_config
144
+ service = Hps::HpsGiftCardService.new
145
+ service.replace( TestData.valid_gift_card_not_encrypted, TestData.valid_gift_card_not_encrypted )
146
+ end # replace_valid_gift_card
147
+
148
+ def self.reward_valid_gift_card(amount, currency = "USD", gratuity = nil, tax = nil)
149
+ TestHelper.valid_multi_use_config
150
+ service = Hps::HpsGiftCardService.new
151
+ service.reward( TestData.valid_gift_card_not_encrypted, amount, 'USD', gratuity, tax )
152
+ end # reward_valid_gift_card
153
+
154
+ def self.sale_valid_gift_card(amount, currency = "USD", gratuity = nil, tax = nil, random_card = true)
155
+ TestHelper.valid_multi_use_config
156
+ service = Hps::HpsGiftCardService.new
157
+ service.sale( TestData.valid_gift_card_not_encrypted(random_card), amount, currency, gratuity, tax)
158
+ end # sale_valid_gift_card
159
+
160
+ def self.void_gift_card_sale(txn_id)
161
+ TestHelper.valid_multi_use_config
162
+ service = Hps::HpsGiftCardService.new
163
+ service.void( txn_id )
164
+ end # void_gift_card_sale
165
+
166
+ def self.reverse_gift_card_sale(amount, txn_id = TestData.valid_gift_card_not_encrypted(false))
167
+ TestHelper.valid_multi_use_config
168
+ service = Hps::HpsGiftCardService.new
169
+ service.reverse( txn_id, amount )
170
+ end # reverse_gift_card_sale
171
+
172
+ # Testing exceptions from transactions
173
+ def self.gift_card_transaction_exception(amount, method = :sale)
174
+ TestHelper.valid_multi_use_config
175
+ service = Hps::HpsGiftCardService.new
176
+ service.send(method, TestData.valid_gift_card_not_encrypted, amount )
177
+ end # gift_card_sale_with_invaid_pin
178
+ end
179
+ end