hps 2.3.2 → 2.5.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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -0
  3. data/Gemfile +4 -4
  4. data/Gemfile.lock +77 -0
  5. data/LICENSE.md +264 -264
  6. data/PRIVACY.txt +65 -65
  7. data/README.md +213 -213
  8. data/Rakefile +15 -15
  9. data/examples/sinatra-verify-only/Gemfile +4 -4
  10. data/examples/sinatra-verify-only/app.rb +32 -32
  11. data/examples/sinatra-verify-only/views/index.erb +478 -478
  12. data/examples/sinatra-verify-only/views/result.erb +39 -39
  13. data/hps.gemspec +28 -27
  14. data/lib/hps/configuration.rb +17 -17
  15. data/lib/hps/entities/hps_account_verify.rb +8 -8
  16. data/lib/hps/entities/hps_address.rb +6 -6
  17. data/lib/hps/entities/hps_authorization.rb +12 -12
  18. data/lib/hps/entities/hps_batch.rb +6 -6
  19. data/lib/hps/entities/hps_cardholder.rb +6 -6
  20. data/lib/hps/entities/hps_charge.rb +8 -8
  21. data/lib/hps/entities/hps_charge_exceptions.rb +6 -6
  22. data/lib/hps/entities/hps_check.rb +18 -18
  23. data/lib/hps/entities/hps_check_holder.rb +10 -10
  24. data/lib/hps/entities/hps_check_response.rb +45 -45
  25. data/lib/hps/entities/hps_check_response_details.rb +9 -9
  26. data/lib/hps/entities/hps_credit_card.rb +34 -34
  27. data/lib/hps/entities/hps_direct_market_data.rb +5 -5
  28. data/lib/hps/entities/hps_encryption_data.rb +6 -6
  29. data/lib/hps/entities/hps_gift_card.rb +133 -133
  30. data/lib/hps/entities/hps_manage_tokens.rb +8 -8
  31. data/lib/hps/entities/hps_refund.rb +8 -8
  32. data/lib/hps/entities/hps_report_transaction_details.rb +10 -10
  33. data/lib/hps/entities/hps_report_transaction_summary.rb +6 -6
  34. data/lib/hps/entities/hps_reversal.rb +10 -10
  35. data/lib/hps/entities/hps_token_data.rb +10 -10
  36. data/lib/hps/entities/hps_track_data.rb +5 -5
  37. data/lib/hps/entities/hps_transaction.rb +161 -161
  38. data/lib/hps/entities/hps_transaction_details.rb +6 -6
  39. data/lib/hps/entities/hps_transaction_header.rb +8 -8
  40. data/lib/hps/entities/hps_transaction_type.rb +16 -16
  41. data/lib/hps/entities/hps_void.rb +8 -8
  42. data/lib/hps/infrastructure/api_connection_exception.rb +11 -11
  43. data/lib/hps/infrastructure/authentication_exception.rb +11 -11
  44. data/lib/hps/infrastructure/card_exception.rb +15 -15
  45. data/lib/hps/infrastructure/exceptions.json +547 -547
  46. data/lib/hps/infrastructure/hps_account_type.rb +11 -11
  47. data/lib/hps/infrastructure/hps_check_exception.rb +13 -13
  48. data/lib/hps/infrastructure/hps_check_type.rb +11 -11
  49. data/lib/hps/infrastructure/hps_data_entry_mode.rb +11 -11
  50. data/lib/hps/infrastructure/hps_exception.rb +25 -25
  51. data/lib/hps/infrastructure/hps_exception_mapper.rb +145 -145
  52. data/lib/hps/infrastructure/hps_gateway_response_validation.rb +20 -20
  53. data/lib/hps/infrastructure/hps_input_validation.rb +13 -13
  54. data/lib/hps/infrastructure/hps_sdk_codes.rb +48 -48
  55. data/lib/hps/infrastructure/hps_sec_code.rb +27 -27
  56. data/lib/hps/infrastructure/hps_track_data_method.rb +6 -6
  57. data/lib/hps/infrastructure/invalid_request_exception.rb +15 -15
  58. data/lib/hps/services/hps_batch_service.rb +29 -29
  59. data/lib/hps/services/hps_charge_service.rb +773 -773
  60. data/lib/hps/services/hps_check_service.rb +110 -110
  61. data/lib/hps/services/hps_gift_card_service.rb +301 -301
  62. data/lib/hps/services/hps_service.rb +140 -136
  63. data/lib/hps/version.rb +3 -3
  64. data/lib/hps.rb +63 -63
  65. data/tests/amex_tests.rb +292 -292
  66. data/tests/cert_tests.rb +80 -80
  67. data/tests/certification/card_present_spec.rb +320 -320
  68. data/tests/certification/gift_card_certification_test.rb +106 -106
  69. data/tests/certification/gift_card_certification_tests.rb +107 -107
  70. data/tests/check_tests.rb +50 -50
  71. data/tests/discover_tests.rb +386 -386
  72. data/tests/exception_mapper_tests.rb +311 -311
  73. data/tests/general_tests.rb +140 -140
  74. data/tests/giftcard_tests.rb +212 -212
  75. data/tests/hps_token_service.rb +56 -56
  76. data/tests/mastercard_tests.rb +387 -387
  77. data/tests/secret_key.rb +11 -11
  78. data/tests/test_check.rb +77 -77
  79. data/tests/test_data.rb +138 -138
  80. data/tests/test_helper.rb +179 -179
  81. data/tests/token_tests.rb +512 -512
  82. data/tests/visa_tests.rb +445 -445
  83. metadata +31 -13
