diff --git a/constants/orders.go b/constants/orders.go index 178c7bd1..d6ffa7bf 100644 --- a/constants/orders.go +++ b/constants/orders.go @@ -10,7 +10,7 @@ const ( type Currency string const ( - CURRENCYUSD Currency = "usd" + CURRENCYUSD Currency = "usd" // 美金 ) // 金额单位 @@ -45,11 +45,11 @@ type OrderPayStatusCode int64 // 30,已付尾款 // 40,已退尾款 const ( - ORDER_PAY_STATUS_UNPAIDDEPOSIT OrderPayStatusCode = 0 - ORDER_PAY_STATUS_PAIDDEPOSIT OrderPayStatusCode = 10 - ORDER_PAY_STATUS_REFUNDEDDEPOSIT OrderPayStatusCode = 20 - ORDER_PAY_STATUS_PAIDDREMAINING OrderPayStatusCode = 30 - ORDER_PAY_STATUS_REFUNDEDREMAINING OrderPayStatusCode = 40 + ORDER_PAY_STATUS_UNPAIDDEPOSIT OrderPayStatusCode = 0 // 0,未付首款 + ORDER_PAY_STATUS_PAIDDEPOSIT OrderPayStatusCode = 10 // 10,已付首款 + ORDER_PAY_STATUS_REFUNDEDDEPOSIT OrderPayStatusCode = 20 // 20,已退首款 + ORDER_PAY_STATUS_PAIDDREMAINING OrderPayStatusCode = 30 // 30,已付尾款 + ORDER_PAY_STATUS_REFUNDEDREMAINING OrderPayStatusCode = 40 // 40,已退尾款 ) // 订单状态 @@ -102,17 +102,17 @@ func init() { // 订单状态名称 OrderPayStatusMessage = make(map[OrderPayStatusCode]string) - OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid" - OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDEPOSIT] = "Deposit Payment Paid" - OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDDEPOSIT] = "Deposit Payment Refunded" - OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDREMAINING] = "Final Payment Paid" - OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDREMAINING] = "Final Payment Refunded" + OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid" // 未支付首款 + OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDEPOSIT] = "Deposit Payment Paid" // 已支付首款 + OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDDEPOSIT] = "Deposit Payment Refunded" // 首款已回退 + OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDREMAINING] = "Final Payment Paid" // 尾款未支付 + OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDREMAINING] = "Final Payment Refunded" // 已退款 // 订单状态名称 PayStatusMessage = make(map[PayStatusCode]string) - PayStatusMessage[PAY_STATUS_UNPAID] = "Unpaid" - PayStatusMessage[PAY_STATUS_PAID] = "Paid" - PayStatusMessage[PAY_STATUS_REFUNDED] = "Refunded" + PayStatusMessage[PAY_STATUS_UNPAID] = "Unpaid" // 未支付 + PayStatusMessage[PAY_STATUS_PAID] = "Paid" // 已支付 + PayStatusMessage[PAY_STATUS_REFUNDED] = "Refunded" // 已退款 // 订单状态名称 OrderStatusMessage = make(map[OrderStatusCode]string) diff --git a/server/ldap-admin/internal/logic/getmenudetaillogic.go b/server/ldap-admin/internal/logic/getmenudetaillogic.go index 48d98416..b8c8443b 100644 --- a/server/ldap-admin/internal/logic/getmenudetaillogic.go +++ b/server/ldap-admin/internal/logic/getmenudetaillogic.go @@ -4,6 +4,7 @@ import ( "errors" "fusenapi/utils/auth" "fusenapi/utils/basic" + "gorm.io/gorm" "context" diff --git a/server/pay/internal/handler/orderrefundhandler.go b/server/pay/internal/handler/orderrefundhandler.go deleted file mode 100644 index 3d7998ff..00000000 --- a/server/pay/internal/handler/orderrefundhandler.go +++ /dev/null @@ -1,35 +0,0 @@ -package handler - -import ( - "net/http" - "reflect" - - "fusenapi/utils/basic" - - "fusenapi/server/pay/internal/logic" - "fusenapi/server/pay/internal/svc" - "fusenapi/server/pay/internal/types" -) - -func OrderRefundHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - - var req types.OrderRefundReq - userinfo, err := basic.RequestParse(w, r, svcCtx, &req) - if err != nil { - return - } - - // 创建一个业务逻辑层实例 - l := logic.NewOrderRefundLogic(r.Context(), svcCtx) - - rl := reflect.ValueOf(l) - basic.BeforeLogic(w, r, rl) - - resp := l.OrderRefund(&req, userinfo) - - if !basic.AfterLogic(w, r, rl, resp) { - basic.NormalAfterLogic(w, r, resp) - } - } -} diff --git a/server/pay/internal/handler/routes.go b/server/pay/internal/handler/routes.go index e8eee5bc..de8adf84 100644 --- a/server/pay/internal/handler/routes.go +++ b/server/pay/internal/handler/routes.go @@ -12,11 +12,6 @@ import ( func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ - { - Method: http.MethodPost, - Path: "/api/pay/refund", - Handler: OrderRefundHandler(serverCtx), - }, { Method: http.MethodPost, Path: "/api/pay/stripe-webhook", diff --git a/server/pay/internal/logic/orderrefundlogic.go b/server/pay/internal/logic/orderrefundlogic.go deleted file mode 100644 index 5f9e11db..00000000 --- a/server/pay/internal/logic/orderrefundlogic.go +++ /dev/null @@ -1,43 +0,0 @@ -package logic - -import ( - "fusenapi/utils/auth" - "fusenapi/utils/basic" - - "context" - - "fusenapi/server/pay/internal/svc" - "fusenapi/server/pay/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type OrderRefundLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -func NewOrderRefundLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OrderRefundLogic { - return &OrderRefundLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -// 处理进入前逻辑w,r -// func (l *OrderRefundLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { -// } - -// 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *OrderRefundLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { -// // httpx.OkJsonCtx(r.Context(), w, resp) -// } - -func (l *OrderRefundLogic) OrderRefund(req *types.OrderRefundReq, userinfo *auth.UserInfo) (resp *basic.Response) { - // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) - // userinfo 传入值时, 一定不为null - - return resp.SetStatus(basic.CodeOK) -} diff --git a/server/pay/internal/types/types.go b/server/pay/internal/types/types.go index 184059ee..1412ff9e 100644 --- a/server/pay/internal/types/types.go +++ b/server/pay/internal/types/types.go @@ -5,12 +5,6 @@ import ( "fusenapi/utils/basic" ) -type OrderRefundReq struct { -} - -type OrderRefundRes struct { -} - type StripeWebhookReq struct { Payload []byte `json:"base_byte_slice,optional"` StripeSignature string `json:"Stripe-Signature"` diff --git a/server_api/pay.api b/server_api/pay.api index bea11c1f..4205ce94 100644 --- a/server_api/pay.api +++ b/server_api/pay.api @@ -10,21 +10,11 @@ info ( import "basic.api" service pay { - - @handler OrderRefundHandler - post /api/pay/refund(OrderRefundReq) returns (response); - @handler StripeWebhookHandler post /api/pay/stripe-webhook(StripeWebhookReq) returns (response); } -// 退款 -type ( - OrderRefundReq struct{} - OrderRefundRes struct{} -) - // StripeWebhook支付通知 type ( StripeWebhookReq {