Class: Io::Flow::V0::Models::PaymentCapture
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentCapture
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Capture actually transfers funds from the customer. Once a capture has succeeded, the final charge shows up on the customer’s statement. You can capture as many times as you’d like up until the total amount of the authorization has been captured or the authorization otherwise becomes unavailable (e.g. expires).
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 = {}) ⇒ PaymentCapture
constructor
A new instance of PaymentCapture.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentCapture
Returns a new instance of PaymentCapture.
56465 56466 56467 56468 56469 56470 56471 56472 56473 56474 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56465 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :amount, :currency, :created_at, :updated_at, :status], 'PaymentCapture') @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::PaymentCaptureStatus) ? x : ::Io::Flow::V0::Models::PaymentCaptureStatus.new(x)) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def amount @amount end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def currency @currency end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def id @id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def status @status end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
56463 56464 56465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56463 def updated_at @updated_at end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
56480 56481 56482 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56480 def copy(incoming={}) PaymentCapture.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
56484 56485 56486 56487 56488 56489 56490 56491 56492 56493 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56484 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
56476 56477 56478 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56476 def to_json JSON.dump(to_hash) end |