@yunzhanghu/sdk-nodejs 1.0.3 → 1.0.5

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 (44) hide show
  1. package/.eslintignore +2 -1
  2. package/README.md +6 -3
  3. package/example/apiUserSign.js +24 -12
  4. package/example/authentication.js +48 -24
  5. package/example/bizlicXjjH5.js +12 -6
  6. package/example/bizlicXjjH5Api.js +18 -9
  7. package/example/custom.js +53 -0
  8. package/example/dataService.js +42 -21
  9. package/example/h5UserSign.js +24 -12
  10. package/example/invoice.js +42 -21
  11. package/example/payment.js +93 -33
  12. package/example/tax.js +12 -6
  13. package/example/uploadusersign.js +12 -6
  14. package/package.json +2 -4
  15. package/src/common/client.ts +361 -371
  16. package/src/common/exception/yzhSDKHttpException.ts +26 -26
  17. package/src/common/http/index.ts +56 -58
  18. package/src/common/utils/index.ts +16 -16
  19. package/src/index.ts +1 -1
  20. package/src/services/apiusersign/index.ts +107 -107
  21. package/src/services/authentication/index.ts +162 -180
  22. package/src/services/bizlicxjjh5/index.ts +77 -77
  23. package/src/services/bizlicxjjh5api/index.ts +108 -126
  24. package/src/services/custom/index.ts +36 -0
  25. package/src/services/dataservice/index.ts +246 -270
  26. package/src/services/h5usersign/index.ts +93 -93
  27. package/src/services/index.ts +12 -11
  28. package/src/services/invoice/index.ts +184 -208
  29. package/src/services/payment/index.ts +493 -387
  30. package/src/services/tax/index.ts +53 -53
  31. package/src/services/uploadusersign/index.ts +67 -67
  32. package/src/typings.d.ts +1 -1
  33. package/yzh/common/client.d.ts +3 -3
  34. package/yzh/common/client.js +24 -31
  35. package/yzh/common/exception/yzhSDKHttpException.js +2 -2
  36. package/yzh/common/http/index.js +9 -9
  37. package/yzh/common/utils/index.d.ts +2 -2
  38. package/yzh/index.d.ts +1 -1
  39. package/yzh/services/custom/index.d.ts +28 -0
  40. package/yzh/services/custom/index.js +23 -0
  41. package/yzh/services/index.d.ts +12 -11
  42. package/yzh/services/index.js +3 -1
  43. package/yzh/services/payment/index.d.ts +106 -4
  44. package/yzh/services/payment/index.js +4 -0
@@ -1,285 +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
190
  export class InvoiceClient extends YZHclient {
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
- }
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
+ }
205
205
 
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
- }
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
+ }
213
213
 
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
- }
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
+ }
221
221
 
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
- }
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
+ }
229
229
 
230
- // GetInvoiceStatus 查询发票开具申请状态
231
- async GetInvoiceStatus(
232
- req: GetInvoiceStatusRequest,
233
- cb?: (error: null | string, rep: GetInvoiceStatusResponse) => void
234
- ): Promise<GetInvoiceStatusResponse> {
235
- return this.request(
236
- "post",
237
- "/api/invoice/v2/invoice/invoice-status",
238
- req,
239
- { encryption: false },
240
- cb
241
- )
242
- }
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
+ }
243
237
 
244
- // GetInvoiceInformation 查询发票信息
245
- async GetInvoiceInformation(
246
- req: GetInvoiceInformationRequest,
247
- cb?: (error: null | string, rep: GetInvoiceInformationResponse) => void
248
- ): Promise<GetInvoiceInformationResponse> {
249
- return this.request(
250
- "post",
251
- "/api/invoice/v2/invoice-face-information",
252
- req,
253
- { encryption: false },
254
- cb
255
- )
256
- }
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
+ }
257
245
 
258
- // GetInvoiceFile 下载 PDF 版发票
259
- async GetInvoiceFile(
260
- req: GetInvoiceFileRequest,
261
- cb?: (error: null | string, rep: GetInvoiceFileResponse) => void
262
- ): Promise<GetInvoiceFileResponse> {
263
- return this.request(
264
- "post",
265
- "/api/invoice/v2/invoice/invoice-pdf",
266
- req,
267
- { encryption: false },
268
- cb
269
- )
270
- }
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
+ }
271
253
 
272
- // SendReminderEmail 发送发票扫描件压缩包下载链接邮件
273
- async SendReminderEmail(
274
- req: SendReminderEmailRequest,
275
- cb?: (error: null | string, rep: SendReminderEmailResponse) => void
276
- ): Promise<SendReminderEmailResponse> {
277
- return this.request(
278
- "post",
279
- "/api/invoice/v2/invoice/reminder/email",
280
- req,
281
- { encryption: false },
282
- cb
283
- )
284
- }
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
+ }
285
261
  }