Class: Merchantconfig

Inherits:
Object
  • Object
show all
Defined in:
lib/AuthenticationSDK/core/MerchantConfig.rb

Overview

This fuction has all the merchantConfig properties getters and setters methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cybsPropertyObj) ⇒ Merchantconfig

Returns a new instance of Merchantconfig.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 10

def initialize(cybsPropertyObj)
  # Common Parameters
  @merchantId = cybsPropertyObj['merchantID']
  @runEnvironment = cybsPropertyObj['runEnvironment']
  @intermediateHost = cybsPropertyObj['intermediateHost']
  @defaultDeveloperId = cybsPropertyObj['defaultDeveloperId']
  @authenticationType = cybsPropertyObj['authenticationType']
  @proxyAddress = cybsPropertyObj['proxyAddress']
  @proxyPort = cybsPropertyObj['proxyPort']
  @getId = ''
  @requestHost = ''
  @requestTarget = ''
  @requestJsonData = ''
  # HTTP Parameters
  @merchantSecretKey = cybsPropertyObj['merchantsecretKey']
  @merchantKeyId = cybsPropertyObj['merchantKeyId']
  # JWT Parameters
  @keysDirectory = cybsPropertyObj['keysDirectory']
  @keyAlias = cybsPropertyObj['keyAlias']
  @keyPass = cybsPropertyObj['keyPass']
  @keyFilename = cybsPropertyObj['keyFilename']
  @useMetaKey = cybsPropertyObj['useMetaKey']
  @portfolioID = cybsPropertyObj['portfolioID']
  @solutionId = cybsPropertyObj['solutionId']
  @p12KeyFilePath = nil
  # MutualAuth & OAuth Parameters
  @enableClientCert = cybsPropertyObj['enableClientCert']
  @clientCertDirectory = cybsPropertyObj['clientCertDirectory']
  @sslClientCert = cybsPropertyObj['sslClientCert']
  @privateKey = cybsPropertyObj['privateKey']
  @sslKeyPassword = cybsPropertyObj['sslKeyPassword']
  @clientId = cybsPropertyObj['clientId']
  @clientSecret = cybsPropertyObj['clientSecret']
  @accessToken = cybsPropertyObj['accessToken']
  @refreshToken = cybsPropertyObj['refreshToken']
  # LogConfiguration
  @log_config = LogConfiguration.new(cybsPropertyObj['logConfiguration'])
  # Custom Default Headers
  @defaultCustomHeaders = cybsPropertyObj['defaultCustomHeaders']
  # Keep Alive Time for Connection Pooling
  @keepAliveTime = cybsPropertyObj['keepAliveTime'] || 118 # Default to 118 seconds as same as default of libcurl
  # Path to client JWE pem file directory
  @pemFileDirectory = cybsPropertyObj['pemFileDirectory']
  @mleKeyAlias = cybsPropertyObj['mleKeyAlias']
  @useMLEGlobally = cybsPropertyObj['useMLEGlobally']
  @enableRequestMLEForOptionalApisGlobally = !!(cybsPropertyObj['enableRequestMLEForOptionalApisGlobally'] || cybsPropertyObj['useMLEGlobally'])
  @disableRequestMLEForMandatoryApisGlobally = cybsPropertyObj['disableRequestMLEForMandatoryApisGlobally']

  
  if !cybsPropertyObj['mleForRequestPublicCertPath'].nil? && !cybsPropertyObj['mleForRequestPublicCertPath'].to_s.strip.empty?
      @mleForRequestPublicCertPath = cybsPropertyObj['mleForRequestPublicCertPath'].to_s.strip
  end

  @mapToControlMLEonAPI = cybsPropertyObj['mapToControlMLEonAPI']
  validateMerchantDetails
  validateMLEConfiguration(cybsPropertyObj)
  @p12KeyFilePath = File.join(@keysDirectory, @keyFilename + ".p12")
  logAllProperties(cybsPropertyObj)
end

Instance Attribute Details

#accessTokenObject

Returns the value of attribute accessToken.



390
391
392
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 390

def accessToken
  @accessToken
end

#authenticationTypeObject

Returns the value of attribute authenticationType.



372
373
374
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 372

def authenticationType
  @authenticationType
end

#clientCertDirectoryObject

