Class: CyberSourceMergedSpec::GenerateCaptureContextRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/generate_capture_context_request.rb

Overview

This is a server-to-server API request to generate the capture context that can be used to initiate an instance of Microform on an acceptance page. The capture context is a digitally signed JWT that provides authentication, one-time keys, and the target origin to the Microform Integration application.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(client_version: SKIP, target_origins: SKIP, allowed_card_networks: SKIP, allowed_payment_types: SKIP, transient_token_response_options: SKIP, additional_properties: nil) ⇒ GenerateCaptureContextRequest

Returns a new instance of GenerateCaptureContextRequest.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 123

def initialize(client_version: SKIP, target_origins: SKIP,
               allowed_card_networks: SKIP, allowed_payment_types: SKIP,
               transient_token_response_options: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_version = client_version unless client_version == SKIP
  @target_origins = target_origins unless target_origins == SKIP
  @allowed_card_networks = allowed_card_networks unless allowed_card_networks == SKIP
  @allowed_payment_types = allowed_payment_types unless allowed_payment_types == SKIP
  unless transient_token_response_options == SKIP
    @transient_token_response_options =
      transient_token_response_options
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#allowed_card_networksArray[String]

The list of card networks you want to use for this Microform transaction. Microform currently supports the following card networks: - VISA - MASTERCARD - AMEX - CARNET - CARTESBANCAIRES - CUP - DINERSCLUB - DISCOVER - EFTPOS - ELO - JAYWAN - JCB - JCREW - KCP - MADA - MAESTRO - MEEZA - PAYPAK - UATP Important:

  • When integrating Microform (Card) at least one card network should be specified in the allowedCardNetworks field in the capture context request.
  • When integrating Microform (ACH/eCheck) the allowedCardNetworks field is not required in the capture context request.
  • When integrating both Microform (Card) and Microform (ACH/eCheck) at least one card network should be specified in the allowedCardNetworks field in the capture context request.

Returns:

  • (Array[String])


79
80
81
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 79

def allowed_card_networks
  @allowed_card_networks
end

#allowed_payment_typesArray[String]

The payment types that are allowed for the merchant.
Possible values when launching Microform:

  • CARD
  • CHECK

Returns:

  • (Array[String])


86
87
88
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 86

def allowed_payment_types
  @allowed_payment_types
end

#client_versionString

Specify the version of Microform that you want to use.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 18

def client_version
  @client_version
end

#target_originsArray[String]

The target origin of the website on which you will be launching Microform is defined by the scheme (protocol), hostname (domain) and port number (if used).
You must use https://hostname (unless you use http://localhost) Wildcards are NOT supported. Ensure that subdomains are included. Any valid top-level domain is supported (e.g. .com, .co.uk, .gov.br etc) Examples:

- https://example.com
- https://subdomain.example.com
- https://example.com:8080<br><br>

If you are embedding within multiple nested iframes you need to specify the origins of all the browser contexts used, for example:

targetOrigins: [
"https://example.com",
"https://basket.example.com",
"https://ecom.example.com"
]<br><br>

You can supply up to nine origins within the targetOrigins field for nested iframes. If the list of origins exceeds five ensure that you:

- Compare the list of origins in the v2/sessions targetOrigins field

against the location.ancestorOrigins of the browser.

  • Ensure that the count of origins and their content matches in both. If any origins are absent or mismatched, the system will prevent Microform from loading and display a client-side error message.

Returns:

  • (Array[String])


47
48
49
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 47

def target_origins
  @target_origins
end

#transient_token_response_optionsTransientTokenResponseOptions

The payment types that are allowed for the merchant.
Possible values when launching Microform:

  • CARD
  • CHECK



93
94
95
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 93

def transient_token_response_options
  @transient_token_response_options
end

Class Method Details

.from_element(root) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 172

def self.from_element(root)
  client_version = XmlUtilities.from_element(root, 'clientVersion', String)
  target_origins = XmlUtilities.from_element_to_array(root, 'targetOrigins',
                                                      String)
  allowed_card_networks = XmlUtilities.from_element_to_array(
    root, 'allowedCardNetworks', String
  )
  allowed_payment_types = XmlUtilities.from_element_to_array(
    root, 'allowedPaymentTypes', String
  )
  transient_token_response_options = XmlUtilities.from_element(
    root, 'TransientTokenResponseOptions',
    TransientTokenResponseOptions
  )

  new(client_version: client_version,
      target_origins: target_origins,
      allowed_card_networks: allowed_card_networks,
      allowed_payment_types: allowed_payment_types,
      transient_token_response_options: transient_token_response_options,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 142

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  client_version = hash.key?('clientVersion') ? hash['clientVersion'] : SKIP
  target_origins = hash.key?('targetOrigins') ? hash['targetOrigins'] : SKIP
  allowed_card_networks =
    hash.key?('allowedCardNetworks') ? hash['allowedCardNetworks'] : SKIP
  allowed_payment_types =
    hash.key?('allowedPaymentTypes') ? hash['allowedPaymentTypes'] : SKIP
  if hash['transientTokenResponseOptions']
    transient_token_response_options = TransientTokenResponseOptions.from_hash(hash['transientTokenResponseOptions'])
  end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  GenerateCaptureContextRequest.new(client_version: client_version,
                                    target_origins: target_origins,
                                    allowed_card_networks: allowed_card_networks,
                                    allowed_payment_types: allowed_payment_types,
                                    transient_token_response_options: transient_token_response_options,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



96
97
98
99
100
101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 96

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_version'] = 'clientVersion'
  @_hash['target_origins'] = 'targetOrigins'
  @_hash['allowed_card_networks'] = 'allowedCardNetworks'
  @_hash['allowed_payment_types'] = 'allowedPaymentTypes'
  @_hash['transient_token_response_options'] =
    'transientTokenResponseOptions'
  @_hash
end

.nullablesObject

An array for nullable fields



119
120
121
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 119

def self.nullables
  []
end

.optionalsObject

An array for optional fields



108
109
110
111
112
113
114
115
116
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 108

def self.optionals
  %w[
    client_version
    target_origins
    allowed_card_networks
    allowed_payment_types
    transient_token_response_options
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



223
224
225
226
227
228
229
230
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 223

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_version: #{@client_version.inspect}, target_origins:"\
  " #{@target_origins.inspect}, allowed_card_networks: #{@allowed_card_networks.inspect},"\
  " allowed_payment_types: #{@allowed_payment_types.inspect},"\
  " transient_token_response_options: #{@transient_token_response_options.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



214
215
216
217
218
219
220
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 214

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_version: #{@client_version}, target_origins: #{@target_origins},"\
  " allowed_card_networks: #{@allowed_card_networks}, allowed_payment_types:"\
  " #{@allowed_payment_types}, transient_token_response_options:"\
  " #{@transient_token_response_options}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/cyber_source_merged_spec/models/generate_capture_context_request.rb', line 195

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'clientVersion', client_version)
  XmlUtilities.add_array_as_subelement(doc, root, 'targetOrigins',
                                       target_origins)
  XmlUtilities.add_array_as_subelement(doc, root, 'allowedCardNetworks',
                                       allowed_card_networks)
  XmlUtilities.add_array_as_subelement(doc, root, 'allowedPaymentTypes',
                                       allowed_payment_types)
  XmlUtilities.add_as_subelement(doc, root, 'TransientTokenResponseOptions',
                                 transient_token_response_options)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end