@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,321 +1,261 @@
1
- import YZHclient from "../../common/client"
1
+ import YZHclient from '../../common/client';
2
2
 
3
3
  /** GetInvoiceStatRequest 查询平台企业已开具和待开具发票金额请求 */
4
4
  interface GetInvoiceStatRequest {
5
- /** 综合服务主体 ID */
6
- broker_id: string
7
- /** 平台企业 ID */
8
- dealer_id: string
9
- /** 查询年份 */
10
- year: number
5
+ /** 综合服务主体 ID */
6
+ broker_id: string;
7
+ /** 平台企业 ID */
8
+ dealer_id: string;
9
+ /** 查询年份 */
10
+ year: number;
11
11
  }
12
12
 
13
13
  /** GetInvoiceStatResponse 查询平台企业已开具和待开具发票金额返回 */
14
14
  interface GetInvoiceStatResponse {
15
- /** 平台企业 ID */
16
- dealer_id: string
17
- /** 综合服务主体 ID */
18
- broker_id: string
19
- /** 已开发票金额 */
20
- invoiced: string
21
- /** 开票中发票金额 */
22
- invoicing: string
23
- /** 待开发票金额 */
24
- not_invoiced: string
15
+ /** 平台企业 ID */
16
+ dealer_id: string;
17
+ /** 综合服务主体 ID */
18
+ broker_id: string;
19
+ /** 已开发票金额 */
20
+ invoiced: string;
21
+ /** 开票中发票金额 */
22
+ invoicing: string;
23
+ /** 待开发票金额 */
24
+ not_invoiced: string;
25
25
  }
26
26
 
27
27
  /** GetInvoiceAmountRequest 查询可开具发票额度和发票开具信息请求 */
28
28
  interface GetInvoiceAmountRequest {
29
- /** 综合服务主体 ID */
30
- broker_id: string
31
- /** 平台企业 ID */
32
- dealer_id: string
29
+ /** 综合服务主体 ID */
30
+ broker_id: string;
31
+ /** 平台企业 ID */
32
+ dealer_id: string;
33
33
  }
34
34
 
35
35
  /** GetInvoiceAmountResponse 查询可开具发票额度和发票开具信息返回 */
36
36
  interface GetInvoiceAmountResponse {
37
- /** 可开票额度 */
38
- amount: string
39
- /** 系统支持的开户行及账号 */
40
- bank_name_account: BankNameAccount[]
41
- /** 系统支持的货物或应税劳务、服务名称 */
42
- goods_services_name: GoodsServicesName[]
37
+ /** 可开票额度 */
38
+ amount: string;
39
+ /** 系统支持的开户行及账号 */
40
+ bank_name_account: BankNameAccount[];
41
+ /** 系统支持的货物或应税劳务、服务名称 */
42
+ goods_services_name: GoodsServicesName[];
43
43
  }
44
44
 
45
45
  /** ApplyInvoiceRequest 发票开具申请请求 */
46
46
  interface ApplyInvoiceRequest {
47
- /** 发票申请编号 */
48
- invoice_apply_id: string
49
- /** 综合服务主体 ID */
50
- broker_id: string
51
- /** 平台企业 ID */
52
- dealer_id: string
53
- /** 申请开票金额 */
54
- amount: string
55
- /** 发票类型 */
56
- invoice_type: string
57
- /** 开户行及账号 */
58
- bank_name_account: string
59
- /** 货物或应税劳务、服务名称 */
60
- goods_services_name: string
61
- /** 发票备注 */
62
- remark: string
47
+ /** 发票申请编号 */
48
+ invoice_apply_id: string;
49
+ /** 综合服务主体 ID */
50
+ broker_id: string;
51
+ /** 平台企业 ID */
52
+ dealer_id: string;
53
+ /** 申请开票金额 */
54
+ amount: string;
55
+ /** 发票类型 */
56
+ invoice_type: string;
57
+ /** 开户行及账号 */
58
+ bank_name_account: string;
59
+ /** 货物或应税劳务、服务名称 */
60
+ goods_services_name: string;
61
+ /** 发票备注 */
62
+ remark: string;
63
63
  }
