lib/active_merchant/billing/gateways/payflow.rb in activemerchant-1.123.0 vs lib/active_merchant/billing/gateways/payflow.rb in activemerchant-1.124.0

- old
+ new

@@ -287,21 +287,29 @@ xml.tag! 'PAReq', three_d_secure[:pareq] unless three_d_secure[:pareq].blank? xml.tag! 'ACSUrl', three_d_secure[:acs_url] unless three_d_secure[:acs_url].blank? xml.tag! 'ECI', three_d_secure[:eci] unless three_d_secure[:eci].blank? xml.tag! 'CAVV', three_d_secure[:cavv] unless three_d_secure[:cavv].blank? xml.tag! 'XID', three_d_secure[:xid] unless three_d_secure[:xid].blank? - xml.tag! 'THREEDSVERSION', three_d_secure[:version] unless three_d_secure[:version].blank? - xml.tag! 'DSTRANSACTIONID', three_d_secure[:ds_transaction_id] unless three_d_secure[:ds_transaction_id].blank? + xml.tag! 'ThreeDSVersion', three_d_secure[:version] unless three_d_secure[:version].blank? + xml.tag! 'DSTransactionID', three_d_secure[:ds_transaction_id] unless three_d_secure[:ds_transaction_id].blank? end end end def authentication_status(three_d_secure, xml) - if three_d_secure[:authentication_response_status].present? - xml.tag! 'Status', three_d_secure[:authentication_response_status] - elsif three_d_secure[:directory_response_status].present? - xml.tag! 'Status', three_d_secure[:directory_response_status] + status = if three_d_secure[:authentication_response_status].present? + three_d_secure[:authentication_response_status] + elsif three_d_secure[:directory_response_status].present? + three_d_secure[:directory_response_status] end + if status.present? + xml.tag! 'Status', status + xml.tag! 'AuthenticationStatus', status if version_2_or_newer?(three_d_secure) + end + end + + def version_2_or_newer?(three_d_secure) + three_d_secure[:version]&.start_with?('2') end def credit_card_type(credit_card) return '' if card_brand(credit_card).blank?