Returns the value of attribute clientCertDirectory.



384
385
386
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 384

def clientCertDirectory
  @clientCertDirectory
end

#clientIdObject

Returns the value of attribute clientId.



388
389
390
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 388

def clientId
  @clientId
end

#clientSecretObject

Returns the value of attribute clientSecret.



389
390
391
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 389

def clientSecret
  @clientSecret
end

#defaultCustomHeadersObject

Returns the value of attribute defaultCustomHeaders.



403
404
405
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 403

def defaultCustomHeaders
  @defaultCustomHeaders
end

#defaultDeveloperIdObject

Returns the value of attribute defaultDeveloperId.



376
377
378
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 376

def defaultDeveloperId
  @defaultDeveloperId
end

#disableRequestMLEForMandatoryApisGloballyObject

Returns the value of attribute disableRequestMLEForMandatoryApisGlobally.



407
408
409
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 407

def disableRequestMLEForMandatoryApisGlobally
  @disableRequestMLEForMandatoryApisGlobally
end

#enableClientCertObject

Returns the value of attribute enableClientCert.



383
384
385
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 383

def enableClientCert
  @enableClientCert
end

#enableRequestMLEForOptionalApisGloballyObject

Returns the value of attribute enableRequestMLEForOptionalApisGlobally.



406
407
408
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 406

def enableRequestMLEForOptionalApisGlobally
  @enableRequestMLEForOptionalApisGlobally
end

#getIdObject

Returns the value of attribute getId.



395
396
397
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 395

def getId
  @getId
end

#intermediateHostObject

Returns the value of attribute intermediateHost.



375
376
377
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 375

def intermediateHost
  @intermediateHost
end

#keepAliveTimeObject

Returns the value of attribute keepAliveTime.



382
383
384
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 382

def keepAliveTime
  @keepAliveTime
end

#keyAliasObject

Returns the value of attribute keyAlias.



377
378
379
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 377

def keyAlias
  @keyAlias
end

#keyFilenameObject

Returns the value of attribute keyFilename.



379
380
381
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 379

def keyFilename
  @keyFilename
end

#keyPassObject

Returns the value of attribute keyPass.



378
379
380
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 378

def keyPass
  @keyPass
end

#keysDirectoryObject

Returns the value of attribute keysDirectory.



373
374
375
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 373

def keysDirectory
  @keysDirectory
end

#log_configObject

Returns the value of attribute log_config.



397
398
399
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 397

def log_config
  @log_config
end

#log_objObject

Returns the value of attribute log_obj.



401
402
403
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 401

def log_obj
  @log_obj
end

#loggerObject

Returns the value of attribute logger.



396
397
398
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 396

def logger
  @logger
end

#mapToControlMLEonAPIObject

Returns the value of attribute mapToControlMLEonAPI.



409
410
411
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 409

def mapToControlMLEonAPI
  @mapToControlMLEonAPI
end

#merchantIdObject

getter and setter methods



369
370
371
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 369

def merchantId
  @merchantId
end

#merchantKeyIdObject

Returns the value of attribute merchantKeyId.



371
372
373
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 371

def merchantKeyId
  @merchantKeyId
end

#merchantSecretKeyObject

Returns the value of attribute merchantSecretKey.



370
371
372
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 370

def merchantSecretKey
  @merchantSecretKey
end

#mleForRequestPublicCertPathObject

Returns the value of attribute mleForRequestPublicCertPath.



408
409
410
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 408

def mleForRequestPublicCertPath
  @mleForRequestPublicCertPath
end

#mleKeyAliasObject

Returns the value of attribute mleKeyAlias.



410
411
412
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 410

def mleKeyAlias
  @mleKeyAlias
end

#p12KeyFilePathObject

Returns the value of attribute p12KeyFilePath.



411
412
413
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 411

def p12KeyFilePath
  @p12KeyFilePath
end

#pemFileDirectoryObject

Returns the value of attribute pemFileDirectory.



404
405
406
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 404

def pemFileDirectory
  @pemFileDirectory
end

#portfolioIDObject

Returns the value of attribute portfolioID.



381
382
383
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 381

def portfolioID
  @portfolioID
end

#privateKeyObject

Returns the value of attribute privateKey.