64
64
 
65
65
  /** ApplyInvoiceResponse 发票开具申请返回 */
66
66
  interface ApplyInvoiceResponse {
67
- /** 发票申请单 ID */
68
- application_id: string
69
- /** 发票张数 */
70
- count: string
67
+ /** 发票申请单 ID */
68
+ application_id: string;
69
+ /** 发票张数 */
70
+ count: string;
71
71
  }
72
72
 
73
73
  /** GetInvoiceStatusRequest 查询发票开具申请状态请求 */
74
74
  interface GetInvoiceStatusRequest {
75
- /** 发票申请编号 */
76
- invoice_apply_id: string
77
- /** 发票申请单 ID */
78
- application_id: string
75
+ /** 发票申请编号 */
76
+ invoice_apply_id: string;
77
+ /** 发票申请单 ID */
78
+ application_id: string;
79
79
  }
80
80
 
81
81
  /** GetInvoiceStatusResponse 查询发票开具申请状态返回 */
82
82
  interface GetInvoiceStatusResponse {
83
- /** 申请结果 */
84
- status: string
85
- /** 发票张数 */
86
- count: string
87
- /** 价税合计 */
88
- price_tax_amount: string
89
- /** 不含税金额 */
90
- price_amount: string
91
- /** 税额 */
92
- tax_amount: string
93
- /** 发票类型 */
94
- invoice_type: string
95
- /** 购方名称 */
96
- customer_name: string
97
- /** 纳税人识别号 */
98
- customer_tax_num: string
99
- /** 购方地址、电话 */
100
- customer_address_tel: string
101
- /** 开户行及账号 */
102
- bank_name_account: string
103
- /** 货物或应税劳务、服务名称 */
104
- goods_services_name: string
105
- /** 发票备注 */
106
- remark: string
107
- /** 邮寄类型 */
108
- post_type: string
109
- /** 快递单号 */
110
- waybill_number: string[]
83
+ /** 申请结果 */
84
+ status: string;
85
+ /** 发票张数 */
86
+ count: string;
87
+ /** 价税合计 */
88
+ price_tax_amount: string;
89
+ /** 不含税金额 */
90
+ price_amount: string;
91
+ /** 税额 */
92
+ tax_amount: string;
93
+ /** 发票类型 */
94
+ invoice_type: string;
95
+ /** 购方名称 */
96
+ customer_name: string;
97
+ /** 纳税人识别号 */
98
+ customer_tax_num: string;
99
+ /** 购方地址、电话 */
100
+ customer_address_tel: string;
101
+ /** 开户行及账号 */
102
+ bank_name_account: string;
103
+ /** 货物或应税劳务、服务名称 */
104
+ goods_services_name: string;
105
+ /** 发票备注 */
106
+ remark: string;
107
+ /** 邮寄类型 */
108
+ post_type: string;
109
+ /** 快递单号 */
110
+ waybill_number: string[];
111
111
  }
112
112
 
113
113
  /** GetInvoiceInformationRequest 查询发票信息请求 */
114
114
  interface GetInvoiceInformationRequest {
115
- /** 发票申请编号 */
116
- invoice_apply_id: string
117
- /** 发票申请单 ID */
118
- application_id: string
115
+ /** 发票申请编号 */
116
+ invoice_apply_id: string;
117
+ /** 发票申请单 ID */
118
+ application_id: string;
119
119
  }
120
120
 
121
121
  /** GetInvoiceInformationResponse 查询发票信息返回 */
122
122
  interface GetInvoiceInformationResponse {
123
- /** 发票信息 */
124
- information: InformationDataInfo[]
123
+ /** 发票信息 */
124
+ information: InformationDataInfo[];
125
125
  }
126
126
 
127
127
  /** InformationDataInfo 查询发票信息返回 */
