lib/active_merchant/billing/gateways/braintree.rb in activemerchant-1.3.2 vs lib/active_merchant/billing/gateways/braintree.rb in activemerchant-1.4.0
- old
+ new
@@ -4,11 +4,11 @@
module Billing #:nodoc:
class BraintreeGateway < Gateway
URL = 'https://secure.braintreepaymentgateway.com/api/transact.php'
self.supported_countries = ['US']
- self.supported_cardtypes = [:visa, :master, :american_express]
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
self.homepage_url = 'http://www.braintreepaymentsolutions.com'
self.display_name = 'Braintree'
def initialize(options = {})
requires!(options, :login, :password)
@@ -73,9 +73,18 @@
post[:customer_vault] = "delete_customer"
add_customer_vault_id(post, vault_id)
commit(nil, nil, post)
end
+ # To match the other stored-value gateways, like TrustCommerce,
+ # store and unstore need to be defined
+ def store(creditcard, options = {})
+ billing_id = options.delete(:billing_id).to_s || true
+ authorize(100, creditcard, options.merge(:store => billing_id))
+ end
+
+ alias_method :unstore, :delete
+
private
def add_customer_data(post, options)
if options.has_key? :email
post[:email] = options[:email]
end