387
388
389
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 387

def privateKey
  @privateKey
end

#proxyAddressObject

Returns the value of attribute proxyAddress.



398
399
400
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 398

def proxyAddress
  @proxyAddress
end

#proxyPortObject

Returns the value of attribute proxyPort.



399
400
401
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 399

def proxyPort
  @proxyPort
end

#refreshTokenObject

Returns the value of attribute refreshToken.



391
392
393
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 391

def refreshToken
  @refreshToken
end

#requestHostObject

Returns the value of attribute requestHost.



374
375
376
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 374

def requestHost
  @requestHost
end

#requestJsonDataObject

Returns the value of attribute requestJsonData.



392
393
394
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 392

def requestJsonData
  @requestJsonData
end

#requestTargetObject

Returns the value of attribute requestTarget.



400
401
402
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 400

def requestTarget
  @requestTarget
end

#requestTypeObject

Returns the value of attribute requestType.



394
395
396
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 394

def requestType
  @requestType
end

#requestUrlObject

Returns the value of attribute requestUrl.



393
394
395
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 393

def requestUrl
  @requestUrl
end

#solutionIdObject

Returns the value of attribute solutionId.



402
403
404
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 402

def solutionId
  @solutionId
end

#sslClientCertObject

Returns the value of attribute sslClientCert.



385
386
387
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 385

def sslClientCert
  @sslClientCert
end

#sslKeyPasswordObject

Returns the value of attribute sslKeyPassword.



386
387
388
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 386

def sslKeyPassword
  @sslKeyPassword
end

#useMetaKeyObject

Returns the value of attribute useMetaKey.



380
381
382
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 380

def useMetaKey
  @useMetaKey
end

#useMLEGloballyObject

Returns the value of attribute useMLEGlobally.



405
406
407
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 405

def useMLEGlobally
  @useMLEGlobally
end

Instance Method Details

#check_key_fileObject



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 339

def check_key_file
  # Directory exists?
  unless Dir.exist?(@keysDirectory)
    @log_obj.logger.error("Keys Directory not found. Entered directory : #{@keysDirectory}")
    return false
  end

  key_file_pathname = File.join(@keysDirectory, @keyFilename + ".p12")

  # File exists?
  unless File.exist?(key_file_pathname)
    @log_obj.logger.error("Key File not found. Check path/filename entered. Entered path/filename : #{key_file_pathname}")
    return false
  end

  @log_obj.logger.info("Entered value for Key File Path : #{key_file_pathname}")

  # Can file be opened for reading?
  begin
    File.open(key_file_pathname, 'rb') do |f|
      # Just open and close
    end
    return true
  rescue => e
    @log_obj.logger.info("File cannot be accessed. Permission denied : #{key_file_pathname}")
    return false
  end
end

#logAllProperties(merchantPropertyObj) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 321

def logAllProperties(merchantPropertyObj)
  propertyObj = Marshal.load(Marshal.dump(merchantPropertyObj))      
  merchantConfig = ''
  hiddenProperties = (Constants::HIDDEN_MERCHANT_PROPERTIES).split(',')
  hiddenPropArray = Array.new
  hiddenProperties.each do |value|
    hiddenPropArray << value.strip
  end
  hiddenPropArray.each do |prop|
    propertyObj.each do |key, value|
      if key == prop
        propertyObj.delete(key)
      end
    end
  end
  @log_obj.logger.info('Merchant Configuration :\n' + propertyObj.to_s)
end

#validateMerchantDetailsObject

fall back logic



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 71

