orbital-gateway 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.sample +3 -1
- data/bin/console +4 -4
- data/lib/orbital/gateway.rb +14 -0
- data/lib/orbital/gateway/api.rb +136 -0
- data/lib/orbital/gateway/api/authorization.rb +145 -0
- data/lib/orbital/gateway/api/customer.rb +104 -0
- data/lib/orbital/gateway/api/inquiry.rb +31 -0
- data/lib/orbital/gateway/orbital_response.rb +11 -0
- data/lib/orbital/gateway/orbital_response/authorization_response.rb +85 -0
- data/lib/orbital/gateway/orbital_response/inquiry_response.rb +20 -0
- data/lib/orbital/gateway/orbital_response/profile_response.rb +87 -0
- data/lib/orbital/gateway/version.rb +1 -1
- data/orbital-gateway.gemspec +4 -1
- metadata +67 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac2cb3f28720897ce47beb78db5ff493e1bcc336
|
4
|
+
data.tar.gz: 9637ff2b94dd73ef1f01c4b9cadbdac1980ad117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df75c8f8fff39ebc4f302a3a89b06a36c3bf16840b0269495aaa4402fe35fc0ab8cd01d2f7bac7dfb95541b2f089dd0c269d9eb676c3794e10fff9fa286221b0
|
7
|
+
data.tar.gz: 65f6eabf3d8a1ef2f23d9fb42db64e7d8d3de5e6514bd29e4b89263dda7955d0a0c032b8cc8791a230a6effa9f05d0f0f155467857393659a340ca8d0de1f2d4
|
data/.env.sample
CHANGED
data/bin/console
CHANGED
@@ -8,8 +8,8 @@ require "orbital/gateway"
|
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
9
9
|
|
10
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
|
12
|
-
|
11
|
+
require "pry"
|
12
|
+
Pry.start
|
13
13
|
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|
14
|
+
# require "irb"
|
15
|
+
# IRB.start(__FILE__)
|
data/lib/orbital/gateway.rb
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
+
require "active_support/all"
|
2
|
+
require "nokogiri"
|
3
|
+
require "builder"
|
4
|
+
require "httparty"
|
5
|
+
require "ostruct"
|
6
|
+
|
1
7
|
require "orbital/gateway/version"
|
8
|
+
require "orbital/gateway/api"
|
9
|
+
require "orbital/gateway/api/customer"
|
10
|
+
require "orbital/gateway/api/authorization"
|
11
|
+
require "orbital/gateway/api/inquiry"
|
12
|
+
require "orbital/gateway/orbital_response"
|
13
|
+
require "orbital/gateway/orbital_response/profile_response"
|
14
|
+
require "orbital/gateway/orbital_response/authorization_response"
|
15
|
+
require "orbital/gateway/orbital_response/inquiry_response"
|
2
16
|
|
3
17
|
module Orbital
|
4
18
|
module Gateway
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class Api
|
4
|
+
def url_endpoint
|
5
|
+
ENV.fetch("ORBITAL_GATEWAY_BASE_URL", "https://orbitalvar1.chasepaymentech.com/authorize")
|
6
|
+
end
|
7
|
+
|
8
|
+
def api_version
|
9
|
+
ENV.fetch("ORBITAL_GATEWAY_API_VERSION", "7.4")
|
10
|
+
end
|
11
|
+
|
12
|
+
def orbital_merchant_id
|
13
|
+
ENV.fetch("ORBITAL_MERCHANT_ID", "not-configured")
|
14
|
+
end
|
15
|
+
|
16
|
+
def orbital_connection_id
|
17
|
+
ENV.fetch("ORBITAL_CONNECTION_ID", "not-configured")
|
18
|
+
end
|
19
|
+
|
20
|
+
def orbital_connection_password
|
21
|
+
ENV.fetch("ORBITAL_CONNECTION_PASSWORD", "not-configured")
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_bin
|
25
|
+
ENV.fetch("ORBITAL_BIN", "stratus")
|
26
|
+
end
|
27
|
+
|
28
|
+
include HTTParty
|
29
|
+
|
30
|
+
def initialize(options = {})
|
31
|
+
end
|
32
|
+
|
33
|
+
def post(body, trace_number=nil)
|
34
|
+
response = self.class.post(url_endpoint, body: body, timeout: 30, headers: modify_headers(body.size.to_s, trace_number))
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def modify_headers(size, trace_number=nil)
|
40
|
+
head = headers
|
41
|
+
head.merge!('Trace-Number' => trace_number.to_s,
|
42
|
+
'Merchant-Id' => orbital_merchant_id) if trace_number
|
43
|
+
head
|
44
|
+
end
|
45
|
+
|
46
|
+
def headers
|
47
|
+
{
|
48
|
+
'MIME-Version' => '1.1',
|
49
|
+
'Content-Type' => "application/PTI#{api_version.gsub(/\./, '')}",
|
50
|
+
'Content-Transfer-Encoding' => 'text',
|
51
|
+
'Request-Number' => '1',
|
52
|
+
'Document-Type' => 'Request',
|
53
|
+
'Interface-Version' => 'Ruby|Orbital Gateway'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def bin
|
58
|
+
available_bins = {
|
59
|
+
'stratus' => '000001',
|
60
|
+
'pns' => '000002'
|
61
|
+
}
|
62
|
+
available_bins[set_bin]
|
63
|
+
end
|
64
|
+
|
65
|
+
def base_request
|
66
|
+
xml = xml_envelope
|
67
|
+
xml.tag! :Request do
|
68
|
+
xml.tag! :NewOrder do
|
69
|
+
add_xml_credentials(xml)
|
70
|
+
add_bin_merchant_and_terminal(xml)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def xml_envelope
|
76
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
77
|
+
xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
|
78
|
+
xml
|
79
|
+
end
|
80
|
+
|
81
|
+
def add_xml_credentials(xml)
|
82
|
+
xml.tag! :OrbitalConnectionUsername, orbital_connection_id
|
83
|
+
xml.tag! :OrbitalConnectionPassword, orbital_connection_password
|
84
|
+
end
|
85
|
+
|
86
|
+
def add_bin_merchant_and_terminal(xml)
|
87
|
+
xml.tag! :BIN, bin
|
88
|
+
xml.tag! :MerchantID, orbital_merchant_id
|
89
|
+
xml.tag! :TerminalID, '001'
|
90
|
+
end
|
91
|
+
|
92
|
+
CURRENCY_CODES = {
|
93
|
+
'AUD' => '036',
|
94
|
+
'BRL' => '986',
|
95
|
+
'CAD' => '124',
|
96
|
+
'CLP' => '152',
|
97
|
+
'CZK' => '203',
|
98
|
+
'DKK' => '208',
|
99
|
+
'HKD' => '344',
|
100
|
+
'ICK' => '352',
|
101
|
+
'JPY' => '392',
|
102
|
+
'MXN' => '484',
|
103
|
+
'NZD' => '554',
|
104
|
+
'NOK' => '578',
|
105
|
+
'SGD' => '702',
|
106
|
+
'SEK' => '752',
|
107
|
+
'CHF' => '756',
|
108
|
+
'GBP' => '826',
|
109
|
+
'USD' => '840',
|
110
|
+
'EUR' => '978'
|
111
|
+
}
|
112
|
+
|
113
|
+
CURRENCY_EXPONENTS = {
|
114
|
+
'AUD' => '2',
|
115
|
+
'BRL' => '2',
|
116
|
+
'CAD' => '2',
|
117
|
+
'CLP' => '2',
|
118
|
+
'CZK' => '2',
|
119
|
+
'DKK' => '2',
|
120
|
+
'HKD' => '2',
|
121
|
+
'ICK' => '2',
|
122
|
+
'JPY' => '0',
|
123
|
+
'MXN' => '2',
|
124
|
+
'NZD' => '2',
|
125
|
+
'NOK' => '2',
|
126
|
+
'SGD' => '2',
|
127
|
+
'SEK' => '2',
|
128
|
+
'CHF' => '2',
|
129
|
+
'GBP' => '2',
|
130
|
+
'USD' => '2',
|
131
|
+
'EUR' => '2'
|
132
|
+
}
|
133
|
+
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class Api::Authorization < Api
|
4
|
+
class << self
|
5
|
+
def void(parameters)
|
6
|
+
gateway = new
|
7
|
+
xml_data = gateway.void(parameters)
|
8
|
+
response = gateway.post(xml_data)
|
9
|
+
OrbitalResponse::AuthorizationResponse.new(response, xml_data)
|
10
|
+
end
|
11
|
+
|
12
|
+
def refund(tx_ref_num:, account_num: nil, order_id: SecureRandom.hex(8), tx_ref_idx: nil, card_brand: nil, amount: nil)
|
13
|
+
gateway = new
|
14
|
+
xml_data = gateway.refund({tx_ref_num: tx_ref_num, account_num: account_num, order_id: order_id, tx_ref_idx: nil, card_brand: card_brand, amount: amount})
|
15
|
+
response = gateway.post(xml_data)
|
16
|
+
OrbitalResponse::AuthorizationResponse.new(response, xml_data)
|
17
|
+
end
|
18
|
+
|
19
|
+
def auth_and_capture(parameters, retry_trace=nil)
|
20
|
+
gateway = new
|
21
|
+
xml_data = gateway.auth_and_capture(parameters)
|
22
|
+
response = gateway.post(xml_data, retry_trace || rand(9999999999999999))
|
23
|
+
OrbitalResponse::AuthorizationResponse.new(response, xml_data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def auth_only(parameters)
|
27
|
+
gateway = new
|
28
|
+
xml_data = gateway.auth_only(parameters)
|
29
|
+
response = gateway.post(xml_data)
|
30
|
+
OrbitalResponse::AuthorizationResponse.new(response, xml_data)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_bin_merchant_and_terminal(xml)
|
35
|
+
xml.tag! :BIN, bin
|
36
|
+
xml.tag! :MerchantID, orbital_merchant_id
|
37
|
+
xml.tag! :TerminalID, '001'
|
38
|
+
end
|
39
|
+
|
40
|
+
def auth_only(parameters)
|
41
|
+
xml = xml_envelope
|
42
|
+
xml.tag! :Request do
|
43
|
+
xml.tag! :NewOrder do
|
44
|
+
add_xml_credentials(xml)
|
45
|
+
xml.tag! :IndustryType, 'EC'
|
46
|
+
xml.tag! :MessageType, 'A'
|
47
|
+
add_bin_merchant_and_terminal(xml)
|
48
|
+
add_data(xml, parameters)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def auth_and_capture(parameters)
|
54
|
+
xml = xml_envelope
|
55
|
+
xml.tag! :Request do
|
56
|
+
xml.tag! :NewOrder do
|
57
|
+
add_xml_credentials(xml)
|
58
|
+
xml.tag! :IndustryType, 'EC'
|
59
|
+
xml.tag! :MessageType, 'AC'
|
60
|
+
add_bin_merchant_and_terminal(xml)
|
61
|
+
add_data(xml, parameters)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def refund(parameters)
|
67
|
+
xml = xml_envelope
|
68
|
+
xml.tag! :Request do
|
69
|
+
xml.tag! :NewOrder do
|
70
|
+
add_xml_credentials(xml)
|
71
|
+
xml.tag! :IndustryType, 'EC'
|
72
|
+
xml.tag! :MessageType, 'R'
|
73
|
+
add_bin_merchant_and_terminal(xml)
|
74
|
+
add_data(xml, parameters)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def void(parameters)
|
80
|
+
xml = xml_envelope
|
81
|
+
xml.tag! :Request do
|
82
|
+
xml.tag! :Reversal do
|
83
|
+
add_xml_credentials(xml)
|
84
|
+
void_data(xml, parameters)
|
85
|
+
xml.target!
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def add_data(xml, parameters)
|
91
|
+
xml.tag! :CardBrand, parameters[:card_brand]
|
92
|
+
xml.tag! :AccountNum, parameters[:account_num]
|
93
|
+
xml.tag! :Exp, parameters[:expiration_date]
|
94
|
+
xml.tag! :CurrencyCode, CURRENCY_CODES.fetch(parameters[:currency_country], '840')
|
95
|
+
xml.tag! :CurrencyExponent, CURRENCY_EXPONENTS.fetch(parameters[:currency_country], '2')
|
96
|
+
xml.tag! :AVSzip, parameters[:avs_zip]
|
97
|
+
xml.tag! :AVSaddress1, parameters[:avs_address_one]
|
98
|
+
xml.tag! :AVSaddress2, parameters[:avs_address_two]
|
99
|
+
xml.tag! :AVScity, parameters[:avs_city]
|
100
|
+
xml.tag! :AVSstate, parameters[:avs_state]
|
101
|
+
xml.tag! :AVSphoneNum, parameters[:avs_phone]
|
102
|
+
xml.tag! :CustomerRefNum, parameters[:customer_ref_num]
|
103
|
+
xml.tag! :OrderID, parameters[:order_id]
|
104
|
+
xml.tag! :Amount, parameters[:amount]
|
105
|
+
xml.tag!(:TxRefNum, parameters[:tx_ref_num]) if parameters[:tx_ref_num]
|
106
|
+
xml.tag!(:PartialAuthInd, parameters[:partial_auth_ind]) if parameters[:partial_auth_ind]
|
107
|
+
xml.target!
|
108
|
+
end
|
109
|
+
|
110
|
+
def refund_data(xml, parameters)
|
111
|
+
xml.tag! :CurrencyCode, CURRENCY_CODES.fetch(parameters[:currency_country], '840')
|
112
|
+
xml.tag! :CurrencyExponent, CURRENCY_EXPONENTS.fetch(parameters[:currency_country], '2')
|
113
|
+
xml.tag! :OrderID, parameters[:order_id]
|
114
|
+
xml.tag! :Amount, parameters[:amount]
|
115
|
+
xml.tag! :CardBrand, parameters[:card_brand]
|
116
|
+
xml.tag! :AccountNum, parameters[:account_num]
|
117
|
+
xml.tag! :TxRefNum, parameters[:tx_ref_num]
|
118
|
+
xml.tag! :TxRefIdx, parameters[:tx_ref_idx]
|
119
|
+
xml.target!
|
120
|
+
end
|
121
|
+
|
122
|
+
def void_data(xml, parameters)
|
123
|
+
xml.tag! :TxRefNum, parameters[:tx_ref_num]
|
124
|
+
xml.tag! :TxRefIdx, parameters[:tx_ref_idx]
|
125
|
+
xml.tag! :AdjustedAmt, parameters[:amount] if parameters[:amount]
|
126
|
+
xml.tag! :OrderID, parameters[:order_id]
|
127
|
+
add_bin_merchant_and_terminal(xml)
|
128
|
+
xml.tag! :ReversalRetryNumber, parameters[:reversal_retry_number] if parameters[:reversal_retry_number]
|
129
|
+
xml.tag! :OnlineReversalInd, parameters[:online_reversal_ind] if parameters[:online_reversal_ind]
|
130
|
+
end
|
131
|
+
|
132
|
+
def inquery_data(xml, parameters)
|
133
|
+
xml.tag! :OrderID, parameters[:order_id]
|
134
|
+
xml.tag! :InquiryRetryNumber, parameters[:inquiry_retry_number]
|
135
|
+
end
|
136
|
+
|
137
|
+
def add_cryptogram(xml, parameters)
|
138
|
+
card_brand = parameters[:card_brand]
|
139
|
+
if card_brand == 'VI'
|
140
|
+
xml.tag!(:CAVV, Base64.encode64(parameters[:avs_cvv]).strip)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class Api::Customer < Api
|
4
|
+
class << self
|
5
|
+
def create_profile(parameters)
|
6
|
+
gateway = new
|
7
|
+
xml_data = gateway.create_profile(parameters)
|
8
|
+
response = gateway.post(xml_data)
|
9
|
+
OrbitalResponse::ProfileResponse.new(response, xml_data)
|
10
|
+
end
|
11
|
+
|
12
|
+
def update_profile(parameters)
|
13
|
+
gateway = new
|
14
|
+
xml_data = gateway.update_profile(parameters)
|
15
|
+
response = gateway.post(xml_data)
|
16
|
+
OrbitalResponse::ProfileResponse.new(response, xml_data)
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_profile(parameters)
|
20
|
+
gateway = new
|
21
|
+
xml_data = gateway.delete_profile(parameters)
|
22
|
+
response = gateway.post(xml_data)
|
23
|
+
OrbitalResponse::ProfileResponse.new(response, xml_data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def retrieve_profile(parameters)
|
27
|
+
gateway = new
|
28
|
+
xml_data = gateway.retrieve_profile(parameters)
|
29
|
+
response = gateway.post(xml_data)
|
30
|
+
OrbitalResponse::ProfileResponse.new(response, xml_data)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def xml_body(parameters)
|
35
|
+
xml = xml_envelope
|
36
|
+
xml.tag! :Request do
|
37
|
+
xml.tag! :Profile do
|
38
|
+
add_xml_credentials(xml)
|
39
|
+
add_bin_merchant_and_terminal(xml)
|
40
|
+
add_data(xml, parameters)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_profile(parameters)
|
46
|
+
xml_body(parameters.merge({customer_profile_action: :create}))
|
47
|
+
end
|
48
|
+
|
49
|
+
def update_profile(parameters)
|
50
|
+
xml_body(parameters.merge({customer_profile_action: :update}))
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete_profile(parameters)
|
54
|
+
xml_body(parameters.merge({customer_profile_action: :delete}))
|
55
|
+
end
|
56
|
+
|
57
|
+
def retrieve_profile(parameters)
|
58
|
+
xml_body(parameters.merge({customer_profile_action: :retrieve}))
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def add_bin_merchant_and_terminal(xml)
|
64
|
+
xml.tag! :CustomerBin, bin
|
65
|
+
xml.tag! :CustomerMerchantID, orbital_merchant_id
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_data(xml, parameters)
|
69
|
+
xml.tag! :CustomerName, parameters[:customer_name]
|
70
|
+
xml.tag! :CustomerRefNum, parameters[:customer_ref_num]
|
71
|
+
xml.tag! :CustomerAddress1, parameters[:customer_address_one]
|
72
|
+
xml.tag! :CustomerAddress2, parameters[:customer_address_two] if parameters[:customer_address_two]
|
73
|
+
xml.tag! :CustomerCity, parameters[:customer_city]
|
74
|
+
xml.tag! :CustomerState, parameters[:customer_state]
|
75
|
+
xml.tag! :CustomerZIP, parameters[:customer_zip]
|
76
|
+
xml.tag! :CustomerEmail, parameters[:customer_email]
|
77
|
+
xml.tag! :CustomerPhone, parameters[:customer_phone]
|
78
|
+
xml.tag! :CustomerCountryCode, parameters[:customer_country_code]
|
79
|
+
xml.tag! :CustomerProfileAction, action(parameters[:customer_profile_action])
|
80
|
+
xml.tag!(:CustomerProfileOrderOverrideInd, 'NO') unless parameters[:customer_profile_action] == :delete
|
81
|
+
if parameters[:customer_profile_action] == :create
|
82
|
+
xml.tag! :CustomerProfileFromOrderInd, 'S'
|
83
|
+
end
|
84
|
+
xml.tag! :OrderDefaultDescription, parameters[:order_default_description]
|
85
|
+
xml.tag! :OrderDefaultAmount, parameters[:order_default_amount]
|
86
|
+
xml.tag!(:CustomerAccountType, 'CC') unless parameters[:customer_profile_action] == :delete
|
87
|
+
xml.tag! :Status, 'A'
|
88
|
+
xml.tag! :CCAccountNum, parameters[:credit_card_number]
|
89
|
+
xml.tag! :CCExpireDate, parameters[:expiration_date]
|
90
|
+
xml.target!
|
91
|
+
end
|
92
|
+
|
93
|
+
def action(chosen_action)
|
94
|
+
available_actions = {
|
95
|
+
create: 'C',
|
96
|
+
retrieve: 'R',
|
97
|
+
update: 'U',
|
98
|
+
delete: 'D'
|
99
|
+
}
|
100
|
+
available_actions[chosen_action]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class Api::Inquiry < Api
|
4
|
+
class << self
|
5
|
+
def find_request(retry_trace_number)
|
6
|
+
gateway = new
|
7
|
+
xml_data = gateway.xml_body({retry_trace_number: retry_trace_number})
|
8
|
+
response = gateway.post(xml_data)
|
9
|
+
OrbitalResponse::InquiryResponse.new(response)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def xml_body(parameters)
|
14
|
+
xml = xml_envelope
|
15
|
+
xml.tag! :Request do
|
16
|
+
xml.tag! :Inquiry do
|
17
|
+
add_xml_credentials(xml)
|
18
|
+
add_bin_merchant_and_terminal(xml)
|
19
|
+
add_data(xml, parameters)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_data(xml, parameters)
|
25
|
+
xml.tag! :OrderID, parameters[:order_id]
|
26
|
+
xml.tag! :InquiryRetryNumber, parameters[:retry_trace_number]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class OrbitalResponse::AuthorizationResponse < OrbitalResponse
|
4
|
+
attr_reader :industry_type,
|
5
|
+
:message_type,
|
6
|
+
:merchant_id,
|
7
|
+
:terminal_id,
|
8
|
+
:card_brand,
|
9
|
+
:account_num,
|
10
|
+
:order_id,
|
11
|
+
:tx_ref_num,
|
12
|
+
:tx_ref_idx,
|
13
|
+
:proc_status,
|
14
|
+
:approval_status,
|
15
|
+
:resp_code,
|
16
|
+
:avs_resp_code,
|
17
|
+
:cvv2_resp_code,
|
18
|
+
:auth_code,
|
19
|
+
:recurring_advice_cd,
|
20
|
+
:cavv_resp_code,
|
21
|
+
:status_msg,
|
22
|
+
:resp_msg,
|
23
|
+
:host_resp_code,
|
24
|
+
:host_avs_resp_code,
|
25
|
+
:host_cvv2_resp_code,
|
26
|
+
:customer_ref_num,
|
27
|
+
:customer_name,
|
28
|
+
:profile_proc_status,
|
29
|
+
:customer_profile_message,
|
30
|
+
:resp_time,
|
31
|
+
:partial_auth_occurred,
|
32
|
+
:requested_amount,
|
33
|
+
:redeemed_amount,
|
34
|
+
:remaining_balance,
|
35
|
+
:country_fraud_filter_status,
|
36
|
+
:iso_country_code
|
37
|
+
|
38
|
+
def initialize(response_xml, request_xml)
|
39
|
+
super
|
40
|
+
@message_type = nokogiri.at_css("Response MessageType")&.text
|
41
|
+
@merchant_id = nokogiri.at_css("Response MerchantID")&.text
|
42
|
+
@terminal_id = nokogiri.at_css("Response TerminalID")&.text
|
43
|
+
@card_brand = nokogiri.at_css("Response CardBrand")&.text
|
44
|
+
@account_num = nokogiri.at_css("Response AccountNum")&.text
|
45
|
+
@order_id = nokogiri.at_css("Response OrderID")&.text
|
46
|
+
@tx_ref_num = nokogiri.at_css("Response TxRefNum")&.text
|
47
|
+
@tx_ref_idx = nokogiri.at_css("Response TxRefIdx")&.text
|
48
|
+
@proc_status = nokogiri.at_css("Response ProcStatus")&.text
|
49
|
+
@approval_status = nokogiri.at_css("Response ApprovalStatus")&.text
|
50
|
+
@resp_code = nokogiri.at_css("Response RespCode")&.text
|
51
|
+
@avs_resp_code = nokogiri.at_css("Response AVSRespCode")&.text
|
52
|
+
@cvv2_resp_code = nokogiri.at_css("Response CVV2RespCode")&.text
|
53
|
+
@auth_code = nokogiri.at_css("Response AuthCode")&.text
|
54
|
+
@recurring_advice_cd = nokogiri.at_css("Response RecurringAdviceCd")&.text
|
55
|
+
@cavv_resp_code = nokogiri.at_css("Response CAVVRespCode")&.text
|
56
|
+
@status_msg = nokogiri.at_css("Response StatusMsg")&.text
|
57
|
+
@resp_msg = nokogiri.at_css("Response RespMsg")&.text
|
58
|
+
@host_resp_code = nokogiri.at_css("Response HostRespCode")&.text
|
59
|
+
@host_avs_resp_code = nokogiri.at_css("Response HostAVSRespCode")&.text
|
60
|
+
@host_cvv2_resp_code = nokogiri.at_css("Response HostCVV2RespCode")&.text
|
61
|
+
@customer_ref_num = nokogiri.at_css("Response CustomerRefNum")&.text
|
62
|
+
@customer_name = nokogiri.at_css("Response CustomerName")&.text
|
63
|
+
@profile_proc_status = nokogiri.at_css("Response ProfileProcStatus")&.text
|
64
|
+
@customer_profile_message = nokogiri.at_css("Response CustomerProfileMessage")&.text
|
65
|
+
@resp_time = nokogiri.at_css("Response RespTime")&.text
|
66
|
+
@partial_auth_occurred = nokogiri.at_css("Response PartialAuthOccurred")&.text
|
67
|
+
@requested_amount = nokogiri.at_css("Response RequestedAmount")&.text
|
68
|
+
@redeemed_amount = nokogiri.at_css("Response RedeemedAmount")&.text
|
69
|
+
@remaining_balance = nokogiri.at_css("Response RemainingBalance")&.text
|
70
|
+
@country_fraud_filter_status = nokogiri.at_css("Response CountryFraudFilterStatus")&.text
|
71
|
+
@iso_country_code = nokogiri.at_css("Response IsoCountryCode")&.text
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_s
|
75
|
+
nokogiri.to_xml
|
76
|
+
end
|
77
|
+
|
78
|
+
def success?
|
79
|
+
resp_code == '00' || approval_status.to_s == '1'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class OrbitalResponse::InquiryResponse < OrbitalResponse
|
4
|
+
attr_reader :industry_type
|
5
|
+
|
6
|
+
def initialize(response_xml)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
nokogiri.to_xml
|
12
|
+
end
|
13
|
+
|
14
|
+
def success?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Orbital
|
2
|
+
module Gateway
|
3
|
+
class OrbitalResponse::ProfileResponse < OrbitalResponse
|
4
|
+
attr_reader :customer_bin,
|
5
|
+
:customer_merchant_id,
|
6
|
+
:customer_bin,
|
7
|
+
:customer_merchant_id,
|
8
|
+
:customer_name,
|
9
|
+
:customer_ref_num,
|
10
|
+
:customer_profile_action,
|
11
|
+
:profile_proc_status,
|
12
|
+
:customer_profile_message,
|
13
|
+
:customer_address_one,
|
14
|
+
:customer_address_two,
|
15
|
+
:customer_city,
|
16
|
+
:customer_state,
|
17
|
+
:customer_zip,
|
18
|
+
:customer_email,
|
19
|
+
:customer_phone,
|
20
|
+
:customer_country_code,
|
21
|
+
:customer_profile_order_override_ind,
|
22
|
+
:order_default_description,
|
23
|
+
:order_default_amount,
|
24
|
+
:customer_account_type,
|
25
|
+
:status,
|
26
|
+
:cc_account_num,
|
27
|
+
:cc_expire_date,
|
28
|
+
:ecp_account_dda,
|
29
|
+
:ecp_account_type,
|
30
|
+
:ecp_account_rt,
|
31
|
+
:ecp_bank_pmt_dlv,
|
32
|
+
:switch_solo_start_date,
|
33
|
+
:swith_solo_issue_num,
|
34
|
+
:resp_time,
|
35
|
+
:mit_msg_type,
|
36
|
+
:mit_submitted_transaction_id
|
37
|
+
|
38
|
+
def initialize(response_xml, request_xml)
|
39
|
+
super
|
40
|
+
@customer_bin = nokogiri.at_css("Response ProfileResp CustomerBin")&.text
|
41
|
+
@customer_merchant_id = nokogiri.at_css("Response ProfileResp CustomerMerchantID")&.text
|
42
|
+
@customer_name = nokogiri.at_css("Response ProfileResp CustomerName")&.text
|
43
|
+
@customer_ref_num = nokogiri.at_css("Response ProfileResp CustomerRefNum")&.text
|
44
|
+
@customer_profile_action = nokogiri.at_css("Response ProfileResp CustomerProfileAction")&.text
|
45
|
+
@profile_proc_status = nokogiri.at_css("Response ProfileResp ProfileProcStatus")&.text
|
46
|
+
@customer_profile_message = nokogiri.at_css("Response ProfileResp CustomerProfileMessage")&.text
|
47
|
+
@customer_address_one = nokogiri.at_css("Response ProfileResp CustomerAddress1")&.text
|
48
|
+
@customer_address_two = nokogiri.at_css("Response ProfileResp CustomerAddress2")&.text
|
49
|
+
@customer_city = nokogiri.at_css("Response ProfileResp CustomerCity")&.text
|
50
|
+
@customer_state = nokogiri.at_css("Response ProfileResp CustomerState")&.text
|
51
|
+
@customer_zip = nokogiri.at_css("Response ProfileResp CustomerZIP")&.text
|
52
|
+
@customer_email = nokogiri.at_css("Response ProfileResp CustomerEmail")&.text
|
53
|
+
@customer_phone = nokogiri.at_css("Response ProfileResp CustomerPhone")&.text
|
54
|
+
@customer_country_code = nokogiri.at_css("Response ProfileResp CustomerCountryCode")&.text
|
55
|
+
@customer_profile_order_override_ind = nokogiri.at_css("Response ProfileResp CustomerProfileOrderOverrideInd")&.text
|
56
|
+
@order_default_description = nokogiri.at_css("Response ProfileResp OrderDefaultDescription")&.text
|
57
|
+
@order_default_amount = nokogiri.at_css("Response ProfileResp OrderDefaultAmount")&.text
|
58
|
+
@customer_account_type = nokogiri.at_css("Response ProfileResp CustomerAccountType")&.text
|
59
|
+
@status = nokogiri.at_css("Response ProfileResp Status")&.text
|
60
|
+
@cc_account_num = nokogiri.at_css("Response ProfileResp CCAccountNum")&.text
|
61
|
+
@cc_expire_date = nokogiri.at_css("Response ProfileResp CCExpireDate")&.text
|
62
|
+
@ecp_account_dda = nokogiri.at_css("Response ProfileResp ECPAccountDDA")&.text
|
63
|
+
@ecp_account_type = nokogiri.at_css("Response ProfileResp ECPAccountType")&.text
|
64
|
+
@ecp_account_rt = nokogiri.at_css("Response ProfileResp ECPAccountRT")&.text
|
65
|
+
@ecp_bank_pmt_dlv = nokogiri.at_css("Response ProfileResp ECPBankPmtDlv")&.text
|
66
|
+
@switch_solo_start_date = nokogiri.at_css("Response ProfileResp SwitchSoloStartDate")&.text
|
67
|
+
@swith_solo_issue_num = nokogiri.at_css("Response ProfileResp SwitchSoloIssueNum")&.text
|
68
|
+
@resp_time = nokogiri.at_css("Response ProfileResp RespTime")&.text
|
69
|
+
@mit_msg_type = nokogiri.at_css("Response ProfileResp MITMsgType")&.text
|
70
|
+
@mit_submitted_transaction_id = nokogiri.at_css("Response ProfileResp MITSubmittedTransactionID")&.text
|
71
|
+
end
|
72
|
+
|
73
|
+
def to_s
|
74
|
+
nokogiri.to_xml
|
75
|
+
end
|
76
|
+
|
77
|
+
def success?
|
78
|
+
profile_proc_status == '0'
|
79
|
+
# Example of a failure
|
80
|
+
# <ProfileProcStatus>9581</ProfileProcStatus>
|
81
|
+
# <CustomerProfileMessage>Profile: Cannot Read profile. Profile does not exist for Cust Ref Num: [62E66156562D01C7] and MID: [351154].</CustomerProfileMessage>
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
data/orbital-gateway.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "bundler", "~> 1.16"
|
36
36
|
spec.add_development_dependency "rake", "~> 10.0"
|
37
37
|
spec.add_development_dependency "minitest", "~> 5.0"
|
38
|
+
spec.add_development_dependency "faker"
|
38
39
|
# spec.add_development_dependency "vcr"
|
39
40
|
# spec.add_development_dependency "webmock"
|
40
41
|
spec.add_development_dependency "pry"
|
@@ -44,5 +45,7 @@ Gem::Specification.new do |spec|
|
|
44
45
|
spec.add_development_dependency "simplecov"
|
45
46
|
spec.add_development_dependency "dotenv"
|
46
47
|
spec.add_dependency "httparty", ">= 0.14.0"
|
47
|
-
|
48
|
+
spec.add_dependency "activesupport"
|
49
|
+
spec.add_dependency "nokogiri"
|
50
|
+
spec.add_dependency "builder"
|
48
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orbital-gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faker
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,48 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: 0.14.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: activesupport
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: nokogiri
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: builder
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
139
195
|
description: Ruby wrapper for interacting with the Chase Paymentech Orbital Gateway
|
140
196
|
XML API
|
141
197
|
email:
|
@@ -155,6 +211,14 @@ files:
|
|
155
211
|
- bin/console
|
156
212
|
- bin/setup
|
157
213
|
- lib/orbital/gateway.rb
|
214
|
+
- lib/orbital/gateway/api.rb
|
215
|
+
- lib/orbital/gateway/api/authorization.rb
|
216
|
+
- lib/orbital/gateway/api/customer.rb
|
217
|
+
- lib/orbital/gateway/api/inquiry.rb
|
218
|
+
- lib/orbital/gateway/orbital_response.rb
|
219
|
+
- lib/orbital/gateway/orbital_response/authorization_response.rb
|
220
|
+
- lib/orbital/gateway/orbital_response/inquiry_response.rb
|
221
|
+
- lib/orbital/gateway/orbital_response/profile_response.rb
|
158
222
|
- lib/orbital/gateway/version.rb
|
159
223
|
- orbital-gateway.gemspec
|
160
224
|
homepage: https://github.com/beneggett/orbital-gateway
|
@@ -178,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
242
|
version: '0'
|
179
243
|
requirements: []
|
180
244
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.6.
|
245
|
+
rubygems_version: 2.6.12
|
182
246
|
signing_key:
|
183
247
|
specification_version: 4
|
184
248
|
summary: Chase Paymentech Orbital Gateway API
|