Sha256: d42e95628773764247cd70ed5f254af4186edb7bb3db9a70a14d40fe6baba8cb

Contents?: true

Size: 547 Bytes

Versions: 12

Compression:

Stored size: 547 Bytes

Contents

module Spree
  module UserPaymentSource
    extend ActiveSupport::Concern

    included do
      has_many :credit_cards, class_name: "Spree::CreditCard", foreign_key: :user_id
    end

    def default_credit_card
      credit_cards.default.first
    end

    def payment_sources
      credit_cards.with_payment_profile
    end

    def drop_payment_source(source)
      Spree::Deprecation.warn("User#drop_payment_source is deprecated", caller)
      gateway = source.payment_method
      gateway.disable_customer_profile(source)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
solidus_core-2.0.3 app/models/concerns/spree/user_payment_source.rb
solidus_core-1.4.2 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.0.2 app/models/concerns/spree/user_payment_source.rb
solidus_core-1.4.1 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.0.1 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.1.0.beta1 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.0.0 app/models/concerns/spree/user_payment_source.rb
solidus_core-1.4.0 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.0.0.rc1 app/models/concerns/spree/user_payment_source.rb
solidus_core-1.4.0.rc1 app/models/concerns/spree/user_payment_source.rb
solidus_core-2.0.0.beta1 app/models/concerns/spree/user_payment_source.rb
solidus_core-1.4.0.beta1 app/models/concerns/spree/user_payment_source.rb