add ctxaccid to wallet event

This commit is contained in:
Pavel 2024-06-07 15:03:38 +03:00
parent b58da2159b
commit 22ad5335af
2 changed files with 14 additions and 10 deletions

@ -66,7 +66,7 @@ func Run(config *models.Config, logger *zap.Logger, build Build) (appErr error)
loggerForHlog := logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core {
return zapcore.NewTee(core, clickHouseLogger)
}))
}), zap.AddCallerSkip(2))
loggerHlog := hlog.New(loggerForHlog).Module(config.Service.ModuleLogger)
loggerHlog.With(models.AllFields{})
@ -136,7 +136,7 @@ func Run(config *models.Config, logger *zap.Logger, build Build) (appErr error)
Logger: logger,
Services: services,
Repositories: repositories,
HLogger: loggerHlog,
HLogger: loggerHlog,
})
encrypt := qutils.NewEncrypt(config.Service.PubKey, config.Service.PrivKey)

@ -71,6 +71,11 @@ func (receiver *WalletController) RequestMoney(ctx *fiber.Ctx) error {
return receiver.middleWare.ErrorOld(ctx, err)
}
account, err := receiver.accountRepo.FindByUserID(ctx.Context(), userID)
if err != nil {
return receiver.middleWare.ErrorOld(ctx, err)
}
link, err := receiver.GetPaymentLink(ctx.Context(), &models.GetPaymentLinkRequest{
Body: &request,
UserID: userID,
@ -81,16 +86,15 @@ func (receiver *WalletController) RequestMoney(ctx *fiber.Ctx) error {
}
hlogger.Emit(models.InfoRequestMoney{
CtxUserIP: ctx.IP(),
CtxUserPort: ctx.Port(),
KeyDomain: strings.Join(ctx.Subdomains(), "/"),
KeyPath: ctx.Path(),
CtxUserID: userID,
// todo
CtxAccountID: "",
CtxUserIP: ctx.IP(),
CtxUserPort: ctx.Port(),
KeyDomain: strings.Join(ctx.Subdomains(), "/"),
KeyPath: ctx.Path(),
CtxUserID: userID,
CtxAccountID: account.ID,
KeyPaymentType: string(request.Type),
KeyCurrency: request.Currency,
CtxPrice: int64(request.Amount),
CtxPrice: request.Amount,
CtxReturnURL: link,
})