Sha256: 83af24ba623bcc420641b33f766a2d1ff140bc7b227e0cfbc0aeebdf6d14ef38

Contents?: true

Size: 741 Bytes

Versions: 7

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

# This class represents a single attempt to fulfill an installment. It will
# indicate the result of that attempt.
module SolidusSubscriptions
  class InstallmentDetail < ApplicationRecord
    belongs_to(
      :installment,
      class_name: 'SolidusSubscriptions::Installment',
      inverse_of: :details
    )

    belongs_to(:order, class_name: '::Spree::Order', optional: true)

    validates :installment, presence: true
    alias_attribute :successful, :success

    scope :succeeded, -> { where success: true }
    scope :failed, -> { where success: false }

    # Was the attempt at fulfilling this installment a failure?
    #
    # @return [Boolean]
    def failed?
      !success
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_subscriptions-2.0.2 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-2.0.1 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-2.0.0 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-1.1.0 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-1.0.1 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-1.0.0 app/models/solidus_subscriptions/installment_detail.rb
solidus_subscriptions-1.0.0.rc1 app/models/solidus_subscriptions/installment_detail.rb