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.
- checksums.yaml +4 -4
- data/Gemfile +4 -8
- data/LICENSE.txt +32 -32
- data/PRIVACY.txt +65 -65
- data/README.md +214 -41
- data/Rakefile +15 -15
- data/hps.gemspec +28 -26
- data/lib/hps.rb +48 -45
- 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 +6 -10
- 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 +34 -33
- data/lib/hps/entities/hps_direct_market_data.rb +5 -0
- data/lib/hps/entities/hps_encryption_data.rb +6 -0
- 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_track_data.rb +5 -0
- 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/hps_track_data_method.rb +6 -0
- 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 +735 -635
- data/lib/hps/services/hps_service.rb +127 -128
- data/lib/hps/version.rb +3 -3
- data/tests/amex_tests.rb +292 -231
- data/tests/cert_tests.rb +80 -80
- data/tests/certification/card_present_spec.rb +320 -0
- data/tests/discover_tests.rb +386 -325
- data/tests/exception_mapper_tests.rb +244 -244
- data/tests/general_tests.rb +65 -57
- data/tests/hps_token_service.rb +56 -56
- data/tests/mastercard_tests.rb +387 -326
- data/tests/secret_key.rb +11 -11
- data/tests/test_data.rb +128 -128
- data/tests/test_helper.rb +115 -108
- data/tests/token_tests.rb +512 -512
- data/tests/visa_tests.rb +445 -378
- metadata +36 -3
data/Rakefile
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
task :console do
|
|
2
|
-
require 'bundler/gem_tasks'
|
|
3
|
-
require 'hps'
|
|
4
|
-
begin
|
|
5
|
-
require 'pry'
|
|
6
|
-
ARGV.clear
|
|
7
|
-
Pry.start
|
|
8
|
-
rescue LoadError
|
|
9
|
-
#pry was not found so loading irb
|
|
10
|
-
require 'irb'
|
|
11
|
-
require 'irb/completion'
|
|
12
|
-
ARGV.clear
|
|
13
|
-
IRB.start
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
task :console do
|
|
2
|
+
require 'bundler/gem_tasks'
|
|
3
|
+
require 'hps'
|
|
4
|
+
begin
|
|
5
|
+
require 'pry'
|
|
6
|
+
ARGV.clear
|
|
7
|
+
Pry.start
|
|
8
|
+
rescue LoadError
|
|
9
|
+
#pry was not found so loading irb
|
|
10
|
+
require 'irb'
|
|
11
|
+
require 'irb/completion'
|
|
12
|
+
ARGV.clear
|
|
13
|
+
IRB.start
|
|
14
|
+
end
|
|
15
|
+
end
|
data/hps.gemspec
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'hps/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "hps"
|
|
8
|
-
spec.version = Hps::VERSION
|
|
9
|
-
spec.authors = ["Heartland Payment Systems"]
|
|
10
|
-
spec.email = ["IntegrationSupportTeam@e-hps.com"]
|
|
11
|
-
spec.description = %q{Ruby SDK for processing payments via Portico Gateway}
|
|
12
|
-
spec.summary = %q{Heartland Payment Systems - Portico Gateway SDK}
|
|
13
|
-
spec.homepage = ""
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
|
|
16
|
-
spec.files = `git ls-files`.split($/)
|
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
-
spec.add_development_dependency "rake"
|
|
23
|
-
spec.
|
|
24
|
-
spec.
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'hps/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "hps"
|
|
8
|
+
spec.version = Hps::VERSION
|
|
9
|
+
spec.authors = ["Heartland Payment Systems"]
|
|
10
|
+
spec.email = ["IntegrationSupportTeam@e-hps.com"]
|
|
11
|
+
spec.description = %q{Ruby SDK for processing payments via Portico Gateway}
|
|
12
|
+
spec.summary = %q{Heartland Payment Systems - Portico Gateway SDK}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
spec.add_development_dependency "rspec"
|
|
24
|
+
spec.add_development_dependency "pry"
|
|
25
|
+
spec.add_dependency('builder', '>= 2.1.2', '< 4.0.0')
|
|
26
|
+
spec.add_dependency('activesupport', '>= 2.3.14', '< 5.0.0')
|
|
27
|
+
|
|
28
|
+
end
|
data/lib/hps.rb
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
require 'builder'
|
|
2
|
-
require 'net/http'
|
|
3
|
-
require 'net/https'
|
|
4
|
-
require "hps/version"
|
|
5
|
-
require "hps/configuration"
|
|
6
|
-
|
|
7
|
-
# Entities
|
|
8
|
-
require "hps/entities/hps_transaction"
|
|
9
|
-
require "hps/entities/hps_authorization"
|
|
10
|
-
require "hps/entities/hps_account_verify"
|
|
11
|
-
require "hps/entities/hps_address"
|
|
12
|
-
require "hps/entities/hps_batch"
|
|
13
|
-
require "hps/entities/hps_cardholder"
|
|
14
|
-
require "hps/entities/hps_charge"
|
|
15
|
-
require "hps/entities/hps_charge_exceptions"
|
|
16
|
-
require "hps/entities/hps_credit_card"
|
|
17
|
-
require "hps/entities/
|
|
18
|
-
require "hps/entities/
|
|
19
|
-
require "hps/entities/
|
|
20
|
-
require "hps/entities/
|
|
21
|
-
require "hps/entities/
|
|
22
|
-
require "hps/entities/
|
|
23
|
-
require "hps/entities/
|
|
24
|
-
require "hps/entities/
|
|
25
|
-
require "hps/entities/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
require "hps/infrastructure/
|
|
31
|
-
require "hps/infrastructure/
|
|
32
|
-
require "hps/infrastructure/
|
|
33
|
-
require "hps/infrastructure/
|
|
34
|
-
require "hps/infrastructure/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
require "hps/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
require 'builder'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'net/https'
|
|
4
|
+
require "hps/version"
|
|
5
|
+
require "hps/configuration"
|
|
6
|
+
|
|
7
|
+
# Entities
|
|
8
|
+
require "hps/entities/hps_transaction"
|
|
9
|
+
require "hps/entities/hps_authorization"
|
|
10
|
+
require "hps/entities/hps_account_verify"
|
|
11
|
+
require "hps/entities/hps_address"
|
|
12
|
+
require "hps/entities/hps_batch"
|
|
13
|
+
require "hps/entities/hps_cardholder"
|
|
14
|
+
require "hps/entities/hps_charge"
|
|
15
|
+
require "hps/entities/hps_charge_exceptions"
|
|
16
|
+
require "hps/entities/hps_credit_card"
|
|
17
|
+
require "hps/entities/hps_encryption_data"
|
|
18
|
+
require "hps/entities/hps_refund"
|
|
19
|
+
require "hps/entities/hps_report_transaction_details"
|
|
20
|
+
require "hps/entities/hps_report_transaction_summary"
|
|
21
|
+
require "hps/entities/hps_reversal"
|
|
22
|
+
require "hps/entities/hps_token_data"
|
|
23
|
+
require "hps/entities/hps_track_data"
|
|
24
|
+
require "hps/entities/hps_transaction_header"
|
|
25
|
+
require "hps/entities/hps_transaction_type"
|
|
26
|
+
require "hps/entities/hps_transaction_details"
|
|
27
|
+
require "hps/entities/hps_void"
|
|
28
|
+
|
|
29
|
+
# Infrastructure
|
|
30
|
+
require "hps/infrastructure/hps_sdk_codes"
|
|
31
|
+
require "hps/infrastructure/hps_exception"
|
|
32
|
+
require "hps/infrastructure/api_connection_exception"
|
|
33
|
+
require "hps/infrastructure/authentication_exception"
|
|
34
|
+
require "hps/infrastructure/card_exception"
|
|
35
|
+
require "hps/infrastructure/invalid_request_exception"
|
|
36
|
+
require "hps/infrastructure/hps_exception_mapper"
|
|
37
|
+
require "hps/infrastructure/hps_track_data_method"
|
|
38
|
+
|
|
39
|
+
# Services
|
|
40
|
+
require "hps/services/hps_service"
|
|
41
|
+
require "hps/services/hps_charge_service"
|
|
42
|
+
require "hps/services/hps_batch_service"
|
|
43
|
+
|
|
44
|
+
module Hps
|
|
45
|
+
|
|
46
|
+
extend Configuration
|
|
47
|
+
|
|
48
|
+
end
|
data/lib/hps/configuration.rb
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
module Configuration
|
|
3
|
-
|
|
4
|
-
VALID_CONFIG_KEYS = [ :service_uri, :user_name, :password, :developer_id, :version_number, :license_id, :device_id, :site_id, :site_trace, :secret_api_key ].freeze
|
|
5
|
-
|
|
6
|
-
attr_accessor *VALID_CONFIG_KEYS
|
|
7
|
-
|
|
8
|
-
def configure
|
|
9
|
-
yield self
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def options
|
|
13
|
-
Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
module Configuration
|
|
3
|
+
|
|
4
|
+
VALID_CONFIG_KEYS = [ :service_uri, :user_name, :password, :developer_id, :version_number, :license_id, :device_id, :site_id, :site_trace, :secret_api_key ].freeze
|
|
5
|
+
|
|
6
|
+
attr_accessor *VALID_CONFIG_KEYS
|
|
7
|
+
|
|
8
|
+
def configure
|
|
9
|
+
yield self
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def options
|
|
13
|
+
Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
17
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsAccountVerify < HpsAuthorization
|
|
3
|
-
|
|
4
|
-
def initialize(header)
|
|
5
|
-
super(header)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsAccountVerify < HpsAuthorization
|
|
3
|
+
|
|
4
|
+
def initialize(header)
|
|
5
|
+
super(header)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
end
|
|
9
9
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsAddress
|
|
3
|
-
|
|
4
|
-
attr_accessor :address, :city, :state, :zip, :country
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsAddress
|
|
3
|
+
|
|
4
|
+
attr_accessor :address, :city, :state, :zip, :country
|
|
5
|
+
|
|
6
|
+
end
|
|
7
7
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsAuthorization < HpsTransaction
|
|
3
|
-
|
|
4
|
-
attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code,
|
|
5
|
-
:cvv_result_text, :cpc_indicator, :authorization_code,
|
|
6
|
-
:authorized_amount, :card_type, :token_data
|
|
7
|
-
|
|
8
|
-
def initialize(header)
|
|
9
|
-
super(header)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsAuthorization < HpsTransaction
|
|
3
|
+
|
|
4
|
+
attr_accessor :avs_result_code, :avs_result_text, :cvv_result_code,
|
|
5
|
+
:cvv_result_text, :cpc_indicator, :authorization_code,
|
|
6
|
+
:authorized_amount, :card_type, :token_data
|
|
7
|
+
|
|
8
|
+
def initialize(header)
|
|
9
|
+
super(header)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
13
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsBatch
|
|
3
|
-
|
|
4
|
-
attr_accessor :id, :transaction_count, :total_amount, :sequence_number
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsBatch
|
|
3
|
+
|
|
4
|
+
attr_accessor :id, :transaction_count, :total_amount, :sequence_number
|
|
5
|
+
|
|
6
|
+
end
|
|
7
7
|
end
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
self.address = Hps::HpsAddress.new
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsCardHolder
|
|
3
|
+
|
|
4
|
+
attr_accessor :first_name, :last_name, :phone, :email_address, :address
|
|
5
|
+
|
|
6
|
+
end
|
|
11
7
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsCharge < HpsAuthorization
|
|
3
|
-
|
|
4
|
-
def initialize(header)
|
|
5
|
-
super(header)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsCharge < HpsAuthorization
|
|
3
|
+
|
|
4
|
+
def initialize(header)
|
|
5
|
+
super(header)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
end
|
|
9
9
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsChargeExceptions
|
|
3
|
-
|
|
4
|
-
attr_accessor :card_exception, :hps_exception
|
|
5
|
-
|
|
6
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsChargeExceptions
|
|
3
|
+
|
|
4
|
+
attr_accessor :card_exception, :hps_exception
|
|
5
|
+
|
|
6
|
+
end
|
|
7
7
|
end
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
module Hps
|
|
2
|
-
class HpsCreditCard
|
|
3
|
-
|
|
4
|
-
attr_accessor :number, :cvv, :exp_month,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
:
|
|
12
|
-
:
|
|
13
|
-
:
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
end
|
|
1
|
+
module Hps
|
|
2
|
+
class HpsCreditCard
|
|
3
|
+
|
|
4
|
+
attr_accessor :number, :cvv, :exp_month,
|
|
5
|
+
:exp_year, :card_present, :reader_present
|
|
6
|
+
|
|
7
|
+
def initialize
|
|
8
|
+
|
|
9
|
+
@regex_map = {
|
|
10
|
+
:Amex => /^3[47][0-9]{13}$/,
|
|
11
|
+
:MasterCard => /^5[1-5][0-9]{14}$/,
|
|
12
|
+
:Visa => /^4[0-9]{12}(?:[0-9]{3})?$/,
|
|
13
|
+
:DinersClub => /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/,
|
|
14
|
+
:EnRoute => /^(2014|2149)/,
|
|
15
|
+
:Discover => /^6(?:011|5[0-9]{2})[0-9]{12}$/,
|
|
16
|
+
:Jcb => /^(?:2131|1800|35\\d{3})\\d{11}$/
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def card_type
|
|
22
|
+
|
|
23
|
+
@regex_map.each { |key, value|
|
|
24
|
+
unless value.match(number.to_s).nil?
|
|
25
|
+
return key
|
|
26
|
+
end
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
"Unknown"
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
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
|