Class: OnlinePayments::SDK::Domain::Order

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#additional_inputOnlinePayments::SDK::Domain::AdditionalOrderInput

Returns the current value of additional_input.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def additional_input
  @additional_input
end

#amount_of_moneyOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of amount_of_money.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def amount_of_money
  @amount_of_money
end

#customerOnlinePayments::SDK::Domain::Customer

Returns the current value of customer.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def customer
  @customer
end

#discountOnlinePayments::SDK::Domain::Discount

Returns the current value of discount.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def discount
  @discount
end

#referencesOnlinePayments::SDK::Domain::OrderReferences

Returns the current value of references.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def references
  @references
end

#shippingOnlinePayments::SDK::Domain::Shipping

Returns the current value of shipping.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def shipping
  @shipping
end

#shopping_cartOnlinePayments::SDK::Domain::ShoppingCart

Returns the current value of shopping_cart.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def shopping_cart
  @shopping_cart
end

#surcharge_specific_inputOnlinePayments::SDK::Domain::SurchargeSpecificInput

Returns the current value of surcharge_specific_input.

Returns:



25
26
27
# File 'lib/onlinepayments/sdk/domain/order.rb', line 25

def surcharge_specific_input
  @surcharge_specific_input
end

Instance Method Details

#from_hash(hash) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/onlinepayments/sdk/domain/order.rb', line 49

def from_hash(hash)
  super
  if hash.key? 'additionalInput'
    raise TypeError, "value '%s' is not a Hash" % [hash['additionalInput']] unless hash['additionalInput'].is_a? Hash
    @additional_input = OnlinePayments::SDK::Domain::AdditionalOrderInput.new_from_hash(hash['additionalInput'])
  end
  if hash.key? 'amountOfMoney'
    raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
    @amount_of_money = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
  end
  if hash.key? 'customer'
    raise TypeError, "value '%s' is not a Hash" % [hash['customer']] unless hash['customer'].is_a? Hash
    @customer = OnlinePayments::SDK::Domain::Customer.new_from_hash(hash['customer'])
  end
  if hash.key? 'discount'
    raise TypeError, "value '%s' is not a Hash" % [hash['discount']] unless hash['discount'].is_a? Hash
    @discount = OnlinePayments::SDK::Domain::Discount.new_from_hash(hash['discount'])
  end
  if hash.key? 'references'
    raise TypeError, "value '%s' is not a Hash" % [hash['references']] unless hash['references'].is_a? Hash
    @references = OnlinePayments::SDK::Domain::OrderReferences.new_from_hash(hash['references'])
  end
  if hash.key? 'shipping'
    raise TypeError, "value '%s' is not a Hash" % [hash['shipping']] unless hash['shipping'].is_a? Hash
    @shipping = OnlinePayments::SDK::Domain::Shipping.new_from_hash(hash['shipping'])
  end
  if hash.key? 'shoppingCart'
    raise TypeError, "value '%s' is not a Hash" % [hash['shoppingCart']] unless hash['shoppingCart'].is_a? Hash
    @shopping_cart = OnlinePayments::SDK::Domain::ShoppingCart.new_from_hash(hash['shoppingCart'])
  end
  if hash.key? 'surchargeSpecificInput'
    raise TypeError, "value '%s' is not a Hash" % [hash['surchargeSpecificInput']] unless hash['surchargeSpecificInput'].is_a? Hash
    @surcharge_specific_input = OnlinePayments::SDK::Domain::SurchargeSpecificInput.new_from_hash(hash['surchargeSpecificInput'])
  end
end

#to_hHash

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/onlinepayments/sdk/domain/order.rb', line 36

def to_h
  hash = super
  hash['additionalInput'] = @additional_input.to_h if @additional_input
  hash['amountOfMoney'] = @amount_of_money.to_h if @amount_of_money
  hash['customer'] = @customer.to_h if @customer
  hash['discount'] = @discount.to_h if @discount
  hash['references'] = @references.to_h if @references
  hash['shipping'] = @shipping.to_h if @shipping
  hash['shoppingCart'] = @shopping_cart.to_h if @shopping_cart
  hash['surchargeSpecificInput'] = @surcharge_specific_input.to_h if @surcharge_specific_input
  hash
end