Sha256: ed8369e3a98b1ed6d190f20da199b3322ba19beb90ecc20e6567a6b8993f5511

Contents?: true

Size: 612 Bytes

Versions: 28

Compression:

Stored size: 612 Bytes

Contents

module ActsAsSubscribableBuyer
  extend ActiveSupport::Concern

  module ActiveRecord
    def acts_as_subscribable_buyer(*options)
      include ::ActsAsSubscribableBuyer
    end
  end

  included do
    has_one :customer, class_name: 'Effective::Customer'

    before_save(if: -> { persisted? && email_changed? && customer.present? }) do
      Rails.logger.info "STRIPE CUSTOMER EMAIL UPDATE: #{customer.stripe_customer_id}"
      customer.stripe_customer.email = email
      customer.stripe_customer.description = to_s
      throw :abort unless (customer.stripe_customer.save rescue false)
    end
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
effective_orders-3.2.3 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.2.2 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.2.1 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.2.0 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.1.7 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.1.6 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.1.4 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.1.3 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.1.0 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.0.4 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.0.3 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-3.0.2 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta14 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta13 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta12 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta11 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta10 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta9 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta8 app/models/concerns/acts_as_subscribable_buyer.rb
effective_orders-4.0.0beta7 app/models/concerns/acts_as_subscribable_buyer.rb