Class: UnionPei::SDKConfig

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/unionpei/sdk_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSDKConfig

Returns a new instance of SDKConfig.



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
# File 'lib/unionpei/sdk_config.rb', line 16

def initialize
  ini = parse_acpsdk
  acpsdk = ini['acpsdk']
  @frontTransUrl = acpsdk['acpsdk.frontTransUrl']
  @singleQueryUrl = acpsdk['acpsdk.singleQueryUrl']
  @backTransUrl = acpsdk['acpsdk.backTransUrl']
  @batchTransUrl = acpsdk['acpsdk.batchTransUrl']
  @fileTransUrl = acpsdk['acpsdk.fileTransUrl']
  @appTransUrl = acpsdk['acpsdk.appTransUrl']
  @cardTransUrl = acpsdk['acpsdk.cardTransUrl']

  @jfFrontTransUrl = acpsdk['acpsdk.jfFrontTransUrl']
  @jfSingleQueryUrl = acpsdk['acpsdk.jfSingleQueryUrl']
  @jfBackTransUrl = acpsdk['acpsdk.jfBackTransUrl']
  @jfCardTransUrl = acpsdk['acpsdk.jfCardTransUrl']
  @jfAppTransUrl = acpsdk['acpsdk.jfAppTransUrl']

  @qrcBackTransUrl = acpsdk['acpsdk.qrcBackTransUrl']
  @qrcB2cIssBackTransUrl = acpsdk['acpsdk.qrcB2cIssBackTransUrl']
  @qrcB2cMerBackTransUrl = acpsdk['acpsdk.qrcB2cMerBackTransUrl']

  @signMethod = acpsdk['acpsdk.signMethod']
  @signMethod = @signMethod.to_s unless @signMethod.nil?
  @version = acpsdk['acpsdk.version']
  @version = '5.0.0' if @version.nil?

  @ifValidateCNName = acpsdk['acpsdk.ifValidateCNName']
  @ifValidateCNName = true if @ifValidateCNName.nil?
  @ifValidateRemoteCert = acpsdk['acpsdk.ifValidateRemoteCert']
  @ifValidateRemoteCert = false if @ifValidateRemoteCert.nil?

  @signCertPath = acpsdk['acpsdk.signCert.path']
  @signCertPwd = acpsdk['acpsdk.signCert.pwd']
  @signCertPwd = @signCertPwd.to_s unless @signCertPwd.nil?

  @validateCertDir = acpsdk['acpsdk.validateCert.dir']
  @encryptCertPath = acpsdk['acpsdk.encryptCert.path']
  @rootCertPath = acpsdk['acpsdk.rootCert.path']
  @middleCertPath = acpsdk['acpsdk.middleCert.path']

  @frontUrl = acpsdk['acpsdk.frontUrl']
  @backUrl = acpsdk['acpsdk.backUrl']

  @encoding = acpsdk['acpsdk.encoding']
  @secureKey = acpsdk['acpsdk.secureKey']
  @secureKey = @secureKey.to_s unless @secureKey.nil?

  @logFilePath = acpsdk['acpsdk.log.file.path']
  @logLevel = acpsdk['acpsdk.log.level']

  @encoding = 'UTF-8'
end

Instance Attribute Details

#appTransUrlObject (readonly)

Returns the value of attribute appTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def appTransUrl
  @appTransUrl
end

#backTransUrlObject (readonly)

Returns the value of attribute backTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def backTransUrl
  @backTransUrl
end

#backUrlObject (readonly)

Returns the value of attribute backUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def backUrl
  @backUrl
end

#batchTransUrlObject (readonly)

Returns the value of attribute batchTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def batchTransUrl
  @batchTransUrl
end

#cardTransUrlObject (readonly)

Returns the value of attribute cardTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def cardTransUrl
  @cardTransUrl
end

#encodingObject (readonly)

Returns the value of attribute encoding.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def encoding
  @encoding
end

#encryptCertPathObject (readonly)

Returns the value of attribute encryptCertPath.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def encryptCertPath
  @encryptCertPath
end

#fileTransUrlObject (readonly)

Returns the value of attribute fileTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def fileTransUrl
  @fileTransUrl
end

#frontTransUrlObject (readonly)

Returns the value of attribute frontTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def frontTransUrl
  @frontTransUrl
end

#frontUrlObject (readonly)

Returns the value of attribute frontUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def frontUrl
  @frontUrl
end

#ifValidateCNNameObject (readonly)

Returns the value of attribute ifValidateCNName.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def ifValidateCNName
  @ifValidateCNName
end

#ifValidateRemoteCertObject (readonly)

Returns the value of attribute ifValidateRemoteCert.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def ifValidateRemoteCert
  @ifValidateRemoteCert
end

#jfAppTransUrlObject (readonly)

Returns the value of attribute jfAppTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def jfAppTransUrl
  @jfAppTransUrl
end

#jfBackTransUrlObject (readonly)

Returns the value of attribute jfBackTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def jfBackTransUrl
  @jfBackTransUrl
end

#jfCardTransUrlObject (readonly)

Returns the value of attribute jfCardTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def jfCardTransUrl
  @jfCardTransUrl
end

#jfFrontTransUrlObject (readonly)

Returns the value of attribute jfFrontTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def jfFrontTransUrl
  @jfFrontTransUrl
end

#jfSingleQueryUrlObject (readonly)

Returns the value of attribute jfSingleQueryUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def jfSingleQueryUrl
  @jfSingleQueryUrl
end

#logFilePathObject (readonly)

Returns the value of attribute logFilePath.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def logFilePath
  @logFilePath
end

#logLevelObject (readonly)

Returns the value of attribute logLevel.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def logLevel
  @logLevel
end

#middleCertPathObject (readonly)

Returns the value of attribute middleCertPath.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def middleCertPath
  @middleCertPath
end

#qrcB2cIssBackTransUrlObject (readonly)

Returns the value of attribute qrcB2cIssBackTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def qrcB2cIssBackTransUrl
  @qrcB2cIssBackTransUrl
end

#qrcB2cMerBackTransUrlObject (readonly)

Returns the value of attribute qrcB2cMerBackTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def qrcB2cMerBackTransUrl
  @qrcB2cMerBackTransUrl
end

#qrcBackTransUrlObject (readonly)

Returns the value of attribute qrcBackTransUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def qrcBackTransUrl
  @qrcBackTransUrl
end

#rootCertPathObject (readonly)

Returns the value of attribute rootCertPath.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def rootCertPath
  @rootCertPath
end

#secureKeyObject (readonly)

Returns the value of attribute secureKey.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def secureKey
  @secureKey
end

#signCertPathObject (readonly)

Returns the value of attribute signCertPath.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def signCertPath
  @signCertPath
end

#signCertPwdObject (readonly)

Returns the value of attribute signCertPwd.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def signCertPwd
  @signCertPwd
end

#signMethodObject (readonly)

Returns the value of attribute signMethod.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def signMethod
  @signMethod
end

#singleQueryUrlObject (readonly)

Returns the value of attribute singleQueryUrl.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def singleQueryUrl
  @singleQueryUrl
end

#validateCertDirObject (readonly)

Returns the value of attribute validateCertDir.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def validateCertDir
  @validateCertDir
end

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/unionpei/sdk_config.rb', line 9

def version
  @version
end

Instance Method Details

#parse_acpsdkObject



69
70
71
72
# File 'lib/unionpei/sdk_config.rb', line 69

def parse_acpsdk
  acp_sdk_config_path = ::UnionPei.configuration.acp_sdk_config_path
  IniParse.parse(File.read(acp_sdk_config_path).force_encoding('UTF-8'))
end