Class Index [+]

Quicksearch

ActiveMerchant::Billing::OrbitalGateway

For more information on Orbital, visit the integration center

    

Authentication Options

The Orbital Gateway supports two methods of authenticating incoming requests: Source IP authentication and Connection Username/Password authentication

In addition, these IP addresses/Connection Usernames must be affiliated with the Merchant IDs for which the client should be submitting transactions.

This does allow Third Party Hosting service organizations presenting on behalf of other merchants to submit transactions. However, each time a new customer is added, the merchant or Third-Party hosting organization needs to ensure that the new Merchant IDs or Chain IDs are affiliated with the hosting companies IPs or Connection Usernames.

If the merchant expects to have more than one merchant account with the Orbital Gateway, it should have its IP addresses/Connection Usernames affiliated at the Chain level hierarchy within the Orbital Gateway. Each time a new merchant ID is added, as long as it is placed within the same Chain, it will simply work. Otherwise, the additional MIDs will need to be affiliated with the merchant IPs or Connection Usernames respectively. For example, we generally affiliate all Salem accounts [BIN 000001] with their Company Number [formerly called MA #] number so all MIDs or Divisions under that Company will automatically be affiliated.

Constants

API_VERSION
POST_HEADERS
APPROVED
CURRENCY_CODES

Public Class Methods

new(options = {}) click to toggle source
    # File lib/active_merchant/billing/gateways/orbital.rb, line 80
80:       def initialize(options = {})
81:         unless options[:ip_authentication] == true
82:           requires!(options, :login, :password, :merchant_id)
83:         end
84:         @options = options
85:         super
86:       end

Public Instance Methods

authorize(money, creditcard, options = {}) click to toggle source

A – Authorization request

    # File lib/active_merchant/billing/gateways/orbital.rb, line 89
89:       def authorize(money, creditcard, options = {})
90:         order = build_new_order_xml('A', money, options) do |xml|
91:           add_creditcard(xml, creditcard, options[:currency])        
92:           add_address(xml, creditcard, options)   
93:         end
94:         commit(order)
95:       end
capture(money, authorization, options = {}) click to toggle source

MFC - Mark For Capture

     # File lib/active_merchant/billing/gateways/orbital.rb, line 107
107:       def capture(money, authorization, options = {})
108:         commit(build_mark_for_capture_xml(money, authorization, options))
109:       end
credit(money, authorization, options= {}) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 119
119:       def credit(money, authorization, options= {})
120:         deprecated CREDIT_DEPRECATION_MESSAGE
121:         refund(money, authorization, options)
122:       end
purchase(money, creditcard, options = {}) click to toggle source

AC – Authorization and Capture

     # File lib/active_merchant/billing/gateways/orbital.rb, line 98
 98:       def purchase(money, creditcard, options = {})
 99:         order = build_new_order_xml('AC', money, options) do |xml|
100:           add_creditcard(xml, creditcard, options[:currency])
101:           add_address(xml, creditcard, options)   
102:         end
103:         commit(order)
104:       end
refund(money, authorization, options = {}) click to toggle source

R – Refund request

     # File lib/active_merchant/billing/gateways/orbital.rb, line 112
112:       def refund(money, authorization, options = {})
113:         order = build_new_order_xml('R', money, options.merge(:authorization => authorization)) do |xml|
114:           add_refund(xml, options[:currency])
115:         end
116:         commit(order)
117:       end
void(authorization, options = {}) click to toggle source

setting money to nil will perform a full void

     # File lib/active_merchant/billing/gateways/orbital.rb, line 125
125:       def void(authorization, options = {})
126:         order = build_void_request_xml(authorization, options)
127:         commit(order)
128:       end

Private Instance Methods

add_address(xml, creditcard, options) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 150
150:       def add_address(xml, creditcard, options)      
151:         if address = options[:billing_address] || options[:address]
152:           xml.tag! :AVSzip, address[:zip]
153:           xml.tag! :AVSaddress1, address[:address1]
154:           xml.tag! :AVSaddress2, address[:address2]
155:           xml.tag! :AVScity, address[:city]
156:           xml.tag! :AVSstate, address[:state]
157:           xml.tag! :AVSphoneNum, address[:phone] ? address[:phone].scan(/\d/).join.to_s : nil
158:           xml.tag! :AVSname, creditcard.name
159:           xml.tag! :AVScountryCode, address[:country]
160:         end
161:       end
add_bin_merchant_and_terminal(xml, parameters) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 322
322:       def add_bin_merchant_and_terminal(xml, parameters)
323:         xml.tag! :BIN, bin
324:         xml.tag! :MerchantID, @options[:merchant_id]
325:         xml.tag! :TerminalID, parameters[:terminal_id] || '001'
326:       end
add_creditcard(xml, creditcard, currency=nil) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 163
163:       def add_creditcard(xml, creditcard, currency=nil)
164:         xml.tag! :AccountNum, creditcard.number
165:         xml.tag! :Exp, expiry_date(creditcard)
166:         
167:         xml.tag! :CurrencyCode, currency_code(currency)
168:         xml.tag! :CurrencyExponent, '2' # Will need updating to support currencies such as the Yen.
169:         
170:         xml.tag! :CardSecValInd, 1 if creditcard.verification_value? && %( visa discover ).include?(creditcard.brand)
171:         xml.tag! :CardSecVal,  creditcard.verification_value if creditcard.verification_value?
172:       end
add_customer_data(xml, options) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 132
132:       def add_customer_data(xml, options)
133:         if options[:customer_ref_num]
134:           xml.tag! :CustomerProfileFromOrderInd, 'S'
135:           xml.tag! :CustomerRefNum, options[:customer_ref_num]
136:         else
137:           xml.tag! :CustomerProfileFromOrderInd, 'A'
138:         end
139:       end
add_refund(xml, currency=nil) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 174
174:       def add_refund(xml, currency=nil)
175:         xml.tag! :AccountNum, nil
176:         
177:         xml.tag! :CurrencyCode, currency_code(currency)
178:         xml.tag! :CurrencyExponent, '2' # Will need updating to support currencies such as the Yen.
179:       end
add_soft_descriptors(xml, soft_desc) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 141
141:       def add_soft_descriptors(xml, soft_desc)
142:         xml.tag! :SDMerchantName, soft_desc.merchant_name
143:         xml.tag! :SDProductDescription, soft_desc.product_description
144:         xml.tag! :SDMerchantCity, soft_desc.merchant_city
145:         xml.tag! :SDMerchantPhone, soft_desc.merchant_phone
146:         xml.tag! :SDMerchantURL, soft_desc.merchant_url
147:         xml.tag! :SDMerchantEmail, soft_desc.merchant_email
148:       end
add_xml_credentials(xml) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 317
317:       def add_xml_credentials(xml)
318:         xml.tag! :OrbitalConnectionUsername, @options[:login] unless ip_authentication?
319:         xml.tag! :OrbitalConnectionPassword, @options[:password] unless ip_authentication?
320:       end
bin() click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 307
307:       def bin
308:         @options[:bin] || '000001' # default is Salem Global
309:       end
build_mark_for_capture_xml(money, authorization, parameters = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 269
269:       def build_mark_for_capture_xml(money, authorization, parameters = {})
270:         tx_ref_num, order_id = authorization.split(';')
271:         xml = xml_envelope
272:         xml.tag! :Request do
273:           xml.tag! :MarkForCapture do
274:             add_xml_credentials(xml)
275:             xml.tag! :OrderID, order_id
276:             xml.tag! :Amount, amount(money)
277:             add_bin_merchant_and_terminal(xml, parameters)
278:             xml.tag! :TxRefNum, tx_ref_num
279:           end
280:         end
281:         xml.target!
282:       end
build_new_order_xml(action, money, parameters = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 243
243:       def build_new_order_xml(action, money, parameters = {})
244:         requires!(parameters, :order_id)
245:         xml = xml_envelope
246:         xml.tag! :Request do
247:           xml.tag! :NewOrder do
248:             add_xml_credentials(xml)
249:             xml.tag! :IndustryType, parameters[:industry_type] || "EC"
250:             xml.tag! :MessageType, action
251:             add_bin_merchant_and_terminal(xml, parameters)
252:             
253:             yield xml if block_given?
254:             
255:             xml.tag! :Comments, parameters[:comments] if parameters[:comments]
256:             xml.tag! :OrderID, parameters[:order_id].to_s[0...22]
257:             xml.tag! :Amount, amount(money)
258:             
259:             # Append Transaction Reference Number at the end for Refund transactions
260:             if action == "R"
261:               tx_ref_num, _ = parameters[:authorization].split(';')
262:               xml.tag! :TxRefNum, tx_ref_num
263:             end
264:           end
265:         end
266:         xml.target!
267:       end
build_void_request_xml(authorization, parameters = {}) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 284
284:       def build_void_request_xml(authorization, parameters = {})
285:         tx_ref_num, order_id = authorization.split(';')
286:         xml = xml_envelope
287:         xml.tag! :Request do
288:           xml.tag! :Reversal do
289:             add_xml_credentials(xml)
290:             xml.tag! :TxRefNum, tx_ref_num
291:             xml.tag! :TxRefIdx, parameters[:transaction_index]
292:             xml.tag! :OrderID, order_id
293:             add_bin_merchant_and_terminal(xml, parameters)
294:           end
295:         end
296:         xml.target!
297:       end
commit(order) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 202
202:       def commit(order)
203:         headers = POST_HEADERS.merge("Content-length" => order.size.to_s)
204:         request = lambda {return parse(ssl_post(remote_url, order, headers))}
205:         
206:         # Failover URL will be used in the event of a connection error
207:         begin response = request.call; rescue ConnectionError; retry end
208:         
209:         Response.new(success?(response), message_from(response), response,
210:           {:authorization => "#{response[:tx_ref_num]};#{response[:order_id]}",
211:            :test => self.test?,
212:            :avs_result => {:code => response[:avs_resp_code]},
213:            :cvv_result => response[:cvv2_resp_code]
214:           }
215:         )
216:       end
currency_code(currency) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 299
299:       def currency_code(currency)
300:         CURRENCY_CODES[(currency || self.default_currency)].to_s
301:       end
expiry_date(credit_card) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 303
303:       def expiry_date(credit_card)
304:         "#{format(credit_card.month, :two_digits)}#{format(credit_card.year, :two_digits)}"
305:       end
ip_authentication?() click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 239
239:       def ip_authentication?
240:         @options[:ip_authentication] == true
241:       end
message_from(response) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 235
235:       def message_from(response)
236:         success?(response) ? 'APPROVED' : response[:resp_msg] || response[:status_msg]
237:       end
parse(body) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 181
181:       def parse(body)
182:         response = {}
183:         xml = REXML::Document.new(body)
184:         root = REXML::XPath.first(xml, "//Response") ||
185:                REXML::XPath.first(xml, "//ErrorResponse")
186:         if root
187:           root.elements.to_a.each do |node|
188:             recurring_parse_element(response, node)
189:           end
190:         end
191:         response
192:       end
recurring_parse_element(response, node) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 194
194:       def recurring_parse_element(response, node)
195:         if node.has_elements?
196:           node.elements.each{|e| recurring_parse_element(response, e) }
197:         else
198:           response[node.name.underscore.to_sym] = node.text
199:         end
200:       end
remote_url() click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 218
218:       def remote_url
219:         unless $!.class == ActiveMerchant::ConnectionError
220:           self.test? ? self.primary_test_url : self.primary_live_url
221:         else
222:           self.test? ? self.secondary_test_url : self.secondary_live_url
223:         end
224:       end
success?(response) click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 226
226:       def success?(response)
227:         if response[:message_type].nil? || response[:message_type] == "R"
228:           response[:proc_status] == SUCCESS
229:         else
230:           response[:proc_status] == SUCCESS &&
231:             response[:resp_code] == APPROVED
232:         end
233:       end
xml_envelope() click to toggle source
     # File lib/active_merchant/billing/gateways/orbital.rb, line 311
311:       def xml_envelope
312:         xml = Builder::XmlMarkup.new(:indent => 2)
313:         xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
314:         xml
315:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.