Class: OpenapiClient::Payment

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_client/models/payment.rb

Overview

Payment information for the transaction.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Payment

Initializes the object

Parameters:

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

    Model attributes in the form of hash



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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
# File 'lib/openapi_client/models/payment.rb', line 104

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?(:'paymentType')
    self.payment_type = attributes[:'paymentType']
  end

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#entry_method ⇒ Object

The method in which the card information entered the system.



27
28
29
# File 'lib/openapi_client/models/payment.rb', line 27

def entry_method
  @entry_method
end

#issuer_approved_amount ⇒ Object

The actual approved amount. This field should be filled in when the message has already passed through the issuer (e.g. post-authorization). For transaction/authorization this amount refers to the amount that was locked on the card-holders account.



32
33
34
# File 'lib/openapi_client/models/payment.rb', line 32

def issuer_approved_amount
  @issuer_approved_amount
end

#issuer_card_balance ⇒ Object

The payment methods account balance if available. This field should be filled in when the message has already passed through the issuer (e.g. post-authorization).



35
36
37
# File 'lib/openapi_client/models/payment.rb', line 35

def issuer_card_balance
  @issuer_card_balance
end

#issuer_response ⇒ Object

Returns the value of attribute issuer_response.



29
30
31
# File 'lib/openapi_client/models/payment.rb', line 29

def issuer_response
  @issuer_response
end

#method ⇒ Object

Returns the value of attribute method.



21
22
23
# File 'lib/openapi_client/models/payment.rb', line 21

def method
  @method
end

#payment_type ⇒ Object

Defines the type of the payment.



19
20
21
# File 'lib/openapi_client/models/payment.rb', line 19

def payment_type
  @payment_type
end

#pin_present ⇒ Object

Indicates if the cards Personal Identification Number was supplied.



24
25
26
# File 'lib/openapi_client/models/payment.rb', line 24

def pin_present
  @pin_present
end

#user_defined ⇒ Object

A JSON object that carries any additional information that might be helpful for fraud detection.



44
45
46
# File 'lib/openapi_client/models/payment.rb', line 44

def user_defined
  @user_defined
end

#verification3ds ⇒ Object

Returns the value of attribute verification3ds.



39
40
41
# File 'lib/openapi_client/models/payment.rb', line 39

def verification3ds
  @verification3ds
end

#verification_avs ⇒ Object

Returns the value of attribute verification_avs.



37
38
39
# File 'lib/openapi_client/models/payment.rb', line 37

def verification_avs
  @verification_avs
end

#verification_cvv ⇒ Object

Returns the value of attribute verification_cvv.



41
42
43
# File 'lib/openapi_client/models/payment.rb', line 41

def verification_cvv
  @verification_cvv
end

Class Method Details

.attribute_map ⇒ Object

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



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/openapi_client/models/payment.rb', line 69

def self.attribute_map
  {
    :'payment_type' => :'paymentType',
    :'method' => :'method',
    :'pin_present' => :'pinPresent',
    :'entry_method' => :'entryMethod',
    :'issuer_response' => :'issuerResponse',
    :'issuer_approved_amount' => :'issuerApprovedAmount',
    :'issuer_card_balance' => :'issuerCardBalance',
    :'verification_avs' => :'verificationAvs',
    :'verification3ds' => :'verification3ds',
    :'verification_cvv' => :'verificationCvv',
    :'user_defined' => :'userDefined'
  }
end

.openapi_types ⇒ Object

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/openapi_client/models/payment.rb', line 86

def self.openapi_types
  {
    :'payment_type' => :'String',
    :'method' => :'PaymentPayMethod',
    :'pin_present' => :'BOOLEAN',
    :'entry_method' => :'String',
    :'issuer_response' => :'PaymentIssuerResponse',
    :'issuer_approved_amount' => :'String',
    :'issuer_card_balance' => :'String',
    :'verification_avs' => :'PaymentVerificationAvs',
    :'verification3ds' => :'PaymentVerification3ds',
    :'verification_cvv' => :'PaymentVerificationCvv',
    :'user_defined' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/openapi_client/models/payment.rb', line 214

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      payment_type == o.payment_type &&
      method == o.method &&
      pin_present == o.pin_present &&
      entry_method == o.entry_method &&
      issuer_response == o.issuer_response &&
      issuer_approved_amount == o.issuer_approved_amount &&
      issuer_card_balance == o.issuer_card_balance &&
      verification_avs == o.verification_avs &&
      verification3ds == o.verification3ds &&
      verification_cvv == o.verification_cvv &&
      user_defined == o.user_defined
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string —

    type Data type

  • string —

    value Value to be deserialized

Returns:

  • (Object) —

    Deserialized data



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/openapi_client/models/payment.rb', line 266

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(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 = OpenapiClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of 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



332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/openapi_client/models/payment.rb', line 332

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



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/openapi_client/models/payment.rb', line 245

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the 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


232
233
234
# File 'lib/openapi_client/models/payment.rb', line 232

def eql?(o)
  self == o
end

#hash ⇒ Fixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum) —

    Hash code



238
239
240
# File 'lib/openapi_client/models/payment.rb', line 238

def hash
  [payment_type, method, pin_present, entry_method, issuer_response, issuer_approved_amount, issuer_card_balance, verification_avs, verification3ds, verification_cvv, user_defined].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/openapi_client/models/payment.rb', line 157

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

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

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

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

  invalid_properties
end

#to_body ⇒ Hash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash) —

    Returns the object in the form of hash



312
313
314
# File 'lib/openapi_client/models/payment.rb', line 312

def to_body
  to_hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



318
319
320
321
322
323
324
325
326
# File 'lib/openapi_client/models/payment.rb', line 318

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_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



306
307
308
# File 'lib/openapi_client/models/payment.rb', line 306

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



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/openapi_client/models/payment.rb', line 180

def valid?
  return false if @payment_type.nil?
  payment_type_validator = EnumAttributeValidator.new('String', ['payment/card', 'payment/wallet'])
  return false unless payment_type_validator.valid?(@payment_type)
  return false if @method.nil?
  return false if @pin_present.nil?
  return false if @entry_method.nil?
  entry_method_validator = EnumAttributeValidator.new('String', ['manual', 'stripe', 'ocr', 'emv', 'nfc', 'remote', 'pinPresent'])
  return false unless entry_method_validator.valid?(@entry_method)
  true
end