Module: Pay::Attributes::MerchantExtension
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/pay/attributes.rb
Instance Method Summary collapse
Instance Method Details
#set_merchant_processor(processor_name, **attributes) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/pay/attributes.rb', line 91 def set_merchant_processor(processor_name, **attributes) with_lock do pay_merchants.update_all(default: false) pay_merchant = pay_merchants.where( Pay::Merchant.inheritance_column => "Pay::#{processor_name.to_s.classify}::Merchant", :processor => processor_name ).first_or_initialize pay_merchant.update!(attributes.merge(default: true)) end # Return new payment processor reload_merchant_processor end |