class Vantiv::TestCard

Constants

CARDS

Attributes

card_number[R]
cvv[R]
expiry_month[R]
expiry_year[R]
mocked_sandbox_payment_account_id[R]
name[R]
network[R]
temporary_token[R]

Public Class Methods

all() click to toggle source
# File lib/vantiv/test_card.rb, line 86
def self.all
  CARDS.map do |raw_card|
    new(raw_card)
  end
end
find(card_number) click to toggle source
# File lib/vantiv/test_card.rb, line 98
def self.find(card_number)
  card = CARDS.find do |card_data|
    card_data[:card_number] == card_number
  end
  raise CardNotFound.new("No card with account number #{card_number}") unless card
  new(card)
end
find_by_payment_account_id(payment_account_id) click to toggle source
# File lib/vantiv/test_card.rb, line 106
def self.find_by_payment_account_id(payment_account_id)
  card = CARDS.find do |card_data|
    card_data[:mocked_sandbox_payment_account_id] == payment_account_id
  end
  raise CardNotFound.new("No card with mocked sandbox payment account id #{payment_account_id}") unless card
  new(card)
end
new(card_number:, expiry_month:, expiry_year:, cvv:, mocked_sandbox_payment_account_id:, network:, name:, temporary_token:) click to toggle source
# File lib/vantiv/test_card.rb, line 116
def initialize(card_number:, expiry_month:, expiry_year:, cvv:, mocked_sandbox_payment_account_id:, network:, name:, temporary_token:)
  @card_number = card_number
  @expiry_month = expiry_month
  @expiry_year = expiry_year
  @cvv = cvv
  @mocked_sandbox_payment_account_id = mocked_sandbox_payment_account_id
  @network = network
  @name = name
  @temporary_token = temporary_token
end

Public Instance Methods

!=(other_object) click to toggle source
# File lib/vantiv/test_card.rb, line 135
def !=(other_object)
  !(self == other_object)
end
==(other_object) click to toggle source
Calls superclass method
# File lib/vantiv/test_card.rb, line 127
def ==(other_object)
  if other_object.is_a?(TestCard)
    name == other_object.name
  else
    super
  end
end
tokenizable?() click to toggle source
# File lib/vantiv/test_card.rb, line 139
def tokenizable?
  self != TestCard.invalid_card_number
end