lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.119.0 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.120.0
- old
+ new
@@ -706,23 +706,24 @@
def add_processing_options(xml, options)
return unless options[:stored_credential]
xml.processingOptions do
- if options[:stored_credential][:initial_transaction]
+ if options[:stored_credential][:initial_transaction] && options[:stored_credential][:reason_type] == 'recurring'
+ xml.isFirstRecurringPayment 'true'
+ elsif options[:stored_credential][:initial_transaction]
xml.isFirstSubsequentAuth 'true'
- # xml.isFirstRecurringPayment 'true' if options[:stored_credential][:reason_type] == 'recurring'
elsif options[:stored_credential][:initiator] == 'cardholder'
xml.isStoredCredentials 'true'
else
xml.isSubsequentAuth 'true'
end
end
end
def add_subsequent_auth_information(xml, options)
- return unless options.dig(:stored_credential, :reason_type) == 'unscheduled'
+ return unless options.dig(:stored_credential, :initiator) == 'merchant'
xml.subsequentAuthInformation do
xml.reason options[:stored_credential_reason_type_override] if options[:stored_credential_reason_type_override]
xml.originalNetworkTransId options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
end
@@ -929,9 +930,14 @@
empty?(element.content) ? nil : element.content
end
response[:full_response_code] =
if element = doc.at_xpath('//messages/message/code')
+ empty?(element.content) ? nil : element.content
+ end
+
+ response[:network_trans_id] =
+ if element = doc.at_xpath('//networkTransId')
empty?(element.content) ? nil : element.content
end
response
end