@yunzhanghu/sdk-nodejs 0.0.1-beta.1

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/.eslintignore +4 -0
  2. package/.eslintrc.json +19 -0
  3. package/.husky/pre-commit +7 -0
  4. package/LICENSE +201 -0
  5. package/README.md +114 -0
  6. package/example/apiUserSign.js +70 -0
  7. package/example/authentication.js +142 -0
  8. package/example/bizlicXjjH5.js +46 -0
  9. package/example/bizlicXjjH5Api.js +65 -0
  10. package/example/conf/config.js +30 -0
  11. package/example/dataService.js +98 -0
  12. package/example/h5UserSign.js +68 -0
  13. package/example/invoice.js +91 -0
  14. package/example/notify.js +36 -0
  15. package/example/package.json +12 -0
  16. package/example/payment.js +186 -0
  17. package/example/tax.js +34 -0
  18. package/package.json +47 -0
  19. package/prettier.config.js +32 -0
  20. package/src/common/client.ts +367 -0
  21. package/src/common/exception/yzhSDKHttpException.ts +32 -0
  22. package/src/common/http/index.ts +57 -0
  23. package/src/common/utils/index.ts +18 -0
  24. package/src/index.ts +1 -0
  25. package/src/services/apiusersign/index.ts +125 -0
  26. package/src/services/authentication/index.ts +247 -0
  27. package/src/services/bizlicxjjh5/index.ts +129 -0
  28. package/src/services/bizlicxjjh5api/index.ts +169 -0
  29. package/src/services/dataservice/index.ts +315 -0
  30. package/src/services/h5usersign/index.ts +145 -0
  31. package/src/services/index.ts +10 -0
  32. package/src/services/invoice/index.ts +257 -0
  33. package/src/services/payment/index.ts +523 -0
  34. package/src/services/tax/index.ts +77 -0
  35. package/src/typings.d.ts +1 -0
  36. package/tsconfig.json +25 -0
  37. package/yzh/common/client.d.ts +119 -0
  38. package/yzh/common/client.js +314 -0
  39. package/yzh/common/exception/yzhSDKHttpException.d.ts +10 -0
  40. package/yzh/common/exception/yzhSDKHttpException.js +21 -0
  41. package/yzh/common/http/index.d.ts +6 -0
  42. package/yzh/common/http/index.js +51 -0
  43. package/yzh/common/utils/index.d.ts +14 -0
  44. package/yzh/common/utils/index.js +11 -0
  45. package/yzh/index.d.ts +1 -0
  46. package/yzh/index.js +4 -0
  47. package/yzh/services/apiusersign/index.d.ts +86 -0
  48. package/yzh/services/apiusersign/index.js +26 -0
  49. package/yzh/services/authentication/index.d.ts +153 -0
  50. package/yzh/services/authentication/index.js +42 -0
  51. package/yzh/services/bizlicxjjh5/index.d.ts +76 -0
  52. package/yzh/services/bizlicxjjh5/index.js +18 -0
  53. package/yzh/services/bizlicxjjh5api/index.d.ts +107 -0
  54. package/yzh/services/bizlicxjjh5api/index.js +22 -0
  55. package/yzh/services/dataservice/index.d.ts +243 -0
  56. package/yzh/services/dataservice/index.js +38 -0
  57. package/yzh/services/h5usersign/index.d.ts +90 -0
  58. package/yzh/services/h5usersign/index.js +26 -0
  59. package/yzh/services/index.d.ts +10 -0
  60. package/yzh/services/index.js +23 -0
  61. package/yzh/services/invoice/index.d.ts +158 -0
  62. package/yzh/services/invoice/index.js +34 -0
  63. package/yzh/services/payment/index.d.ts +358 -0
  64. package/yzh/services/payment/index.js +50 -0
  65. package/yzh/services/tax/index.d.ts +55 -0
  66. package/yzh/services/tax/index.js +18 -0
