Sha256: 3416a2f6b84f5e591688899ff2426cae437aebbe25bd56ffbaa86a78980d89b2

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

module Spree
  class Konbini < Spree::Base
    STORES = %i(lawson family-mart sunkus circle-k ministop daily-yamazaki seven-eleven)

    belongs_to :payment_method
    belongs_to :user, class_name: Spree.user_class, foreign_key: 'user_id'
    has_many :payments, as: :source

    validates :convenience, presence: true

    def actions
      %w{capture void}
    end

    def can_capture?(payment)
      return false unless ['checkout', 'pending'].include?(payment.state)
      payment.source.expires_at && (payment.source.expires_at > DateTime.current)
    end

    def can_void?(payment)
      payment.state != 'void'
    end

    def instructions_partial_path
      "spree/orders/konbini"
    end

    def imported
      false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_komoju-0.0.5 app/models/spree/konbini.rb
spree_komoju-0.0.4 app/models/spree/konbini.rb
spree_komoju-0.0.3 app/models/spree/konbini.rb