128
128
  interface InformationDataInfo {
129
- /** 货物或应税劳务、服务名称 */
130
- goods_services_name: string
131
- /** 发票号码 */
132
- invoice_num: string
133
- /** 发票代码 */
134
- invoice_code: string
135
- /** 不含税金额 */
136
- price_amount: string
137
- /** 税额 */
138
- tax_amount: string
139
- /** 税率 */
140
- tax_rate: string
141
- /** 价税合计 */
142
- price_tax_amount: string
143
- /** 开票日期 */
144
- invoiced_date: string
129
+ /** 货物或应税劳务、服务名称 */
130
+ goods_services_name: string;
131
+ /** 发票号码 */
132
+ invoice_num: string;
133
+ /** 发票代码 */
134
+ invoice_code: string;
135
+ /** 不含税金额 */
136
+ price_amount: string;
137
+ /** 税额 */
138
+ tax_amount: string;
139
+ /** 税率 */
140
+ tax_rate: string;
141
+ /** 价税合计 */
142
+ price_tax_amount: string;
143
+ /** 开票日期 */
144
+ invoiced_date: string;
145
145
  }
146
146
 
147
147
  /** BankNameAccount 系统支持的开户行及账号 */
148
148
  interface BankNameAccount {
149
- /** 开户行及账号 */
150
- item: string
151
- /** 是否为默认值 */
152
- default: boolean
149
+ /** 开户行及账号 */
150
+ item: string;
151
+ /** 是否为默认值 */
152
+ default: boolean;
153
153
  }
154
154
 
155
155
  /** GoodsServicesName 系统支持的货物或应税劳务、服务名称 */
156
156
  interface GoodsServicesName {
157
- /** 货物或应税劳务、服务名称 */
158
- item: string
159
- /** 是否为默认值 */
160
- default: boolean
157
+ /** 货物或应税劳务、服务名称 */
158
+ item: string;
159
+ /** 是否为默认值 */
160
+ default: boolean;
161
161
  }
162
162
 
163
163
  /** GetInvoiceFileRequest 下载 PDF 版发票请求 */
164
164
  interface GetInvoiceFileRequest {
165
- /** 发票申请编号 */
166
- invoice_apply_id: string
167
- /** 发票申请单 ID */
168
- application_id: string
165
+ /** 发票申请编号 */
166
+ invoice_apply_id: string;
167
+ /** 发票申请单 ID */
168
+ application_id: string;
169
169
  }
170
170
 
171
171
  /** GetInvoiceFileResponse 下载 PDF 版发票返回 */
172
172
  interface GetInvoiceFileResponse {
173
- /** 下载地址 */
174
- url: string
175
- /** 文件名称 */
176
- name: string
173
+ /** 下载地址 */
174
+ url: string;
175
+ /** 文件名称 */
176
+ name: string;
177
177
  }
178
178
 
179
179
  /** SendReminderEmailRequest 发送发票扫描件压缩包下载链接邮件请求 */
180
180
  interface SendReminderEmailRequest {
181
- /** 发票申请编号 */
182
- invoice_apply_id: string
183
- /** 发票申请单 ID */
184
- application_id: string
181
+ /** 发票申请编号 */
182
+ invoice_apply_id: string;
183
+ /** 发票申请单 ID */
184
+ application_id: string;
185
185
  }
186
186
 
187
187
  /** SendReminderEmailResponse 发送发票扫描件压缩包下载链接邮件返回 */
188
188
  interface SendReminderEmailResponse {}
189
189
 
