Sha256: c16c44fe94ce27a0cbba323fa0043971e2bdae23e02f825a3a4ac284db91f3a7

Contents?: true

Size: 419 Bytes

Versions: 5

Compression:

Stored size: 419 Bytes

Contents

Spree.user_class.class_eval do
  after_create :create_mollie_customer

  def create_mollie_customer
    # Don't create Mollie customers is spree_auth_devise is not installed.
    return unless defined? Spree::User
    mollie_gateway = Spree::PaymentMethod.find_by_type 'Spree::Gateway::MollieGateway'
    mollie_customer = mollie_gateway.create_customer(self)
    update mollie_customer_id: mollie_customer.id
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spree_mollie_gateway-1.0.3 app/models/spree/user_decorator.rb
spree_mollie_gateway-1.0.2 app/models/spree/user_decorator.rb
spree_mollie_gateway-1.0.0 app/models/spree/user_decorator.rb
spree_mollie_gateway-1.0.0.pre.beta4 app/models/spree/user_decorator.rb
spree_mollie_gateway-1.0.0.pre.beta3 app/models/spree/user_decorator.rb