Class: NewStoreApi::SalesOrderItemPaymentHistory
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::SalesOrderItemPaymentHistory
- Defined in:
- lib/new_store_api/models/sales_order_item_payment_history.rb
Overview
Contains the payments/refunds history for the order. Can also include multiple payments against multiple credit sources (i.e. gift card + credit card)
Instance Attribute Summary collapse
-
#amount ⇒ Float
The monetary value of the payment/refund.
-
#category ⇒ CategoryEnum
Describes if it is a Payment (authorization or capture) or Refund.
-
#currency ⇒ String
The currency of the amount as 3 character ISO-4217 code.
-
#method ⇒ SalesOrderPaymentMethodEnum
The method customer paid for the order.
-
#payment_information ⇒ String
Any payment information related to the payment method used.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(amount = nil, category = nil, currency = nil, method = nil, payment_information = SKIP) ⇒ SalesOrderItemPaymentHistory
constructor
A new instance of SalesOrderItemPaymentHistory.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(amount = nil, category = nil, currency = nil, method = nil, payment_information = SKIP) ⇒ SalesOrderItemPaymentHistory
Returns a new instance of SalesOrderItemPaymentHistory.
59 60 61 62 63 64 65 66 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 59 def initialize(amount = nil, category = nil, currency = nil, method = nil, payment_information = SKIP) @amount = amount @category = category @currency = currency @method = method @payment_information = payment_information unless payment_information == SKIP end |
Instance Attribute Details
#amount ⇒ Float
The monetary value of the payment/refund.
16 17 18 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 16 def amount @amount end |
#category ⇒ CategoryEnum
Describes if it is a Payment (authorization or capture) or Refund.
20 21 22 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 20 def category @category end |
#currency ⇒ String
The currency of the amount as 3 character ISO-4217 code. Example USD, EUR.
24 25 26 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 24 def currency @currency end |
#method ⇒ SalesOrderPaymentMethodEnum
The method customer paid for the order.
28 29 30 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 28 def method @method end |
#payment_information ⇒ String
Any payment information related to the payment method used. For example, it can contain the card type along with the last 4 digits of the credit card number.
34 35 36 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 34 def payment_information @payment_information end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? hash['amount'] : nil category = hash.key?('category') ? hash['category'] : nil currency = hash.key?('currency') ? hash['currency'] : nil method = hash.key?('method') ? hash['method'] : nil payment_information = hash.key?('payment_information') ? hash['payment_information'] : SKIP # Create object from extracted values. SalesOrderItemPaymentHistory.new(amount, category, currency, method, payment_information) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['amount'] = 'amount' @_hash['category'] = 'category' @_hash['currency'] = 'currency' @_hash['method'] = 'method' @_hash['payment_information'] = 'payment_information' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
48 49 50 51 52 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 48 def self.optionals %w[ payment_information ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
96 97 98 99 100 101 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 96 def inspect class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount.inspect}, category: #{@category.inspect}, currency:"\ " #{@currency.inspect}, method: #{@method.inspect}, payment_information:"\ " #{@payment_information.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
89 90 91 92 93 |
# File 'lib/new_store_api/models/sales_order_item_payment_history.rb', line 89 def to_s class_name = self.class.name.split('::').last "<#{class_name} amount: #{@amount}, category: #{@category}, currency: #{@currency}, method:"\ " #{@method}, payment_information: #{@payment_information}>" end |