Class: ProtonApi::CardTransactionAuthorizationRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/proton_api/models/card_transaction_authorization_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CardTransactionAuthorizationRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



129
130
131
132
133
134
135
136
137
138
139
140
141
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 129

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'currency_code')
    self.currency_code = attributes[:'currency_code']
  end

  if attributes.has_key?(:'memo')
    self.memo = attributes[:'memo']
  else
    self.memo = 'null'
  end

  if attributes.has_key?(:'partial_auth')
    self.partial_auth = attributes[:'partial_auth']
  else
    self.partial_auth = false
  end

  if attributes.has_key?(:'transaction_type')
    self.transaction_type = attributes[:'transaction_type']
  end

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  else
    self.description = 'null'
  end

  if attributes.has_key?(:'transaction_category_id')
    self.transaction_category_id = attributes[:'transaction_category_id']
  end

  if attributes.has_key?(:'use_audit_log')
    self.use_audit_log = attributes[:'use_audit_log']
  else
    self.use_audit_log = false
  end

  if attributes.has_key?(:'merchant_category_code')
    self.merchant_category_code = attributes[:'merchant_category_code']
  end

  if attributes.has_key?(:'card_id')
    self.card_id = attributes[:'card_id']
  end

  if attributes.has_key?(:'transaction_category')
    self.transaction_category = attributes[:'transaction_category']
  else
    self.transaction_category = 'null'
  end

  if attributes.has_key?(:'cleanse_data')
    self.cleanse_data = attributes[:'cleanse_data']
  else
    self.cleanse_data = false
  end

  if attributes.has_key?(:'auth_type')
    if (value = attributes[:'auth_type']).is_a?(Array)
      self.auth_type = value
    end
  end

  if attributes.has_key?(:'mid')
    self.mid = attributes[:'mid']
  else
    self.mid = 'null'
  end

  if attributes.has_key?(:'transaction_status_scope')
    if (value = attributes[:'transaction_status_scope']).is_a?(Array)
      self.transaction_status_scope = value
    end
  end

  if attributes.has_key?(:'location')
    self.location = attributes[:'location']
  end

  if attributes.has_key?(:'merchant')
    self.merchant = attributes[:'merchant']
  else
    self.merchant = 'null'
  end

  if attributes.has_key?(:'amount')
    self.amount = attributes[:'amount']
  end

  if attributes.has_key?(:'date')
    self.date = attributes[:'date']
  end

  if attributes.has_key?(:'merchant_id')
    self.merchant_id = attributes[:'merchant_id']
  end
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



49
50
51
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 49

def amount
  @amount
end

#auth_typeObject

Returns the value of attribute auth_type.



39
40
41
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 39

def auth_type
  @auth_type
end

#card_idObject

Returns the value of attribute card_id.



33
34
35
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 33

def card_id
  @card_id
end

#cleanse_dataObject

Returns the value of attribute cleanse_data.



37
38
39
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 37

def cleanse_data
  @cleanse_data
end

#currency_codeObject

Returns the value of attribute currency_code.



17
18
19
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 17

def currency_code
  @currency_code
end

#dateObject

Returns the value of attribute date.



51
52
53
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 51

def date
  @date
end

#descriptionObject

Returns the value of attribute description.



25
26
27
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 25

def description
  @description
end

#locationObject

Returns the value of attribute location.



45
46
47
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 45

def location
  @location
end

#memoObject

Returns the value of attribute memo.



19
20
21
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 19

def memo
  @memo
end

#merchantObject

Returns the value of attribute merchant.



47
48
49
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 47

def merchant
  @merchant
end

#merchant_category_codeObject

Returns the value of attribute merchant_category_code.



31
32
33
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 31

def merchant_category_code
  @merchant_category_code
end

#merchant_idObject

Returns the value of attribute merchant_id.



53
54
55
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 53

def merchant_id
  @merchant_id
end

#midObject

Returns the value of attribute mid.



41
42
43
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 41

def mid
  @mid
end

#partial_authObject

Returns the value of attribute partial_auth.



21
22
23
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 21

def partial_auth
  @partial_auth
end

#transaction_categoryObject

Returns the value of attribute transaction_category.



35
36
37
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 35

def transaction_category
  @transaction_category
end

#transaction_category_idObject

Returns the value of attribute transaction_category_id.



27
28
29
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 27

def transaction_category_id
  @transaction_category_id
end

#transaction_status_scopeObject

