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.



27129
27130
27131
27132
27133
27134
27135
27136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27129

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.



27127
27128
27129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27127

def expires_at
  @expires_at
end

#merchant_identifierObject (readonly)

Returns the value of attribute merchant_identifier.



27127
27128
27129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27127

def merchant_identifier
  @merchant_identifier
end

#payment_data_requestObject (readonly)

Returns the value of attribute payment_data_request.



27127
27128
27129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27127

def payment_data_request
  @payment_data_request
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



27142
27143
27144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27142

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

#subtype_to_hashObject



27146
27147
27148
27149
27150
27151
27152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27146

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

#to_jsonObject



27138
27139
27140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27138

def to_json
  JSON.dump(to_hash)
end