class Io::Flow::V0::Models::PaymentRequestForm

Attributes

amount[R]
attributes[R]
currency[R]
device_details[R]
locale[R]
order_information[R]
payment_capture_option[R]
payment_method_data[R]
reference[R]
return_url[R]
supported_actions[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 58806
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 58826
def copy(incoming={})
  PaymentRequestForm.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 58830
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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 58822
def to_json
  JSON.dump(to_hash)
end