Class: BraintreeRails::MerchantAccount

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/braintree_rails/merchant_account.rb

Instance Method Summary collapse

Methods included from Model

included

Instance Method Details

#add_errors(validation_errors) ⇒ Object



22
23
24
25
26
27
# File 'lib/braintree_rails/merchant_account.rb', line 22

def add_errors(validation_errors)
  [individual, business, funding].each do |association|
    association.add_errors(validation_errors.except(:base)) if association
    super(validation_errors)
  end
end

#attributes_for(action) ⇒ Object



29
30
31
# File 'lib/braintree_rails/merchant_account.rb', line 29

def attributes_for(action)
  super.merge(individual_attributes).merge(business_attributes).merge(funding_attributes)
end

#business_attributesObject



37
38
39
# File 'lib/braintree_rails/merchant_account.rb', line 37

def business_attributes
  business.present? ? {:business => business.attributes_for(:as_association)} : {}
end

#funding_attributesObject



41
42
43
# File 'lib/braintree_rails/merchant_account.rb', line 41

def funding_attributes
  funding.present? ? {:funding => funding.attributes_for(:as_association)} : {}
end

#individual_attributesObject



33
34
35
# File 'lib/braintree_rails/merchant_account.rb', line 33

def individual_attributes
  individual.present? ? {:individual => individual.attributes_for(:as_association)} : {}
end