Class: CyberSourceMergedSpec::ProcessingInformation23

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

Overview

ProcessingInformation23 Model.

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(session_type: SKIP, payment_flow_mode: SKIP, action_list: SKIP, additional_properties: nil) ⇒ ProcessingInformation23

Returns a new instance of ProcessingInformation23.



51
52
53
54
55
56
57
58
59
60
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 51

def initialize(session_type: SKIP, payment_flow_mode: SKIP,
               action_list: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @session_type = session_type unless session_type == SKIP
  @payment_flow_mode = payment_flow_mode unless payment_flow_mode == SKIP
  @action_list = action_list unless action_list == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#action_listArray[String]

Possible values are one or more of follows:

  • AP_SESSIONS: Use this when Alternative Payment Sessions service is requested.

Returns:

  • (Array[String])


26
27
28
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 26

def action_list
  @action_list
end

#payment_flow_modeString

Whether merchant wants to pass the flow Inline or want to invoke Klarna Hosted Page

Returns:

  • (String)


20
21
22
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 20

def payment_flow_mode
  @payment_flow_mode
end

#session_typeString

Will have 2 values, 'U' (Update) , 'N' (New). Any other values will be rejected. Default will be 'N'

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 15

def session_type
  @session_type
end

Class Method Details

.from_element(root) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 86

def self.from_element(root)
  session_type = XmlUtilities.from_element(root, 'sessionType', String)
  payment_flow_mode = XmlUtilities.from_element(root, 'paymentFlowMode',
                                                String)
  action_list = XmlUtilities.from_element_to_array(root, 'actionList',
                                                   String)

  new(session_type: session_type,
      payment_flow_mode: payment_flow_mode,
      action_list: action_list,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  session_type = hash.key?('sessionType') ? hash['sessionType'] : SKIP
  payment_flow_mode =
    hash.key?('paymentFlowMode') ? hash['paymentFlowMode'] : SKIP
  action_list = hash.key?('actionList') ? hash['actionList'] : SKIP

  # 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.
  ProcessingInformation23.new(session_type: session_type,
                              payment_flow_mode: payment_flow_mode,
                              action_list: action_list,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['session_type'] = 'sessionType'
  @_hash['payment_flow_mode'] = 'paymentFlowMode'
  @_hash['action_list'] = 'actionList'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



38
39
40
41
42
43
44
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 38

def self.optionals
  %w[
    session_type
    payment_flow_mode
    action_list
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 120

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} session_type: #{@session_type.inspect}, payment_flow_mode:"\
  " #{@payment_flow_mode.inspect}, action_list: #{@action_list.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} session_type: #{@session_type}, payment_flow_mode: #{@payment_flow_mode},"\
  " action_list: #{@action_list}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/cyber_source_merged_spec/models/processing_information23.rb', line 99

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

  XmlUtilities.add_as_subelement(doc, root, 'sessionType', session_type)
  XmlUtilities.add_as_subelement(doc, root, 'paymentFlowMode',
                                 payment_flow_mode)
  XmlUtilities.add_array_as_subelement(doc, root, 'actionList', action_list)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end