Skip to content

Commit

Permalink
Merge pull request #320 from mltsy/master
Browse files Browse the repository at this point in the history
Viaklix/Elavon: Separate "demo accounts" from "test transactions"
  • Loading branch information
ntalbott committed Mar 30, 2012
2 parents e890476 + 4acea7c commit 205690d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/gateways/elavon.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def authorize(money, creditcard, options = {})
add_creditcard(form, creditcard) add_creditcard(form, creditcard)
add_address(form, options) add_address(form, options)
add_customer_data(form, options) add_customer_data(form, options)
add_test_mode(form, options)
commit(:authorize, money, form) commit(:authorize, money, form)
end end


Expand All @@ -77,6 +78,7 @@ def capture(money, authorization, options = {})
add_invoice(form, options) add_invoice(form, options)
add_creditcard(form, options[:credit_card]) add_creditcard(form, options[:credit_card])
add_customer_data(form, options) add_customer_data(form, options)
add_test_mode(form, options)
commit(:capture, money, form) commit(:capture, money, form)
end end


Expand Down
9 changes: 7 additions & 2 deletions lib/active_merchant/billing/gateways/viaklix.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def purchase(money, creditcard, options = {})
add_creditcard(form, creditcard) add_creditcard(form, creditcard)
add_address(form, options) add_address(form, options)
add_customer_data(form, options) add_customer_data(form, options)
add_test_mode(form, options)
commit(:purchase, money, form) commit(:purchase, money, form)
end end


Expand All @@ -58,10 +59,15 @@ def credit(money, creditcard, options = {})
add_creditcard(form, creditcard) add_creditcard(form, creditcard)
add_address(form, options) add_address(form, options)
add_customer_data(form, options) add_customer_data(form, options)
add_test_mode(form, options)
commit(:credit, money, form) commit(:credit, money, form)
end end


private private
def add_test_mode(form, options)
form[:test_mode] = 'TRUE' if options[:test_mode]
end

def add_customer_data(form, options) def add_customer_data(form, options)
form[:email] = options[:email].to_s.slice(0, 100) unless options[:email].blank? form[:email] = options[:email].to_s.slice(0, 100) unless options[:email].blank?
form[:customer_code] = options[:customer].to_s.slice(0, 10) unless options[:customer].blank? form[:customer_code] = options[:customer].to_s.slice(0, 10) unless options[:customer].blank?
Expand Down Expand Up @@ -129,8 +135,7 @@ def preamble
'merchant_id' => @options[:login], 'merchant_id' => @options[:login],
'pin' => @options[:password], 'pin' => @options[:password],
'show_form' => 'false', 'show_form' => 'false',
'test_mode' => test? ? 'TRUE' : 'FALSE', 'result_format' => 'ASCII'
'result_format' => 'ASCII',
} }


result['user_id'] = @options[:user] unless @options[:user].blank? result['user_id'] = @options[:user] unless @options[:user].blank?
Expand Down

0 comments on commit 205690d

Please sign in to comment.