def validateMerchantDetails()
  if !@keepAliveTime.is_a?(Integer)
    err = StandardError.new(Constants::ERROR_PREFIX + "keepAliveTime must be an integer and in seconds")
    raise err
  end
  
  logmessage = ''
  @log_config.validate(logmessage)
  @log_obj = Log.new @log_config, "MerchantConfig"
  @log_obj.logger.info('START> =======================================')
  if !logmessage.to_s.empty?
    @log_obj.logger.warn(ExceptionHandler.new.new_api_warning logmessage)
  end
  if @authenticationType.to_s.empty?
    err = StandardError.new(Constants::ERROR_PREFIX + Constants::AUTH_TYPE_MANDATORY)
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end
  if !@authenticationType.instance_of? String
    err = StandardError.new(Constants::ERROR_PREFIX+ Constants::AUTH_ERROR)
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end
  if !@runEnvironment.to_s.empty?
    if !@runEnvironment.instance_of? String
      @requestHost = @runEnvironment.to_s
    end

    if Constants::OLD_RUN_ENVIRONMENT_CONSTANTS.include?(@runEnvironment.upcase)
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::DEPRECATED_ENVIRONMENT)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    else
      @requestHost = @runEnvironment
    end
  elsif @runEnvironment.to_s.empty?
    err = StandardError.new(Constants::ERROR_PREFIX + Constants::RUN_ENVIRONMENT)
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end

  if !@enableClientCert.nil? && @enableClientCert
    if @sslClientCert.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::SSL_CLIENT_CERT_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@sslClientCert.instance_of? String
      @sslClientCert=@sslClientCert.to_s
    end
    if @privateKey.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::PRIVATE_KEY_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@privateKey.instance_of? String
      @privateKey=@privateKey.to_s
    end
    if @sslKeyPassword.to_s.empty?
      err = Constants::WARNING_PREFIX + Constants::SSL_KEY_PASSWORD_EMPTY
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning err)
      raise err
    elsif !@sslKeyPassword.instance_of? String
      @sslKeyPassword=@sslKeyPassword.to_s
    end
    if @clientCertDirectory.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_CERT_DIR_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@clientCertDirectory.instance_of? String
      @clientCertDirectory=@clientCertDirectory.to_s
    end
  end

  if @authenticationType.upcase == Constants::AUTH_TYPE_JWT
    if @merchantId.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::MERCHANT_ID_NULL)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@merchantId.instance_of? String
      @merchantId=@merchantId.to_s
    end
    if @keyAlias.to_s.empty?
      @keyAlias = @merchantId
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning Constants::WARNING_PREFIX + Constants::KEY_ALIAS_NULL_EMPTY)
    elsif !@keyAlias.instance_of? String
      @keyAlias=@keyAlias.to_s
    elsif @keyAlias != @merchantId
      @keyAlias = @merchantId
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning Constants::WARNING_PREFIX + Constants::INCORRECT_KEY_ALIAS)
    end
    if @keyPass.to_s.empty?
      @keyPass = @merchantId
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning Constants::WARNING_PREFIX + Constants::KEY_PASS_NULL)
    elsif !@keyPass.instance_of? String
      @keyPass=@keyPass.to_s
    end
    if @keysDirectory.to_s.empty?
      @keysDirectory = Constants::DEFAULT_KEY_DIRECTORY
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning Constants::WARNING_PREFIX + Constants::KEY_DIRECTORY_EMPTY + @keysDirectory)
    elsif !@keysDirectory.instance_of? String
      @keysDirectory=@keysDirectory.to_s
    end
    if @keyFilename.to_s.empty?
      @keyFilename = @merchantId
      @log_obj.logger.warn(ExceptionHandler.new.new_api_warning Constants::WARNING_PREFIX + Constants::KEY_FILE_NAME_NULL_EMPTY)
    elsif !@keyFilename.instance_of? String
      @keyFilename=@keyFilename.to_s
    end
    if !check_key_file
      @log_obj.logger.error(ExceptionHandler.new.new_custom_error "Error finding or accessing the Key Directory or Key File. Please review the values in the merchant configuration.")
    end
  end
  if @authenticationType.upcase == Constants::AUTH_TYPE_MUTUAL_AUTH
    if @clientId.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_ID_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@clientId.instance_of? String
      @clientId=@clientId.to_s
    end
    if @clientSecret.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::CLIENT_SECRET_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@clientSecret.instance_of? String
      @clientSecret=@clientSecret.to_s
    end
  end
  if @authenticationType.upcase == Constants::AUTH_TYPE_OAUTH
    if @accessToken.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::ACCESS_TOKEN_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@accessToken.instance_of? String
      @accessToken=@accessToken.to_s
    end
    if @refreshToken.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::REFRESH_TOKEN_EMPTY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@refreshToken.instance_of? String
      @refreshToken=@refreshToken.to_s
    end
  end
  if @authenticationType.upcase == Constants::AUTH_TYPE_HTTP
    if @merchantId.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX + Constants::MERCHANT_ID_NULL)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@merchantId.instance_of? String
      @merchantId=@merchantId.to_s
    end
    if @merchantKeyId.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX+ Constants::MERCHANT_KEY_ID_MANDATORY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@merchantKeyId.instance_of? String
      @merchantKeyId=@merchantKeyId.to_s
    end
    if @merchantSecretKey.to_s.empty?
      err = StandardError.new(Constants::ERROR_PREFIX+ Constants::MERCHANT_SECRET_KEY_MANDATORY)
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    elsif !@merchantSecretKey.instance_of? String
      @merchantSecretKey=@merchantSecretKey.to_s
    end
  end
  if @useMetaKey && @portfolioID.to_s.empty?
    err = StandardError.new(Constants::ERROR_PREFIX+ Constants::PORTFOLIO_ID_MANDATORY)
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end

  if !@proxyAddress.instance_of? String
    @proxyAddress=@proxyAddress.to_s
  end
  if !@proxyPort.instance_of? String
    @proxyPort=@proxyPort.to_s
  end
  unless @pemFileDirectory.instance_of? String
    @pemFileDirectory = @pemFileDirectory.to_s
  end