@@ -1,133 +1,133 @@
1
- module Hps
2
- # ===============
3
- # = HpsGiftCard =
4
- # ===============
5
- class HpsGiftCard
6
- attr_accessor :number, :track_data, :alias, :token_value,
7
- :encryption_data, :pin
8
-
9
- def initialize(number = nil)
10
- self.number = number
11
- end
12
- end # HpsGiftCard
13
-
14
- # =======================
15
- # = HpsGiftCardActivate =
16
- # =======================
17
- class HpsGiftCardActivate < HpsTransaction
18
- # Values used in the card activate response
19
- attr_accessor :authorization_code, :balance_amount, :points_balance_amount
20
-
21
- # The rewards (dollars or points) added to the account as
22
- # a result of the transaction
23
- attr_accessor :rewards
24
-
25
- # Notes contain reward messages to be displayed on a receipt,
26
- # mobile app, or web page to inform an account holder about
27
- # special rewards or promotions available on their account
28
- attr_accessor :notes
29
-
30
- def self.from_response(response, txn_type, return_type = nil)
31
- activation_response = response['Transaction'][txn_type]
32
-
33
- activation = return_type ? return_type.constantize.new : self.new
34
-
35
- activation.transaction_id = response['Header']['GatewayTxnId']
36
- activation.authorization_code = activation_response['AuthCode']
37
- activation.balance_amount = activation_response['BalanceAmt']
38
- activation.points_balance_amount = activation_response['PointsBalanceAmt']
39
- activation.rewards = activation_response['Rewards']
40
- activation.notes = activation_response['Notes']
41
- activation.response_code = activation_response['RspCode']
42
- activation.response_text = activation_response['RspText']
43
-
44
- return activation
45
- end # from_response
46
- end # HpsGiftCardActivate
47
-
48
- # =========================
49
- # = HpsGiftCardDeactivate =
50
- # =========================
51
- class HpsGiftCardDeactivate < HpsGiftCardActivate
52
-
53
- end # HpsGiftCardDeactivate
54
-
55
- # ======================
56
- # = HpsGiftCardReplace =
57
- # ======================
58
- class HpsGiftCardReplace < HpsGiftCardActivate
59
-
60
- end # HpsGiftCardReplace
61
-
62
- # =======================
63
- # = HpsGiftCardReversal =
64
- # =======================
65
- class HpsGiftCardReversal < HpsGiftCardActivate
66
-
67
- end # HpsGiftCardReversal
68
-
69
- # =====================
70
- # = HpsGiftCardReward =
71
- # =====================
72
- class HpsGiftCardReward < HpsGiftCardActivate
73
-
74
- end # HpsGiftCardReward
75
-
76
- # ======================
77
- # = HpsGiftCardBalance =
78
- # ======================
79
- class HpsGiftCardBalance < HpsGiftCardActivate
80
-
81
- end # HpsGiftCardBalance
82
-
83
- # =======================
84
- # = HpsGiftCardAddValue =
85
- # =======================
86
- class HpsGiftCardAddValue < HpsGiftCardActivate
87
-
88
- end # HpsGiftCardAddValue
89
-
90
- # ===================
91
- # = HpsGiftCardVoid =
92
- # ===================
93
- class HpsGiftCardVoid < HpsGiftCardActivate
94
-
95
- end # HpsGiftCardVoid
96
-
97
- # ===================
98
- # = HpsGiftCardSale =
99
- # ===================
100
- class HpsGiftCardSale < HpsGiftCardActivate
101
- attr_accessor :split_tender_card_amount, :split_tender_balance_due
102
-
103
- def self.from_response(response, txn_type)
104
- transaction = response['Transaction']
105
-
106
- sale = self.superclass.from_response(response, txn_type, self.name)
107
-
108
- sale.split_tender_card_amount = transaction['SplitTenderCardAmt']
109
- sale.split_tender_balance_due = transaction['SplitTenderBalanceDueAmt']
110
-
111
- return sale
112
- end # from_response
113
- end # HpsGiftCardSale
114
-
115
- # ====================
116
- # = HpsGiftCardAlias =
117
- # ====================
118
- class HpsGiftCardAlias < HpsTransaction
119
- attr_accessor :gift_card
120
-
121
- def self.from_response(response, txn_type)
122
- alias_response = response['Transaction'][txn_type]
123
-
124
- alias_item = HpsGiftCardAlias.new
125
- alias_item.transaction_id = response['Header']['GatewayTxnId']
126
- alias_item.gift_card = HpsGiftCard.new(alias_response['CardData'])
127
- alias_item.response_code = alias_response['RspCode']
128
- alias_item.response_text = alias_response['RspText']
129
-
130
- return alias_item
131
- end # from_response
132
- end # HpsGiftCardAlias
133
- end # Hps
1
+ module Hps
2
+ # ===============
3
+ # = HpsGiftCard =
4
+ # ===============
5
+ class HpsGiftCard
6
+ attr_accessor :number, :track_data, :alias, :token_value,
7
+ :encryption_data, :pin
8
+
9
+ def initialize(number = nil)
10
+ self.number = number
11
+ end
12
+ end # HpsGiftCard
13
+
14
+ # =======================
15
+ # = HpsGiftCardActivate =
16
+ # =======================
17
+ class HpsGiftCardActivate < HpsTransaction
18
+ # Values used in the card activate response
19
+ attr_accessor :authorization_code, :balance_amount, :points_balance_amount
20
+
21
+ # The rewards (dollars or points) added to the account as
22
+ # a result of the transaction
23
+ attr_accessor :rewards
24
+
25
+ # Notes contain reward messages to be displayed on a receipt,
26
+ # mobile app, or web page to inform an account holder about
27
+ # special rewards or promotions available on their account
28
+ attr_accessor :notes
29
+
30
+ def self.from_response(response, txn_type, return_type = nil)
31
+ activation_response = response['Transaction'][txn_type]
32
+
33
+ activation = return_type ? return_type.constantize.new : self.new
34
+
35
+ activation.transaction_id = response['Header']['GatewayTxnId']
36
+ activation.authorization_code = activation_response['AuthCode']
37
+ activation.balance_amount = activation_response['BalanceAmt']
38
+ activation.points_balance_amount = activation_response['PointsBalanceAmt']
39
+ activation.rewards = activation_response['Rewards']
40
+ activation.notes = activation_response['Notes']
41
+ activation.response_code = activation_response['RspCode']
42
+ activation.response_text = activation_response['RspText']
43
+
44
+ return activation
45
+ end # from_response
46
+ end # HpsGiftCardActivate
47
+
48
+ # =========================
49
+ # = HpsGiftCardDeactivate =
50
+ # =========================
51
+ class HpsGiftCardDeactivate < HpsGiftCardActivate
52
+
53
+ end # HpsGiftCardDeactivate
54
+
55
+ # ======================
56
+ # = HpsGiftCardReplace =
57
+ # ======================
58
+ class HpsGiftCardReplace < HpsGiftCardActivate
59
+
60
+ end # HpsGiftCardReplace
61
+
62
+ # =======================
63
+ # = HpsGiftCardReversal =
64
+ # =======================
65
+ class HpsGiftCardReversal < HpsGiftCardActivate
66
+
67
+ end # HpsGiftCardReversal
68
+
69
+ # =====================
70
+ # = HpsGiftCardReward =
71
+ # =====================
72
+ class HpsGiftCardReward < HpsGiftCardActivate
73
+
74
+ end # HpsGiftCardReward
75
+
76
+ # ======================
77
+ # = HpsGiftCardBalance =
78
+ # ======================
79
+ class HpsGiftCardBalance < HpsGiftCardActivate
80
+
81
+ end # HpsGiftCardBalance
82
+
83
+ # =======================
84
+ # = HpsGiftCardAddValue =
85
+ # =======================
86
+ class HpsGiftCardAddValue < HpsGiftCardActivate
87
+
88
+ end # HpsGiftCardAddValue
89
+
90
+ # ===================
91
+ # = HpsGiftCardVoid =
92
+ # ===================
93
+ class HpsGiftCardVoid < HpsGiftCardActivate
94
+
95
+ end # HpsGiftCardVoid
96
+
97
+ # ===================
98
+ # = HpsGiftCardSale =
99
+ # ===================
100
+ class HpsGiftCardSale < HpsGiftCardActivate
101
+ attr_accessor :split_tender_card_amount, :split_tender_balance_due
102
+
103
+ def self.from_response(response, txn_type)
104
+ transaction = response['Transaction']
105
+
106
+ sale = self.superclass.from_response(response, txn_type, self.name)
107
+
108
+ sale.split_tender_card_amount = transaction['SplitTenderCardAmt']
109
+ sale.split_tender_balance_due = transaction['SplitTenderBalanceDueAmt']
110
+
111
+ return sale
112
+ end # from_response
113
+ end # HpsGiftCardSale
114
+
115
+ # ====================
116
+ # = HpsGiftCardAlias =
117
+ # ====================
118
+ class HpsGiftCardAlias < HpsTransaction
119
+ attr_accessor :gift_card
120
+
121
+ def self.from_response(response, txn_type)
122
+ alias_response = response['Transaction'][txn_type]
123
+
124
+ alias_item = HpsGiftCardAlias.new
125
+ alias_item.transaction_id = response['Header']['GatewayTxnId']
126
+ alias_item.gift_card = HpsGiftCard.new(alias_response['CardData'])
127
+ alias_item.response_code = alias_response['RspCode']
128
+ alias_item.response_text = alias_response['RspText']
129
+
130
+ return alias_item
131
+ end # from_response
132
+ end # HpsGiftCardAlias
133
+ end # Hps
@@ -1,9 +1,9 @@
1
- module Hps
2
- class HpsManageTokens < HpsTransaction
3
-
4
- def initialize(header)
5
- super(header)
6
- end
7
-
8
- end
1
+ module Hps
2
+ class HpsManageTokens < HpsTransaction
3
+
4
+ def initialize(header)
5
+ super(header)
6
+ end
7
+
8
+ end
9
9
  end
