Class: BreadMachine::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/breadmachine/dto/card.rb

Overview

A data transfer object that represents the user’s credit card.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Card

Required properties include :issuer, :number, and :expiry_date.

:issuer should be a downcased string (“amex”, “visa”, “mastercard”) :number should be an integer :expiry_date should be a string in the format “mm/yy”

:issue is required for Solo cards. :start_date is required for “some” cards. The XPay spec says “for a full

list of cards requiring start_date, please contact your acquiring bank".

TODO: make expiry_date and start_date into Date objects to save crappy string munging.



29
30
31
# File 'lib/breadmachine/dto/card.rb', line 29

def initialize(attributes = {})
  attributes.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#expiry_dateObject

Returns the value of attribute expiry_date.



9
10
11
# File 'lib/breadmachine/dto/card.rb', line 9

def expiry_date
  @expiry_date
end

#issueObject

Returns the value of attribute issue.



11
12
13
# File 'lib/breadmachine/dto/card.rb', line 11

def issue
  @issue
end

#issuerObject

Returns the value of attribute issuer.



7
8
9
# File 'lib/breadmachine/dto/card.rb', line 7

def issuer
  @issuer
end

#numberObject

Returns the value of attribute number.



8
9
10
# File 'lib/breadmachine/dto/card.rb', line 8

def number
  @number
end

#security_codeObject

Returns the value of attribute security_code.



12
13
14
# File 'lib/breadmachine/dto/card.rb', line 12

def security_code
  @security_code
end

#start_dateObject

Returns the value of attribute start_date.



10
11
12
# File 'lib/breadmachine/dto/card.rb', line 10

def start_date
  @start_date
end

#transaction_referenceObject

Returns the value of attribute transaction_reference.



14
15
16
# File 'lib/breadmachine/dto/card.rb', line 14

def transaction_reference
  @transaction_reference
end

#transaction_verifierObject

Returns the value of attribute transaction_verifier.



13
14
15
# File 'lib/breadmachine/dto/card.rb', line 13

def transaction_verifier
  @transaction_verifier
end