feat: payment pay
This commit is contained in:
@@ -0,0 +1,283 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v3.19.4
|
||||
// source: payment/payment.proto
|
||||
|
||||
package payment
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Payment_Pay_FullMethodName = "/payment.Payment/Pay"
|
||||
Payment_Query_FullMethodName = "/payment.Payment/Query"
|
||||
Payment_Close_FullMethodName = "/payment.Payment/Close"
|
||||
Payment_Refund_FullMethodName = "/payment.Payment/Refund"
|
||||
Payment_Notify_FullMethodName = "/payment.Payment/Notify"
|
||||
)
|
||||
|
||||
// PaymentClient is the client API for Payment service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type PaymentClient interface {
|
||||
// 发起支付
|
||||
Pay(ctx context.Context, in *PayReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 查询支付状态
|
||||
Query(ctx context.Context, in *QueryReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 关闭支付
|
||||
Close(ctx context.Context, in *CloseReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 退款
|
||||
Refund(ctx context.Context, in *RefundReq, opts ...grpc.CallOption) (*Response, error)
|
||||
// 支付回调(由 BFF/网关转发原始 body + headers)
|
||||
Notify(ctx context.Context, in *NotifyReq, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
type paymentClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewPaymentClient(cc grpc.ClientConnInterface) PaymentClient {
|
||||
return &paymentClient{cc}
|
||||
}
|
||||
|
||||
func (c *paymentClient) Pay(ctx context.Context, in *PayReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Payment_Pay_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *paymentClient) Query(ctx context.Context, in *QueryReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Payment_Query_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *paymentClient) Close(ctx context.Context, in *CloseReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Payment_Close_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *paymentClient) Refund(ctx context.Context, in *RefundReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Payment_Refund_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *paymentClient) Notify(ctx context.Context, in *NotifyReq, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, Payment_Notify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// PaymentServer is the server API for Payment service.
|
||||
// All implementations must embed UnimplementedPaymentServer
|
||||
// for forward compatibility.
|
||||
type PaymentServer interface {
|
||||
// 发起支付
|
||||
Pay(context.Context, *PayReq) (*Response, error)
|
||||
// 查询支付状态
|
||||
Query(context.Context, *QueryReq) (*Response, error)
|
||||
// 关闭支付
|
||||
Close(context.Context, *CloseReq) (*Response, error)
|
||||
// 退款
|
||||
Refund(context.Context, *RefundReq) (*Response, error)
|
||||
// 支付回调(由 BFF/网关转发原始 body + headers)
|
||||
Notify(context.Context, *NotifyReq) (*Response, error)
|
||||
mustEmbedUnimplementedPaymentServer()
|
||||
}
|
||||
|
||||
// UnimplementedPaymentServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedPaymentServer struct{}
|
||||
|
||||
func (UnimplementedPaymentServer) Pay(context.Context, *PayReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Pay not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentServer) Query(context.Context, *QueryReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Query not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentServer) Close(context.Context, *CloseReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Close not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentServer) Refund(context.Context, *RefundReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Refund not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentServer) Notify(context.Context, *NotifyReq) (*Response, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Notify not implemented")
|
||||
}
|
||||
func (UnimplementedPaymentServer) mustEmbedUnimplementedPaymentServer() {}
|
||||
func (UnimplementedPaymentServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafePaymentServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PaymentServer will
|
||||
// result in compilation errors.
|
||||
type UnsafePaymentServer interface {
|
||||
mustEmbedUnimplementedPaymentServer()
|
||||
}
|
||||
|
||||
func RegisterPaymentServer(s grpc.ServiceRegistrar, srv PaymentServer) {
|
||||
// If the following call panics, it indicates UnimplementedPaymentServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Payment_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Payment_Pay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PayReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PaymentServer).Pay(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Payment_Pay_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PaymentServer).Pay(ctx, req.(*PayReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Payment_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PaymentServer).Query(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Payment_Query_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PaymentServer).Query(ctx, req.(*QueryReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Payment_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CloseReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PaymentServer).Close(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Payment_Close_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PaymentServer).Close(ctx, req.(*CloseReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Payment_Refund_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RefundReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PaymentServer).Refund(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Payment_Refund_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PaymentServer).Refund(ctx, req.(*RefundReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Payment_Notify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NotifyReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PaymentServer).Notify(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Payment_Notify_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PaymentServer).Notify(ctx, req.(*NotifyReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Payment_ServiceDesc is the grpc.ServiceDesc for Payment service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Payment_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "payment.Payment",
|
||||
HandlerType: (*PaymentServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Pay",
|
||||
Handler: _Payment_Pay_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Query",
|
||||
Handler: _Payment_Query_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Close",
|
||||
Handler: _Payment_Close_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Refund",
|
||||
Handler: _Payment_Refund_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Notify",
|
||||
Handler: _Payment_Notify_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "payment/payment.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user