Class: Io::Flow::V0::Models::PaypalAuthorizationForm

Inherits:
AuthorizationForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Executes the PayPal payment

Instance Attribute Summary collapse

Attributes inherited from AuthorizationForm

#discriminator

Instance Method Summary collapse

Methods inherited from AuthorizationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PaypalAuthorizationForm

Returns a new instance of PaypalAuthorizationForm.



23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23678

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::PAYPAL_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:paypal_payment_id, :paypal_payer_id], 'PaypalAuthorizationForm')
  @paypal_payment_id = HttpClient::Preconditions.assert_class('paypal_payment_id', opts.delete(:paypal_payment_id), String)
  @paypal_payer_id = HttpClient::Preconditions.assert_class('paypal_payer_id', opts.delete(:paypal_payer_id), String)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, 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 })
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



23676
23677
23678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23676

def attributes
  @attributes
end

#ipObject (readonly)

Returns the value of attribute ip.



23676
23677
23678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23676

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



23676
23677
23678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23676

def key
  @key
end

#paypal_payer_idObject (readonly)

Returns the value of attribute paypal_payer_id.



23676
23677
23678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23676

def paypal_payer_id
  @paypal_payer_id
end

#paypal_payment_idObject (readonly)

Returns the value of attribute paypal_payment_id.



23676
23677
23678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23676

def paypal_payment_id
  @paypal_payment_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23693
23694
23695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23693

def copy(incoming={})
  PaypalAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



23697
23698
23699
23700
23701
23702
23703
23704
23705
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23697

def subtype_to_hash
  {
    :paypal_payment_id => paypal_payment_id,
    :paypal_payer_id => paypal_payer_id,
    :key => key,
    :attributes => attributes.nil? ? nil : attributes,
    :ip => ip
  }
end

#to_jsonObject



23689
23690
23691
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23689

def to_json
  JSON.dump(to_hash)
end