@yunzhanghu/sdk-nodejs 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +8 -0
- package/.eslintrc.js +16 -0
- package/.prettierrc.js +3 -0
- package/README.md +23 -6
- package/example/apiUserSign.js +66 -12
- package/example/authentication.js +136 -25
- package/example/bizlicXjjH5.js +33 -7
- package/example/bizlicXjjH5Api.js +50 -10
- package/example/conf/config.js +2 -0
- package/example/dataService.js +105 -8
- package/example/h5UserSign.js +65 -10
- package/example/invoice.js +111 -14
- package/example/notify.js +0 -1
- package/example/payment.js +208 -26
- package/example/tax.js +31 -3
- package/example/uploadusersign.js +66 -0
- package/package.json +50 -45
- package/src/common/client.ts +364 -355
- package/src/common/exception/yzhSDKHttpException.ts +29 -26
- package/src/common/http/index.ts +62 -53
- package/src/common/utils/index.ts +16 -14
- package/src/index.ts +1 -1
- package/src/services/apiusersign/index.ts +107 -105
- package/src/services/authentication/index.ts +162 -196
- package/src/services/bizlicxjjh5/index.ts +77 -107
- package/src/services/bizlicxjjh5api/index.ts +108 -156
- package/src/services/dataservice/index.ts +246 -268
- package/src/services/h5usersign/index.ts +93 -105
- package/src/services/index.ts +11 -10
- package/src/services/invoice/index.ts +184 -244
- package/src/services/payment/index.ts +501 -435
- package/src/services/tax/index.ts +53 -51
- package/src/services/uploadusersign/index.ts +88 -0
- package/src/typings.d.ts +1 -1
- package/tdsformat.js +22 -0
- package/tsconfig.json +2 -1
- package/yzh/common/client.d.ts +3 -0
- package/yzh/common/client.js +9 -3
- package/yzh/common/http/index.d.ts +1 -0
- package/yzh/common/http/index.js +18 -8
- package/yzh/common/utils/index.d.ts +1 -0
- package/yzh/common/utils/index.js +1 -0
- package/yzh/services/apiusersign/index.d.ts +34 -7
- package/yzh/services/apiusersign/index.js +9 -8
- package/yzh/services/authentication/index.d.ts +57 -19
- package/yzh/services/authentication/index.js +12 -11
- package/yzh/services/bizlicxjjh5/index.d.ts +16 -4
- package/yzh/services/bizlicxjjh5/index.js +6 -5
- package/yzh/services/bizlicxjjh5api/index.d.ts +22 -5
- package/yzh/services/bizlicxjjh5api/index.js +7 -6
- package/yzh/services/dataservice/index.d.ts +52 -11
- package/yzh/services/dataservice/index.js +23 -10
- package/yzh/services/h5usersign/index.d.ts +28 -6
- package/yzh/services/h5usersign/index.js +8 -7
- package/yzh/services/index.d.ts +3 -2
- package/yzh/services/index.js +7 -5
- package/yzh/services/invoice/index.d.ts +51 -12
- package/yzh/services/invoice/index.js +11 -10
- package/yzh/services/payment/index.d.ts +194 -18
- package/yzh/services/payment/index.js +28 -13
- package/yzh/services/tax/index.d.ts +17 -4
- package/yzh/services/tax/index.js +6 -5
- package/yzh/services/uploadusersign/index.d.ts +78 -0
- package/yzh/services/uploadusersign/index.js +19 -0
- package/.eslintrc.json +0 -19
- package/prettier.config.js +0 -32
|
@@ -1,144 +1,132 @@
|
|
|
1
|
-
import YZHclient from
|
|
1
|
+
import YZHclient from '../../common/client';
|
|
2
2
|
|
|
3
3
|
/** H5UserPresignRequest 预申请签约请求 */
|
|
4
4
|
interface H5UserPresignRequest {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
/** 平台企业 ID */
|
|
6
|
+
dealer_id: string;
|
|
7
|
+
/** 综合服务主体 ID */
|
|
8
|
+
broker_id: string;
|
|
9
|
+
/** 姓名 */
|
|
10
|
+
real_name: string;
|
|
11
|
+
/** 证件号码 */
|
|
12
|
+
id_card: string;
|
|
13
|
+
/** 证件类型 0:身份证 2:港澳居民来往内地通行证 3:护照 5:台湾居民来往大陆通行证 9:港澳居民居住证 10:台湾居民居住证 11:外国人永久居留身份证 12:外国人工作许可证 */
|
|
14
|
+
certificate_type: number;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** H5UserPresignResponse 预申请签约返回 */
|
|
18
18
|
interface H5UserPresignResponse {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
/** 用户 ID(废弃字段) */
|
|
20
|
+
uid: string;
|
|
21
|
+
/** H5 签约 token */
|
|
22
|
+
token: string;
|
|
23
|
+
/** 签约状态 */
|
|
24
|
+
status: number;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** H5UserSignRequest 申请签约请求 */
|
|
28
28
|
interface H5UserSignRequest {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
/** H5 签约 token */
|
|
30
|
+
token: string;
|
|
31
|
+
/** H5 页面主题颜色 */
|
|
32
|
+
color: string;
|
|
33
|
+
/** 回调 URL 地址 */
|
|
34
|
+
url: string;
|
|
35
|
+
/** 跳转 URL */
|
|
36
|
+
redirect_url: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** H5UserSignResponse 申请签约返回 */
|
|
40
40
|
interface H5UserSignResponse {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/** H5 签约页面 URL */
|
|
42
|
+
url: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** GetH5UserSignStatusRequest 获取用户签约状态请求 */
|
|
46
46
|
interface GetH5UserSignStatusRequest {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
/** 平台企业 ID */
|
|
48
|
+
dealer_id: string;
|
|
49
|
+
/** 综合服务主体 ID */
|
|
50
|
+
broker_id: string;
|
|
51
|
+
/** 姓名 */
|
|
52
|
+
real_name: string;
|
|
53
|
+
/** 证件号码 */
|
|
54
|
+
id_card: string;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** GetH5UserSignStatusResponse 获取用户签约状态返回 */
|
|
58
58
|
interface GetH5UserSignStatusResponse {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
/** 签约时间 */
|
|
60
|
+
signed_at: string;
|
|
61
|
+
/** 用户签约状态 */
|
|
62
|
+
status: number;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/** H5UserReleaseRequest 用户解约(测试账号专用接口)请求 */
|
|
66
66
|
interface H5UserReleaseRequest {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
/** 综合服务主体 ID */
|
|
68
|
+
broker_id: string;
|
|
69
|
+
/** 平台企业 ID */
|
|
70
|
+
dealer_id: string;
|
|
71
|
+
/** 姓名 */
|
|
72
|
+
real_name: string;
|
|
73
|
+
/** 证件号码 */
|
|
74
|
+
id_card: string;
|
|
75
|
+
/** 证件类型 0:身份证 2:港澳居民来往内地通行证 3:护照 5:台湾居民来往大陆通行证 9:港澳居民居住证 10:台湾居民居住证 11:外国人永久居留身份证 12:外国人工作许可证 */
|
|
76
|
+
certificate_type: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/** H5UserReleaseResponse 用户解约(测试账号专用接口)返回 */
|
|
80
80
|
interface H5UserReleaseResponse {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** NotifyH5UserSignRequest 签约回调 */
|
|
86
|
-
interface NotifyH5UserSignRequest {
|
|
87
|
-
/** 平台企业 ID */
|
|
88
|
-
dealer_id: string
|
|
89
|
-
/** 综合服务主体 ID */
|
|
90
|
-
broker_id: string
|
|
91
|
-
/** 姓名 */
|
|
92
|
-
real_name: string
|
|
93
|
-
/** 证件号码 */
|
|
94
|
-
id_card: string
|
|
95
|
-
/** 预签约手机号 */
|
|
96
|
-
phone: string
|
|
81
|
+
/** 是否解约成功 */
|
|
82
|
+
status: string;
|
|
97
83
|
}
|
|
98
84
|
|
|
99
85
|
export class H5UserSignServiceClient extends YZHclient {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
86
|
+
// eslint-disable-next-line no-useless-constructor
|
|
87
|
+
constructor(conf: {
|
|
88
|
+
dealer_id: string;
|
|
89
|
+
broker_id: string;
|
|
90
|
+
app_key: string;
|
|
91
|
+
des3_key: string;
|
|
92
|
+
private_key: string;
|
|
93
|
+
yzh_public_key: string;
|
|
94
|
+
sign_type: 'rsa' | 'sha256';
|
|
95
|
+
base_url?: string;
|
|
96
|
+
timeout?: number;
|
|
97
|
+
}) {
|
|
98
|
+
super(conf);
|
|
99
|
+
}
|
|
112
100
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
101
|
+
// H5UserPresign 预申请签约
|
|
102
|
+
async H5UserPresign(
|
|
103
|
+
req: H5UserPresignRequest,
|
|
104
|
+
cb?: (error: null | string, rep: H5UserPresignResponse) => void
|
|
105
|
+
): Promise<H5UserPresignResponse> {
|
|
106
|
+
return this.request('post', '/api/sdk/v1/presign', req, { encryption: false }, cb);
|
|
107
|
+
}
|
|
120
108
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
109
|
+
// H5UserSign 申请签约
|
|
110
|
+
async H5UserSign(
|
|
111
|
+
req: H5UserSignRequest,
|
|
112
|
+
cb?: (error: null | string, rep: H5UserSignResponse) => void
|
|
113
|
+
): Promise<H5UserSignResponse> {
|
|
114
|
+
return this.request('get', '/api/sdk/v1/sign/h5', req, { encryption: false }, cb);
|
|
115
|
+
}
|
|
128
116
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
// GetH5UserSignStatus 获取用户签约状态
|
|
118
|
+
async GetH5UserSignStatus(
|
|
119
|
+
req: GetH5UserSignStatusRequest,
|
|
120
|
+
cb?: (error: null | string, rep: GetH5UserSignStatusResponse) => void
|
|
121
|
+
): Promise<GetH5UserSignStatusResponse> {
|
|
122
|
+
return this.request('get', '/api/sdk/v1/sign/user/status', req, { encryption: false }, cb);
|
|
123
|
+
}
|
|
136
124
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
// H5UserRelease 用户解约(测试账号专用接口)
|
|
126
|
+
async H5UserRelease(
|
|
127
|
+
req: H5UserReleaseRequest,
|
|
128
|
+
cb?: (error: null | string, rep: H5UserReleaseResponse) => void
|
|
129
|
+
): Promise<H5UserReleaseResponse> {
|
|
130
|
+
return this.request('post', '/api/sdk/v1/sign/release', req, { encryption: false }, cb);
|
|
131
|
+
}
|
|
144
132
|
}
|
package/src/services/index.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { Util } from
|
|
2
|
-
export { ApiUserSignServiceClient } from
|
|
3
|
-
export { AuthenticationClient } from
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
1
|
+
export { Util } from '../common/utils';
|
|
2
|
+
export { ApiUserSignServiceClient } from './apiusersign';
|
|
3
|
+
export { AuthenticationClient } from './authentication';
|
|
4
|
+
export { BizlicXjjH5ServiceClient } from './bizlicxjjh5';
|
|
5
|
+
export { BizlicXjjH5APIServiceClient } from './bizlicxjjh5api';
|
|
6
|
+
export { DataServiceClient } from './dataservice';
|
|
7
|
+
export { H5UserSignServiceClient } from './h5usersign';
|
|
8
|
+
export { InvoiceClient } from './invoice';
|
|
9
|
+
export { PaymentClient } from './payment';
|
|
10
|
+
export { TaxClient } from './tax';
|
|
11
|
+
export { UploadUserSignServiceClient } from './uploadusersign';
|