@@ -0,0 +1,257 @@
1
+ import YZHclient from "../../common/client";
2
+
3
+ /** GetInvoiceStatRequest 查询平台企业已开具和待开具发票金额请求 */
4
+ interface GetInvoiceStatRequest {
5
+ /** 综合服务主体 ID */
6
+ broker_id: string
7
+ /** 平台企业 ID */
8
+ dealer_id: string
9
+ /** 查询年份 */
10
+ year: number
11
+ }
12
+
13
+ /** GetInvoiceStatResponse 查询平台企业已开具和待开具发票金额返回 */
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
25
+ }
26
+
27
+ /** GetInvoiceAmountRequest 查询可开具发票额度和发票开具信息请求 */
28
+ interface GetInvoiceAmountRequest {
29
+ /** 综合服务主体 ID */
30
+ broker_id: string
31
+ /** 平台企业 ID */
32
+ dealer_id: string
33
+ }
34
+
35
+ /** GetInvoiceAmountResponse 查询可开具发票额度和发票开具信息返回 */
36
+ interface GetInvoiceAmountResponse {
37
+ /** 可开票额度 */
38
+ amount: string
39
+ /** 系统支持的开户行及账号 */
40
+ bank_name_account: BankNameAccount[]
41
+ /** 系统支持的货物或应税劳务、服务名称 */
42
+ goods_services_name: GoodsServicesName[]
43
+ }
44
+
45
+ /** ApplyInvoiceRequest 发票开具申请请求 */
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
63
+ }
64
+
65
+ /** ApplyInvoiceResponse 发票开具申请返回 */
66
+ interface ApplyInvoiceResponse {
67
+ /** 发票申请单 ID */
68
+ application_id: string
69
+ /** 发票张数 */
70
+ count: string
71
+ }
72
+
73
+ /** GetInvoiceStatusRequest 查询发票开具申请状态请求 */
74
+ interface GetInvoiceStatusRequest {
75
+ /** 发票申请编号 */
76
+ invoice_apply_id: string
77
+ /** 发票申请单 ID */
78
+ application_id: string
79
+ }
80
+
81
+ /** GetInvoiceStatusResponse 查询发票开具申请状态返回 */
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[]
111
+ }
112
+
113
+ /** BankNameAccount 系统支持的开户行及账号 */
114
+ interface BankNameAccount {
115
+ /** 开户行及账号 */
116
+ item: string
117
+ /** 是否为默认值 */
118
+ default: boolean
119
+ }
120
+
121
+ /** GoodsServicesName 系统支持的货物或应税劳务、服务名称 */
122
+ interface GoodsServicesName {
123
+ /** 货物或应税劳务、服务名称 */
124
+ item: string
125
+ /** 是否为默认值 */
126
+ default: boolean
127
+ }
128
+
129
+ /** GetInvoiceFileRequest 下载 PDF 版发票请求 */
130
+ interface GetInvoiceFileRequest {
131
+ /** 发票申请编号 */
132
+ invoice_apply_id: string
133
+ /** 发票申请单 ID */
134
+ application_id: string
135
+ }
136
+
137
+ /** GetInvoiceFileResponse 下载 PDF 版发票返回 */
138
+ interface GetInvoiceFileResponse {
139
+ /** 下载地址 */
140
+ url: string
141
+ /** 文件名称 */
142
+ name: string
143
+ }
144
+
145
+ /** SendReminderEmailRequest 发送发票扫描件压缩包下载链接邮件请求 */
146
+ interface SendReminderEmailRequest {
147
+ /** 发票申请编号 */
148
+ invoice_apply_id: string
149
+ /** 发票申请单 ID */
150
+ application_id: string
151
+ }
152
+
153
+ /** SendReminderEmailResponse 发送发票扫描件压缩包下载链接邮件返回 */
154
+ interface SendReminderEmailResponse {
155
+ }
156
+
157
+ /** NotifyInvoiceDoneRequest 发票开具完成通知 */
158
+ interface NotifyInvoiceDoneRequest {
159
+ /** 发票申请单 ID */
160
+ application_id: string
161
+ /** 发票申请编号 */
162
+ invoice_apply_id: string
163
+ /** 申请结果 */
164
+ status: string
165
+ /** 发票张数 */
166
+ count: number
167
+ /** 价税合计 */
168
+ price_tax_amount: string
169
+ /** 不含税金额 */
170
+ price_amount: string
171
+ /** 税额 */
172
+ tax_amount: string
173
+ /** 发票类型 */
174
+ invoice_type: string
175
+ /** 购方名称 */
176
+ customer_name: string
177
+ /** 纳税人识别号 */
178
+ customer_tax_num: string
179
+ /** 购方地址、电话 */
180
+ customer_address_tel: string
181
+ /** 开户行及账号 */
182
+ bank_name_account: string
183
+ /** 货物或应税劳务、服务名称 */
184
+ goods_services_name: string
185
+ /** 发票备注 */
186
+ remark: string
187
+ /** 邮寄类型 */
188
+ post_type: string
189
+ /** 快递单号 */
190
+ waybill_number: string[]
191
+ /** 驳回原因 */
192
+ reject_reason: string
193
+ }
194
+
195
+ export class Invoice extends YZHclient {
196
+ constructor(conf: {
197
+ dealer_id: string
198
+ broker_id: string
199
+ app_key: string
200
+ des3_key: string
201
+ private_key: string
202
+ yzh_public_key: string
203
+ sign_type: "rsa" | "sha256"
204
+ base_url?: string
205
+ }) {
206
+ super(conf)
207
+ }
208
+
209
+ // GetInvoiceStat 查询平台企业已开具和待开具发票金额
210
+ async GetInvoiceStat(
211
+ req: GetInvoiceStatRequest,
212
+ cb?: (error: null | string, rep: GetInvoiceStatResponse) => void
213
+ ): Promise<GetInvoiceStatResponse> {
214
+ return this.request("get", "/api/payment/v1/invoice-stat", req, { encryption: false }, cb)
215
+ }
216
+
217
+ // GetInvoiceAmount 查询可开具发票额度和发票开具信息
218
+ async GetInvoiceAmount(
219
+ req: GetInvoiceAmountRequest,
220
+ cb?: (error: null | string, rep: GetInvoiceAmountResponse) => void
221
+ ): Promise<GetInvoiceAmountResponse> {
222
+ return this.request("post", "/api/invoice/v2/invoice-amount", req, { encryption: false }, cb)
223
+ }
224
+
225
+ // ApplyInvoice 发票开具申请
226
+ async ApplyInvoice(
227
+ req: ApplyInvoiceRequest,
228
+ cb?: (error: null | string, rep: ApplyInvoiceResponse) => void
229
+ ): Promise<ApplyInvoiceResponse> {
230
+ return this.request("post", "/api/invoice/v2/apply", req, { encryption: false }, cb)
231
+ }
232
+
233
+ // GetInvoiceStatus 查询发票开具申请状态
234
+ async GetInvoiceStatus(
235
+ req: GetInvoiceStatusRequest,
236
+ cb?: (error: null | string, rep: GetInvoiceStatusResponse) => void
237
+ ): Promise<GetInvoiceStatusResponse> {
238
+ return this.request("post", "/api/invoice/v2/invoice/invoice-status", req, { encryption: false }, cb)
239
+ }
240
+
241
+ // GetInvoiceFile 下载 PDF 版发票
242
+ async GetInvoiceFile(
243
+ req: GetInvoiceFileRequest,
244
+ cb?: (error: null | string, rep: GetInvoiceFileResponse) => void
245
+ ): Promise<GetInvoiceFileResponse> {
246
+ return this.request("post", "/api/invoice/v2/invoice/invoice-pdf", req, { encryption: false }, cb)
247
+ }
248
+
249
+ // SendReminderEmail 发送发票扫描件压缩包下载链接邮件
250
+ async SendReminderEmail(
251
+ req: SendReminderEmailRequest,
252
+ cb?: (error: null | string, rep: SendReminderEmailResponse) => void
253
+ ): Promise<SendReminderEmailResponse> {
254
+ return this.request("post", "/api/invoice/v2/invoice/reminder/email", req, { encryption: false }, cb)
255
+ }
256
+
257
+ }