Sha256: 43f7aecf21ee32fb89482f95b36d73adaa767d417c47f87026611b3b834676f9

Contents?: true

Size: 464 Bytes

Versions: 9

Compression:

Stored size: 464 Bytes

Contents

Spree.user_class.class_eval do
  after_create :create_mollie_customer

  def create_mollie_customer
    # Don't create Mollie customers if spree_auth_devise is not installed.
    return unless defined? Spree::User

    mollie_gateway = Spree::PaymentMethod.find_by_type 'Spree::Gateway::MollieGateway'
    return unless mollie_gateway.present?

    mollie_customer = mollie_gateway.create_customer(self)
    update mollie_customer_id: mollie_customer.id
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_mollie_gateway-3.2.1 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.2.0 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.1.0 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.4 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.3 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.2 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.1 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.0 app/models/spree/user_decorator.rb
spree_mollie_gateway-3.0.0.pre.beta app/models/spree/user_decorator.rb