Method: Square::Connect::Tender#initialize

Defined in:
lib/square/connect/tender.rb

#initialize(attributes = {}) ⇒ Tender

Returns a new instance of Tender.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/square/connect/tender.rb', line 6

def initialize(attributes = {})
  self.type = attributes[:type]
  self.name = attributes[:name]
  self.card_brand = attributes[:card_brand]
  self.pan_suffix = attributes[:pan_suffix]
  self.entry_method = attributes[:entry_method]
  self.payment_note = attributes[:payment_note]
  [
    :total_money,
    :tendered_money,
    :change_back_money
  ].each do |money_attr|
    if attributes[money_attr].present?
      self.send "#{money_attr}=", Money.new(attributes[money_attr])
    end
  end
end