Returns the value of attribute transaction_status_scope.



43
44
45
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 43

def transaction_status_scope
  @transaction_status_scope
end

#transaction_typeObject

Returns the value of attribute transaction_type.



23
24
25
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 23

def transaction_type
  @transaction_type
end

#use_audit_logObject

Returns the value of attribute use_audit_log.



29
30
31
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 29

def use_audit_log
  @use_audit_log
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 78

def self.attribute_map
  {
    :'currency_code' => :'currency_code',
    :'memo' => :'memo',
    :'partial_auth' => :'partial_auth',
    :'transaction_type' => :'transaction_type',
    :'description' => :'description',
    :'transaction_category_id' => :'transaction_category_id',
    :'use_audit_log' => :'use_audit_log',
    :'merchant_category_code' => :'merchant_category_code',
    :'card_id' => :'card_id',
    :'transaction_category' => :'transaction_category',
    :'cleanse_data' => :'cleanse_data',
    :'auth_type' => :'auth_type',
    :'mid' => :'mid',
    :'transaction_status_scope' => :'transaction_status_scope',
    :'location' => :'location',
    :'merchant' => :'merchant',
    :'amount' => :'amount',
    :'date' => :'date',
    :'merchant_id' => :'merchant_id'
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    :'currency_code' => :'String',
    :'memo' => :'String',
    :'partial_auth' => :'BOOLEAN',
    :'transaction_type' => :'String',
    :'description' => :'String',
    :'transaction_category_id' => :'String',
    :'use_audit_log' => :'BOOLEAN',
    :'merchant_category_code' => :'Integer',
    :'card_id' => :'String',
    :'transaction_category' => :'String',
    :'cleanse_data' => :'BOOLEAN',
    :'auth_type' => :'Array<String>',
    :'mid' => :'String',
    :'transaction_status_scope' => :'Array<String>',
    :'location' => :'Location',
    :'merchant' => :'String',
    :'amount' => :'Float',
    :'date' => :'DateTime',
    :'merchant_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 284

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      currency_code == o.currency_code &&
      memo == o.memo &&
      partial_auth == o.partial_auth &&
      transaction_type == o.transaction_type &&
      description == o.description &&
      transaction_category_id == o.transaction_category_id &&
      use_audit_log == o.use_audit_log &&
      merchant_category_code == o.merchant_category_code &&
      card_id == o.card_id &&
      transaction_category == o.transaction_category &&
      cleanse_data == o.cleanse_data &&
      auth_type == o.auth_type &&
      mid == o.mid &&
      transaction_status_scope == o.transaction_status_scope &&
      location == o.location &&
      merchant == o.merchant &&
      amount == o.amount &&
      date == o.date &&
      merchant_id == o.merchant_id
end

#_deserialize(type, value) ⇒ Object

Returns Deserialized data.

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 343

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    value
  when :Date
    value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = ProtonApi.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 407

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 323

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


310
311
312
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 310

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



316
317
318
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 316

def hash
  [currency_code, memo, partial_auth, transaction_type, description, transaction_category_id, use_audit_log, merchant_category_code, card_id, transaction_category, cleanse_data, auth_type, mid, transaction_status_scope, location, merchant, amount, date, merchant_id].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 234

def list_invalid_properties
  invalid_properties = Array.new
  if @currency_code.nil?
    invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.')
  end

  if @transaction_type.nil?
    invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
  end

  if @card_id.nil?
    invalid_properties.push('invalid value for "card_id", card_id cannot be nil.')
  end

  if @amount.nil?
    invalid_properties.push('invalid value for "amount", amount cannot be nil.')
  end

  if @date.nil?
    invalid_properties.push('invalid value for "date", date cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



388
389
390
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 388

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



394
395
396
397
398
399
400
401
402
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 394

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns String presentation of the object.

Returns:

  • (String)

    String presentation of the object



382
383
384
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 382

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



261
262
263
264
265
266
267
268
269
270
# File 'lib/proton_api/models/card_transaction_authorization_request.rb', line 261

def valid?
  return false if @currency_code.nil?
  return false if @transaction_type.nil?
  transaction_type_validator = EnumAttributeValidator.new('String', ['atm_withdrawal', 'purchase', 'other'])
  return false unless transaction_type_validator.valid?(@transaction_type)
  return false if @card_id.nil?
  return false if @amount.nil?
  return false if @date.nil?
  true
end