Skip to content

Commit

Permalink
Actually fix the bug by adding extdata element to Payflow Requests
Browse files Browse the repository at this point in the history
git-svn-id: https://activemerchant.googlecode.com/svn/trunk/active_merchant@643 6513ea26-6c20-0410-8a68-89cd7235086d
  • Loading branch information
codyfauser committed Feb 22, 2008
1 parent e7532cb commit 2b7f03c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
@@ -1,5 +1,6 @@
= ActiveMerchant CHANGELOG

* Actually fix the bug by adding extdata element to Payflow Requests [cody]
* Fix bug with adding name to Payflow requests [cody]
* Gateways will now look for CreditCard#brand before looking for CreditCard#type [cody]
* Make before_validate in CreditCard more clear [keith_du...@mac.com, cody]
Expand Down
3 changes: 2 additions & 1 deletion lib/active_merchant/billing/gateways/payflow.rb
Expand Up @@ -126,13 +126,14 @@ def add_credit_card(xml, credit_card)
xml.tag! 'CardType', credit_card_type(credit_card)
xml.tag! 'CardNum', credit_card.number
xml.tag! 'ExpDate', expdate(credit_card)
xml.tag! 'NameOnCard', credit_card.name
xml.tag! 'NameOnCard', credit_card.first_name
xml.tag! 'CVNum', credit_card.verification_value if credit_card.verification_value?

if requires_start_date_or_issue_number?(credit_card)
xml.tag!('ExtData', 'Name' => 'CardStart', 'Value' => startdate(credit_card)) unless credit_card.start_month.blank? || credit_card.start_year.blank?
xml.tag!('ExtData', 'Name' => 'CardIssue', 'Value' => format(credit_card.issue_number, :two_digits)) unless credit_card.issue_number.blank?
end
xml.tag! 'ExtData', 'Name' => 'LASTNAME', 'Value' => credit_card.last_name
end
end

Expand Down
Expand Up @@ -128,7 +128,7 @@ def build_reference_request(action, money, authorization, options)
def add_address(xml, tag, address, options)
return if address.nil?
xml.tag! tag do
xml.tag! 'Name', address[:name]
xml.tag! 'Name', address[:name] unless address[:name].blank?
xml.tag! 'EMail', options[:email] unless options[:email].blank?
xml.tag! 'Phone', address[:phone] unless address[:phone].blank?
xml.tag! 'CustCode', options[:customer] if !options[:customer].blank? && tag == 'BillTo'
Expand Down Expand Up @@ -200,7 +200,7 @@ def commit(request_body, request_type = nil)
headers = build_headers(request.size)

response = parse(ssl_post(test? ? TEST_URL : LIVE_URL, request, headers))

build_response(response[:result] == "0", response[:message], response,
:test => test?,
:authorization => response[:pn_ref] || response[:rp_ref],
Expand Down
11 changes: 0 additions & 11 deletions test/unit/gateways/payflow_test.rb
Expand Up @@ -191,18 +191,7 @@ def test_duplicate_response_flag
def test_ensure_gateway_uses_safe_retry
assert @gateway.retry_safe
end

def test_ensure_name_is_added_to_address
xml_doc = Builder::XmlMarkup.new

@gateway.send(:add_address, xml_doc, 'Address', @options[:billing_address], {})

result = REXML::Document.new(xml_doc.target!)
assert result.root.elements['//Name']
assert_equal 'Jim Smith', result.root.elements['//Name'].text.to_s

end

private
def successful_recurring_response
<<-XML
Expand Down

0 comments on commit 2b7f03c

Please sign in to comment.