Class: CyberSourceMergedSpec::AuthorizationOptions3

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

Overview

AuthorizationOptions3 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(auth_type: SKIP, verbal_auth_code: SKIP, verbal_auth_transaction_id: SKIP, additional_properties: nil) ⇒ AuthorizationOptions3

Returns a new instance of AuthorizationOptions3.



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

def initialize(auth_type: SKIP, verbal_auth_code: SKIP,
               verbal_auth_transaction_id: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @auth_type = auth_type unless auth_type == SKIP
  @verbal_auth_code = verbal_auth_code unless verbal_auth_code == SKIP
  unless verbal_auth_transaction_id == SKIP
    @verbal_auth_transaction_id =
      verbal_auth_transaction_id
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#auth_typeString

Authorization type. Possible values:

  • AUTOCAPTURE: automatic capture.
  • STANDARDCAPTURE: standard capture.
  • VERBAL: forced capture. Include it in the payment request for a forced capture. Include it in the capture request for a verbal payment.

Asia, Middle East, and Africa Gateway; Cielo; Comercio Latino; and

CyberSource Latin American Processing Set this field to AUTOCAPTURE and include it in a bundled request to indicate that you are requesting an automatic capture. If your account is configured to enable automatic captures, set this field to STANDARDCAPTURE and include it in a standard authorization or bundled request to indicate that you are overriding an automatic capture.

Forced Capture

Set this field to VERBAL and include it in the authorization request to indicate that you are performing a forced capture; therefore, you receive the authorization code outside the CyberSource system.

Verbal Authorization

Set this field to VERBAL and include it in the capture request to indicate that the request is for a verbal authorization.

for PayPal ptsV2CreateOrderPost400Response

Set this field to 'AUTHORIZE' or 'CAPTURE' depending on whether you want to invoke delayed capture or sale respectively.

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 35

def auth_type
  @auth_type
end

#verbal_auth_codeString

Authorization code.

Forced Capture

Use this field to send the authorization code you received from a payment that you authorized outside the CyberSource system.

PIN debit

Authorization code that is returned by the processor. Returned by PIN debit purchase.

Verbal Authorization

Use this field in CAPTURE API to send the verbally received authorization code.

Returns:

  • (String)


49
50
51
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 49

def verbal_auth_code
  @verbal_auth_code
end

#verbal_auth_transaction_idString

Transaction ID (TID).

FDMS South

This field is required for verbal authorizations and forced captures with the American Express card type to comply with the CAPN requirements:

  • Forced capture: Obtain the value for this field from the authorization response.
  • Verbal authorization: You cannot obtain a value for this field so CyberSource uses the default value of 000000000000000 (15 zeros).

Returns:

  • (String)


62
63
64
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 62

def verbal_auth_transaction_id
  @verbal_auth_transaction_id
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  auth_type = XmlUtilities.from_element(root, 'authType', String)
  verbal_auth_code = XmlUtilities.from_element(root, 'verbalAuthCode',
                                               String)
  verbal_auth_transaction_id = XmlUtilities.from_element(
    root, 'verbalAuthTransactionId', String
  )

  new(auth_type: auth_type,
      verbal_auth_code: verbal_auth_code,
      verbal_auth_transaction_id: verbal_auth_transaction_id,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auth_type = hash.key?('authType') ? hash['authType'] : SKIP
  verbal_auth_code =
    hash.key?('verbalAuthCode') ? hash['verbalAuthCode'] : SKIP
  verbal_auth_transaction_id =
    hash.key?('verbalAuthTransactionId') ? hash['verbalAuthTransactionId'] : 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.
  AuthorizationOptions3.new(auth_type: auth_type,
                            verbal_auth_code: verbal_auth_code,
                            verbal_auth_transaction_id: verbal_auth_transaction_id,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auth_type'] = 'authType'
  @_hash['verbal_auth_code'] = 'verbalAuthCode'
  @_hash['verbal_auth_transaction_id'] = 'verbalAuthTransactionId'
  @_hash
end

.nullablesObject

An array for nullable fields



83
84
85
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 83

def self.nullables
  []
end

.optionalsObject

An array for optional fields



74
75
76
77
78
79
80
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 74

def self.optionals
  %w[
    auth_type
    verbal_auth_code
    verbal_auth_transaction_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 163

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

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 155

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

#to_xml_element(doc, root_name) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/cyber_source_merged_spec/models/authorization_options3.rb', line 140

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

  XmlUtilities.add_as_subelement(doc, root, 'authType', auth_type)
  XmlUtilities.add_as_subelement(doc, root, 'verbalAuthCode',
                                 verbal_auth_code)
  XmlUtilities.add_as_subelement(doc, root, 'verbalAuthTransactionId',
                                 verbal_auth_transaction_id)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end