class Io::Flow::V0::Models::PaymentForm

Represents the data needed to initiate an online payment

Attributes

discriminator[R]

Public Class Methods

from_json(hash) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13639
def PaymentForm.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
  if discriminator.empty?
    raise "Union type[payment_form] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::MERCHANT_OF_RECORD_PAYMENT_FORM; MerchantOfRecordPaymentForm.new(hash)
    else PaymentFormUndefinedType.new(:discriminator => discriminator)
  end
end
new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13625
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discriminator], 'PaymentForm')
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
end

Public Instance Methods

subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13631
def subtype_to_hash
  raise 'Cannot serialize an instance of payment_form directly - must use one of the specific types: merchant_of_record_payment_form'
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13635
def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end