@@ -1,9 +1,9 @@
1
- module Hps
2
- class HpsRefund < HpsTransaction
3
-
4
- def initialize(header)
5
- super(header)
6
- end
7
-
8
- end
1
+ module Hps
2
+ class HpsRefund < HpsTransaction
3
+
4
+ def initialize(header)
5
+ super(header)
6
+ end
7
+
8
+ end
9
9
  end
@@ -1,11 +1,11 @@
1
- module Hps
2
- class HpsReportTransactionDetails < HpsAuthorization
3
-
4
- attr_accessor :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
-
6
- def initialize(header)
7
- super(header)
8
- end
9
-
10
- end
1
+ module Hps
2
+ class HpsReportTransactionDetails < HpsAuthorization
3
+
4
+ attr_accessor :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
+
6
+ def initialize(header)
7
+ super(header)
8
+ end
9
+
10
+ end
11
11
  end
@@ -1,7 +1,7 @@
1
- module Hps
2
- class HpsReportTransactionSummary < HpsTransaction
3
-
4
- attr_accessor :amount, :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
-
6
- end
1
+ module Hps
2
+ class HpsReportTransactionSummary < HpsTransaction
3
+
4
+ attr_accessor :amount, :original_transaction_id, :masked_card_number, :transaction_type, :transaction_date, :exceptions
5
+
6
+ end
7
7
  end
