@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.
Files changed (66) hide show
  1. package/.editorconfig +8 -0
  2. package/.eslintrc.js +16 -0
  3. package/.prettierrc.js +3 -0
  4. package/README.md +23 -6
  5. package/example/apiUserSign.js +66 -12
  6. package/example/authentication.js +136 -25
  7. package/example/bizlicXjjH5.js +33 -7
  8. package/example/bizlicXjjH5Api.js +50 -10
  9. package/example/conf/config.js +2 -0
  10. package/example/dataService.js +105 -8
  11. package/example/h5UserSign.js +65 -10
  12. package/example/invoice.js +111 -14
  13. package/example/notify.js +0 -1
  14. package/example/payment.js +208 -26
  15. package/example/tax.js +31 -3
  16. package/example/uploadusersign.js +66 -0
  17. package/package.json +50 -45
  18. package/src/common/client.ts +364 -355
  19. package/src/common/exception/yzhSDKHttpException.ts +29 -26
  20. package/src/common/http/index.ts +62 -53
  21. package/src/common/utils/index.ts +16 -14
  22. package/src/index.ts +1 -1
  23. package/src/services/apiusersign/index.ts +107 -105
  24. package/src/services/authentication/index.ts +162 -196
  25. package/src/services/bizlicxjjh5/index.ts +77 -107
  26. package/src/services/bizlicxjjh5api/index.ts +108 -156
  27. package/src/services/dataservice/index.ts +246 -268
  28. package/src/services/h5usersign/index.ts +93 -105
  29. package/src/services/index.ts +11 -10
  30. package/src/services/invoice/index.ts +184 -244
  31. package/src/services/payment/index.ts +501 -435
  32. package/src/services/tax/index.ts +53 -51
  33. package/src/services/uploadusersign/index.ts +88 -0
  34. package/src/typings.d.ts +1 -1
  35. package/tdsformat.js +22 -0
  36. package/tsconfig.json +2 -1
  37. package/yzh/common/client.d.ts +3 -0
  38. package/yzh/common/client.js +9 -3
  39. package/yzh/common/http/index.d.ts +1 -0
  40. package/yzh/common/http/index.js +18 -8
  41. package/yzh/common/utils/index.d.ts +1 -0
  42. package/yzh/common/utils/index.js +1 -0
  43. package/yzh/services/apiusersign/index.d.ts +34 -7
  44. package/yzh/services/apiusersign/index.js +9 -8
  45. package/yzh/services/authentication/index.d.ts +57 -19
  46. package/yzh/services/authentication/index.js +12 -11
  47. package/yzh/services/bizlicxjjh5/index.d.ts +16 -4
  48. package/yzh/services/bizlicxjjh5/index.js +6 -5
  49. package/yzh/services/bizlicxjjh5api/index.d.ts +22 -5
  50. package/yzh/services/bizlicxjjh5api/index.js +7 -6
  51. package/yzh/services/dataservice/index.d.ts +52 -11
  52. package/yzh/services/dataservice/index.js +23 -10
  53. package/yzh/services/h5usersign/index.d.ts +28 -6
  54. package/yzh/services/h5usersign/index.js +8 -7
  55. package/yzh/services/index.d.ts +3 -2
  56. package/yzh/services/index.js +7 -5
  57. package/yzh/services/invoice/index.d.ts +51 -12
  58. package/yzh/services/invoice/index.js +11 -10
  59. package/yzh/services/payment/index.d.ts +194 -18
  60. package/yzh/services/payment/index.js +28 -13
  61. package/yzh/services/tax/index.d.ts +17 -4
  62. package/yzh/services/tax/index.js +6 -5
  63. package/yzh/services/uploadusersign/index.d.ts +78 -0
  64. package/yzh/services/uploadusersign/index.js +19 -0
  65. package/.eslintrc.json +0 -19
  66. package/prettier.config.js +0 -32
@@ -1,144 +1,132 @@
1
- import YZHclient from "../../common/client"
1
+ import YZHclient from '../../common/client';
2
2
 
