Class: CyberSource::Acpv1instructionsMandates

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/models/acpv1instructions_mandates.rb

Overview

Mandate data.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Acpv1instructionsMandates

Initializes the object

Parameters:

  • (defaults to: {})

    Model attributes in the form of hash



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 89

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#decline_thresholdObject

Returns the value of attribute decline_threshold.



29
30
31
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 29

def decline_threshold
  @decline_threshold
end

#descriptionObject

Description of the product.



40
41
42
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 40

def description
  @description
end

#effective_until_timeObject

UTC time in Unix epoch format.



34
35
36
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 34

def effective_until_time
  @effective_until_time
end

#mandate_idObject

Unique identifier with in the context of a purchase-intent for the mandate. Assigned by Partner. Id shall not be reused when a mandate is updated/deleted.



18
19
20
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 18

def mandate_id
  @mandate_id
end

#merchant_categoryObject

Merchant category Description.



24
25
26
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 24

def merchant_category
  @merchant_category
end

#merchant_category_codeObject

Merchant category Code. Once it is checked, it has to be valid merchant category code. Ex:" 5311"



27
28
29
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 27

def merchant_category_code
  @merchant_category_code
end

#preferred_merchant_nameObject

User merchant preference.



21
22
23
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 21

def preferred_merchant_name
  @preferred_merchant_name
end

#quantityObject

Quantity of the product.



37
38
39
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 37

def quantity
  @quantity
end

#recurring_payment_informationObject

Returns the value of attribute recurring_payment_information.



31
32
33
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 31

def recurring_payment_information
  @recurring_payment_information
end

Class Method Details

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 43

def self.attribute_map
  {
    :'mandate_id' => :'mandateId',
    :'preferred_merchant_name' => :'preferredMerchantName',
    :'merchant_category' => :'merchantCategory',
    :'merchant_category_code' => :'merchantCategoryCode',
    :'decline_threshold' => :'declineThreshold',
    :'recurring_payment_information' => :'recurringPaymentInformation',
    :'effective_until_time' => :'effectiveUntilTime',
    :'quantity' => :'quantity',
    :'description' => :'description'
  }
end

.json_mapObject

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



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 58

def self.json_map
  {
    :'mandate_id' => :'mandate_id',
    :'preferred_merchant_name' => :'preferred_merchant_name',
    :'merchant_category' => :'merchant_category',
    :'merchant_category_code' => :'merchant_category_code',
    :'decline_threshold' => :'decline_threshold',
    :'recurring_payment_information' => :'recurring_payment_information',
    :'effective_until_time' => :'effective_until_time',
    :'quantity' => :'quantity',
    :'description' => :'description'
  }
end

.swagger_typesObject

Attribute type mapping.



73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 73

def self.swagger_types
  {
    :'mandate_id' => :'String',
    :'preferred_merchant_name' => :'String',
    :'merchant_category' => :'String',
    :'merchant_category_code' => :'String',
    :'decline_threshold' => :'Acpv1instructionsDeclineThreshold',
    :'recurring_payment_information' => :'Acpv1instructionsRecurringPaymentInformation',
    :'effective_until_time' => :'String',
    :'quantity' => :'String',
    :'description' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • to be compared



275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 275

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      mandate_id == o.mandate_id &&
      preferred_merchant_name == o.preferred_merchant_name &&
      merchant_category == o.merchant_category &&
      merchant_category_code == o.merchant_category_code &&
      decline_threshold == o.decline_threshold &&
      recurring_payment_information == o.recurring_payment_information &&
      effective_until_time == o.effective_until_time &&
      quantity == o.quantity &&
      description == o.description
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • type Data type

  • value Value to be deserialized

Returns:

  • Deserialized data



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 325

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 = CyberSource.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:

  • Any valid value

Returns:

  • Returns the value in the form of hash



391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 391

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:

  • Model attributes in the form of hash

Returns:

  • Returns the model itself



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 304

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 the attribute

      # is documented as an array but the input is not

      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{self.class.json_map[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:

  • to be compared

Returns:

See Also:

  • `==` method


291
292
293
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 291

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • Hash code



297
298
299
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 297

def hash
  [mandate_id, preferred_merchant_name, merchant_category, merchant_category_code, decline_threshold, recurring_payment_information, effective_until_time, quantity, description].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 134

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

  #if @mandate_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "mandate_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


  #if !@preferred_merchant_name.nil? && @preferred_merchant_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "preferred_merchant_name", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


  #if !@merchant_category.nil? && @merchant_category !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "merchant_category", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


  #if !@merchant_category_code.nil? && @merchant_category_code !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "merchant_category_code", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


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

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

  #if @effective_until_time !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "effective_until_time", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


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

  #if @description !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

    #invalid_properties.push('invalid value for "description", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')

  #end


  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • Returns the object in the form of hash



371
372
373
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 371

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • Returns the object in the form of hash



377
378
379
380
381
382
383
384
385
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 377

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 the string representation of the object

Returns:

  • String presentation of the object



365
366
367
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 365

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • true if the model is valid



181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/cybersource_rest_client/models/acpv1instructions_mandates.rb', line 181

def valid?
  return false if @mandate_id.nil?
  #return false if @mandate_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  #return false if !@preferred_merchant_name.nil? && @preferred_merchant_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  #return false if !@merchant_category.nil? && @merchant_category !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  #return false if !@merchant_category_code.nil? && @merchant_category_code !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  return false if @decline_threshold.nil?
  return false if @effective_until_time.nil?
  #return false if @effective_until_time !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  return false if @description.nil?
  #return false if @description !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)

  true
end