@@ -1,11 +1,11 @@
1
- module Hps
2
- class HpsReversal < HpsTransaction
3
-
4
- attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code, :cvv_result_text, :cpc_indicator
5
-
6
- def initialize(header)
7
- super(header)
8
- end
9
-
10
- end
1
+ module Hps
2
+ class HpsReversal < HpsTransaction
3
+
4
+ attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code, :cvv_result_text, :cpc_indicator
5
+
6
+ def initialize(header)
7
+ super(header)
8
+ end
9
+
10
+ end
11
11
  end
@@ -1,11 +1,11 @@
1
- module Hps
2
- class HpsTokenData
3
-
4
- attr_accessor :token_value, :response_code, :response_message
5
-
6
- def initialize(response_message = nil)
7
- @response_message = response_message
8
- end
9
-
10
- end
1
+ module Hps
2
+ class HpsTokenData
3
+
4
+ attr_accessor :token_value, :response_code, :response_message
5
+
6
+ def initialize(response_message = nil)
7
+ @response_message = response_message
8
+ end
9
+
10
+ end
11
11
  end
@@ -1,5 +1,5 @@
1
- module Hps
2
- class Hps::HpsTrackData
3
- attr_accessor :value, :method_obtained
4
- end
5
- end
1
+ module Hps
2
+ class Hps::HpsTrackData
3
+ attr_accessor :value, :method_obtained
4
+ end
5
+ end