190
- /** NotifyInvoiceDoneRequest 发票开具完成通知 */
191
- interface NotifyInvoiceDoneRequest {
192
- /** 发票申请单 ID */
193
- application_id: string
194
- /** 发票申请编号 */
195
- invoice_apply_id: string
196
- /** 申请结果 */
197
- status: string
198
- /** 发票张数 */
199
- count: number
200
- /** 价税合计 */
201
- price_tax_amount: string
202
- /** 不含税金额 */
203
- price_amount: string
204
- /** 税额 */
205
- tax_amount: string
206
- /** 发票类型 */
207
- invoice_type: string
208
- /** 购方名称 */
209
- customer_name: string
210
- /** 纳税人识别号 */
211
- customer_tax_num: string
212
- /** 购方地址、电话 */
213
- customer_address_tel: string
214
- /** 开户行及账号 */
215
- bank_name_account: string
216
- /** 货物或应税劳务、服务名称 */
217
- goods_services_name: string
218
- /** 发票备注 */
219
- remark: string
220
- /** 邮寄类型 */
221
- post_type: string
222
- /** 快递单号 */
223
- waybill_number: string[]
224
- /** 驳回原因 */
225
- reject_reason: string
226
- }
227
-
228
190
  export class InvoiceClient extends YZHclient {
229
- constructor(conf: {
230
- dealer_id: string
231
- broker_id: string
232
- app_key: string
233
- des3_key: string
234
- private_key: string
235
- yzh_public_key: string
236
- sign_type: "rsa" | "sha256"
237
- base_url?: string
238
- }) {
239
- super(conf)
240
- }
191
+ // eslint-disable-next-line no-useless-constructor
192
+ constructor(conf: {
193
+ dealer_id: string;
194
+ broker_id: string;
195
+ app_key: string;
196
+ des3_key: string;
197
+ private_key: string;
198
+ yzh_public_key: string;
199
+ sign_type: 'rsa' | 'sha256';
200
+ base_url?: string;
201
+ timeout?: number;
202
+ }) {
203
+ super(conf);
204
+ }
241
205
 
242
- // GetInvoiceStat 查询平台企业已开具和待开具发票金额
243
- async GetInvoiceStat(
244
- req: GetInvoiceStatRequest,
245
- cb?: (error: null | string, rep: GetInvoiceStatResponse) => void
246
- ): Promise<GetInvoiceStatResponse> {
247
- return this.request("get", "/api/payment/v1/invoice-stat", req, { encryption: false }, cb)
248
- }
206
+ // GetInvoiceStat 查询平台企业已开具和待开具发票金额
207
+ async GetInvoiceStat(
208
+ req: GetInvoiceStatRequest,
209
+ cb?: (error: null | string, rep: GetInvoiceStatResponse) => void
210
+ ): Promise<GetInvoiceStatResponse> {
211
+ return this.request('get', '/api/payment/v1/invoice-stat', req, { encryption: false }, cb);
212
+ }
249
213
 
250
- // GetInvoiceAmount 查询可开具发票额度和发票开具信息
251
- async GetInvoiceAmount(
252
- req: GetInvoiceAmountRequest,
253
- cb?: (error: null | string, rep: GetInvoiceAmountResponse) => void
254
- ): Promise<GetInvoiceAmountResponse> {
255
- return this.request("post", "/api/invoice/v2/invoice-amount", req, { encryption: false }, cb)
256
- }
214
+ // GetInvoiceAmount 查询可开具发票额度和发票开具信息
215
+ async GetInvoiceAmount(
216
+ req: GetInvoiceAmountRequest,
217
+ cb?: (error: null | string, rep: GetInvoiceAmountResponse) => void
218
+ ): Promise<GetInvoiceAmountResponse> {
219
+ return this.request('post', '/api/invoice/v2/invoice-amount', req, { encryption: false }, cb);
220
+ }
257
221
 
258
- // ApplyInvoice 发票开具申请
259
- async ApplyInvoice(
260
- req: ApplyInvoiceRequest,
261
- cb?: (error: null | string, rep: ApplyInvoiceResponse) => void
262
- ): Promise<ApplyInvoiceResponse> {
263
- return this.request("post", "/api/invoice/v2/apply", req, { encryption: false }, cb)
264
- }
222
+ // ApplyInvoice 发票开具申请
223
+ async ApplyInvoice(
224
+ req: ApplyInvoiceRequest,
225
+ cb?: (error: null | string, rep: ApplyInvoiceResponse) => void
226
+ ): Promise<ApplyInvoiceResponse> {
227
+ return this.request('post', '/api/invoice/v2/apply', req, { encryption: false }, cb);
228
+ }
265
229
 
266
- // GetInvoiceStatus 查询发票开具申请状态
267
- async GetInvoiceStatus(
268
- req: GetInvoiceStatusRequest,
269
- cb?: (error: null | string, rep: GetInvoiceStatusResponse) => void
270
- ): Promise<GetInvoiceStatusResponse> {
271
- return this.request(
272
- "post",
273
- "/api/invoice/v2/invoice/invoice-status",
274
- req,
275
- { encryption: false },
276
- cb
277
- )
278
- }
230
+ // GetInvoiceStatus 查询发票开具申请状态
231
+ async GetInvoiceStatus(
232
+ req: GetInvoiceStatusRequest,
233
+ cb?: (error: null | string, rep: GetInvoiceStatusResponse) => void
234
+ ): Promise<GetInvoiceStatusResponse> {
235
+ return this.request('post', '/api/invoice/v2/invoice/invoice-status', req, { encryption: false }, cb);
236
+ }
279
237
 
280
- // GetInvoiceInformation 查询发票信息
281
- async GetInvoiceInformation(
282
- req: GetInvoiceInformationRequest,
283
- cb?: (error: null | string, rep: GetInvoiceInformationResponse) => void
284
- ): Promise<GetInvoiceInformationResponse> {
285
- return this.request(
286
- "post",
287
- "/api/invoice/v2/invoice-face-information",
288
- req,
289
- { encryption: false },
290
- cb
291
- )
292
- }
238
+ // GetInvoiceInformation 查询发票信息
239
+ async GetInvoiceInformation(
240
+ req: GetInvoiceInformationRequest,
241
+ cb?: (error: null | string, rep: GetInvoiceInformationResponse) => void
242
+ ): Promise<GetInvoiceInformationResponse> {
243
+ return this.request('post', '/api/invoice/v2/invoice-face-information', req, { encryption: false }, cb);
244
+ }
293
245
 
294
- // GetInvoiceFile 下载 PDF 版发票
295
- async GetInvoiceFile(
296
- req: GetInvoiceFileRequest,
297
- cb?: (error: null | string, rep: GetInvoiceFileResponse) => void
298
- ): Promise<GetInvoiceFileResponse> {
299
- return this.request(
300
- "post",
301
- "/api/invoice/v2/invoice/invoice-pdf",
302
- req,
303
- { encryption: false },
304
- cb
305
- )
306
- }
246
+ // GetInvoiceFile 下载 PDF 版发票
247
+ async GetInvoiceFile(
248
+ req: GetInvoiceFileRequest,
249
+ cb?: (error: null | string, rep: GetInvoiceFileResponse) => void
250
+ ): Promise<GetInvoiceFileResponse> {
251
+ return this.request('post', '/api/invoice/v2/invoice/invoice-pdf', req, { encryption: false }, cb);
252
+ }
307
253
 
308
- // SendReminderEmail 发送发票扫描件压缩包下载链接邮件
309
- async SendReminderEmail(
310
- req: SendReminderEmailRequest,
311
- cb?: (error: null | string, rep: SendReminderEmailResponse) => void
312
- ): Promise<SendReminderEmailResponse> {
313
- return this.request(
314
- "post",
315
- "/api/invoice/v2/invoice/reminder/email",
316
- req,
317
- { encryption: false },
318
- cb
319
- )
320
- }
254
+ // SendReminderEmail 发送发票扫描件压缩包下载链接邮件
255
+ async SendReminderEmail(
256
+ req: SendReminderEmailRequest,
257
+ cb?: (error: null | string, rep: SendReminderEmailResponse) => void
258
+ ): Promise<SendReminderEmailResponse> {
259
+ return this.request('post', '/api/invoice/v2/invoice/reminder/email', req, { encryption: false }, cb);
260
+ }
321
261
  }