-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= | ||
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= | ||
github.com/coreos/etcd v3.3.15+incompatible h1:+9RjdC18gMxNQVvSiXvObLu29mOFmkgdsB4cRTlV+EE= | ||
github.com/coreos/etcd v3.3.15+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= | ||
github.com/nilorg/sdk v0.0.0-20190818083213-d52976243caf h1:RueXnD1RRiIx8BHlCjy48n1lEA9ArWxL6vO3etNUxwY= | ||
github.com/nilorg/sdk v0.0.0-20190818083213-d52976243caf/go.mod h1:X1swpPdqguAZaBDoEPyEWHSsJii0YQ1o+3piMv6W3JU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package wxpay | ||
|
||
import ( | ||
"encoding/xml" | ||
|
||
"github.com/nilorg/sdk/random" | ||
) | ||
|
||
// https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5&index=4 | ||
|
||
// SendGroupRedPackRequest 发裂变红包 | ||
type SendGroupRedPackRequest struct { | ||
XMLName xml.Name `xml:"xml"` | ||
NonceStr string `xml:"nonce_str"` | ||
Sign string `xml:"sign"` | ||
MchBillno string `xml:"mch_billno"` | ||
MchID string `xml:"mch_id"` | ||
SendName string `xml:"send_name"` | ||
ReOpenID string `xml:"re_openid"` | ||
TotalAmount uint `xml:"total_amount"` | ||
TotalNum uint `xml:"total_num"` | ||
AmtType string `xml:"amt_type"` | ||
Wishing string `xml:"wishing"` | ||
ActName string `xml:"act_name"` | ||
Remark string `xml:"remark"` | ||
SceneID string `xml:"scene_id"` | ||
RiskInfo string `xml:"risk_info"` | ||
} | ||
|
||
// NewSendGroupRedPackRequest 创建裂变红包 | ||
func NewSendGroupRedPackRequest() *SendGroupRedPackRequest { | ||
return &SendGroupRedPackRequest{ | ||
NonceStr: random.AZaz09(32), | ||
} | ||
} | ||
|
||
// SignMD5 md5 | ||
func (req *SendGroupRedPackRequest) SignMD5(apiKey string) error { | ||
params, err := SignStructToParameter(*req) | ||
if err != nil { | ||
return err | ||
} | ||
params["key"] = apiKey | ||
value := SignMD5(params) | ||
req.Sign = value | ||
return nil | ||
} | ||
|
||
// SendGroupRedPackResponse ... | ||
type SendGroupRedPackResponse struct { | ||
ResponseStatus | ||
MchBillno string `xml:"mch_billno"` | ||
MchID string `xml:"mch_id"` | ||
WxAppID string `xml:"wxappid"` | ||
ReOpenID string `xml:"re_openid"` | ||
TotalAmount uint `xml:"total_amount"` | ||
SendListID uint `xml:"send_listid"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters