//go:build integration package rpc import ( "encoding/json" "fmt" "testing" pb "bsm/full/module/ec/order/pb" ) func TestQuickCreateByToken(t *testing.T) { coon, ctx := GetCoon() clent := pb.NewSummaryClient(coon) defer coon.Close() data := pb.QuickCreateByProductRequest{ PartnerId: 5, ProductIdentity: "a34d83f3-f09c-42e8-8c2c-85d5eba363c3", Number: 10, SpecIdentity: "ca0a6439-7e8f-4203-8e13-b29529222b1b", StoreIdentity: "B9355263-4983-5BAA-631A-046B453480C8", AddressIdentity: "c01a1c75-5b5b-460f-9335-858029e9617f", DeliveryTime: "2024-06-27 00:00:00", MemberIdentity: "1e280531-8ffd-4cf8-b445-f37ce1807685", } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := clent.QuickCreateByProduct(ctx, &data) if err != nil { fmt.Println(err) } fmt.Printf("返回的测试消息: %s", res) } func TestSubmit(t *testing.T) { conn, ctx := GetCoon() client := pb.NewSummaryClient(conn) defer conn.Close() data := pb.SubmitRequest{ Id: []string{"68ed35da-2ed8-458b-8669-07ade375e8cf"}, PartnerId: 5, StoreIdentity: "B9355263-4983-5BAA-631A-046B453480C8", AddressIdentity: "b5d9173d-847d-417d-946e-750db94ca3b6", } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := client.Submit(ctx, &data) if err != nil { panic(err) } s, err := json.Marshal(res) if err != nil { panic(err) } fmt.Printf("返回的测试消息: %s", s) } func TestCheck(t *testing.T) { coon, ctx := GetCoon() clent := pb.NewSummaryClient(coon) defer coon.Close() res, err := clent.Check(ctx, &pb.Empty{}) if err != nil { fmt.Println(err) } fmt.Printf("返回的测试消息: %s", res) } func TestGetDetail(t *testing.T) { coon, ctx := GetCoon() client := pb.NewSummaryClient(coon) defer coon.Close() data := pb.OrderIdentRequest{ Identity: "78d9d2e9-8c63-4ff4-a6ee-4b2234944fcb", } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := client.Get(ctx, &data) if err != nil { panic(err) } s, err := json.Marshal(res) if err != nil { panic(err) } fmt.Printf("返回的测试消息: %s", s) } func TestSummaryList(t *testing.T) { coon, ctx := GetCoon() client := pb.NewSummaryClient(coon) defer coon.Close() // Unpaid:未付款 // Paid:已付款 // NotDelivered:未发货 // Delivered:已发货 // NotComment:待评论 data := pb.SummaryListRequest{ // Type: "Paid", OrderStatus: 2, } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := client.List(ctx, &data) if err != nil { panic(err) } s, err := json.Marshal(res) if err != nil { panic(err) } fmt.Printf("返回的测试消息: %s", s) } func TestConfirm(t *testing.T) { coon, ctx := GetCoon() clent := pb.NewSummaryClient(coon) defer coon.Close() res, err := clent.Confirm(ctx, &pb.ConfirmRequest{ OrderNo: "2437105418797837", AddressIdentity: "10", CouponIdentity: "c3d9af1d-d26d-c313-a5df-091ad8d2acf8", Remark: "测试信息", LogisticsFee: 4, }) if err != nil { fmt.Println(err) } fmt.Printf("返回的测试消息: %s", res) } func TestCancel(t *testing.T) { coon, ctx := GetCoon() clent := pb.NewSummaryClient(coon) defer coon.Close() res, err := clent.Cancel(ctx, &pb.CancelRequest{ OrderNo: "2437105418797837", }) if err != nil { fmt.Println(err) } fmt.Printf("返回的测试消息: %s", res) } func TestQuickCreateByProduct(t *testing.T) { conn, ctx := GetCoon() client := pb.NewSummaryClient(conn) defer conn.Close() data := pb.QuickCreateByProductRequest{ PartnerId: 5, StoreIdentity: "B9355263-4983-5BAA-631A-046B453480C8", ProductIdentity: "a34d83f3-f09c-42e8-8c2c-85d5eba363c3", Number: 2, Args: "{\"id\":\"11\",\"identity\":\"bd6b0d21-97d9-4b48-80d1-df28d02b444c\",\"product_id\":\"a8ec80f3-7934-4558-912e-31b4bda9428d\",\"title\":\"瓶数02\",\"stock_type\":2,\"stock\":\"0\",\"price\":\"11300\",\"direct_sales\":\"0\",\"tp_type\":0,\"ds_tp_type\":0,\"img\":\"\",\"spec_no\":\"918946794533509425\"}", AddressIdentity: "c01a1c75-5b5b-460f-9335-858029e9617f", DeliveryTime: "", SpecIdentity: "ca0a6439-7e8f-4203-8e13-b29529222b1b", } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := client.QuickCreateByProduct(ctx, &data) if err != nil { panic(err) } s, err := json.Marshal(res) if err != nil { panic(err) } fmt.Printf("返回的测试消息: %s", s) } func TestSimulatePay(t *testing.T) { conn, ctx := GetCoon() client := pb.NewSummaryClient(conn) defer conn.Close() data := pb.SimulatePayRequest{ Identity: []string{"d78e4521-1610-494c-a12e-20211301fa31"}, } re, _ := json.Marshal(&data) fmt.Printf("发送的测试消息: %s\n", re) res, err := client.SimulatePay(ctx, &data) if err != nil { panic(err) } s, err := json.Marshal(res) if err != nil { panic(err) } fmt.Printf("返回的测试消息: %s", s) }