Class: AlphaCard::Sale
- Inherits:
-
AlphaCardObject
- Object
- AlphaCardObject
- AlphaCard::Sale
- Defined in:
- lib/alpha_card/objects/sale.rb
Overview
Implementation of Alpha Card Services Sale object. Contains all the information about Customer Credit Card, such as CVV, number, expiration date, etc. Process the Alpha Card Services payment.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Not writable attribute, defines the type of transaction (default is ‘sale’).
Instance Method Summary collapse
-
#create(order, account) ⇒ Boolean
Creates the sale for the specified
AlphaCard::Order
with theAlphaCard::Account
credentials.
Methods inherited from AlphaCardObject
Instance Attribute Details
#type ⇒ Object (readonly)
Not writable attribute, defines the type of transaction (default is ‘sale’)
17 |
# File 'lib/alpha_card/objects/sale.rb', line 17 attribute :type, String, default: 'sale', writer: :private |
Instance Method Details
#create(order, account) ⇒ Boolean
Creates the sale for the specified AlphaCard::Order
with the AlphaCard::Account
credentials.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/alpha_card/objects/sale.rb', line 42 def create(order, account) [:ccexp, :ccnumber, :amount].each do |attr| fail Exception, "No #{attr} information provided!" if self[attr].nil? || self[attr].empty? end params = filled_attributes || {} [order, order.billing, order.shipping].compact.each do |obj| params.merge!(obj ? obj.filled_attributes : {}) end AlphaCard.request(params, account).success? end |