test
This commit is contained in:
parent
7ad047acd6
commit
e8d8ec626f
|
@ -30,7 +30,44 @@ func getAlpayRedConf() []byte {
|
|||
return marshal
|
||||
}
|
||||
|
||||
func alipayRedPack() {
|
||||
func alipayOrderRedPack() {
|
||||
err := manage.Add(alpayRedConf)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
defer manage.Close()
|
||||
type ProductExtra struct {
|
||||
Wishing string `json:"wishing"`
|
||||
}
|
||||
productExtra := ProductExtra{Wishing: "wishing"}
|
||||
productExtraBytes, err := json.Marshal(productExtra)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
request := &proto.OrderRequest{
|
||||
Config: config(),
|
||||
Order: &proto.OrderRequest_Order{
|
||||
OrderNo: "lsxd202406071545141534",
|
||||
Account: "18512869479",
|
||||
Quantity: 1,
|
||||
Amount: 0.01,
|
||||
Extra: []byte(`{"name":"樊波"}`),
|
||||
},
|
||||
Product: &proto.OrderRequest_Product{
|
||||
ProductNo: "",
|
||||
Price: 0.01,
|
||||
Extra: productExtraBytes,
|
||||
},
|
||||
}
|
||||
log.Printf("Order request.Product.Extra:%s", string(request.Product.Extra))
|
||||
result, err := instance.Order(context.Background(), alpayRedConf.Tag, request)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
log.Printf("Order res:%+v", result)
|
||||
}
|
||||
|
||||
func alipayQueryRedPack() {
|
||||
err := manage.Add(alpayRedConf)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
|
|
|
@ -3,5 +3,5 @@ package main
|
|||
// main 这只是一个演示
|
||||
func main() {
|
||||
//wechatCpn()
|
||||
wechatRedPack()
|
||||
alipayOrderRedPack()
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ func TestOrder(t *testing.T) {
|
|||
request := &proto.OrderRequest{
|
||||
Config: config(),
|
||||
Order: &proto.OrderRequest_Order{
|
||||
OrderNo: "lsxd202406071545141533",
|
||||
Account: "18666173766",
|
||||
OrderNo: "lsxd202406071545141534",
|
||||
Account: "18512869479",
|
||||
Quantity: 1,
|
||||
Amount: 0.01,
|
||||
Extra: []byte(`{"name":"李子铭"}`),
|
||||
Extra: []byte(`{"name":"樊波"}`),
|
||||
},
|
||||
Product: &proto.OrderRequest_Product{
|
||||
ProductNo: "",
|
||||
|
|
Loading…
Reference in New Issue