feat: payment pay

This commit is contained in:
zzw
2026-09-11 16:08:17 +08:00
parent f8c7419964
commit d9529a219d
33 changed files with 3108 additions and 89 deletions
+76
View File
@@ -0,0 +1,76 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
// Source: payment.proto
package paymentClient
import (
"context"
"lone-services/rpc/payment/pb"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
CloseReq = payment.CloseReq
NotifyReq = payment.NotifyReq
PayReq = payment.PayReq
QueryReq = payment.QueryReq
RefundReq = payment.RefundReq
Response = payment.Response
Payment 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)
}
defaultPayment struct {
cli zrpc.Client
}
)
func NewPayment(cli zrpc.Client) Payment {
return &defaultPayment{
cli: cli,
}
}
// 发起支付
func (m *defaultPayment) Pay(ctx context.Context, in *PayReq, opts ...grpc.CallOption) (*Response, error) {
client := payment.NewPaymentClient(m.cli.Conn())
return client.Pay(ctx, in, opts...)
}
// 查询支付状态
func (m *defaultPayment) Query(ctx context.Context, in *QueryReq, opts ...grpc.CallOption) (*Response, error) {
client := payment.NewPaymentClient(m.cli.Conn())
return client.Query(ctx, in, opts...)
}
// 关闭支付
func (m *defaultPayment) Close(ctx context.Context, in *CloseReq, opts ...grpc.CallOption) (*Response, error) {
client := payment.NewPaymentClient(m.cli.Conn())
return client.Close(ctx, in, opts...)
}
// 退款
func (m *defaultPayment) Refund(ctx context.Context, in *RefundReq, opts ...grpc.CallOption) (*Response, error) {
client := payment.NewPaymentClient(m.cli.Conn())
return client.Refund(ctx, in, opts...)
}
// 支付回调(由 BFF/网关转发原始 body + headers)
func (m *defaultPayment) Notify(ctx context.Context, in *NotifyReq, opts ...grpc.CallOption) (*Response, error) {
client := payment.NewPaymentClient(m.cli.Conn())
return client.Notify(ctx, in, opts...)
}