Class: AlogramPayRisk::EntityIds

Inherits:
ApiModelBase show all
Defined in:
lib/alogram_payrisk/models/entity_ids.rb

Overview

Canonical entity identifiers (tenant/client/user/device/session). Do not send raw PII. Hash emails/phones/addresses as sha256 and prefix with ‘sha256_’. Tiered support: - tenantId is the top-level SaaS customer (required for all flows). - clientId is the tenant’s downstream business customer (e.g. merchant/partner) and MAY be omitted for processor / bank / PSP-style integrations. - endCustomerId is the tenant/client’s consumer or business account (cardholder, shopper, etc.) and MAY be omitted for purely device- or instrument-level checks.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ EntityIds

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 109

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `AlogramPayRisk::EntityIds` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `AlogramPayRisk::EntityIds`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'tenant_id')
    self.tenant_id = attributes[:'tenant_id']
  end

  if attributes.key?(:'client_id')
    self.client_id = attributes[:'client_id']
  end

  if attributes.key?(:'end_customer_id')
    self.end_customer_id = attributes[:'end_customer_id']
  end

  if attributes.key?(:'member_id')
    self.member_id = attributes[:'member_id']
  end

  if attributes.key?(:'payment_instrument_id')
    self.payment_instrument_id = attributes[:'payment_instrument_id']
  end

  if attributes.key?(:'device_id')
    self.device_id = attributes[:'device_id']
  end

  if attributes.key?(:'session_id')
    self.session_id = attributes[:'session_id']
  end

  if attributes.key?(:'email_hash')
    self.email_hash = attributes[:'email_hash']
  end

  if attributes.key?(:'email_domain_hash')
    self.email_domain_hash = attributes[:'email_domain_hash']
  end

  if attributes.key?(:'phone_hash')
    self.phone_hash = attributes[:'phone_hash']
  end

  if attributes.key?(:'shipping_address_hash')
    self.shipping_address_hash = attributes[:'shipping_address_hash']
  end

  if attributes.key?(:'billing_address_hash')
    self.billing_address_hash = attributes[:'billing_address_hash']
  end
end

Instance Attribute Details

#billing_address_hashObject

Normalized+lowercased billing address hash (e.g., sha256).



53
54
55
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 53

def billing_address_hash
  @billing_address_hash
end

#client_idObject

Canonical ID for the Tenant’s business customer (e.g., merchant/partner). Opaque, immutable, lowercase. Must start with ‘cid_’.



23
24
25
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 23

def client_id
  @client_id
end

#device_idObject

Server-issued stable device token (device-level identifier). Should persist across sessions and logins on the same browser/device.



35
36
37
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 35

def device_id
  @device_id
end

#email_domain_hashObject

Normalized+lowercased email domain hash (e.g., sha256).



44
45
46
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 44

def email_domain_hash
  @email_domain_hash
end

#email_hashObject

Normalized+lowercased email hash (e.g., sha256).



41
42
43
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 41

def email_hash
  @email_hash
end

#end_customer_idObject

Canonical ID for the client’s end user / consumer (account holder). Opaque, immutable, lowercase. Must start with "ecid_". Do not put PII (like emails or phone numbers) in this field.



26
27
28
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 26

def end_customer_id
  @end_customer_id
end

#member_idObject

Canonical ID for a Tenant member/operator (employee/contractor) using the platform. Opaque, immutable, lowercase. Must start with ‘mid_’.



29
30
31
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 29

def member_id
  @member_id
end

#payment_instrument_idObject

Tokenized instrument ID (non-PCI).



32
33
34
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 32

def payment_instrument_id
  @payment_instrument_id
end

#phone_hashObject

Normalized+lowercased phone hash (e.g., sha256).



47
48
49
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 47

def phone_hash
  @phone_hash
end

#session_idObject

Application/user session identifier (login or checkout session). Typically rotates more frequently than deviceId and may be tied to authentication.



38
39
40
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 38