3
3
  /** H5UserPresignRequest 预申请签约请求 */
4
4
  interface H5UserPresignRequest {
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
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
- /** 用户 ID(废弃字段) */
20
- uid: string
21
- /** H5 签约 token */
22
- token: string
23
- /** 签约状态 */
24
- status: number
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
- /** H5 签约 token */
30
- token: string
31
- /** H5 页面主题颜色 */
32
- color: string
33
- /** 回调 URL 地址 */
34
- url: string
35
- /** 跳转 URL */
36
- redirect_url: string
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
- /** H5 签约页面 URL */
42
- url: string
41
+ /** H5 签约页面 URL */
42
+ url: string;
43
43
  }
44
44
 
45
45
  /** GetH5UserSignStatusRequest 获取用户签约状态请求 */
46
46
  interface GetH5UserSignStatusRequest {
47
- /** 平台企业 ID */
48
- dealer_id: string
49
- /** 综合服务主体 ID */
50
- broker_id: string
51
- /** 姓名 */
52
- real_name: string
53
- /** 证件号码 */
54
- id_card: string
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
- signed_at: string
61
- /** 用户签约状态 */
62
- status: number
59
+ /** 签约时间 */
60
+ signed_at: string;
61
+ /** 用户签约状态 */
62
+ status: number;
63
63
  }
64
64
 
65
65
  /** H5UserReleaseRequest 用户解约(测试账号专用接口)请求 */
66
66
  interface H5UserReleaseRequest {
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
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
- status: string
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
- constructor(conf: {
101
- dealer_id: string
102
- broker_id: string
103
- app_key: string
104
- des3_key: string
105
- private_key: string
106
- yzh_public_key: string
107
- sign_type: "rsa" | "sha256"
108
- base_url?: string
109
- }) {
110
- super(conf)
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
- // H5UserPresign 预申请签约
114
- async H5UserPresign(
115
- req: H5UserPresignRequest,
116
- cb?: (error: null | string, rep: H5UserPresignResponse) => void
117
- ): Promise<H5UserPresignResponse> {
118
- return this.request("post", "/api/sdk/v1/presign", req, { encryption: false }, cb)
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
- // H5UserSign 申请签约
122
- async H5UserSign(
123
- req: H5UserSignRequest,
124
- cb?: (error: null | string, rep: H5UserSignResponse) => void
125
- ): Promise<H5UserSignResponse> {
126
- return this.request("get", "/api/sdk/v1/sign/h5", req, { encryption: false }, cb)
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
- // GetH5UserSignStatus 获取用户签约状态
130
- async GetH5UserSignStatus(
131
- req: GetH5UserSignStatusRequest,
132
- cb?: (error: null | string, rep: GetH5UserSignStatusResponse) => void
133
- ): Promise<GetH5UserSignStatusResponse> {
134
- return this.request("get", "/api/sdk/v1/sign/user/status", req, { encryption: false }, cb)
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
- // H5UserRelease 用户解约(测试账号专用接口)
138
- async H5UserRelease(
139
- req: H5UserReleaseRequest,
140
- cb?: (error: null | string, rep: H5UserReleaseResponse) => void
141
- ): Promise<H5UserReleaseResponse> {
142
- return this.request("post", "/api/sdk/v1/sign/release", req, { encryption: false }, cb)
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
  }
@@ -1,10 +1,11 @@
1
- export { Util } from "../common/utils"
2
- export { ApiUserSignServiceClient } from "./apiusersign"
3
- export { AuthenticationClient } from "./authentication"
4
- export { DataServiceClient } from "./dataservice"
5
- export { H5UserSignServiceClient } from "./h5usersign"
6
- export { InvoiceClient } from "./invoice"
7
- export { PaymentClient } from "./payment"
8
- export { TaxClient } from "./tax"
9
- export { BizlicXjjH5APIServiceClient } from "./bizlicxjjh5api"
10
- export { BizlicXjjH5ServiceClient } from "./bizlicxjjh5"
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';