Class: Io::Flow::V0::Models::ActionUseSdkKlarnaV1

Inherits:
Action
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Use the Klarna SDK v1 and load the widgets for payment method categories. After the decision has been made, the payment request will be updated asynchronously. x.klarnacdn.net/kp/lib/v1/index.html

Instance Attribute Summary collapse

Attributes inherited from Action

#type

Instance Method Summary collapse

Methods inherited from Action

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ActionUseSdkKlarnaV1

Returns a new instance of ActionUseSdkKlarnaV1.



29344
29345
29346
29347
29348
29349
29350
29351
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29344

def initialize(incoming={})
  super(:type => Action::Types::ACTION_USE_SDK_KLARNA_V1)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:client_token, :payment_method_categories], 'ActionUseSdkKlarnaV1')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @client_token = HttpClient::Preconditions.assert_class('client_token', opts.delete(:client_token), String)
  @payment_method_categories = HttpClient::Preconditions.assert_class('payment_method_categories', opts.delete(:payment_method_categories), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::KlarnaPaymentCategory) ? x : ::Io::Flow::V0::Models::KlarnaPaymentCategory.new(x)) }
end

Instance Attribute Details

#client_tokenObject (readonly)

Returns the value of attribute client_token.



29342
29343
29344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29342

def client_token
  @client_token
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



29342
29343
29344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29342

def expires_at
  @expires_at
end

#payment_method_categoriesObject (readonly)

Returns the value of attribute payment_method_categories.



29342
29343
29344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29342

def payment_method_categories
  @payment_method_categories
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29357
29358
29359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29357

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

#subtype_to_hashObject



29361
29362
29363
29364
29365
29366
29367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29361

def subtype_to_hash
  {
    :expires_at => expires_at,
    :client_token => client_token,
    :payment_method_categories => payment_method_categories.map { |o| o.to_hash }
  }
end

#to_jsonObject



29353
29354
29355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29353

def to_json
  JSON.dump(to_hash)
end