@ethan-utils/pay-gateway 1.4.1 → 1.4.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethan-utils/pay-gateway",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "蓝兔支付,7Pay 等多种第三方支付的网关工具包",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,6 +8,8 @@
8
8
  "files": [
9
9
  "dist",
10
10
  "types",
11
+ "ltzf/types.d.ts",
12
+ "7pay/types.d.ts",
11
13
  "README.md"
12
14
  ],
13
15
  "exports": {
@@ -42,7 +44,7 @@
42
44
  "@types/crypto-js": "^4.2.2"
43
45
  },
44
46
  "scripts": {
45
- "generate-types": "tsc --emitDeclarationOnly --declaration --declarationDir types --project tsconfig.json",
47
+ "generate-types": "tsc --emitDeclarationOnly --declaration --declarationDir types --project tsconfig.json && cp -f ltzf/types.d.ts types/ltzf/types.d.ts && cp -f 7pay/types.d.ts types/7pay/types.d.ts",
46
48
  "build": "rolldown -c rolldown.config.ts && pnpm generate-types"
47
49
  }
48
50
  }
@@ -0,0 +1,204 @@
1
+ declare global {
2
+ namespace SevenPay {
3
+ namespace Params {
4
+ /**
5
+ * 页面跳转支付参数
6
+ */
7
+ export interface JumpPay {
8
+ /** 商品名称,不超过100字 */
9
+ name: string;
10
+ /** 订单金额,最多保留两位小数 */
11
+ money: string;
12
+ /** 支付方式,alipay/wxpay */
13
+ type: string;
14
+ /** 订单编号,唯一 */
15
+ out_trade_no: string;
16
+ /** 异步通知页面,不支持带参数 */
17
+ notify_url: string;
18
+ /** 商户唯一标识 */
19
+ pid: string;
20
+ /** 支付渠道ID,可选 */
21
+ cid?: string;
22
+ /** 附加内容,可选 */
23
+ param?: string;
24
+ /** 跳转页面,交易完成后跳转,不支持带参数 */
25
+ return_url: string;
26
+ /** 签名 */
27
+ sign?: string;
28
+ /** 签名方法,默认为MD5 */
29
+ sign_type?: "MD5";
30
+ }
31
+ /**
32
+ * API接口支付参数
33
+ */
34
+ export interface ApiPay {
35
+ /** 商户唯一标识 */
36
+ pid: string;
37
+ /** 支付渠道ID,可选 */
38
+ cid?: string;
39
+ /** 支付方式,alipay/wxpay */
40
+ type: string;
41
+ /** 订单编号,唯一 */
42
+ out_trade_no: string;
43
+ /** 异步通知页面,不支持带参数 */
44
+ notify_url: string;
45
+ /** 商品名称,不超过100字 */
46
+ name: string;
47
+ /** 订单金额,最多保留两位小数 */
48
+ money: string;
49
+ /** 客户端IP地址 */
50
+ clientip: string;
51
+ /** 设备类型,可选 */
52
+ device?: string;
53
+ /** 附加内容,可选 */
54
+ param?: string;
55
+ /** 签名 */
56
+ sign?: string;
57
+ /** 签名方法,默认为MD5 */
58
+ sign_type?: "MD5";
59
+ }
60
+ /**
61
+ * 余额查询参数
62
+ */
63
+ export interface BalanceQuery {
64
+ /** 操作类型,固定为balance */
65
+ act: "balance";
66
+ /** 商户唯一标识 */
67
+ pid: string;
68
+ /** 商户密钥 */
69
+ key: string;
70
+ }
71
+ /**
72
+ * 订单查询参数
73
+ */
74
+ export interface OrderQuery {
75
+ /** 操作类型,固定为order */
76
+ act: "order";
77
+ /** 商户唯一标识 */
78
+ pid: string;
79
+ /** 商户密钥 */
80
+ key: string;
81
+ /** 平台订单号,可选 */
82
+ trade_no?: string;
83
+ /** 商户订单号,可选 */
84
+ out_trade_no?: string;
85
+ }
86
+ /**
87
+ * 退款参数
88
+ */
89
+ export interface Refund {
90
+ /** 操作类型,固定为refund */
91
+ act: "refund";
92
+ /** 商户唯一标识 */
93
+ pid: string;
94
+ /** 商户密钥 */
95
+ key: string;
96
+ /** 平台订单号,可选 */
97
+ trade_no?: string;
98
+ /** 商户订单号,可选 */
99
+ out_trade_no?: string;
100
+ /** 退款金额,最多保留两位小数 */
101
+ money: string;
102
+ }
103
+ /**
104
+ * 支付结果通知参数
105
+ */
106
+ export interface Notify {
107
+ pid: string;
108
+ name: string;
109
+ money: string;
110
+ out_trade_no: string;
111
+ trade_no: string;
112
+ param?: string;
113
+ trade_status: string;
114
+ type: string;
115
+ sign: string;
116
+ sign_type: "MD5";
117
+ }
118
+ /**
119
+ * 页面跳转支付业务入参类型
120
+ */
121
+ export type JumpPayInput = Omit<
122
+ JumpPay,
123
+ "pid" | "cid" | "notify_url" | "return_url" | "sign" | "sign_type"
124
+ >;
125
+ /**
126
+ * API接口支付业务入参类型
127
+ */
128
+ export type ApiPayInput = Omit<
129
+ ApiPay,
130
+ "pid" | "cid" | "notify_url" | "sign" | "sign_type"
131
+ >;
132
+ /**
133
+ * 余额查询业务入参类型
134
+ */
135
+ export type BalanceQueryInput = Omit<BalanceQuery, "pid" | "key" | "act">;
136
+ /**
137
+ * 订单查询业务入参类型
138
+ */
139
+ export type OrderQueryInput = Omit<OrderQuery, "pid" | "key" | "act">;
140
+ /**
141
+ * 退款业务入参类型
142
+ */
143
+ export type RefundInput = Omit<Refund, "pid" | "key" | "act">;
144
+ /**
145
+ * 支付结果通知验签业务入参类型
146
+ */
147
+ export type NotifyInput = Omit<Notify, "pid" | "sign" | "sign_type">;
148
+ }
149
+ namespace Response {
150
+ /**
151
+ * API接口支付响应
152
+ */
153
+ export interface ApiPay {
154
+ code: number;
155
+ msg: string;
156
+ O_id?: string;
157
+ trade_no?: string;
158
+ payurl?: string;
159
+ qrcode?: string;
160
+ img?: string;
161
+ }
162
+ /**
163
+ * 余额查询响应
164
+ */
165
+ export interface BalanceQuery {
166
+ code: number;
167
+ msg: string;
168
+ balance?: string;
169
+ }
170
+ /**
171
+ * 订单查询响应
172
+ */
173
+ export interface OrderQuery {
174
+ code: number;
175
+ msg: string;
176
+ trade_no?: string;
177
+ out_trade_no?: string;
178
+ type?: string;
179
+ pid?: string;
180
+ addtime?: string;
181
+ endtime?: string;
182
+ name?: string;
183
+ money?: string;
184
+ status?: number;
185
+ param?: string;
186
+ buyer?: string;
187
+ }
188
+ /**
189
+ * 退款响应
190
+ */
191
+ export interface Refund {
192
+ code: number;
193
+ msg: string;
194
+ }
195
+ /**
196
+ * 支付结果通知响应
197
+ */
198
+ export type Notify = "success" | string;
199
+ }
200
+ }
201
+ }
202
+
203
+ // 导出 SevenPay 命名空间
204
+ export type { SevenPay };