Permalink
Browse files

Merge pull request #320 from mltsy/master

Viaklix/Elavon: Separate "demo accounts" from "test transactions"
  • Loading branch information...
2 parents e890476 + 4acea7c commit 205690d78fa53767528044a47ca08904eff1e123 @ntalbott ntalbott committed Mar 30, 2012
@@ -59,6 +59,7 @@ def authorize(money, creditcard, options = {})
add_creditcard(form, creditcard)
add_address(form, options)
add_customer_data(form, options)
+ add_test_mode(form, options)
commit(:authorize, money, form)
end
@@ -77,6 +78,7 @@ def capture(money, authorization, options = {})
add_invoice(form, options)
add_creditcard(form, options[:credit_card])
add_customer_data(form, options)
+ add_test_mode(form, options)
commit(:capture, money, form)
end
@@ -43,6 +43,7 @@ def purchase(money, creditcard, options = {})
add_creditcard(form, creditcard)
add_address(form, options)
add_customer_data(form, options)
+ add_test_mode(form, options)
commit(:purchase, money, form)
end
@@ -58,10 +59,15 @@ def credit(money, creditcard, options = {})
add_creditcard(form, creditcard)
add_address(form, options)
add_customer_data(form, options)
+ add_test_mode(form, options)
commit(:credit, money, form)
end
private
+ def add_test_mode(form, options)
+ form[:test_mode] = 'TRUE' if options[:test_mode]
+ end
+
def add_customer_data(form, options)
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?
@@ -129,8 +135,7 @@ def preamble
'merchant_id' => @options[:login],
'pin' => @options[:password],
'show_form' => 'false',
- 'test_mode' => test? ? 'TRUE' : 'FALSE',
- 'result_format' => 'ASCII',
+ 'result_format' => 'ASCII'
}
result['user_id'] = @options[:user] unless @options[:user].blank?

0 comments on commit 205690d

Please sign in to comment.