def session_id
  @session_id
end

#shipping_address_hashObject

Normalized+lowercased shipping address hash (e.g., sha256).



50
51
52
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 50

def shipping_address_hash
  @shipping_address_hash
end

#tenant_idObject

Canonical ID for the paying organization (Tenant). Opaque, immutable, lowercase. Must start with "tid_". Do not use domains or emails here. For a tenant’s domain, use a separate field (e.g., tenantDomain).



20
21
22
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 20

def tenant_id
  @tenant_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



74
75
76
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 74

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 79

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 56

def self.attribute_map
  {
    :'tenant_id' => :'tenantId',
    :'client_id' => :'clientId',
    :'end_customer_id' => :'endCustomerId',
    :'member_id' => :'memberId',
    :'payment_instrument_id' => :'paymentInstrumentId',
    :'device_id' => :'deviceId',
    :'session_id' => :'sessionId',
    :'email_hash' => :'emailHash',
    :'email_domain_hash' => :'emailDomainHash',
    :'phone_hash' => :'phoneHash',
    :'shipping_address_hash' => :'shippingAddressHash',
    :'billing_address_hash' => :'billingAddressHash'
  }
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



617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 617

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif 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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



102
103
104
105
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 102

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 84

def self.openapi_types
  {
    :'tenant_id' => :'String',
    :'client_id' => :'String',
    :'end_customer_id' => :'String',
    :'member_id' => :'String',
    :'payment_instrument_id' => :'String',
    :'device_id' => :'String',
    :'session_id' => :'String',
    :'email_hash' => :'String',
    :'email_domain_hash' => :'String',
    :'phone_hash' => :'String',
    :'shipping_address_hash' => :'String',
    :'billing_address_hash' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 585

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      tenant_id == o.tenant_id &&
      client_id == o.client_id &&
      end_customer_id == o.end_customer_id &&
      member_id == o.member_id &&
      payment_instrument_id == o.payment_instrument_id &&
      device_id == o.device_id &&
      session_id == o.session_id &&
      email_hash == o.email_hash &&
      email_domain_hash == o.email_domain_hash &&
      phone_hash == o.phone_hash &&
      shipping_address_hash == o.shipping_address_hash &&
      billing_address_hash == o.billing_address_hash
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


604
605
606
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 604

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



610
611
612
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 610

def hash
  [tenant_id, client_id, end_customer_id, member_id, payment_instrument_id, device_id, session_id, email_hash, email_domain_hash, phone_hash, shipping_address_hash, billing_address_hash].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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/alogram_payrisk/models/entity_ids.rb', line 174

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@tenant_id.nil? && @tenant_id.to_s.length > 64
    invalid_properties.push('invalid value for "tenant_id", the character length must be smaller than or equal to 64.')
  end

  if !@tenant_id.nil? && @tenant_id.to_s.length < 5
    invalid_properties.push('invalid value for "tenant_id", the character length must be greater than or equal to 5.')
  end

  pattern = Regexp.new(/^tid_[a-z0-9\-_]{2,60}$/)
  if !@tenant_id.nil? && @tenant_id !~ pattern
    invalid_properties.push("invalid value for \"tenant_id\", must conform to the pattern #{pattern}.")
  end

  if !@client_id.nil? && @client_id.to_s.length > 100
    invalid_properties.push('invalid value for "client_id", the character length must be smaller than or equal to 100.')
  end

  if !@client_id.nil? && @client_id.to_s.length < 5
    invalid_properties.push('invalid value for "client_id", the character length must be greater than or equal to 5.')
  end

  pattern = Regexp.new(/^cid_[a-z0-9\-_]{2,96}$/)
  if !@client_id.nil? && @client_id !~ pattern
    invalid_properties.push("invalid value for \"client_id\", must conform to the pattern #{pattern}.")
  end

  if !@end_customer_id.nil? && @end_customer_id.to_s.length > 100
    invalid_properties.push('invalid value for "end_customer_id", the character length must be smaller than or equal to 100.')
  end

  if !@end_customer_id.nil? && @end_customer_id.to_s.length < 6
    invalid_properties.push('invalid value for "end_customer_id", the character length must be greater than or equal to 6.')
  end

  pattern = Regexp.new(/^ecid_[a-z0-9\-_]{2,96}$/)
  if !@end_customer_id.nil? && @end_customer_id !~ pattern
    invalid_properties.push("invalid value for \"end_customer_id\", must conform to the pattern #{pattern}.")
  end

  if !@member_id.nil? && @member_id.to_s.length > 100
    invalid_properties.push('invalid value for "member_id", the character length must be smaller than or equal to 100.')
  end

  if !@member_id.nil? && @member_id.to_s.length < 5
    invalid_properties.push('invalid value for "member_id", the character length must be greater than or equal to 5.')
  end

  pattern = Regexp.new(/^mid_[a-z0-9\-_]{2,96}$/)
  if !@member_id.nil? && @member_id !~ pattern
    invalid_properties.push("invalid value for \"member_id\", must conform to the pattern #{pattern}.")
  end

  if !@payment_instrument_id.nil? && @payment_instrument_id.to_s.length > 100
    invalid_properties.push('invalid value for "payment_instrument_id", the character length must be smaller than or equal to 100.')
  end

  pattern = Regexp.new(/^[a-zA-Z0-9\-_:]{2,96}$/)
  if !@payment_instrument_id.nil? && @payment_instrument_id !~ pattern
    invalid_properties.push("invalid value for \"payment_instrument_id\", must conform to the pattern #{pattern}.")
  end

  if !@device_id.nil? && @device_id.to_s.length > 100
    invalid_properties.push('invalid value for "device_id", the character length must be smaller than or equal to 100.')
  end

  pattern = Regexp.new(/^did_[a-zA-Z0-9\-_:]{2,96}$/)
  if !@device_id.nil? && @device_id !~ pattern
    invalid_properties.push("invalid value for \"device_id\", must conform to the pattern #{pattern}.")
  end

  if !@session_id.nil? && @session_id.to_s.length > 100
    invalid_properties.push('invalid value for "session_id", the character length must be smaller than or equal to 100.')
  end

  pattern = Regexp.new(/^sid_[a-zA-Z0-9\-_:]{2,96}$/)
  if !@session_id.nil? && @session_id !~ pattern
    invalid_properties.push("invalid value for \"session_id\", must conform to the pattern #{pattern}.")
  end

  if !@email_hash.nil? && @email_hash.to_s.length > 71
    invalid_properties.push('invalid value for "email_hash", the character length must be smaller than or equal to 71.')
  end

  pattern = Regexp.new(/^sha256_[0-9a-f]{64}$/)
  if !@email_hash.nil? && @email_hash !~ pattern
    invalid_properties.push("invalid value for \"email_hash\", must conform to the pattern #{pattern}.")
  end

  if !@email_domain_hash.nil? && @email_domain_hash.to_s.length > 71
    invalid_properties.push('invalid value for "email_domain_hash", the character length must be smaller than or equal to 71.')
  end

  pattern = Regexp.new(/^sha256_[0-9a-f]{64}$/)
  if !@email_domain_hash.nil? && @email_domain_hash !~ pattern
    invalid_properties.push("invalid value for \"email_domain_hash\", must conform to the pattern #{pattern}.")
  end

  if !@phone_hash.nil? && @phone_hash.to_s.length > 71
    invalid_properties.push('invalid value for "phone_hash", the character length must be smaller than or equal to 71.')
  end

  pattern = Regexp.new(/^sha256_[0-9a-f]{64}$/)
  if !@phone_hash.nil? && @phone_hash !~ pattern
    invalid_properties.push("invalid value for \"phone_hash\", must conform to the pattern #{pattern}.")
  end

  if !@shipping_address_hash.nil? && @shipping_address_hash.to_s.length > 71
    invalid_properties.push('invalid value for "shipping_address_hash", the character length must be smaller than or equal to 71.')
  end

  pattern = Regexp.new(/^sha256_[0-9a-f]{64}$/)
  if !@shipping_address_hash.nil? && @shipping_address_hash !~ pattern
    invalid_properties.push("invalid value for \"shipping_address_hash\", must conform to the pattern #{pattern}.")
  end

  if !@billing_address_hash.nil? && @billing_address_hash.to_s.length > 71
    invalid_properties.push('invalid value for "billing_address_hash", the character length must be smaller than or equal to 71.')
  end

  pattern = Regexp.new(/^sha256_[0-9a-f]{64}$/)
  if !@billing_address_hash.nil? && @billing_address_hash !~ pattern
    invalid_properties.push("invalid value for \"billing_address_hash\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 639

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/alogram_payrisk/models/entity_ids.rb', line 306

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@tenant_id.nil? && @tenant_id.to_s.length > 64
  return false if !@tenant_id.nil? && @tenant_id.to_s.length < 5
  return false if !@tenant_id.nil? && @tenant_id !~ Regexp.new(/^tid_[a-z0-9\-_]{2,60}$/)
  return false if !@client_id.nil? && @client_id.to_s.length > 100
  return false if !@client_id.nil? && @client_id.to_s.length < 5
  return false if !@client_id.nil? && @client_id !~ Regexp.new(/^cid_[a-z0-9\-_]{2,96}$/)
  return false if !@end_customer_id.nil? && @end_customer_id.to_s.length > 100
  return false if !@end_customer_id.nil? && @end_customer_id.to_s.length < 6
  return false if !@end_customer_id.nil? && @end_customer_id !~ Regexp.new(/^ecid_[a-z0-9\-_]{2,96}$/)
  return false if !@member_id.nil? && @member_id.to_s.length > 100
  return false if !@member_id.nil? && @member_id.to_s.length < 5
  return false if !@member_id.nil? && @member_id !~ Regexp.new(/^mid_[a-z0-9\-_]{2,96}$/)
  return false if !@payment_instrument_id.nil? && @payment_instrument_id.to_s.length > 100
  return false if !@payment_instrument_id.nil? && @payment_instrument_id !~ Regexp.new(/^[a-zA-Z0-9\-_:]{2,96}$/)
  return false if !@device_id.nil? && @device_id.to_s.length > 100
  return false if !@device_id.nil? && @device_id !~ Regexp.new(/^did_[a-zA-Z0-9\-_:]{2,96}$/)
  return false if !@session_id.nil? && @session_id.to_s.length > 100
  return false if !@session_id.nil? && @session_id !~ Regexp.new(/^sid_[a-zA-Z0-9\-_:]{2,96}$/)
  return false if !@email_hash.nil? && @email_hash.to_s.length > 71
  return false if !@email_hash.nil? && @email_hash !~ Regexp.new(/^sha256_[0-9a-f]{64}$/)
  return false if !@email_domain_hash.nil? && @email_domain_hash.to_s.length > 71
  return false if !@email_domain_hash.nil? && @email_domain_hash !~ Regexp.new(/^sha256_[0-9a-f]{64}$/)
  return false if !@phone_hash.nil? && @phone_hash.to_s.length > 71
  return false if !@phone_hash.nil? && @phone_hash !~ Regexp.new(/^sha256_[0-9a-f]{64}$/)
  return false if !@shipping_address_hash.nil? && @shipping_address_hash.to_s.length > 71
  return false if !@shipping_address_hash.nil? && @shipping_address_hash !~ Regexp.new(/^sha256_[0-9a-f]{64}$/)
  return false if !@billing_address_hash.nil? && @billing_address_hash.to_s.length > 71
  return false if !@billing_address_hash.nil? && @billing_address_hash !~ Regexp.new(/^sha256_[0-9a-f]{64}$/)
  true
end