x
Build docker and publish / build (20.15.1) (push) Failing after 4m44s

This commit is contained in:
2026-04-26 21:12:22 -07:00
parent 5b49aa8242
commit ab38cd4943
19 changed files with 2233 additions and 102 deletions
+24 -1
View File
@@ -6,6 +6,7 @@ import (
"io"
"net/http"
commonLogic "github.com/perfect-panel/server/internal/logic/common"
"github.com/perfect-panel/server/pkg/constant"
"github.com/perfect-panel/server/pkg/xerr"
@@ -67,6 +68,13 @@ func (l *StripeNotifyLogic) StripeNotify(r *http.Request, w http.ResponseWriter)
l.Logger.Error("[StripeNotify] Find order failed", logger.Field("error", err.Error()), logger.Field("orderNo", notify.OrderNo))
return errors.Wrapf(xerr.NewErrCode(xerr.OrderNotExist), "order not exist: %v", notify.OrderNo)
}
commonLogic.SubscriptionTraceInfo(l.Logger, commonLogic.SubscriptionTraceFlowOrder, "payment_notify_received",
"[SubscriptionFlow] stripe notify received",
append(commonLogic.OrderTraceFields(orderInfo),
logger.Field("payment_platform", stripeConfig.Platform),
logger.Field("stripe_event_type", notify.EventType),
)...,
)
if notify.EventType == "payment_intent.succeeded" {
if orderInfo.Status == 5 {
return nil
@@ -76,6 +84,13 @@ func (l *StripeNotifyLogic) StripeNotify(r *http.Request, w http.ResponseWriter)
if err != nil {
return err
}
commonLogic.SubscriptionTraceInfo(l.Logger, commonLogic.SubscriptionTraceFlowOrder, "payment_settled",
"[SubscriptionFlow] stripe notify marked order as paid",
append(commonLogic.OrderTraceFields(orderInfo),
logger.Field("payment_platform", stripeConfig.Platform),
logger.Field("stripe_event_type", notify.EventType),
)...,
)
// create ActivateOrder task
payload := types.ForthwithActivateOrderPayload{
OrderNo: notify.OrderNo,
@@ -86,11 +101,19 @@ func (l *StripeNotifyLogic) StripeNotify(r *http.Request, w http.ResponseWriter)
return err
}
task := asynq.NewTask(types.ForthwithActivateOrder, bytes, asynq.MaxRetry(5))
_, err = l.svcCtx.Queue.Enqueue(task)
taskInfo, err := l.svcCtx.Queue.Enqueue(task)
if err != nil {
l.Errorw("[StripeNotify] Enqueue error", logger.Field("errors", err.Error()))
return err
}
commonLogic.SubscriptionTraceInfo(l.Logger, commonLogic.SubscriptionTraceFlowOrder, "activation_task_enqueued",
"[SubscriptionFlow] activation task enqueued from stripe notify",
append(commonLogic.OrderTraceFields(orderInfo),
logger.Field("payment_platform", stripeConfig.Platform),
logger.Field("stripe_event_type", notify.EventType),
logger.Field("queue_task_id", taskInfo.ID),
)...,
)
l.Infow("[StripeNotify] success", logger.Field("orderNo", notify.OrderNo))
}
return nil