Class: Io::Flow::V0::Models::PaymentRefund
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentRefund
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A refund is used to return already captured funds back to the customer. The customer will see the amount credited back to them as a separate transaction.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentRefund
constructor
A new instance of PaymentRefund.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentRefund
Returns a new instance of PaymentRefund.
51742 51743 51744 51745 51746 51747 51748 51749 51750 51751 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51742 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :amount, :currency, :created_at, :updated_at, :status], 'PaymentRefund') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @updated_at = HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:updated_at)), DateTime) @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::PaymentRefundStatus) ? x : ::Io::Flow::V0::Models::PaymentRefundStatus.new(x)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def amount @amount end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def status @status end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
51740 51741 51742 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51740 def updated_at @updated_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
51757 51758 51759 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51757 def copy(incoming={}) PaymentRefund.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
51761 51762 51763 51764 51765 51766 51767 51768 51769 51770 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51761 def to_hash { :id => id, :amount => amount.to_f.to_s, :currency => currency, :created_at => created_at, :updated_at => updated_at, :status => status.to_hash } end |
#to_json ⇒ Object
51753 51754 51755 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51753 def to_json JSON.dump(to_hash) end |