lib/active_merchant/billing/gateways/payment_express.rb in activemerchant-1.91.0 vs lib/active_merchant/billing/gateways/payment_express.rb in activemerchant-1.92.0
- old
+ new
@@ -151,29 +151,32 @@
add_amount(result, money, options)
add_invoice(result, options)
add_address_verification_data(result, options)
add_optional_elements(result, options)
+ add_ip(result, options)
result
end
def build_capture_or_credit_request(money, identification, options)
result = new_transaction
add_amount(result, money, options)
add_invoice(result, options)
add_reference(result, identification)
add_optional_elements(result, options)
+ add_ip(result, options)
result
end
def build_token_request(credit_card, options)
result = new_transaction
add_credit_card(result, credit_card)
add_amount(result, 100, options) # need to make an auth request for $1
add_token_request(result, options)
add_optional_elements(result, options)
+ add_ip(result, options)
result
end
def add_credentials(xml)
xml.add_element('PostUsername').text = @options[:login]
@@ -231,20 +234,23 @@
xml.add_element('AvsStreetAddress').text = address[:address1]
xml.add_element('AvsPostCode').text = address[:zip]
end
+ def add_ip(xml, options)
+ xml.add_element('ClientInfo').text = options[:ip] if options[:ip]
+ end
+
# The options hash may contain optional data which will be passed
# through the specialized optional fields at PaymentExpress
# as follows:
#
# {
# :client_type => :web, # Possible values are: :web, :ivr, :moto, :unattended, :internet, or :recurring
# :txn_data1 => "String up to 255 characters",
# :txn_data2 => "String up to 255 characters",
- # :txn_data3 => "String up to 255 characters",
- # :client_info => "String up to 15 characters. The IP address of the user who processed the transaction."
+ # :txn_data3 => "String up to 255 characters"
# }
#
# +:client_type+, while not documented for PxPost, will be sent as
# the +ClientType+ XML element as described in the documentation for
# the PaymentExpress WebService: http://www.paymentexpress.com/Technical_Resources/Ecommerce_NonHosted/WebService#clientType
@@ -276,11 +282,9 @@
end
xml.add_element('TxnData1').text = options[:txn_data1].to_s.slice(0, 255) unless options[:txn_data1].blank?
xml.add_element('TxnData2').text = options[:txn_data2].to_s.slice(0, 255) unless options[:txn_data2].blank?
xml.add_element('TxnData3').text = options[:txn_data3].to_s.slice(0, 255) unless options[:txn_data3].blank?
-
- xml.add_element('ClientInfo').text = options[:client_info] if options[:client_info]
end
def new_transaction
REXML::Document.new.add_element('Txn')
end