test
This commit is contained in:
parent
5e71fabbf9
commit
3069c47115
|
@ -26,7 +26,7 @@ func TestCard_Order(t *testing.T) {
|
|||
req := &Order{
|
||||
Number: 1,
|
||||
MerchantId: "23329",
|
||||
OutTradeNo: "test_1_zltx_4",
|
||||
OutTradeNo: "test_card_zltx_1",
|
||||
ProductId: "222",
|
||||
Mobile: "18666666666",
|
||||
NotifyUrl: "http://test.openapi.1688sup.cn",
|
||||
|
@ -56,7 +56,7 @@ func TestCard_Query(t *testing.T) {
|
|||
a := &Card{DctWServer: server}
|
||||
req := &Query{
|
||||
MerchantId: "23329",
|
||||
OutTradeNo: "test_1_zltx_4",
|
||||
OutTradeNo: "test_card_zltx_1",
|
||||
Version: "1.0",
|
||||
}
|
||||
resp, err := a.Query(context.Background(), req)
|
||||
|
|
|
@ -26,7 +26,7 @@ func TestDirect_Order(t *testing.T) {
|
|||
req := &Order{
|
||||
Number: 1,
|
||||
MerchantId: "23329",
|
||||
OutTradeNo: "test_1_zltx_7",
|
||||
OutTradeNo: "test_direct_zltx_7",
|
||||
ProductId: "106",
|
||||
AccountType: 1,
|
||||
RechargeAccount: "18666666666",
|
||||
|
@ -57,7 +57,7 @@ func TestDirect_Query(t *testing.T) {
|
|||
a := &Direct{DctWServer: server}
|
||||
req := &Query{
|
||||
MerchantId: "23329",
|
||||
OutTradeNo: "test_1_zltx_7",
|
||||
OutTradeNo: "test_direct_zltx_7",
|
||||
Version: "1.0",
|
||||
}
|
||||
resp, err := a.Query(context.Background(), req)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
const (
|
||||
DeBug = true
|
||||
SignType = "MD5"
|
||||
SignType = "md5"
|
||||
SignKeyName = "Authorization"
|
||||
ApplicationJSON = "application/json"
|
||||
)
|
||||
|
@ -82,7 +82,7 @@ func NewDctWServer(config *DctWConfig, o ...Option) (*DctWServer, error) {
|
|||
|
||||
func (c *DctWServer) Sign(body, path, timestamp string) string {
|
||||
str := c.Config.AppId + body + path + timestamp + c.Config.AppKey
|
||||
return utils.Md5([]byte(str))
|
||||
return utils.Md5ToLower([]byte(str))
|
||||
}
|
||||
|
||||
func (c *DctWServer) BuildAuth(signStr, timestamp string) string {
|
||||
|
|
|
@ -29,6 +29,11 @@ func Load(dir string) ([]string, error) {
|
|||
return files, nil
|
||||
}
|
||||
|
||||
func Md5ToLower(values []byte) string {
|
||||
hash := md5.Sum(values)
|
||||
return strings.ToLower(hex.EncodeToString(hash[:]))
|
||||
}
|
||||
|
||||
func Md5(values []byte) string {
|
||||
hash := md5.Sum(values)
|
||||
return strings.ToUpper(hex.EncodeToString(hash[:]))
|
||||
|
|
Loading…
Reference in New Issue