solidusio/solidus_paypal_braintree

Default Braintree configuration on store creation overwrites custom configuration

mdesantis opened this issue · 0 comments

Building the default Braintree configuration record on store creation doesn't check whether a braintree configuration already exists:

before_create :build_default_configuration
private
def build_default_configuration
build_braintree_configuration
end

overwriting a custom configuration on store creation:

store = Spree::Store.new(
  code: 'some unique store code',
  name: 'name',
  url: 'example.com',
  mail_from_address: 'store@example.com'
)
store.build_braintree_configuration(
  credit_card: true,
  paypal: true,
  apple_pay: true
)
store.save!
store.braintree_configuration #=> ... paypal: false, apple_pay: false, credit_card: false>