class AlphaCard::Order

Implementation of Alpha Card Services Order object. Contains all the information about order (id, description, etc).

Constants

ORIGIN_TRANSACTION_VARIABLES

Original AlphaCard transaction variables names

Public Instance Methods

attributes_for_request(*) click to toggle source

Overloaded method to return all the attributes from the sale + billing + shipping objects.

@return [Hash]

Filled attributes with the original Alpha Card Services
transaction variables names.

@example

billing = AlphaCard::Billing.new(email: 'test@example.com')
shipping = AlphaCard::Shipping.new(first_name: 'John', last_name: 'Doe')
order = AlphaCard::Order.new(id: '1', billing: billing, shipping: shipping)
order.attributes_for_request

#=>  { orderid: '1', email: 'test@example.com', shipping_first_name: 'John', shipping_last_name: 'Doe' }
# File lib/alpha_card/resources/order.rb, line 40
def attributes_for_request(*)
  attributes = filled_attributes.dup

  billing = attributes.delete(:billing)
  attributes.merge!(billing.attributes_for_request) if billing

  shipping = attributes.delete(:shipping)
  attributes.merge!(shipping.attributes_for_request) if shipping

  super(attributes)
end