Skip to content

Commit d5a7f88

Browse files
publish jdcloud-sdk-go version 1.0.16
1 parent 59f143e commit d5a7f88

7 files changed

Lines changed: 399 additions & 1 deletion

File tree

services/cloudauth/ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ Date: 2024-08-20
4848
1.0.15:
4949
Date: 2024-09-11
5050
更新: H5活体检测返回结果增减是否收费标记。新增手机号码状态检测接口。
51+
52+
1.0.16:
53+
Date: 2024-11-04
54+
更新: H5活体检测增加是否展示失败结果参数,增加身份证、营业执照OCR接口。
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// Copyright 2018 JDCLOUD.COM
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// NOTE: This class is auto generated by the jdcloud code generator program.
16+
17+
package apis
18+
19+
import (
20+
"github.com/jdcloud-api/jdcloud-sdk-go/core"
21+
)
22+
23+
type BankCardOCRRequest struct {
24+
25+
core.JDCloudRequest
26+
27+
/* 银行卡图像base64(支持base64编码后小于3M) */
28+
ImageData string `json:"imageData"`
29+
}
30+
31+
/*
32+
* param imageData: 银行卡图像base64(支持base64编码后小于3M) (Required)
33+
*
34+
* @Deprecated, not compatible when mandatory parameters changed
35+
*/
36+
func NewBankCardOCRRequest(
37+
imageData string,
38+
) *BankCardOCRRequest {
39+
40+
return &BankCardOCRRequest{
41+
JDCloudRequest: core.JDCloudRequest{
42+
URL: "/ocr:BankCard",
43+
Method: "POST",
44+
Header: nil,
45+
Version: "v1",
46+
},
47+
ImageData: imageData,
48+
}
49+
}
50+
51+
/*
52+
* param imageData: 银行卡图像base64(支持base64编码后小于3M) (Required)
53+
*/
54+
func NewBankCardOCRRequestWithAllParams(
55+
imageData string,
56+
) *BankCardOCRRequest {
57+
58+
return &BankCardOCRRequest{
59+
JDCloudRequest: core.JDCloudRequest{
60+
URL: "/ocr:BankCard",
61+
Method: "POST",
62+
Header: nil,
63+
Version: "v1",
64+
},
65+
ImageData: imageData,
66+
}
67+
}
68+
69+
/* This constructor has better compatible ability when API parameters changed */
70+
func NewBankCardOCRRequestWithoutParam() *BankCardOCRRequest {
71+
72+
return &BankCardOCRRequest{
73+
JDCloudRequest: core.JDCloudRequest{
74+
URL: "/ocr:BankCard",
75+
Method: "POST",
76+
Header: nil,
77+
Version: "v1",
78+
},
79+
}
80+
}
81+
82+
/* param imageData: 银行卡图像base64(支持base64编码后小于3M)(Required) */
83+
func (r *BankCardOCRRequest) SetImageData(imageData string) {
84+
r.ImageData = imageData
85+
}
86+
87+
88+
// GetRegionId returns path parameter 'regionId' if exist,
89+
// otherwise return empty string
90+
func (r BankCardOCRRequest) GetRegionId() string {
91+
return ""
92+
}
93+
94+
type BankCardOCRResponse struct {
95+
RequestID string `json:"requestId"`
96+
Error core.ErrorResponse `json:"error"`
97+
Result BankCardOCRResult `json:"result"`
98+
}
99+
100+
type BankCardOCRResult struct {
101+
Status string `json:"status"`
102+
Code string `json:"code"`
103+
Number string `json:"number"`
104+
CardType string `json:"cardType"`
105+
Name string `json:"name"`
106+
Bank string `json:"bank"`
107+
Date string `json:"date"`
108+
ChargeFlag string `json:"chargeFlag"`
109+
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Copyright 2018 JDCLOUD.COM
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// NOTE: This class is auto generated by the jdcloud code generator program.
16+
17+
package apis
18+
19+
import (
20+
"github.com/jdcloud-api/jdcloud-sdk-go/core"
21+
)
22+
23+
type BusinessOCRRequest struct {
24+
25+
core.JDCloudRequest
26+
27+
/* 营业执照图像base64(支持base64编码后小于3M) */
28+
ImageData string `json:"imageData"`
29+
}
30+
31+
/*
32+
* param imageData: 营业执照图像base64(支持base64编码后小于3M) (Required)
33+
*
34+
* @Deprecated, not compatible when mandatory parameters changed
35+
*/
36+
func NewBusinessOCRRequest(
37+
imageData string,
38+
) *BusinessOCRRequest {
39+
40+
return &BusinessOCRRequest{
41+
JDCloudRequest: core.JDCloudRequest{
42+
URL: "/ocr:Business",
43+
Method: "POST",
44+
Header: nil,
45+
Version: "v1",
46+
},
47+
ImageData: imageData,
48+
}
49+
}
50+
51+
/*
52+
* param imageData: 营业执照图像base64(支持base64编码后小于3M) (Required)
53+
*/
54+
func NewBusinessOCRRequestWithAllParams(
55+
imageData string,
56+
) *BusinessOCRRequest {
57+
58+
return &BusinessOCRRequest{
59+
JDCloudRequest: core.JDCloudRequest{
60+
URL: "/ocr:Business",
61+
Method: "POST",
62+
Header: nil,
63+
Version: "v1",
64+
},
65+
ImageData: imageData,
66+
}
67+
}
68+
69+
/* This constructor has better compatible ability when API parameters changed */
70+
func NewBusinessOCRRequestWithoutParam() *BusinessOCRRequest {
71+
72+
return &BusinessOCRRequest{
73+
JDCloudRequest: core.JDCloudRequest{
74+
URL: "/ocr:Business",
75+
Method: "POST",
76+
Header: nil,
77+
Version: "v1",
78+
},
79+
}
80+
}
81+
82+
/* param imageData: 营业执照图像base64(支持base64编码后小于3M)(Required) */
83+
func (r *BusinessOCRRequest) SetImageData(imageData string) {
84+
r.ImageData = imageData
85+
}
86+
87+
88+
// GetRegionId returns path parameter 'regionId' if exist,
89+
// otherwise return empty string
90+
func (r BusinessOCRRequest) GetRegionId() string {
91+
return ""
92+
}
93+
94+
type BusinessOCRResponse struct {
95+
RequestID string `json:"requestId"`
96+
Error core.ErrorResponse `json:"error"`
97+
Result BusinessOCRResult `json:"result"`
98+
}
99+
100+
type BusinessOCRResult struct {
101+
Status string `json:"status"`
102+
Code string `json:"code"`
103+
Number string `json:"number"`
104+
Name string `json:"name"`
105+
CompanyType string `json:"companyType"`
106+
Address string `json:"address"`
107+
LegalPersonal string `json:"legalPersonal"`
108+
RegisteredCapital string `json:"registeredCapital"`
109+
Date string `json:"date"`
110+
Scope string `json:"scope"`
111+
RegistrationDate string `json:"registrationDate"`
112+
ChargeFlag string `json:"chargeFlag"`
113+
}

services/cloudauth/apis/GetAliveUrlNew.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ type GetAliveUrlNewRequest struct {
3535

3636
/* 指定动作,逗号隔开。(LookLeft 向左,LookRight 向右,OpenMouth 张嘴,BlinkEye 眨眼,ShakeHead 摇头,NodHead 点头) (Optional) */
3737
Actions *string `json:"actions"`
38+
39+
/* 是否展示失败结果页面 (Optional) */
40+
ShowFail *bool `json:"showFail"`
41+
42+
/* 自有源照片(不超过2M) (Optional) */
43+
Photo *string `json:"photo"`
44+
45+
/* 自有源照片对比通过阈值(0-1000) (Optional) */
46+
PhotoThresh *int `json:"photoThresh"`
3847
}
3948

4049
/*
@@ -62,12 +71,18 @@ func NewGetAliveUrlNewRequest(
6271
* param idcard: 身份证号(需要进行身份核验时传递此参数) (Optional)
6372
* param returnUrl: 采集结束后自动跳转的目标地址(须以http或https开头,长度不超过128字符) (Required)
6473
* param actions: 指定动作,逗号隔开。(LookLeft 向左,LookRight 向右,OpenMouth 张嘴,BlinkEye 眨眼,ShakeHead 摇头,NodHead 点头) (Optional)
74+
* param showFail: 是否展示失败结果页面 (Optional)
75+
* param photo: 自有源照片(不超过2M) (Optional)
76+
* param photoThresh: 自有源照片对比通过阈值(0-1000) (Optional)
6577
*/
6678
func NewGetAliveUrlNewRequestWithAllParams(
6779
name *string,
6880
idcard *string,
6981
returnUrl string,
7082
actions *string,
83+
showFail *bool,
84+
photo *string,
85+
photoThresh *int,
7186
) *GetAliveUrlNewRequest {
7287

7388
return &GetAliveUrlNewRequest{
@@ -81,6 +96,9 @@ func NewGetAliveUrlNewRequestWithAllParams(
8196
Idcard: idcard,
8297
ReturnUrl: returnUrl,
8398
Actions: actions,
99+
ShowFail: showFail,
100+
Photo: photo,
101+
PhotoThresh: photoThresh,
84102
}
85103
}
86104

@@ -113,6 +131,18 @@ func (r *GetAliveUrlNewRequest) SetReturnUrl(returnUrl string) {
113131
func (r *GetAliveUrlNewRequest) SetActions(actions string) {
114132
r.Actions = &actions
115133
}
134+
/* param showFail: 是否展示失败结果页面(Optional) */
135+
func (r *GetAliveUrlNewRequest) SetShowFail(showFail bool) {
136+
r.ShowFail = &showFail
137+
}
138+
/* param photo: 自有源照片(不超过2M)(Optional) */
139+
func (r *GetAliveUrlNewRequest) SetPhoto(photo string) {
140+
r.Photo = &photo
141+
}
142+
/* param photoThresh: 自有源照片对比通过阈值(0-1000)(Optional) */
143+
func (r *GetAliveUrlNewRequest) SetPhotoThresh(photoThresh int) {
144+
r.PhotoThresh = &photoThresh
145+
}
116146

117147

118148
// GetRegionId returns path parameter 'regionId' if exist,

services/cloudauth/client/CloudauthClient.go

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func NewCloudauthClient(credential *core.Credential) *CloudauthClient {
4040
Credential: *credential,
4141
Config: *config,
4242
ServiceName: "cloudauth",
43-
Revision: "1.0.15",
43+
Revision: "1.0.16",
4444
Logger: core.NewDefaultLogger(core.LogInfo),
4545
}}
4646
}
@@ -337,6 +337,26 @@ func (c *CloudauthClient) CheckCompanyInfo3(request *cloudauth.CheckCompanyInfo3
337337
return jdResp, err
338338
}
339339

340+
/* 营业执照OCR */
341+
func (c *CloudauthClient) BusinessOCR(request *cloudauth.BusinessOCRRequest) (*cloudauth.BusinessOCRResponse, error) {
342+
if request == nil {
343+
return nil, errors.New("Request object is nil. ")
344+
}
345+
resp, err := c.Send(request, c.ServiceName)
346+
if err != nil {
347+
return nil, err
348+
}
349+
350+
jdResp := &cloudauth.BusinessOCRResponse{}
351+
err = json.Unmarshal(resp, jdResp)
352+
if err != nil {
353+
c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp))
354+
return nil, err
355+
}
356+
357+
return jdResp, err
358+
}
359+
340360
/* 个人银行卡四要素非身份证版 */
341361
func (c *CloudauthClient) PersonalBankcard4Other(request *cloudauth.PersonalBankcard4OtherRequest) (*cloudauth.PersonalBankcard4OtherResponse, error) {
342362
if request == nil {
@@ -377,6 +397,26 @@ func (c *CloudauthClient) GetAliveResult(request *cloudauth.GetAliveResultReques
377397
return jdResp, err
378398
}
379399

400+
/* 银行卡OCR */
401+
func (c *CloudauthClient) BankCardOCR(request *cloudauth.BankCardOCRRequest) (*cloudauth.BankCardOCRResponse, error) {
402+
if request == nil {
403+
return nil, errors.New("Request object is nil. ")
404+
}
405+
resp, err := c.Send(request, c.ServiceName)
406+
if err != nil {
407+
return nil, err
408+
}
409+
410+
jdResp := &cloudauth.BankCardOCRResponse{}
411+
err = json.Unmarshal(resp, jdResp)
412+
if err != nil {
413+
c.Logger.Log(core.LogError, "Unmarshal json failed, resp: %s", string(resp))
414+
return nil, err
415+
}
416+
417+
return jdResp, err
418+
}
419+
380420
/* H5活体检测获取采集页面链接 */
381421
func (c *CloudauthClient) GetAliveUrl(request *cloudauth.GetAliveUrlRequest) (*cloudauth.GetAliveUrlResponse, error) {
382422
if request == nil {

0 commit comments

Comments
 (0)