end

#validateMLEConfiguration(cybsPropertyObj) ⇒ Object



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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/AuthenticationSDK/core/MerchantConfig.rb', line 254

def validateMLEConfiguration(cybsPropertyObj)

  if !@useMLEGlobally.nil? && !cybsPropertyObj['enableRequestMLEForOptionalApisGlobally'].nil?
    if @useMLEGlobally != cybsPropertyObj['enableRequestMLEForOptionalApisGlobally']
      raise StandardError.new(Constants::ERROR_PREFIX + "useMLEGlobally and enableRequestMLEForOptionalApisGlobally must have the same value if both are set")
    end
  end

  if @disableRequestMLEForMandatoryApisGlobally.nil?
    @disableRequestMLEForMandatoryApisGlobally = false
  end

  unless [true, false].include?(@disableRequestMLEForMandatoryApisGlobally)
    err = StandardError.new(Constants::ERROR_PREFIX + "disableRequestMLEForMandatoryApisGlobally must be a boolean")
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end

  unless [true, false].include?(@enableRequestMLEForOptionalApisGlobally)
    err = StandardError.new(Constants::ERROR_PREFIX + "enableRequestMLEForOptionalApisGlobally must be a boolean")
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end

  unless @mapToControlMLEonAPI.nil?
    unless @mapToControlMLEonAPI.is_a?(Hash) && @mapToControlMLEonAPI.keys.all? {|k| k.is_a?(String)} && @mapToControlMLEonAPI.values.all? { |v| [true, false].include?(v) }
      err = StandardError.new(Constants::ERROR_PREFIX + "mapToControlMLEonAPI must be a map with boolean values")
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    end
  end

  !@mleKeyAlias.nil? && unless @mleKeyAlias.instance_of? String
                          (err = StandardError.new(Constants::ERROR_PREFIX + "mleKeyAlias must be a string"))
                          @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
                          raise err
                        end
  if @mleKeyAlias.to_s.empty?
    @mleKeyAlias = Constants::DEFAULT_ALIAS_FOR_MLE_CERT
  end

  if @mleForRequestPublicCertPath && !@mleForRequestPublicCertPath.to_s.strip.empty?
    begin
      CertificateUtility.validatePathAndFile(@mleForRequestPublicCertPath, "mleForRequestPublicCertPath", @log_config)
    rescue => err
      @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
      raise err
    end
  end

  request_mle_configured = @enableRequestMLEForOptionalApisGlobally
  if !@mapToControlMLEonAPI.nil? && !@mapToControlMLEonAPI.empty?
    @mapToControlMLEonAPI.each do |_, value|
      unless [true, false].include?(value) && value
        request_mle_configured = true
        break
      end
    end
  end

  if request_mle_configured && !Constants::AUTH_TYPE_JWT.eql?(@authenticationType.upcase)
    err = StandardError.new(Constants::ERROR_PREFIX + "Request MLE can only be used with JWT authentication")
    @log_obj.logger.error(ExceptionHandler.new.new_api_exception err)
    raise err
  end
end