class Braintree::Customer

Attributes

addresses[R]
apple_pay_cards[R]
company[R]
created_at[R]
credit_cards[R]
custom_fields[R]
email[R]
fax[R]
first_name[R]
google_pay_cards[R]
graphql_id[R]
id[R]
last_name[R]
paypal_accounts[R]
phone[R]
samsung_pay_cards[R]
tax_identifiers[R]
updated_at[R]
us_bank_accounts[R]
venmo_accounts[R]
visa_checkout_cards[R]
website[R]

Public Class Methods

all() click to toggle source
# File lib/braintree/customer.rb, line 29
def self.all
  Configuration.gateway.customer.all
end
create(*args) click to toggle source
# File lib/braintree/customer.rb, line 33
def self.create(*args)
  Configuration.gateway.customer.create(*args)
end
create!(*args) click to toggle source
# File lib/braintree/customer.rb, line 37
def self.create!(*args)
  Configuration.gateway.customer.create!(*args)
end
credit(customer_id, transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 41
def self.credit(customer_id, transaction_attributes)
  Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
end
credit!(customer_id, transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 45
def self.credit!(customer_id, transaction_attributes)
   return_object_or_raise(:transaction) { credit(customer_id, transaction_attributes) }
end
delete(*args) click to toggle source
# File lib/braintree/customer.rb, line 49
def self.delete(*args)
  Configuration.gateway.customer.delete(*args)
end
find(*args) click to toggle source
# File lib/braintree/customer.rb, line 53
def self.find(*args)
  Configuration.gateway.customer.find(*args)
end
sale(customer_id, transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 57
def self.sale(customer_id, transaction_attributes)
  Transaction.sale(transaction_attributes.merge(:customer_id => customer_id))
end
sale!(customer_id, transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 61
def self.sale!(customer_id, transaction_attributes)
  return_object_or_raise(:transaction) { sale(customer_id, transaction_attributes) }
end
transactions(*args) click to toggle source

Returns a ResourceCollection of transactions for the customer with the given customer_id.

# File lib/braintree/customer.rb, line 70
def self.transactions(*args)
  Configuration.gateway.customer.transactions(*args)
end
update(*args) click to toggle source
# File lib/braintree/customer.rb, line 74
def self.update(*args)
  Configuration.gateway.customer.update(*args)
end
update!(*args) click to toggle source
# File lib/braintree/customer.rb, line 78
def self.update!(*args)
  Configuration.gateway.customer.update!(*args)
end

Public Instance Methods

credit(transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 98
def credit(transaction_attributes)
  @gateway.transaction.credit(transaction_attributes.merge(:customer_id => id))
end
credit!(transaction_attributes) click to toggle source
# File lib/braintree/customer.rb, line 102
def credit!(transaction_attributes)
  return_object_or_raise(:transaction) { credit(transaction_attributes) }
end
default_payment_method() click to toggle source

Returns the customer's default payment method.

# File lib/braintree/customer.rb, line 107
def default_payment_method
  payment_methods.find { |payment_instrument| payment_instrument.default? }
end
delete() click to toggle source
# File lib/braintree/customer.rb, line 111
def delete
  @gateway.customer.delete(id)
end
payment_methods() click to toggle source

Returns the customer's payment methods

# File lib/braintree/customer.rb, line 116
def payment_methods
  @credit_cards +
    @paypal_accounts +
    @apple_pay_cards +
    @google_pay_cards +
    @venmo_accounts +
    @us_bank_accounts +
    @visa_checkout_cards +
    @samsung_pay_cards
end
transactions(options = {}) click to toggle source

Returns a ResourceCollection of transactions for the customer.

# File lib/braintree/customer.rb, line 138
def transactions(options = {})
  @gateway.customer.transactions(id, options)
end