Class: AlphaCard::Sale

Inherits:
AlphaCardObject show all
Defined in:
lib/alpha_card/sale.rb

Instance Method Summary collapse

Methods inherited from AlphaCardObject

#filled_attributes, #to_query

Instance Method Details

#create(order, account) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/alpha_card/sale.rb', line 10

def create(order, )
  [:ccexp, :ccnumber, :amount].each do |attr|
    raise Exception.new("No #{attr.to_s} information provided") if self.send(attr.to_s).blank?
  end

  params = self.filled_attributes || {}
  [order, order.billing, order.shipping].compact.each { |obj| params.merge!(obj.try(:filled_attributes)) }

  AlphaCard.request(params, ).success?
end