Class: Spree::Seeds::PaymentMethods

Inherits:
Object
  • Object
show all
Includes:
Spree::ServiceModule::Base
Defined in:
app/services/spree/seeds/payment_methods.rb

Instance Method Summary collapse

Methods included from Spree::ServiceModule::Base

prepended

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/spree/seeds/payment_methods.rb', line 6

def call
  Spree::Store.all.find_each do |store|
    payment_method = store.payment_methods.find_or_initialize_by(
      type: 'Spree::PaymentMethod::StoreCredit'
    )
    next if payment_method.persisted?

    payment_method.name = Spree.t(:store_credit_name)
    payment_method.description = Spree.t(:store_credit_name)
    payment_method.active = true
    payment_method.save!
  end
end