Files
certd/packages/libs/lib-jdcloud/src/repo/cloudauth/v1/cloudauth.js
2025-04-02 23:13:55 +08:00

3187 lines
86 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Copyright 2018 JDCLOUD.COM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:#www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* 用户管理接口
* 实名认证-用户管理接口
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
require('../../../lib/node_loader')
var JDCloud = require('../../../lib/core')
var Service = JDCloud.Service
var serviceId = 'cloudauth'
Service._services[serviceId] = true
/**
* cloudauth service.
* @version 1.0.16
*/
class CLOUDAUTH extends Service {
constructor (options = {}) {
options._defaultEndpoint = {}
options._defaultEndpoint.protocol =
options._defaultEndpoint.protocol || 'https'
options._defaultEndpoint.host =
options._defaultEndpoint.host || 'cloudauth.jdcloud-api.com'
options.basePath = '/v1' // 默认要设为空""
super(serviceId, options)
}
/**
* 个人实名认证
* @param {Object} opts - parameters
* @param {personalSpec} opts.personalSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalAuth (opts, callback) {
opts = opts || {}
if (opts.personalSpec === undefined || opts.personalSpec === null) {
throw new Error(
"Missing the required parameter 'opts.personalSpec' when calling personalAuth"
)
}
let postBody = {}
if (opts.personalSpec !== undefined && opts.personalSpec !== null) {
postBody['personalSpec'] = opts.personalSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalAuth with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/personal',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人手机号三要素详版
* @param {Object} opts - parameters
* @param {personalMobileSpec} opts.personalMobileSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalMobile (opts, callback) {
opts = opts || {}
if (
opts.personalMobileSpec === undefined ||
opts.personalMobileSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.personalMobileSpec' when calling personalMobile"
)
}
let postBody = {}
if (
opts.personalMobileSpec !== undefined &&
opts.personalMobileSpec !== null
) {
postBody['personalMobileSpec'] = opts.personalMobileSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalMobile with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/detail:mobile3',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人银行卡三要素详版
* @param {Object} opts - parameters
* @param {personalBankcard} opts.personalSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalBankcard3Detail (opts, callback) {
opts = opts || {}
if (opts.personalSpec === undefined || opts.personalSpec === null) {
throw new Error(
"Missing the required parameter 'opts.personalSpec' when calling personalBankcard3Detail"
)
}
let postBody = {}
if (opts.personalSpec !== undefined && opts.personalSpec !== null) {
postBody['personalSpec'] = opts.personalSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalBankcard3Detail with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/detail:bankcard3',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人银行卡三要素非身份证版
* @param {Object} opts - parameters
* @param {personalBankcardOther} opts.personalSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalBankcard3Other (opts, callback) {
opts = opts || {}
if (opts.personalSpec === undefined || opts.personalSpec === null) {
throw new Error(
"Missing the required parameter 'opts.personalSpec' when calling personalBankcard3Other"
)
}
let postBody = {}
if (opts.personalSpec !== undefined && opts.personalSpec !== null) {
postBody['personalSpec'] = opts.personalSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalBankcard3Other with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/other:bankcard3',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人银行卡四要素详版
* @param {Object} opts - parameters
* @param {personalBankcard} opts.personalSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalBankcard4Detail (opts, callback) {
opts = opts || {}
if (opts.personalSpec === undefined || opts.personalSpec === null) {
throw new Error(
"Missing the required parameter 'opts.personalSpec' when calling personalBankcard4Detail"
)
}
let postBody = {}
if (opts.personalSpec !== undefined && opts.personalSpec !== null) {
postBody['personalSpec'] = opts.personalSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalBankcard4Detail with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/detail:bankcard4',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人银行卡四要素非身份证版
* @param {Object} opts - parameters
* @param {personalBankcardOther} opts.personalSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
personalBankcard4Other (opts, callback) {
opts = opts || {}
if (opts.personalSpec === undefined || opts.personalSpec === null) {
throw new Error(
"Missing the required parameter 'opts.personalSpec' when calling personalBankcard4Other"
)
}
let postBody = {}
if (opts.personalSpec !== undefined && opts.personalSpec !== null) {
postBody['personalSpec'] = opts.personalSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call personalBankcard4Other with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/other:bankcard4',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 对公银行账户打款(随机小额)
* @param {Object} opts - parameters
* @param {accountInfo} opts.accountInfo
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
companyTransfer (opts, callback) {
opts = opts || {}
if (opts.accountInfo === undefined || opts.accountInfo === null) {
throw new Error(
"Missing the required parameter 'opts.accountInfo' when calling companyTransfer"
)
}
let postBody = {}
if (opts.accountInfo !== undefined && opts.accountInfo !== null) {
postBody['accountInfo'] = opts.accountInfo
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call companyTransfer with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:transfer',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 对公打款验证
* @param {Object} opts - parameters
* @param {checkInfo} opts.checkInfo
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
checkCompanyTransfer (opts, callback) {
opts = opts || {}
if (opts.checkInfo === undefined || opts.checkInfo === null) {
throw new Error(
"Missing the required parameter 'opts.checkInfo' when calling checkCompanyTransfer"
)
}
let postBody = {}
if (opts.checkInfo !== undefined && opts.checkInfo !== null) {
postBody['checkInfo'] = opts.checkInfo
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call checkCompanyTransfer with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:check',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 对公打款状态查询
* @param {Object} opts - parameters
* @param {string} opts.orderNumber - 订单号
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
queryCompanyTransfer (opts, callback) {
opts = opts || {}
if (opts.orderNumber === undefined || opts.orderNumber === null) {
throw new Error(
"Missing the required parameter 'opts.orderNumber' when calling queryCompanyTransfer"
)
}
let postBody = {}
if (opts.orderNumber !== undefined && opts.orderNumber !== null) {
postBody['orderNumber'] = opts.orderNumber
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call queryCompanyTransfer with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:transferStatus',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 企业基础信息核验
* @param {Object} opts - parameters
* @param {companyInfo} opts.companyInfo
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
checkCompanyInfo (opts, callback) {
opts = opts || {}
if (opts.companyInfo === undefined || opts.companyInfo === null) {
throw new Error(
"Missing the required parameter 'opts.companyInfo' when calling checkCompanyInfo"
)
}
let postBody = {}
if (opts.companyInfo !== undefined && opts.companyInfo !== null) {
postBody['companyInfo'] = opts.companyInfo
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call checkCompanyInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:info',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 法人信息校验
* @param {Object} opts - parameters
* @param {legalPersonSpec} opts.legalPersonSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
checkLegalPerson (opts, callback) {
opts = opts || {}
if (opts.legalPersonSpec === undefined || opts.legalPersonSpec === null) {
throw new Error(
"Missing the required parameter 'opts.legalPersonSpec' when calling checkLegalPerson"
)
}
let postBody = {}
if (opts.legalPersonSpec !== undefined && opts.legalPersonSpec !== null) {
postBody['legalPersonSpec'] = opts.legalPersonSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call checkLegalPerson with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:legalPerson',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 法人信息校验(详版)
* @param {Object} opts - parameters
* @param {legalPersonSpec} opts.legalPersonSpec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
checkLegalPersonDetail (opts, callback) {
opts = opts || {}
if (opts.legalPersonSpec === undefined || opts.legalPersonSpec === null) {
throw new Error(
"Missing the required parameter 'opts.legalPersonSpec' when calling checkLegalPersonDetail"
)
}
let postBody = {}
if (opts.legalPersonSpec !== undefined && opts.legalPersonSpec !== null) {
postBody['legalPersonSpec'] = opts.legalPersonSpec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call checkLegalPersonDetail with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:legalPersonDetail',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 企业三要素
* @param {Object} opts - parameters
* @param {companyInfo3Spec} opts.companyInfo3Spec
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
checkCompanyInfo3 (opts, callback) {
opts = opts || {}
if (opts.companyInfo3Spec === undefined || opts.companyInfo3Spec === null) {
throw new Error(
"Missing the required parameter 'opts.companyInfo3Spec' when calling checkCompanyInfo3"
)
}
let postBody = {}
if (opts.companyInfo3Spec !== undefined && opts.companyInfo3Spec !== null) {
postBody['companyInfo3Spec'] = opts.companyInfo3Spec
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call checkCompanyInfo3 with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:info3',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询省份下城市编码
* @param {Object} opts - parameters
* @param {string} opts.provinceCode - 省份代码
* @param {string} callback - callback
@return {Object} result
* @param boolean success 认证结果true 成功, false 失败
* @param boolean hasException 是否有异常 true 有异常, false 无异常
* @param string code 认证结果状态码
* @param string message 认证结果
* @param string detail 字符串形式的查询结果内容为json
*/
queryCityList (opts, callback) {
opts = opts || {}
if (opts.provinceCode === undefined || opts.provinceCode === null) {
throw new Error(
"Missing the required parameter 'opts.provinceCode' when calling queryCityList"
)
}
let postBody = null
let queryParams = {}
if (opts.provinceCode !== undefined && opts.provinceCode !== null) {
queryParams['provinceCode'] = opts.provinceCode
}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call queryCityList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/query:cityList',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 对公银行账户打款(随机小额)——简单版
* @param {Object} opts - parameters
* @param {accountInfoSimple} opts.accountInfo
* @param {string} callback - callback
@return {Object} result
* @param authInfo authInfo
*/
companyTransferSimple (opts, callback) {
opts = opts || {}
if (opts.accountInfo === undefined || opts.accountInfo === null) {
throw new Error(
"Missing the required parameter 'opts.accountInfo' when calling companyTransferSimple"
)
}
let postBody = {}
if (opts.accountInfo !== undefined && opts.accountInfo !== null) {
postBody['accountInfo'] = opts.accountInfo
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call companyTransferSimple with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/company:transferSimple',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询所有省份列表
* @param {Object} opts - parameters
* @param {string} callback - callback
@return {Object} result
* @param boolean success 认证结果true 成功, false 失败
* @param boolean hasException 是否有异常 true 有异常, false 无异常
* @param string code 认证结果状态码
* @param string message 认证结果
* @param string detail 字符串形式的查询结果内容为json
*/
queryProvinceList (opts, callback) {
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call queryProvinceList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/query:provinceList',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询所有支持的银行
* @param {Object} opts - parameters
* @param {string} callback - callback
@return {Object} result
* @param boolean success 认证结果true 成功, false 失败
* @param boolean hasException 是否有异常 true 有异常, false 无异常
* @param string code 认证结果状态码
* @param string message 认证结果
* @param string detail 字符串形式的查询结果内容为json
*/
queryBankList (opts, callback) {
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call queryBankList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/query:bankList',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询城市下银行分行列表
* @param {Object} opts - parameters
* @param {string} opts.bankCode - 银行代码
* @param {string} opts.cityCode - 城市代码
* @param {string} callback - callback
@return {Object} result
* @param boolean success 认证结果true 成功, false 失败
* @param boolean hasException 是否有异常 true 有异常, false 无异常
* @param string code 认证结果状态码
* @param string message 认证结果
* @param string detail 字符串形式的查询结果内容为json
*/
queryBankBranchList (opts, callback) {
opts = opts || {}
if (opts.bankCode === undefined || opts.bankCode === null) {
throw new Error(
"Missing the required parameter 'opts.bankCode' when calling queryBankBranchList"
)
}
if (opts.cityCode === undefined || opts.cityCode === null) {
throw new Error(
"Missing the required parameter 'opts.cityCode' when calling queryBankBranchList"
)
}
let postBody = null
let queryParams = {}
if (opts.bankCode !== undefined && opts.bankCode !== null) {
queryParams['bankCode'] = opts.bankCode
}
if (opts.cityCode !== undefined && opts.cityCode !== null) {
queryParams['cityCode'] = opts.cityCode
}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call queryBankBranchList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/query:bankBranchList',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 个人身份证OCR
* @param {Object} opts - parameters
* @param {string} opts.imageData - 身份证图像base64(支持base64编码后小于4M分辨率不高于4096x4096的图像)
* @param {string} callback - callback
@return {Object} result
* @param oCRInfo oCRInfo
*/
iDCard (opts, callback) {
opts = opts || {}
if (opts.imageData === undefined || opts.imageData === null) {
throw new Error(
"Missing the required parameter 'opts.imageData' when calling iDCard"
)
}
let postBody = {}
if (opts.imageData !== undefined && opts.imageData !== null) {
postBody['imageData'] = opts.imageData
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call iDCard with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/ocr:IDCard',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 银行卡OCR
* @param {Object} opts - parameters
* @param {string} opts.imageData - 银行卡图像base64(支持base64编码后小于3M)
* @param {string} callback - callback
@return {Object} result
* @param bankCardOCRInfo bankCardOCRInfo
*/
bankCardOCR (opts, callback) {
opts = opts || {}
if (opts.imageData === undefined || opts.imageData === null) {
throw new Error(
"Missing the required parameter 'opts.imageData' when calling bankCardOCR"
)
}
let postBody = {}
if (opts.imageData !== undefined && opts.imageData !== null) {
postBody['imageData'] = opts.imageData
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call bankCardOCR with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/ocr:BankCard',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 营业执照OCR
* @param {Object} opts - parameters
* @param {string} opts.imageData - 营业执照图像base64(支持base64编码后小于3M)
* @param {string} callback - callback
@return {Object} result
* @param businessOCRInfo businessOCRInfo
*/
businessOCR (opts, callback) {
opts = opts || {}
if (opts.imageData === undefined || opts.imageData === null) {
throw new Error(
"Missing the required parameter 'opts.imageData' when calling businessOCR"
)
}
let postBody = {}
if (opts.imageData !== undefined && opts.imageData !== null) {
postBody['imageData'] = opts.imageData
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call businessOCR with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/ocr:Business',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* H5活体检测获取采集页面链接
* @param {Object} opts - parameters
* @param {string} [opts.name] - 姓名(需要进行身份核验时传递此参数) optional
* @param {string} [opts.idcard] - 身份证号(需要进行身份核验时传递此参数) optional
* @param {string} opts.returnUrl - 采集结束后自动跳转的目标地址须以http或https开头长度不超过128字符
* @param {string} callback - callback
@return {Object} result
* @param aliveUrlInfo aliveUrlInfo
*/
getAliveUrl (opts, callback) {
opts = opts || {}
if (opts.returnUrl === undefined || opts.returnUrl === null) {
throw new Error(
"Missing the required parameter 'opts.returnUrl' when calling getAliveUrl"
)
}
let postBody = {}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
if (opts.idcard !== undefined && opts.idcard !== null) {
postBody['idcard'] = opts.idcard
}
if (opts.returnUrl !== undefined && opts.returnUrl !== null) {
postBody['returnUrl'] = opts.returnUrl
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getAliveUrl with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/alive:getUrl',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* H5活体检测结果
* @param {Object} opts - parameters
* @param {string} opts.token - 检测token
* @param {string} callback - callback
@return {Object} result
* @param aliveResultInfo aliveResultInfo
*/
getAliveResult (opts, callback) {
opts = opts || {}
if (opts.token === undefined || opts.token === null) {
throw new Error(
"Missing the required parameter 'opts.token' when calling getAliveResult"
)
}
let postBody = {}
if (opts.token !== undefined && opts.token !== null) {
postBody['token'] = opts.token
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getAliveResult with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/alive:getResult',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* H5活体检测获取采集页面链接新版
* @param {Object} opts - parameters
* @param {string} [opts.name] - 姓名(需要进行身份核验时传递此参数) optional
* @param {string} [opts.idcard] - 身份证号(需要进行身份核验时传递此参数) optional
* @param {string} opts.returnUrl - 采集结束后自动跳转的目标地址须以http或https开头长度不超过128字符
* @param {string} [opts.actions] - 指定动作逗号隔开。LookLeft 向左LookRight 向右OpenMouth 张嘴BlinkEye 眨眼ShakeHead 摇头NodHead 点头) optional
* @param {boolean} [opts.showFail] - 是否展示失败结果页面 optional
* @param {string} [opts.photo] - 自有源照片不超过2M optional
* @param {integer} [opts.photoThresh] - 自有源照片对比通过阈值0-1000 optional
* @param {string} callback - callback
@return {Object} result
* @param aliveUrlInfo aliveUrlInfo
*/
getAliveUrlNew (opts, callback) {
opts = opts || {}
if (opts.returnUrl === undefined || opts.returnUrl === null) {
throw new Error(
"Missing the required parameter 'opts.returnUrl' when calling getAliveUrlNew"
)
}
let postBody = {}
if (opts.name !== undefined && opts.name !== null) {
postBody['name'] = opts.name
}
if (opts.idcard !== undefined && opts.idcard !== null) {
postBody['idcard'] = opts.idcard
}
if (opts.returnUrl !== undefined && opts.returnUrl !== null) {
postBody['returnUrl'] = opts.returnUrl
}
if (opts.actions !== undefined && opts.actions !== null) {
postBody['actions'] = opts.actions
}
if (opts.showFail !== undefined && opts.showFail !== null) {
postBody['showFail'] = opts.showFail
}
if (opts.photo !== undefined && opts.photo !== null) {
postBody['photo'] = opts.photo
}
if (opts.photoThresh !== undefined && opts.photoThresh !== null) {
postBody['photoThresh'] = opts.photoThresh
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getAliveUrlNew with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/alive:getUrlNew',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* H5活体检测结果新版
* @param {Object} opts - parameters
* @param {string} opts.token - 检测token
* @param {string} callback - callback
@return {Object} result
* @param aliveResultInfo aliveResultInfo
*/
getAliveResultNew (opts, callback) {
opts = opts || {}
if (opts.token === undefined || opts.token === null) {
throw new Error(
"Missing the required parameter 'opts.token' when calling getAliveResultNew"
)
}
let postBody = {}
if (opts.token !== undefined && opts.token !== null) {
postBody['token'] = opts.token
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call getAliveResultNew with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/alive:getResultNew',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 一键登录
* @param {Object} opts - parameters
* @param {string} opts.token - 移动端获取的token
* @param {string} [opts.userInformation] - 浏览器加密指纹H5时必传 optional
* @param {integer} opts.appType - 应用类型1 ios应用2 H5应用3 安卓应用)
* @param {string} callback - callback
@return {Object} result
* @param string chargeFlag 1收费0不收费
* @param string msisdn 手机号AES加密用对应appkey解密
* @param string code 认证结果状态码
* @param string message 认证结果
*/
oneClick (opts, callback) {
opts = opts || {}
if (opts.token === undefined || opts.token === null) {
throw new Error(
"Missing the required parameter 'opts.token' when calling oneClick"
)
}
if (opts.appType === undefined || opts.appType === null) {
throw new Error(
"Missing the required parameter 'opts.appType' when calling oneClick"
)
}
let postBody = {}
if (opts.token !== undefined && opts.token !== null) {
postBody['token'] = opts.token
}
if (opts.userInformation !== undefined && opts.userInformation !== null) {
postBody['userInformation'] = opts.userInformation
}
if (opts.appType !== undefined && opts.appType !== null) {
postBody['appType'] = opts.appType
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call oneClick with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/oneClick:login',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 失联地址识别状态查询
* @param {Object} opts - parameters
* @param {string} [opts.phoneNumber] - 手机号(手机号和身份证号不能同时为空) optional
* @param {string} [opts.idNumber] - 身份证号(手机号和身份证号不能同时为空) optional
* @param {string} [opts.address] - 详细地址 optional
* @param {string} opts.customerCode - 商户号
* @param {string} callback - callback
@return {Object} result
* @param string chargeFlag 1收费0不收费
* @param string code 认证结果状态码
* @param string message 认证结果
* @param string taskId taskId(查询地址时需要)
* @param string detail 描述详细信息
*/
addressInfo (opts, callback) {
opts = opts || {}
if (opts.customerCode === undefined || opts.customerCode === null) {
throw new Error(
"Missing the required parameter 'opts.customerCode' when calling addressInfo"
)
}
let postBody = {}
if (opts.phoneNumber !== undefined && opts.phoneNumber !== null) {
postBody['phoneNumber'] = opts.phoneNumber
}
if (opts.idNumber !== undefined && opts.idNumber !== null) {
postBody['idNumber'] = opts.idNumber
}
if (opts.address !== undefined && opts.address !== null) {
postBody['address'] = opts.address
}
if (opts.customerCode !== undefined && opts.customerCode !== null) {
postBody['customerCode'] = opts.customerCode
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call addressInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/address:info',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 失联地址识别结果
* @param {Object} opts - parameters
* @param {string} opts.taskId - taskId(查询接口返回)
* @param {string} opts.customerCode - 商户号
* @param {string} callback - callback
@return {Object} result
* @param string code 认证结果状态码
* @param string message 认证结果
* @param data data 详细信息
*/
addressDetail (opts, callback) {
opts = opts || {}
if (opts.taskId === undefined || opts.taskId === null) {
throw new Error(
"Missing the required parameter 'opts.taskId' when calling addressDetail"
)
}
if (opts.customerCode === undefined || opts.customerCode === null) {
throw new Error(
"Missing the required parameter 'opts.customerCode' when calling addressDetail"
)
}
let postBody = {}
if (opts.taskId !== undefined && opts.taskId !== null) {
postBody['taskId'] = opts.taskId
}
if (opts.customerCode !== undefined && opts.customerCode !== null) {
postBody['customerCode'] = opts.customerCode
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call addressDetail with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/address:detail',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 手机号码状态查询
* @param {Object} opts - parameters
* @param {string} opts.mobile - 手机号码
* @param {string} callback - callback
@return {Object} result
* @param string code 认证结果状态码
* @param string message 认证结果描述
* @param string chargeFlag 是否收费0不收费1收费
* @param string area 归属地
* @param string operator 运营商
* @param string status 号码状态1 正常 2 空号 3 通话中 4 不在网(空号) 5 关机 7 在网但不可用 13 停机 10 未知 9 服务器异常 12 不存在的号码)
* @param string mnpStatus 是否携号转网 1-是 0-否
*/
mobileStatus (opts, callback) {
opts = opts || {}
if (opts.mobile === undefined || opts.mobile === null) {
throw new Error(
"Missing the required parameter 'opts.mobile' when calling mobileStatus"
)
}
let postBody = {}
if (opts.mobile !== undefined && opts.mobile !== null) {
postBody['mobile'] = opts.mobile
}
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call mobileStatus with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/mobile:status',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询服务开通状态
* @param {Object} opts - parameters
* @param {string} callback - callback
@return {Object} result
* @param string pin 用户pin
* @param integer status 当前服务状态(0 未开通 1 开通中 2 正常 3 停服 )
* @param string applyTime 申请开通服务时间
*/
describeApplyStatus (opts, callback) {
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: 'jdcloud'
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 cloudauth/1.0.16'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call describeApplyStatus with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/manage:applyStatus',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
}
module.exports = CLOUDAUTH