class Io::Flow::V0::Models::CreditPayment
A Credit Payment
records a ‘non cash’ payment against an order (e.g. a store credit, gift card, etc.), recording the amount of that credit and additional details to reconcile payments. The primary purpose of the credit payment is to record that a payment has been made against an order so the remaining balance can be correctly computed.
Attributes
attributes[R]
description[R]
id[R]
key[R]
order[R]
original[R]
value[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37556 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :order, :key, :description, :value, :original, :attributes], 'CreditPayment') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::ExpandableOrder) ? x : ::Io::Flow::V0::Models::ExpandableOrder.from_json(x)) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @value = (x = opts.delete(:value); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @original = (x = opts.delete(:original); x.is_a?(::Io::Flow::V0::Models::OriginalPrices) ? x : ::Io::Flow::V0::Models::OriginalPrices.new(x)) @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37572 def copy(incoming={}) CreditPayment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37576 def to_hash { :id => id, :order => order.to_hash, :key => key, :description => description, :value => value.to_hash, :original => original.to_hash, :attributes => attributes } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 37568 def to_json JSON.dump(to_hash) end