Class: Io::Flow::V0::Models::PaymentInformation
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentInformation
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount_capturable ⇒ Object
readonly
Returns the value of attribute amount_capturable.
-
#amount_captured ⇒ Object
readonly
Returns the value of attribute amount_captured.
-
#amount_refundable ⇒ Object
readonly
Returns the value of attribute amount_refundable.
-
#amount_refunded ⇒ Object
readonly
Returns the value of attribute amount_refunded.
-
#authorizations ⇒ Object
readonly
Returns the value of attribute authorizations.
-
#capturable_before ⇒ Object
readonly
Returns the value of attribute capturable_before.
-
#refundable_before ⇒ Object
readonly
Returns the value of attribute refundable_before.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentInformation
constructor
A new instance of PaymentInformation.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentInformation
Returns a new instance of PaymentInformation.
56866 56867 56868 56869 56870 56871 56872 56873 56874 56875 56876 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56866 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:authorizations], 'PaymentInformation') @amount_refundable = (x = opts.delete(:amount_refundable); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_refundable', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @amount_refunded = (x = opts.delete(:amount_refunded); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_refunded', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @refundable_before = (x = opts.delete(:refundable_before); x.nil? ? nil : HttpClient::Preconditions.assert_class('refundable_before', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @amount_capturable = (x = opts.delete(:amount_capturable); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_capturable', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @amount_captured = (x = opts.delete(:amount_captured); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_captured', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @capturable_before = (x = opts.delete(:capturable_before); x.nil? ? nil : HttpClient::Preconditions.assert_class('capturable_before', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @authorizations = HttpClient::Preconditions.assert_class('authorizations', opts.delete(:authorizations), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentAuthorization) ? x : ::Io::Flow::V0::Models::PaymentAuthorization.new(x)) } end |
Instance Attribute Details
#amount_capturable ⇒ Object (readonly)
Returns the value of attribute amount_capturable.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def amount_capturable @amount_capturable end |
#amount_captured ⇒ Object (readonly)
Returns the value of attribute amount_captured.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def amount_captured @amount_captured end |
#amount_refundable ⇒ Object (readonly)
Returns the value of attribute amount_refundable.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def amount_refundable @amount_refundable end |
#amount_refunded ⇒ Object (readonly)
Returns the value of attribute amount_refunded.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def amount_refunded @amount_refunded end |
#authorizations ⇒ Object (readonly)
Returns the value of attribute authorizations.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def @authorizations end |
#capturable_before ⇒ Object (readonly)
Returns the value of attribute capturable_before.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def capturable_before @capturable_before end |
#refundable_before ⇒ Object (readonly)
Returns the value of attribute refundable_before.
56864 56865 56866 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56864 def refundable_before @refundable_before end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
56882 56883 56884 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56882 def copy(incoming={}) PaymentInformation.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
56886 56887 56888 56889 56890 56891 56892 56893 56894 56895 56896 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56886 def to_hash { :amount_refundable => amount_refundable.to_f.to_s, :amount_refunded => amount_refunded.to_f.to_s, :refundable_before => refundable_before, :amount_capturable => amount_capturable.to_f.to_s, :amount_captured => amount_captured.to_f.to_s, :capturable_before => capturable_before, :authorizations => .map { |o| o.to_hash } } end |
#to_json ⇒ Object
56878 56879 56880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56878 def to_json JSON.dump(to_hash) end |