From 91d9552172937701a6122c9241c34e1d9a666903 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Fri, 24 Jul 2026 15:53:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6:=20hb/type?= =?UTF-8?q?s.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb/types.go | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 hb/types.go diff --git a/hb/types.go b/hb/types.go new file mode 100644 index 0000000..5ecb769 --- /dev/null +++ b/hb/types.go @@ -0,0 +1,58 @@ +package hb + +// RefundRequest 退款接口请求参数 +type RefundRequest struct { + MerchantId string `json:"merchantId"` // 商户编号 + RequestId string `json:"requestId"` // 商户请求号 + SignType string `json:"signType"` // 签名方式:MD5 或 RSA + Type string `json:"type"` // 接口类型:OrderRefund + Version string `json:"version"` // 版本号:2.0.0 + OrderId string `json:"orderId"` // 商户订单号 + Amount string `json:"amount"` // 退款金额,以分为单位 + MerchantCert string `json:"merchantCert,omitempty"` // 商户证书公钥(不参与签名) + Hmac string `json:"hmac,omitempty"` // 签名数据 +} + +// RefundResponse 退款接口响应参数 +type RefundResponse struct { + MerchantId string `json:"merchantId"` // 商户编号 + PayNo string `json:"payNo"` // 手机支付平台退款交易流水号 + ReturnCode string `json:"returnCode"` // 返回码 + Message string `json:"message"` // 返回码描述信息 + SignType string `json:"signType"` // 签名方式:MD5 或 RSA + Type string `json:"type"` // 接口类型:OrderRefund + Version string `json:"version"` // 版本号:2.0.0 + Amount string `json:"amount"` // 退款金额,单位为分 + OrderId string `json:"orderId"` // 商户订单号 + Status string `json:"status"` // 退款结果:SUCCESS / FAILED + ServerCert string `json:"serverCert,omitempty"` // 服务器证书公钥(不参与签名) + Hmac string `json:"hmac,omitempty"` // 签名数据 +} + +// RefundStatus 退款状态常量 +const ( + RefundStatusSuccess = "SUCCESS" + RefundStatusFailed = "FAILED" +) + +// SignType 签名方式常量 +const ( + SignTypeMD5 = "MD5" + SignTypeRSA = "RSA" +) + +// 接口类型常量 +const ( + InterfaceTypeOrderRefund = "OrderRefund" +) + +// 版本号常量 +const ( + Version = "2.0.0" +) + +// 返回码常量 +const ( + ReturnCodeSuccess = "000000" + ReturnCodeSuccessAlt = "MCG00000" +) \ No newline at end of file