lib/active_merchant/billing/gateways/borgun.rb in activemerchant-1.106.0 vs lib/active_merchant/billing/gateways/borgun.rb in activemerchant-1.107.1
- old
+ new
@@ -32,11 +32,11 @@
def authorize(money, payment, options={})
post = {}
post[:TransType] = '5'
add_invoice(post, money, options)
add_payment_method(post, payment)
- commit('authonly', post)
+ commit('authonly', post, options)
end
def capture(money, authorization, options={})
post = {}
post[:TransType] = '1'
@@ -123,16 +123,16 @@
end
response
end
- def commit(action, post)
+ def commit(action, post, options={})
post[:Version] = '1000'
post[:Processor] = @options[:processor]
post[:MerchantID] = @options[:merchant_id]
- request = build_request(action, post)
+ request = build_request(action, post, options)
raw = ssl_post(url(action), request, headers)
pairs = parse(raw)
success = success_from(pairs)
Response.new(
@@ -178,20 +178,31 @@
{
'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:password].to_s),
}
end
- def build_request(action, post)
+ def build_request(action, post, options={})
mode = action == 'void' ? 'cancel' : 'get'
xml = Builder::XmlMarkup.new indent: 18
xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
xml.tag!("#{mode}Authorization") do
post.each do |field, value|
xml.tag!(field, value)
end
+ build_airline_xml(xml, options[:passenger_itinerary_data]) if options[:passenger_itinerary_data]
end
inner = CGI.escapeHTML(xml.target!)
envelope(mode).sub(/{{ :body }}/, inner)
+ end
+
+ def build_airline_xml(xml, airline_data)
+ xml.tag!('PassengerItineraryData') do
+ xml.tag!('A1') do
+ airline_data.each do |field, value|
+ xml.tag!(field, value)
+ end
+ end
+ end
end
def envelope(mode)
<<-EOS
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://Borgun/Heimir/pub/ws/Authorization">