Class: Workarea::Payment::Tender::CreditCard

Inherits:
Workarea::Payment::Tender show all
Includes:
CreditCard
Defined in:
app/models/workarea/payment/tender/credit_card.rb

Instance Method Summary collapse

Methods included from CreditCard

#card_change?, #expired?, #number=, #number_changed?, #to_active_merchant

Methods inherited from Workarea::Payment::Tender

#authorized_amount, #build_transaction, #capturable?, #capturable_amount, #captured_amount, #has_amount?, #name, #refundable?, #refundable_amount, #refunded_amount, #uncaptured_amount

Methods included from GuardNegativePrice

#guard_negative_price

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list

Methods included from Mongoid::Document

#embedded_children

Instance Method Details

#saved?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/workarea/payment/tender/credit_card.rb', line 13

def saved?
  saved_card_id.present?
end

#saved_cardObject



21
22
23
24
25
# File 'app/models/workarea/payment/tender/credit_card.rb', line 21

def saved_card
  @saved_card ||= profile.credit_cards.find(saved_card_id) if saved?
rescue
  nil
end

#slugObject



27
28
29
# File 'app/models/workarea/payment/tender/credit_card.rb', line 27

def slug
  :credit_card
end

#to_token_or_active_merchantObject



31
32
33
# File 'app/models/workarea/payment/tender/credit_card.rb', line 31

def to_token_or_active_merchant
  token.presence || to_active_merchant
end

#tokenized?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/workarea/payment/tender/credit_card.rb', line 17

def tokenized?
  super || saved?
end