class UnionPei::AcpService

Public Class Methods

createAutoFormHtml(params, reqUrl) click to toggle source
# File lib/unionpei/acp_service.rb, line 38
def AcpService.createAutoFormHtml(params, reqUrl)
  return SDKUtil.createAutoFormHtml(params, reqUrl)
end
deCodeFileContent(params, fileDirectory) click to toggle source
# File lib/unionpei/acp_service.rb, line 94
def AcpService.deCodeFileContent(params, fileDirectory)
    return SDKUtil.deCodeFileContent(params, fileDirectory)
end
decryptData(data, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd) click to toggle source
# File lib/unionpei/acp_service.rb, line 90
def AcpService.decryptData(data, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd)
    return SDKUtil.decryptPri(data, certPath, certPwd)
end
enCodeFileContent(path) click to toggle source
# File lib/unionpei/acp_service.rb, line 98
def AcpService.enCodeFileContent(path)
    return SDKUtil.enCodeFileContent(path)
end
encryptData(data, certPath=SDKConfig.instance.encryptCertPath) click to toggle source
# File lib/unionpei/acp_service.rb, line 86
def AcpService.encryptData(data, certPath=SDKConfig.instance.encryptCertPath)
    return SDKUtil.encryptPub(data, certPath)
end
getCustomerInfo(customerInfo) click to toggle source
# File lib/unionpei/acp_service.rb, line 42
def AcpService.getCustomerInfo(customerInfo)
  if(customerInfo == nil or customerInfo.length == 0)
      return ""
  end
  return Base.encode64("{" + SDKUtil.createLinkString(customerInfo,false,false)+"}").gsub(/\n|\r/, '')
end
getCustomerInfoWithEncrypt(customerInfo) click to toggle source
# File lib/unionpei/acp_service.rb, line 49
def AcpService.getCustomerInfoWithEncrypt(customerInfo)
  if(customerInfo == nil or customerInfo.length == 0)
    return ""
  end
  encryptedInfo = {}
  for key in customerInfo.keys
    if (key == 'phoneNo' or key == 'cvn2' or key == 'expired')
      encryptedInfo[key] = customerInfo.delete(key)
    end
  end
  if (encryptedInfo.length > 0)
    encryptedInfo = SDKUtil.createLinkString(encryptedInfo, false, false)
    encryptedInfo = AcpService.encryptData(encryptedInfo, SDKConfig.instance.encryptCertPath)
    customerInfo['encryptedInfo'] = encryptedInfo
  end
  return Base64.encode64("{" + SDKUtil.createLinkString(customerInfo,false,false)+"}").gsub(/\n|\r/, '')
end
getEncryptCertId() click to toggle source
# File lib/unionpei/acp_service.rb, line 82
def AcpService.getEncryptCertId
  return CertUtil.getEncryptCertId
end
parseCustomerInfo(customerInfostr, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd) click to toggle source
# File lib/unionpei/acp_service.rb, line 67
def AcpService.parseCustomerInfo(customerInfostr, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd)
  customerInfostr = Base64.decode64(customerInfostr)
  customerInfostr = customerInfostr[1, customerInfostr.length-1]
  customerInfo = SDKUtil.parseQString(customerInfostr)
  if customerInfo['encryptedInfo']
    encryptedInfoStr = customerInfo.delete('encryptedInfo')
    encryptedInfoStr = AcpService.decryptData(encryptedInfoStr, certPath, certPwd)
    encryptedInfo = SDKUtil.parseQString(encryptedInfoStr)
    for key in encryptedInfo.keys
      customerInfo[key] = encryptedInfo[key]
    end
  end
  return customerInfo
end
post(params, url) click to toggle source
# File lib/unionpei/acp_service.rb, line 31
def AcpService.post(params, url)
  content = SDKUtil.createLinkString(params, false, true)
  respString = SDKUtil.post(url, content)
  resp = SDKUtil.parseQString(respString)
  return resp
end
sign(req, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd) click to toggle source
# File lib/unionpei/acp_service.rb, line 11
def AcpService.sign(req, certPath=SDKConfig.instance.signCertPath, certPwd=SDKConfig.instance.signCertPwd)
  SDKUtil.buildSignature(req, certPath, certPwd)
end
signByCertInfo(req, certPath, certPwd) click to toggle source
# File lib/unionpei/acp_service.rb, line 15
def AcpService.signByCertInfo(req, certPath, certPwd)
  SDKUtil.buildSignature(req, certPath, certPwd)
end
signBySecureKey(req, secureKey) click to toggle source
# File lib/unionpei/acp_service.rb, line 19
def AcpService.signBySecureKey(req, secureKey)
  SDKUtil.buildSignature(req, nil, nil, secureKey)
end
updateEncryptCert(params) click to toggle source
# File lib/unionpei/acp_service.rb, line 102
def AcpService.updateEncryptCert(params)
    return SDKUtil.getEncryptCert(params)
end
validate(resp) click to toggle source
# File lib/unionpei/acp_service.rb, line 23
def AcpService.validate(resp)
  SDKUtil.verify(resp)
end
validateBySecureKey(resp, secureKey) click to toggle source
# File lib/unionpei/acp_service.rb, line 27
def AcpService.validateBySecureKey(resp, secureKey)
  SDKUtil.verifyBySecureKey(resp, secureKey)
end