Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge pull request activemerchant#967 from Shopify/payflow_credit_car…
Browse files Browse the repository at this point in the history
…d_comparison_fix

Remove CreditCard comparisons, objects passed in are not necessarily ActiveMerchant::Billing::CreditCards
  • Loading branch information
odorcicd committed Dec 18, 2013
2 parents 5d766c8 + 4ecb293 commit 2a8a472
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions lib/active_merchant/billing/gateways/payflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,17 @@ def purchase(money, funding_source, options = {})
end

def credit(money, funding_source, options = {})
case
when funding_source.is_a?(String)
if funding_source.is_a?(String)
deprecated CREDIT_DEPRECATION_MESSAGE
# Perform referenced credit
refund(money, funding_source, options)
when funding_source.is_a?(CreditCard)
elsif card_brand(funding_source) == 'check'
# Perform non-referenced credit
request = build_credit_card_request(:credit, money, funding_source, options)
commit(request, options)
when funding_source.is_a?(Check)
request = build_check_request(:credit, money, funding_source, options)
commit(request, options)
else raise ArgumentError, "Unsupported funding source provided"
else
request = build_credit_card_request(:credit, money, funding_source, options)
commit(request, options)
end
end

Expand Down Expand Up @@ -82,14 +80,12 @@ def express

private
def build_sale_or_authorization_request(action, money, funding_source, options)
case
when funding_source.is_a?(String)
if funding_source.is_a?(String)
build_reference_sale_or_authorization_request(action, money, funding_source, options)
when funding_source.is_a?(CreditCard)
build_credit_card_request(action, money, funding_source, options)
when funding_source.is_a?(Check)
elsif card_brand(funding_source) == 'check'
build_check_request(action, money, funding_source, options)
else raise ArgumentError, "Unsupported funding source provided"
else
build_credit_card_request(action, money, funding_source, options)
end
end

Expand Down

0 comments on commit 2a8a472

Please sign in to comment.