@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,315 @@
1
+ import YZHclient from "../../common/client";
2
+
3
+ /** GetDailyOrderFileRequest 查询日订单文件请求 */
4
+ interface GetDailyOrderFileRequest {
5
+ /** 订单查询日期, 格式:yyyy-MM-dd */
6
+ order_date: string
7
+ }
8
+
9
+ /** GetDailyOrderFileResponse 查询日订单文件返回 */
10
+ interface GetDailyOrderFileResponse {
11
+ /** 下载地址 */
12
+ order_download_url: string
13
+ }
14
+
15
+ /** GetDailyBillFileV2Request 查询日流水文件请求 */
16
+ interface GetDailyBillFileV2Request {
17
+ /** 所需获取的日流水日期,格式:yyyy-MM-dd */
18
+ bill_date: string
19
+ }
20
+
21
+ /** GetDailyBillFileV2Response 查询日流水文件返回 */
22
+ interface GetDailyBillFileV2Response {
23
+ /** 下载地址 */
24
+ bill_download_url: string
25
+ }
26
+
27
+ /** ListDealerRechargeRecordV2Request 平台企业预付业务服务费记录请求 */
28
+ interface ListDealerRechargeRecordV2Request {
29
+ /** 开始时间,格式:yyyy-MM-dd */
30
+ begin_at: string
31
+ /** 结束时间,格式:yyyy-MM-dd */
32
+ end_at: string
33
+ }
34
+
35
+ /** ListDealerRechargeRecordV2Response 平台企业预付业务服务费记录返回 */
36
+ interface ListDealerRechargeRecordV2Response {
37
+ /** 预付业务服务费记录 */
38
+ data: RechargeRecordInfo[]
39
+ }
40
+
41
+ /** RechargeRecordInfo 预付业务服务费记录信息 */
42
+ interface RechargeRecordInfo {
43
+ /** 平台企业 ID */
44
+ dealer_id: string
45
+ /** 综合服务主体 ID */
46
+ broker_id: string
47
+ /** 预付业务服务费记录 ID */
48
+ recharge_id: string
49
+ /** 预付业务服务费 */
50
+ amount: string
51
+ /** 实际到账金额 */
52
+ actual_amount: string
53
+ /** 创建时间 */
54
+ created_at: string
55
+ /** 资金用途 */
56
+ recharge_channel: string
57
+ /** 预付业务服务费备注 */
58
+ remark: string
59
+ /** 平台企业付款银行账号 */
60
+ recharge_account_no: string
61
+ }
62
+
63
+ /** ListDailyOrderRequest 查询日订单数据请求 */
64
+ interface ListDailyOrderRequest {
65
+ /** 订单查询日期, 格式:yyyy-MM-dd格式:yyyy-MM-dd */
66
+ order_date: string
67
+ /** 偏移量 */
68
+ offset: number
69
+ /** 长度 */
70
+ length: number
71
+ /** 支付路径名,银行卡(默认)、支付宝、微信 */
72
+ channel: string
73
+ /** 如果为 encryption,则对返回的 data 进行加密 */
74
+ data_type: string
75
+ }
76
+
77
+ /** ListDailyOrderResponse 查询日订单数据返回 */
78
+ interface ListDailyOrderResponse {
79
+ /** 总数目 */
80
+ total_num: number
81
+ /** 条目信息 */
82
+ list: DealerOrderInfo[]
83
+ }
84
+
85
+ /** DealerOrderInfo 平台企业支付订单信息 */
86
+ interface DealerOrderInfo {
87
+ /** 综合服务主体 ID */
88
+ broker_id: string
89
+ /** 平台企业 ID */
90
+ dealer_id: string
91
+ /** 平台企业订单号 */
92
+ order_id: string
93
+ /** 订单流水号 */
94
+ ref: string
95
+ /** 批次ID */
96
+ batch_id: string
97
+ /** 姓名 */
98
+ real_name: string
99
+ /** 收款账号 */
100
+ card_no: string
101
+ /** 综合服务主体订单金额 */
102
+ broker_amount: string
103
+ /** 综合服务主体加成服务费 */
104
+ broker_fee: string
105
+ /** 支付路径流水号 */
106
+ bill: string
107
+ /** 订单状态 */
108
+ status: string
109
+ /** 订单状态码描述 */
110
+ status_message: string
111
+ /** 订单详情 */
112
+ status_detail: string
113
+ /** 订单详细状态码描述 */
114
+ status_detail_message: string
115
+ /** 短周期授信账单号 */
116
+ statement_id: string
117
+ /** 服务费账单号 */
118
+ fee_statement_id: string
119
+ /** 余额账单号 */
120
+ bal_statement_id: string
121
+ /** 支付路径 */
122
+ channel: string
123
+ /** 创建时间 */
124
+ created_at: string
125
+ /** 完成时间 */
126
+ finished_time: string
127
+ }
128
+
129
+ /** ListDailyBillRequest 查询日流水数据请求 */
130
+ interface ListDailyBillRequest {
131
+ /** 流水查询日期 */
132
+ bill_date: string
133
+ /** 偏移量 */
134
+ offset: number
135
+ /** 长度 */
136
+ length: number
137
+ /** 如果为 encryption,则对返回的 data 进行加密 */
138
+ data_type: string
139
+ }
140
+
141
+ /** ListDailyBillResponse 查询日流水数据返回 */
142
+ interface ListDailyBillResponse {
143
+ /** 总条数 */
144
+ total_num: number
145
+ /** 条目信息 */
146
+ list: DealerBillInfo[]
147
+ }
148
+
149
+ /** DealerBillInfo 流水详情 */
150
+ interface DealerBillInfo {
151
+ /** 综合服务主体 ID */
152
+ broker_id: string
153
+ /** 平台企业 ID */
154
+ dealer_id: string
155
+ /** 平台企业订单号 */
156
+ order_id: string
157
+ /** 资金流水号 */
158
+ ref: string
159
+ /** 综合服务主体名称 */
160
+ broker_product_name: string
161
+ /** 平台企业名称 */
162
+ dealer_product_name: string
163
+ /** 业务订单流水号 */
164
+ biz_ref: string
165
+ /** 账户类型 */
166
+ acct_type: string
167
+ /** 入账金额 */
168
+ amount: string
169
+ /** 账户余额 */
170
+ balance: string
171
+ /** 业务分类 */
172
+ business_category: string
173
+ /** 业务类型 */
174
+ business_type: string
175
+ /** 收支类型 */
176
+ consumption_type: string
177
+ /** 入账时间 */
178
+ created_at: string
179
+ /** 备注 */
180
+ remark: string
181
+ }
182
+
183
+ /** GetDailyOrderFileV2Request 查询日订单文件(支付和退款订单)请求 */
184
+ interface GetDailyOrderFileV2Request {
185
+ /** 订单查询日期, 格式:yyyy-MM-dd */
186
+ order_date: string
187
+ }
188
+
189
+ /** GetDailyOrderFileV2Response 查询日订单文件(支付和退款订单)返回 */
190
+ interface GetDailyOrderFileV2Response {
191
+ /** 下载地址 */
192
+ url: string
193
+ }
194
+
195
+ /** ListBalanceDailyStatementRequest 查询余额日账单数据请求 */
196
+ interface ListBalanceDailyStatementRequest {
197
+ /** 账单查询日期 格式:yyyy-MM-dd */
198
+ statement_date: string
199
+ }
200
+
201
+ /** ListBalanceDailyStatementResponse 查询余额日账单数据返回 */
202
+ interface ListBalanceDailyStatementResponse {
203
+ /** 条目信息 */
204
+ list: StatementDetail[]
205
+ }
206
+
207
+ /** StatementDetail 余额账单信息详情 */
208
+ interface StatementDetail {
209
+ /** 账单 ID */
210
+ statement_id: string
211
+ /** 账单日期 */
212
+ statement_date: string
213
+ /** 综合服务主体 ID */
214
+ broker_id: string
215
+ /** 平台企业 ID */
216
+ dealer_id: string
217
+ /** 综合服务主体名称 */
218
+ broker_product_name: string
219
+ /** 平台企业名称 */
220
+ dealer_product_name: string
221
+ /** 业务类型 */
222
+ biz_type: string
223
+ /** 账单金额 */
224
+ total_money: string
225
+ /** 订单金额 */
226
+ amount: string
227
+ /** 退汇金额 */
228
+ reex_amount: string
229
+ /** 加成服务费金额 */
230
+ fee_amount: string
231
+ /** 加成服务费抵扣金额 */
232
+ deduct_rebate_fee_amount: string
233
+ /** 冲补金额 */
234
+ money_adjust: string
235
+ /** 账单状态 */
236
+ status: string
237
+ /** 开票状态 */
238
+ invoice_status: string
239
+ /** 项目 ID */
240
+ project_id: string
241
+ /** 项目名称 */
242
+ project_name: string
243
+ }
244
+
245
+ export class Dataservice extends YZHclient {
246
+ constructor(conf: {
247
+ dealer_id: string
248
+ broker_id: string
249
+ app_key: string
250
+ des3_key: string
251
+ private_key: string
252
+ yzh_public_key: string
253
+ sign_type: "rsa" | "sha256"
254
+ base_url?: string
255
+ }) {
256
+ super(conf)
257
+ }
258
+
259
+ // ListDailyOrder 查询日订单数据
260
+ async ListDailyOrder(
261
+ req: ListDailyOrderRequest,
262
+ cb?: (error: null | string, rep: ListDailyOrderResponse) => void
263
+ ): Promise<ListDailyOrderResponse> {
264
+ return this.request("get", "/api/dataservice/v1/orders", req, { encryption: req?.data_type===" encryption" }, cb)
265
+ }
266
+
267
+ // GetDailyOrderFile 查询日订单文件
268
+ async GetDailyOrderFile(
269
+ req: GetDailyOrderFileRequest,
270
+ cb?: (error: null | string, rep: GetDailyOrderFileResponse) => void
271
+ ): Promise<GetDailyOrderFileResponse> {
272
+ return this.request("get", "/api/dataservice/v1/order/downloadurl", req, { encryption: false }, cb)
273
+ }
274
+
275
+ // GetDailyOrderFileV2 查询日订单文件(支付和退款订单)
276
+ async GetDailyOrderFileV2(
277
+ req: GetDailyOrderFileV2Request,
278
+ cb?: (error: null | string, rep: GetDailyOrderFileV2Response) => void
279
+ ): Promise<GetDailyOrderFileV2Response> {
280
+ return this.request("get", "/api/dataservice/v1/order/day/url", req, { encryption: false }, cb)
281
+ }
282
+
283
+ // ListDailyBill 查询日流水数据
284
+ async ListDailyBill(
285
+ req: ListDailyBillRequest,
286
+ cb?: (error: null | string, rep: ListDailyBillResponse) => void
287
+ ): Promise<ListDailyBillResponse> {
288
+ return this.request("get", "/api/dataservice/v1/bills", req, { encryption: req?.data_type===" encryption" }, cb)
289
+ }
290
+
291
+ // GetDailyBillFileV2 查询日流水文件
292
+ async GetDailyBillFileV2(
293
+ req: GetDailyBillFileV2Request,
294
+ cb?: (error: null | string, rep: GetDailyBillFileV2Response) => void
295
+ ): Promise<GetDailyBillFileV2Response> {
296
+ return this.request("get", "/api/dataservice/v2/bill/downloadurl", req, { encryption: false }, cb)
297
+ }
298
+
299
+ // ListDealerRechargeRecordV2 查询平台企业预付业务服务费记录
300
+ async ListDealerRechargeRecordV2(
301
+ req: ListDealerRechargeRecordV2Request,
302
+ cb?: (error: null | string, rep: ListDealerRechargeRecordV2Response) => void
303
+ ): Promise<ListDealerRechargeRecordV2Response> {
304
+ return this.request("get", "/api/dataservice/v2/recharge-record", req, { encryption: false }, cb)
305
+ }
306
+
307
+ // ListBalanceDailyStatement 查询余额日账单数据
308
+ async ListBalanceDailyStatement(
309
+ req: ListBalanceDailyStatementRequest,
310
+ cb?: (error: null | string, rep: ListBalanceDailyStatementResponse) => void
311
+ ): Promise<ListBalanceDailyStatementResponse> {
312
+ return this.request("get", "/api/dataservice/v1/statements-daily", req, { encryption: false }, cb)
313
+ }
314
+
315
+ }
@@ -0,0 +1,145 @@
1
+ import YZHclient from "../../common/client";
2
+
3
+ /** H5UserPresignRequest 预申请签约请求 */
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
15
+ }
16
+
17
+ /** H5UserPresignResponse 预申请签约返回 */
18
+ interface H5UserPresignResponse {
19
+ /** 用户 ID(废弃字段) */
20
+ uid: string
21
+ /** H5 签约 token */
22
+ token: string
23
+ /** 签约状态 */
24
+ status: number
25
+ }
26
+
27
+ /** H5UserSignRequest 申请签约请求 */
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
37
+ }
38
+
39
+ /** H5UserSignResponse 申请签约返回 */
40
+ interface H5UserSignResponse {
41
+ /** H5 签约页面 URL */
42
+ url: string
43
+ }
44
+
45
+ /** GetH5UserSignStatusRequest 获取用户签约状态请求 */
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
55
+ }
56
+
57
+ /** GetH5UserSignStatusResponse 获取用户签约状态返回 */
58
+ interface GetH5UserSignStatusResponse {
59
+ /** 签约时间 */
60
+ signed_at: string
61
+ /** 用户签约状态 */
62
+ status: number
63
+ }
64
+
65
+ /** H5UserReleaseRequest 用户解约(测试账号专用接口)请求 */
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
77
+ }
78
+
79
+ /** H5UserReleaseResponse 用户解约(测试账号专用接口)返回 */
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
97
+ }
98
+
99
+ export class H5usersign 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
+ }
112
+
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
+ }
120
+
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
+ }
128
+
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
+ }
136
+
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
+ }
144
+
145
+ }
@@ -0,0 +1,10 @@
1
+ export { Util } from "../common/utils"
2
+ export { Apiusersign } from "./apiusersign"
3
+ export { Authentication } from "./authentication"
4
+ export { Dataservice } from "./dataservice"
5
+ export { H5usersign } from "./h5usersign"
6
+ export { Invoice } from "./invoice"
7
+ export { Payment } from "./payment"
8
+ export { Tax } from "./tax"
9
+ export { Bizlicxjjh5api } from "./bizlicxjjh5api"
10
+ export { Bizlicxjjh5 } from "./bizlicxjjh5"