diff --git a/payment-service/go.mod b/payment-service/go.mod index dbcd91c..0db1cd9 100644 --- a/payment-service/go.mod +++ b/payment-service/go.mod @@ -82,6 +82,7 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/plutov/paypal/v4 v4.7.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect diff --git a/payment-service/go.sum b/payment-service/go.sum index 68d509a..5192324 100644 --- a/payment-service/go.sum +++ b/payment-service/go.sum @@ -638,6 +638,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= +github.com/plutov/paypal/v4 v4.7.0 h1:6TRvYD4ny6yQfHaABeStNf43GFM1wpW5jU/XEDGQmq0= +github.com/plutov/paypal/v4 v4.7.0/go.mod h1:D56boafCRGcF/fEM0w282kj0fCDKIyrwOPX/Te1jCmw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -755,6 +757,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/payment-service/main.go b/payment-service/main.go index 6896a78..ce69819 100644 --- a/payment-service/main.go +++ b/payment-service/main.go @@ -6,12 +6,14 @@ import ( common "git.mashibing.com/msb_47094/shopping-comm" "github.com/asim/go-micro/plugins/registry/consul/v4" "github.com/gin-gonic/gin" + "github.com/plutov/paypal/v4" "github.com/smartwalle/alipay/v3" "go-micro.dev/v4" "go-micro.dev/v4/registry" "io/ioutil" "log" "net/http" + "os" "os/exec" "payment/proto" "strings" @@ -34,10 +36,22 @@ var ( FindOrderClient = proto.NewFindOrderService("", nil) UpdateTraderClient = proto.NewUpdateTradeOrderService("", nil) + //PayPal国际支付 + PayPalClientID = "AX5c8C-Z9P5vXgs22Q3MWKaEKvVa5-vtU3jtNrQe8W2s-x8eXYn_2aA-e4paaHo6I0Z9eba0Ur2LTdZI" + PayPalPublicKey = "" + PayPalSecretID = "EB_svAAyczD2OoCMh2HMA4ApBysCbHli8gOpFUfKLOaI5zkoePeNd54OI1PT5yDtAqNsWgho7IYNdqFR" + //真实环境 paypal.APIBaseLive + PaypalClient, _ = paypal.NewClient(PayPalClientID, PayPalSecretID, paypal.APIBaseSandBox) ) // 初始化的init func init() { + //PayPal国际支付 + //PaypalClient, _ = paypal.NewClient(PayPalClientID, PayPalSecretID, paypal.APIBaseSandBox) + PaypalClient.SetLog(os.Stdout) // Set log to terminal stdout + accessToken, err := PaypalClient.GetAccessToken(context.Background()) + fmt.Println("PayPal国际支付 :\n", accessToken, " \n ", err) + //支付宝支付 ApliClient.LoadAppPublicCert(AliAppPublicKey) ApliClient.LoadAliPayPublicCert(AliPublicKey) //证书的方式 ApliClient.LoadAliPayRootCert() @@ -51,6 +65,10 @@ func init() { ) FindOrderClient = proto.NewFindOrderService("trade-order", rpcServer.Client()) UpdateTraderClient = proto.NewUpdateTradeOrderService("trade-order", rpcServer.Client()) + +} +func TradeWapPayPal(c *gin.Context) { + //order, err := PaypalClient.CreateOrder(paypal.OrderIntentCapture, []paypal.PurchaseUnitRequest{paypal.PurchaseUnitRequest{ReferenceID: "ref-id", Amount: paypal.Amount{Total: "7.00", Currency: "USD"}}}) } // 手机端的支付 弹出选择APP 还是 H5 @@ -61,7 +79,7 @@ func TradeWapAliPay(c *gin.Context) { pay.OutTradeNo = c.Query("orderNo") //支付之后 支付宝回调的API //pay.ReturnURL = "http://127.0.0.1:8086/return" - pay.NotifyURL = "http://hegf3z.natappfree.cc/return" + pay.NotifyURL = "http://j8utmw.natappfree.cc/return" pay.Body = "APP订单" pay.Subject = "商品标题" res, err := ApliClient.TradeWapPay(pay) @@ -77,12 +95,12 @@ func TradeWapAliPay(c *gin.Context) { func TradePageAlipay(c *gin.Context) { fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TradePageAlipay ") var p = alipay.TradePagePay{} - p.NotifyURL = "http://hegf3z.natappfree.cc/return" //支付异步 + p.NotifyURL = "http://j8utmw.natappfree.cc/return" //支付异步 //p.ReturnURL = "http://127.0.0.1:8086/return" //同步 p.Subject = "商品支付" p.OutTradeNo = c.Query("orderNo") p.TotalAmount = c.Query("payAmount") - p.ProductCode = "FAST_INSTANT_TRADE_PAY" + p.ProductCode = "FAST_INSTANT_TRADE_PAY[" res, err := ApliClient.TradePagePay(p) if err != nil { fmt.Println("支付失败 :", err) @@ -173,10 +191,90 @@ func AliPayNotify(c *gin.Context) { } +// 生成收款订单 +func CreateOrderPayer(c *gin.Context) { + + purchaseUnits := make([]paypal.PurchaseUnitRequest, 1) + purchaseUnits[0] = paypal.PurchaseUnitRequest{ + Amount: &paypal.PurchaseUnitAmount{ + Currency: "USD", //收款类型 + Value: c.Query("amount"), //收款数量 + }, + InvoiceID: c.Query("orderNo"), + ReferenceID: "123", + Description: "商品支付", + } + payer := &paypal.CreateOrderPayer{ + Name: &paypal.CreateOrderPayerName{ + //GivenName: user_idStr, + //Surname: user_idStr, + }, + } + appContext := &paypal.ApplicationContext{ + ReturnURL: "http://j8utmw.natappfree.cc/payPalBack?orderNo=" + c.Query("orderNo"), //回调链接 + } + //CreateOrder(ctx context.Context, intent string, purchaseUnits []PurchaseUnitRequest, payer *CreateOrderPayer, appContext *ApplicationContext) + orderResponse, err := PaypalClient.CreateOrder(context.Background(), "CAPTURE", purchaseUnits, payer, appContext) + if err != nil { + log.Println("create order errors:", err) + c.JSON(http.StatusNotExtended, gin.H{"reslut": err, "Message": "构建订单失败!", "CODE": http.StatusNotExtended}) + return + } + //c.Header("ID", orderResponse.ID) + payURL := (*orderResponse).Links[1].Href + payURL = strings.Replace(payURL, "&", "^&", -1) + common.SetUserToken() + //https://www.sandbox.paypal.com/checkoutnow?token=85V82337B3775564V + exec.Command("cmd", "/c", "start", payURL).Start() + //(*order).Links[1].Href就是支付的链接 + +} + +// 回调(可以利用上面的回调链接实现) +// https://www.sandbox.paypal.com/webapps/hermes? +// flow=1-P&ulReturn=true& +// token=85V82337B3775564V& +// rcache=2& +// useraction=CONTINUE& +// cookieBannerVariant=1& +// targetService4174=xorouternodeweb&country.x=C2& +// locale.x=zh_XC +func PaypalCallback(c *gin.Context) { + //c, err := paypal.NewClient(clientID, secretID, paypal.APIBaseSandBox) + //if err != nil { + // return err + //} + //_, err = c.GetAccessToken() + //if err != nil { + // return err + //} + //“status”:“COMPLETED 或者 PENDING” 说明支付成功了 + ctor := paypal.CaptureOrderRequest{} + //CaptureOrder(ctx context.Context, orderID string, captureOrderRequest CaptureOrderRequest) + order, err := PaypalClient.CaptureOrder(context.Background(), c.Query("ID"), ctor) + o, _ := PaypalClient.GetOrder(context.Background(), c.Query("ID")) + log.Println(o, "\n", order) + if err != nil { + log.Println("/UpdateTradeOrder err ", err) + //return + } + + //查看回调完成后订单状态是否支付完成。 + if (*order).Status != "COMPLETED" { + log.Println("/UpdateTradeOrder err ", err) + c.JSON(http.StatusNotExtended, gin.H{"reslut": err, "Message": "订单回调失败!", "CODE": http.StatusNotExtended}) + return + } + c.JSON(http.StatusOK, gin.H{"reslut": "SUCCESS", "Message": "修改订单支付成功!"}) +} func main() { r := gin.Default() + r.SetTrustedProxies([]string{common.QSIp}) r.GET("/appPay", TradeWapAliPay) r.GET("/pagePay", TradePageAlipay) r.POST("/return", AliPayNotify) + //payPal + r.GET("/payPal", CreateOrderPayer) + r.GET("/payPalBack", PaypalCallback) r.Run(":8086") } diff --git a/payment-service/proto/trade.pb.go b/payment-service/proto/trade.pb.go new file mode 100644 index 0000000..cd65223 --- /dev/null +++ b/payment-service/proto/trade.pb.go @@ -0,0 +1,934 @@ +//* +// @Auth:ShenZ +// @Description: + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.18.1 +// source: trade.proto + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type TradeOrder struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerTime string `protobuf:"bytes,1,opt,name=serverTime,proto3" json:"serverTime,omitempty"` + ExpireTime string `protobuf:"bytes,2,opt,name=expireTime,proto3" json:"expireTime,omitempty"` + TotalAmount float32 `protobuf:"fixed32,3,opt,name=totalAmount,proto3" json:"totalAmount,omitempty"` + ProductAmount float32 `protobuf:"fixed32,4,opt,name=productAmount,proto3" json:"productAmount,omitempty"` + ShippingAmount float32 `protobuf:"fixed32,5,opt,name=shippingAmount,proto3" json:"shippingAmount,omitempty"` + DiscountAmount float32 `protobuf:"fixed32,6,opt,name=discountAmount,proto3" json:"discountAmount,omitempty"` + PayAmount float32 `protobuf:"fixed32,7,opt,name=payAmount,proto3" json:"payAmount,omitempty"` //resp返回需要 + // 新增和修改需要 + ID int32 `protobuf:"varint,8,opt,name=iD,proto3" json:"iD,omitempty"` + IsDeleted bool `protobuf:"varint,9,opt,name=isDeleted,proto3" json:"isDeleted,omitempty"` + OrderStatus int32 `protobuf:"varint,10,opt,name=orderStatus,proto3" json:"orderStatus,omitempty"` + OrderNo string `protobuf:"bytes,11,opt,name=orderNo,proto3" json:"orderNo,omitempty"` + UserId int32 `protobuf:"varint,12,opt,name=userId,proto3" json:"userId,omitempty"` + CreateUser int32 `protobuf:"varint,13,opt,name=createUser,proto3" json:"createUser,omitempty"` + UpdateUser int32 `protobuf:"varint,14,opt,name=updateUser,proto3" json:"updateUser,omitempty"` + CancelReason string `protobuf:"bytes,15,opt,name=cancelReason,proto3" json:"cancelReason,omitempty"` + CreateTime string `protobuf:"bytes,16,opt,name=createTime,proto3" json:"createTime,omitempty"` + SubmitTime string `protobuf:"bytes,17,opt,name=submitTime,proto3" json:"submitTime,omitempty"` +} + +func (x *TradeOrder) Reset() { + *x = TradeOrder{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TradeOrder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TradeOrder) ProtoMessage() {} + +func (x *TradeOrder) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TradeOrder.ProtoReflect.Descriptor instead. +func (*TradeOrder) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{0} +} + +func (x *TradeOrder) GetServerTime() string { + if x != nil { + return x.ServerTime + } + return "" +} + +func (x *TradeOrder) GetExpireTime() string { + if x != nil { + return x.ExpireTime + } + return "" +} + +func (x *TradeOrder) GetTotalAmount() float32 { + if x != nil { + return x.TotalAmount + } + return 0 +} + +func (x *TradeOrder) GetProductAmount() float32 { + if x != nil { + return x.ProductAmount + } + return 0 +} + +func (x *TradeOrder) GetShippingAmount() float32 { + if x != nil { + return x.ShippingAmount + } + return 0 +} + +func (x *TradeOrder) GetDiscountAmount() float32 { + if x != nil { + return x.DiscountAmount + } + return 0 +} + +func (x *TradeOrder) GetPayAmount() float32 { + if x != nil { + return x.PayAmount + } + return 0 +} + +func (x *TradeOrder) GetID() int32 { + if x != nil { + return x.ID + } + return 0 +} + +func (x *TradeOrder) GetIsDeleted() bool { + if x != nil { + return x.IsDeleted + } + return false +} + +func (x *TradeOrder) GetOrderStatus() int32 { + if x != nil { + return x.OrderStatus + } + return 0 +} + +func (x *TradeOrder) GetOrderNo() string { + if x != nil { + return x.OrderNo + } + return "" +} + +func (x *TradeOrder) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *TradeOrder) GetCreateUser() int32 { + if x != nil { + return x.CreateUser + } + return 0 +} + +func (x *TradeOrder) GetUpdateUser() int32 { + if x != nil { + return x.UpdateUser + } + return 0 +} + +func (x *TradeOrder) GetCancelReason() string { + if x != nil { + return x.CancelReason + } + return "" +} + +func (x *TradeOrder) GetCreateTime() string { + if x != nil { + return x.CreateTime + } + return "" +} + +func (x *TradeOrder) GetSubmitTime() string { + if x != nil { + return x.SubmitTime + } + return "" +} + +// 查询订单详情 +type FindOrderReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + OrderNo string `protobuf:"bytes,2,opt,name=orderNo,proto3" json:"orderNo,omitempty"` +} + +func (x *FindOrderReq) Reset() { + *x = FindOrderReq{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindOrderReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindOrderReq) ProtoMessage() {} + +func (x *FindOrderReq) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindOrderReq.ProtoReflect.Descriptor instead. +func (*FindOrderReq) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{1} +} + +func (x *FindOrderReq) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *FindOrderReq) GetOrderNo() string { + if x != nil { + return x.OrderNo + } + return "" +} + +type FindOrderResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TradeOrder *TradeOrder `protobuf:"bytes,1,opt,name=tradeOrder,proto3" json:"tradeOrder,omitempty"` +} + +func (x *FindOrderResp) Reset() { + *x = FindOrderResp{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindOrderResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindOrderResp) ProtoMessage() {} + +func (x *FindOrderResp) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindOrderResp.ProtoReflect.Descriptor instead. +func (*FindOrderResp) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{2} +} + +func (x *FindOrderResp) GetTradeOrder() *TradeOrder { + if x != nil { + return x.TradeOrder + } + return nil +} + +type AddTradeOrderReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CartIds []int32 `protobuf:"varint,1,rep,packed,name=cartIds,proto3" json:"cartIds,omitempty"` + IsVirtual bool `protobuf:"varint,2,opt,name=isVirtual,proto3" json:"isVirtual,omitempty"` + RecipientAddressId int32 `protobuf:"varint,3,opt,name=recipientAddressId,proto3" json:"recipientAddressId,omitempty"` + TradeOrder *TradeOrder `protobuf:"bytes,4,opt,name=tradeOrder,proto3" json:"tradeOrder,omitempty"` +} + +func (x *AddTradeOrderReq) Reset() { + *x = AddTradeOrderReq{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddTradeOrderReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddTradeOrderReq) ProtoMessage() {} + +func (x *AddTradeOrderReq) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddTradeOrderReq.ProtoReflect.Descriptor instead. +func (*AddTradeOrderReq) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{3} +} + +func (x *AddTradeOrderReq) GetCartIds() []int32 { + if x != nil { + return x.CartIds + } + return nil +} + +func (x *AddTradeOrderReq) GetIsVirtual() bool { + if x != nil { + return x.IsVirtual + } + return false +} + +func (x *AddTradeOrderReq) GetRecipientAddressId() int32 { + if x != nil { + return x.RecipientAddressId + } + return 0 +} + +func (x *AddTradeOrderReq) GetTradeOrder() *TradeOrder { + if x != nil { + return x.TradeOrder + } + return nil +} + +type ProductOrder struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId int32 `protobuf:"varint,1,opt,name=productId,proto3" json:"productId,omitempty"` + ProductSkuId int32 `protobuf:"varint,2,opt,name=productSkuId,proto3" json:"productSkuId,omitempty"` + ProductName string `protobuf:"bytes,3,opt,name=productName,proto3" json:"productName,omitempty"` + ProductImageUrl string `protobuf:"bytes,4,opt,name=productImageUrl,proto3" json:"productImageUrl,omitempty"` + SkuDescribe string `protobuf:"bytes,5,opt,name=skuDescribe,proto3" json:"skuDescribe,omitempty"` + Quantity int32 `protobuf:"varint,6,opt,name=quantity,proto3" json:"quantity,omitempty"` + ProductPrice float32 `protobuf:"fixed32,7,opt,name=productPrice,proto3" json:"productPrice,omitempty"` + RealPrice float32 `protobuf:"fixed32,8,opt,name=realPrice,proto3" json:"realPrice,omitempty"` + RealAmount float32 `protobuf:"fixed32,9,opt,name=realAmount,proto3" json:"realAmount,omitempty"` +} + +func (x *ProductOrder) Reset() { + *x = ProductOrder{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductOrder) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductOrder) ProtoMessage() {} + +func (x *ProductOrder) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductOrder.ProtoReflect.Descriptor instead. +func (*ProductOrder) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{4} +} + +func (x *ProductOrder) GetProductId() int32 { + if x != nil { + return x.ProductId + } + return 0 +} + +func (x *ProductOrder) GetProductSkuId() int32 { + if x != nil { + return x.ProductSkuId + } + return 0 +} + +func (x *ProductOrder) GetProductName() string { + if x != nil { + return x.ProductName + } + return "" +} + +func (x *ProductOrder) GetProductImageUrl() string { + if x != nil { + return x.ProductImageUrl + } + return "" +} + +func (x *ProductOrder) GetSkuDescribe() string { + if x != nil { + return x.SkuDescribe + } + return "" +} + +func (x *ProductOrder) GetQuantity() int32 { + if x != nil { + return x.Quantity + } + return 0 +} + +func (x *ProductOrder) GetProductPrice() float32 { + if x != nil { + return x.ProductPrice + } + return 0 +} + +func (x *ProductOrder) GetRealPrice() float32 { + if x != nil { + return x.RealPrice + } + return 0 +} + +func (x *ProductOrder) GetRealAmount() float32 { + if x != nil { + return x.RealAmount + } + return 0 +} + +type AddTradeOrderResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TradeOrder *TradeOrder `protobuf:"bytes,1,opt,name=tradeOrder,proto3" json:"tradeOrder,omitempty"` + Products []*ProductOrder `protobuf:"bytes,2,rep,name=products,proto3" json:"products,omitempty"` +} + +func (x *AddTradeOrderResp) Reset() { + *x = AddTradeOrderResp{} + if protoimpl.UnsafeEnabled { + mi := &file_trade_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddTradeOrderResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddTradeOrderResp) ProtoMessage() {} + +func (x *AddTradeOrderResp) ProtoReflect() protoreflect.Message { + mi := &file_trade_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddTradeOrderResp.ProtoReflect.Descriptor instead. +func (*AddTradeOrderResp) Descriptor() ([]byte, []int) { + return file_trade_proto_rawDescGZIP(), []int{5} +} + +func (x *AddTradeOrderResp) GetTradeOrder() *TradeOrder { + if x != nil { + return x.TradeOrder + } + return nil +} + +func (x *AddTradeOrderResp) GetProducts() []*ProductOrder { + if x != nil { + return x.Products + } + return nil +} + +var File_trade_proto protoreflect.FileDescriptor + +var file_trade_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x04, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, + 0x64, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0d, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x73, + 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x0e, 0x73, 0x68, 0x69, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0e, 0x64, 0x69, 0x73, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, + 0x61, 0x79, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x52, 0x09, + 0x70, 0x61, 0x79, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x44, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x72, 0x64, 0x65, 0x72, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x4e, 0x6f, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x4e, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x0c, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x63, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, + 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x22, + 0x38, 0x0a, 0x0c, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x22, 0x42, 0x0a, 0x0d, 0x46, 0x69, 0x6e, + 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, + 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0xad, 0x01, + 0x0a, 0x10, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x72, 0x74, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x05, 0x52, 0x07, 0x63, 0x61, 0x72, 0x74, 0x49, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, + 0x69, 0x73, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x09, 0x69, 0x73, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x12, 0x2e, 0x0a, 0x12, 0x72, 0x65, + 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, + 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0xbc, 0x02, + 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1c, + 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, + 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x49, 0x64, + 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6d, 0x61, + 0x67, 0x65, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, + 0x73, 0x6b, 0x75, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x6b, 0x75, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, + 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x09, 0x72, 0x65, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, + 0x72, 0x65, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, + 0x52, 0x0a, 0x72, 0x65, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x11, + 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x72, + 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x08, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x73, 0x32, 0x45, 0x0a, 0x09, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x38, 0x0a, 0x09, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, + 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, + 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x5b, 0x0a, 0x10, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, + 0x12, 0x47, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, + 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, + 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_trade_proto_rawDescOnce sync.Once + file_trade_proto_rawDescData = file_trade_proto_rawDesc +) + +func file_trade_proto_rawDescGZIP() []byte { + file_trade_proto_rawDescOnce.Do(func() { + file_trade_proto_rawDescData = protoimpl.X.CompressGZIP(file_trade_proto_rawDescData) + }) + return file_trade_proto_rawDescData +} + +var file_trade_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_trade_proto_goTypes = []interface{}{ + (*TradeOrder)(nil), // 0: proto.TradeOrder + (*FindOrderReq)(nil), // 1: proto.FindOrderReq + (*FindOrderResp)(nil), // 2: proto.FindOrderResp + (*AddTradeOrderReq)(nil), // 3: proto.AddTradeOrderReq + (*ProductOrder)(nil), // 4: proto.ProductOrder + (*AddTradeOrderResp)(nil), // 5: proto.AddTradeOrderResp +} +var file_trade_proto_depIdxs = []int32{ + 0, // 0: proto.FindOrderResp.tradeOrder:type_name -> proto.TradeOrder + 0, // 1: proto.AddTradeOrderReq.tradeOrder:type_name -> proto.TradeOrder + 0, // 2: proto.AddTradeOrderResp.tradeOrder:type_name -> proto.TradeOrder + 4, // 3: proto.AddTradeOrderResp.products:type_name -> proto.ProductOrder + 1, // 4: proto.FindOrder.FindOrder:input_type -> proto.FindOrderReq + 3, // 5: proto.UpdateTradeOrder.UpdateTradeOrder:input_type -> proto.AddTradeOrderReq + 2, // 6: proto.FindOrder.FindOrder:output_type -> proto.FindOrderResp + 5, // 7: proto.UpdateTradeOrder.UpdateTradeOrder:output_type -> proto.AddTradeOrderResp + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_trade_proto_init() } +func file_trade_proto_init() { + if File_trade_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_trade_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TradeOrder); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trade_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindOrderReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trade_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindOrderResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trade_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddTradeOrderReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trade_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductOrder); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trade_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddTradeOrderResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trade_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_trade_proto_goTypes, + DependencyIndexes: file_trade_proto_depIdxs, + MessageInfos: file_trade_proto_msgTypes, + }.Build() + File_trade_proto = out.File + file_trade_proto_rawDesc = nil + file_trade_proto_goTypes = nil + file_trade_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// FindOrderClient is the client API for FindOrder service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type FindOrderClient interface { + FindOrder(ctx context.Context, in *FindOrderReq, opts ...grpc.CallOption) (*FindOrderResp, error) +} + +type findOrderClient struct { + cc grpc.ClientConnInterface +} + +func NewFindOrderClient(cc grpc.ClientConnInterface) FindOrderClient { + return &findOrderClient{cc} +} + +func (c *findOrderClient) FindOrder(ctx context.Context, in *FindOrderReq, opts ...grpc.CallOption) (*FindOrderResp, error) { + out := new(FindOrderResp) + err := c.cc.Invoke(ctx, "/proto.FindOrder/FindOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FindOrderServer is the server API for FindOrder service. +type FindOrderServer interface { + FindOrder(context.Context, *FindOrderReq) (*FindOrderResp, error) +} + +// UnimplementedFindOrderServer can be embedded to have forward compatible implementations. +type UnimplementedFindOrderServer struct { +} + +func (*UnimplementedFindOrderServer) FindOrder(context.Context, *FindOrderReq) (*FindOrderResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindOrder not implemented") +} + +func RegisterFindOrderServer(s *grpc.Server, srv FindOrderServer) { + s.RegisterService(&_FindOrder_serviceDesc, srv) +} + +func _FindOrder_FindOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindOrderReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FindOrderServer).FindOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.FindOrder/FindOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FindOrderServer).FindOrder(ctx, req.(*FindOrderReq)) + } + return interceptor(ctx, in, info, handler) +} + +var _FindOrder_serviceDesc = grpc.ServiceDesc{ + ServiceName: "proto.FindOrder", + HandlerType: (*FindOrderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FindOrder", + Handler: _FindOrder_FindOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "trade.proto", +} + +// UpdateTradeOrderClient is the client API for UpdateTradeOrder service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type UpdateTradeOrderClient interface { + // rpc 服务 + UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, opts ...grpc.CallOption) (*AddTradeOrderResp, error) +} + +type updateTradeOrderClient struct { + cc grpc.ClientConnInterface +} + +func NewUpdateTradeOrderClient(cc grpc.ClientConnInterface) UpdateTradeOrderClient { + return &updateTradeOrderClient{cc} +} + +func (c *updateTradeOrderClient) UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, opts ...grpc.CallOption) (*AddTradeOrderResp, error) { + out := new(AddTradeOrderResp) + err := c.cc.Invoke(ctx, "/proto.UpdateTradeOrder/UpdateTradeOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UpdateTradeOrderServer is the server API for UpdateTradeOrder service. +type UpdateTradeOrderServer interface { + // rpc 服务 + UpdateTradeOrder(context.Context, *AddTradeOrderReq) (*AddTradeOrderResp, error) +} + +// UnimplementedUpdateTradeOrderServer can be embedded to have forward compatible implementations. +type UnimplementedUpdateTradeOrderServer struct { +} + +func (*UnimplementedUpdateTradeOrderServer) UpdateTradeOrder(context.Context, *AddTradeOrderReq) (*AddTradeOrderResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateTradeOrder not implemented") +} + +func RegisterUpdateTradeOrderServer(s *grpc.Server, srv UpdateTradeOrderServer) { + s.RegisterService(&_UpdateTradeOrder_serviceDesc, srv) +} + +func _UpdateTradeOrder_UpdateTradeOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddTradeOrderReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UpdateTradeOrderServer).UpdateTradeOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.UpdateTradeOrder/UpdateTradeOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UpdateTradeOrderServer).UpdateTradeOrder(ctx, req.(*AddTradeOrderReq)) + } + return interceptor(ctx, in, info, handler) +} + +var _UpdateTradeOrder_serviceDesc = grpc.ServiceDesc{ + ServiceName: "proto.UpdateTradeOrder", + HandlerType: (*UpdateTradeOrderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateTradeOrder", + Handler: _UpdateTradeOrder_UpdateTradeOrder_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "trade.proto", +} diff --git a/payment-service/proto/trade.pb.micro.go b/payment-service/proto/trade.pb.micro.go new file mode 100644 index 0000000..292f9cf --- /dev/null +++ b/payment-service/proto/trade.pb.micro.go @@ -0,0 +1,148 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: trade.proto + +package proto + +import ( + fmt "fmt" + proto "google.golang.org/protobuf/proto" + math "math" +) + +import ( + context "context" + api "go-micro.dev/v4/api" + client "go-micro.dev/v4/client" + server "go-micro.dev/v4/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for FindOrder service + +func NewFindOrderEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for FindOrder service + +type FindOrderService interface { + FindOrder(ctx context.Context, in *FindOrderReq, opts ...client.CallOption) (*FindOrderResp, error) +} + +type findOrderService struct { + c client.Client + name string +} + +func NewFindOrderService(name string, c client.Client) FindOrderService { + return &findOrderService{ + c: c, + name: name, + } +} + +func (c *findOrderService) FindOrder(ctx context.Context, in *FindOrderReq, opts ...client.CallOption) (*FindOrderResp, error) { + req := c.c.NewRequest(c.name, "FindOrder.FindOrder", in) + out := new(FindOrderResp) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for FindOrder service + +type FindOrderHandler interface { + FindOrder(context.Context, *FindOrderReq, *FindOrderResp) error +} + +func RegisterFindOrderHandler(s server.Server, hdlr FindOrderHandler, opts ...server.HandlerOption) error { + type findOrder interface { + FindOrder(ctx context.Context, in *FindOrderReq, out *FindOrderResp) error + } + type FindOrder struct { + findOrder + } + h := &findOrderHandler{hdlr} + return s.Handle(s.NewHandler(&FindOrder{h}, opts...)) +} + +type findOrderHandler struct { + FindOrderHandler +} + +func (h *findOrderHandler) FindOrder(ctx context.Context, in *FindOrderReq, out *FindOrderResp) error { + return h.FindOrderHandler.FindOrder(ctx, in, out) +} + +// Api Endpoints for UpdateTradeOrder service + +func NewUpdateTradeOrderEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for UpdateTradeOrder service + +type UpdateTradeOrderService interface { + // rpc 服务 + UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, opts ...client.CallOption) (*AddTradeOrderResp, error) +} + +type updateTradeOrderService struct { + c client.Client + name string +} + +func NewUpdateTradeOrderService(name string, c client.Client) UpdateTradeOrderService { + return &updateTradeOrderService{ + c: c, + name: name, + } +} + +func (c *updateTradeOrderService) UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, opts ...client.CallOption) (*AddTradeOrderResp, error) { + req := c.c.NewRequest(c.name, "UpdateTradeOrder.UpdateTradeOrder", in) + out := new(AddTradeOrderResp) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for UpdateTradeOrder service + +type UpdateTradeOrderHandler interface { + // rpc 服务 + UpdateTradeOrder(context.Context, *AddTradeOrderReq, *AddTradeOrderResp) error +} + +func RegisterUpdateTradeOrderHandler(s server.Server, hdlr UpdateTradeOrderHandler, opts ...server.HandlerOption) error { + type updateTradeOrder interface { + UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, out *AddTradeOrderResp) error + } + type UpdateTradeOrder struct { + updateTradeOrder + } + h := &updateTradeOrderHandler{hdlr} + return s.Handle(s.NewHandler(&UpdateTradeOrder{h}, opts...)) +} + +type updateTradeOrderHandler struct { + UpdateTradeOrderHandler +} + +func (h *updateTradeOrderHandler) UpdateTradeOrder(ctx context.Context, in *AddTradeOrderReq, out *AddTradeOrderResp) error { + return h.UpdateTradeOrderHandler.UpdateTradeOrder(ctx, in, out) +}