Class: Io::Flow::V0::Models::PaymentRequestForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentRequestForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#device_details ⇒ Object
readonly
Returns the value of attribute device_details.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#order_information ⇒ Object
readonly
Returns the value of attribute order_information.
-
#payment_capture_option ⇒ Object
readonly
Returns the value of attribute payment_capture_option.
-
#payment_method_data ⇒ Object
readonly
Returns the value of attribute payment_method_data.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#return_url ⇒ Object
readonly
Returns the value of attribute return_url.
-
#supported_actions ⇒ Object
readonly
Returns the value of attribute supported_actions.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PaymentRequestForm
constructor
A new instance of PaymentRequestForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentRequestForm
Returns a new instance of PaymentRequestForm.
51897 51898 51899 51900 51901 51902 51903 51904 51905 51906 51907 51908 51909 51910 51911 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51897 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:amount, :currency, :order_information, :device_details, :return_url], 'PaymentRequestForm') @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) @order_information = (x = opts.delete(:order_information); x.is_a?(::Io::Flow::V0::Models::OrderInformation) ? x : ::Io::Flow::V0::Models::OrderInformation.from_json(x)) @device_details = (x = opts.delete(:device_details); x.is_a?(::Io::Flow::V0::Models::DeviceDetails) ? x : ::Io::Flow::V0::Models::DeviceDetails.from_json(x)) @locale = (x = opts.delete(:locale); x.nil? ? nil : HttpClient::Preconditions.assert_class('locale', x, String)) @return_url = HttpClient::Preconditions.assert_class('return_url', opts.delete(:return_url), String) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) @reference = (x = opts.delete(:reference); x.nil? ? nil : HttpClient::Preconditions.assert_class('reference', x, String)) @payment_method_data = (x = opts.delete(:payment_method_data); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentMethodData) ? x : ::Io::Flow::V0::Models::PaymentMethodData.from_json(x))) @supported_actions = (x = opts.delete(:supported_actions); x.nil? ? nil : HttpClient::Preconditions.assert_class('supported_actions', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentActionType) ? x : ::Io::Flow::V0::Models::PaymentActionType.apply(x)) }) @payment_capture_option = (x = opts.delete(:payment_capture_option); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentCaptureOption) ? x : ::Io::Flow::V0::Models::PaymentCaptureOption.from_json(x))) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def amount @amount end |
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def attributes @attributes end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def currency @currency end |
#device_details ⇒ Object (readonly)
Returns the value of attribute device_details.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def device_details @device_details end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def locale @locale end |
#order_information ⇒ Object (readonly)
Returns the value of attribute order_information.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def order_information @order_information end |
#payment_capture_option ⇒ Object (readonly)
Returns the value of attribute payment_capture_option.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def payment_capture_option @payment_capture_option end |
#payment_method_data ⇒ Object (readonly)
Returns the value of attribute payment_method_data.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def payment_method_data @payment_method_data end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def reference @reference end |
#return_url ⇒ Object (readonly)
Returns the value of attribute return_url.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def return_url @return_url end |
#supported_actions ⇒ Object (readonly)
Returns the value of attribute supported_actions.
51895 51896 51897 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51895 def supported_actions @supported_actions end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
51917 51918 51919 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51917 def copy(incoming={}) PaymentRequestForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
51921 51922 51923 51924 51925 51926 51927 51928 51929 51930 51931 51932 51933 51934 51935 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51921 def to_hash { :amount => amount.to_f.to_s, :currency => currency, :order_information => order_information.to_hash, :device_details => device_details.to_hash, :locale => locale, :return_url => return_url, :attributes => attributes.nil? ? nil : attributes, :reference => reference, :payment_method_data => payment_method_data.nil? ? nil : payment_method_data.to_hash, :supported_actions => supported_actions.nil? ? nil : supported_actions.map { |o| o.value }, :payment_capture_option => payment_capture_option.nil? ? nil : payment_capture_option.to_hash } end |
#to_json ⇒ Object
51913 51914 51915 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 51913 def to_json JSON.dump(to_hash) end |