Class: Io::Flow::V0::Models::ActionUseSdkApplepayJsCreateSession

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

Overview

Use the Apple Pay Javascript SDK to instantiate an Apple Pay session on the browser. This will start loading the Apple Pay experience, which triggers a validation check from Apple. The results of this operation are a validation request which will be used to update the payment request with a ‘payment_method_data` of type `validate_applepay`. developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/2320659-applepaysession

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 = {}) ⇒ ActionUseSdkApplepayJsCreateSession

Returns a new instance of ActionUseSdkApplepayJsCreateSession.



29276
29277
29278
29279
29280
29281
29282
29283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29276

def initialize(incoming={})
  super(:type => Action::Types::ACTION_USE_SDK_APPLEPAY_JS_CREATE_SESSION)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:merchant_identifier, :payment_data_request], 'ActionUseSdkApplepayJsCreateSession')
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @merchant_identifier = HttpClient::Preconditions.assert_class('merchant_identifier', opts.delete(:merchant_identifier), String)
  @payment_data_request = (x = opts.delete(:payment_data_request); x.is_a?(::Io::Flow::Apple::Pay::V0::Models::ApplePayPaymentInfo) ? x : ::Io::Flow::Apple::Pay::V0::Models::ApplePayPaymentInfo.new(x))
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



29274
29275
29276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29274

def expires_at
  @expires_at
end

#merchant_identifierObject (readonly)

Returns the value of attribute merchant_identifier.



29274
29275
29276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29274

def merchant_identifier
  @merchant_identifier
end

#payment_data_requestObject (readonly)

Returns the value of attribute payment_data_request.



29274
29275
29276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29274

def payment_data_request
  @payment_data_request
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



29289
29290
29291
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29289

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

#subtype_to_hashObject



29293
29294
29295
29296
29297
29298
29299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29293

def subtype_to_hash
  {
    :expires_at => expires_at,
    :merchant_identifier => merchant_identifier,
    :payment_data_request => payment_data_request.to_hash
  }
end

#to_jsonObject



29285
29286
29287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 29285

def to_json
  JSON.dump(to_hash)
end