linting
This commit is contained in:
@@ -58,7 +58,7 @@ func (a *NotificationAPI) onConfirmationRequest(ctx context.Context, request *mo
|
||||
SourceService: req.SourceService,
|
||||
Rail: req.Rail,
|
||||
}
|
||||
env := confirmations.ConfirmationDispatch(string(mservice.Notifications), dispatch, req.SourceService, req.Rail)
|
||||
env := confirmations.ConfirmationDispatch(mservice.Notifications, dispatch, req.SourceService, req.Rail)
|
||||
if err := a.producer.SendMessage(env); err != nil {
|
||||
a.logger.Warn("Failed to publish confirmation dispatch", zap.Error(err), zap.String("request_id", req.RequestID), zap.String("message_id", dispatch.MessageID))
|
||||
return err
|
||||
@@ -143,7 +143,7 @@ func confirmationPrompt(req *model.ConfirmationRequest) string {
|
||||
if err != nil {
|
||||
amountFloat = 0
|
||||
}
|
||||
builder.WriteString(fmt.Sprintf("\n*Requested: %.2f %s*\n\n", amountFloat, req.RequestedMoney.Currency))
|
||||
_, _ = fmt.Fprintf(&builder, "\n*Requested: %.2f %s*\n\n", amountFloat, req.RequestedMoney.Currency)
|
||||
}
|
||||
builder.WriteString("Reply with \"<amount> <currency>\" (e.g., 12.34 USD).")
|
||||
return builder.String()
|
||||
|
||||
@@ -148,9 +148,8 @@ func NewClient(logger mlogger.Logger, l localizer.Localizer, dp domainprovider.D
|
||||
// Timeout for send the data and wait respond
|
||||
smtpServer.SendTimeout = mduration.Param2Duration(config.TimeOut, time.Second)
|
||||
|
||||
// Set TLSConfig to provide custom TLS configuration. For example,
|
||||
// to skip TLS verification (useful for testing):
|
||||
smtpServer.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
// Keep certificate verification enabled.
|
||||
smtpServer.TLSConfig = &tls.Config{InsecureSkipVerify: false}
|
||||
|
||||
// SMTP client
|
||||
lg := logger.Named("client")
|
||||
|
||||
@@ -123,7 +123,7 @@ func CreateAPI(a api.API) (*NotificationAPI, error) {
|
||||
Operations: []string{discovery.OperationNotifySend},
|
||||
Version: appversion.Create().Short(),
|
||||
}
|
||||
p.announcer = discovery.NewAnnouncer(p.logger, a.Register().Producer(), string(mservice.Notifications), announce)
|
||||
p.announcer = discovery.NewAnnouncer(p.logger, a.Register().Producer(), mservice.Notifications, announce)
|
||||
p.announcer.Start()
|
||||
|
||||
return p, nil
|
||||
|
||||
@@ -28,7 +28,6 @@ type mockSentMessage struct {
|
||||
locale string
|
||||
recipients []string
|
||||
data map[string]string
|
||||
buttonLink string
|
||||
}
|
||||
|
||||
func (m *mockMailClient) Send(r mmail.MailBuilder) error {
|
||||
|
||||
@@ -186,7 +186,11 @@ func (c *client) sendMessage(ctx context.Context, payload sendMessagePayload) (*
|
||||
c.logger.Warn("Telegram request failed", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() {
|
||||
if closeErr := resp.Body.Close(); closeErr != nil {
|
||||
c.logger.Warn("Failed to close telegram response body", zap.Error(closeErr))
|
||||
}
|
||||
}()
|
||||
|
||||
respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 16<<10))
|
||||
if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {
|
||||
@@ -321,7 +325,11 @@ func (c *client) sendReaction(ctx context.Context, payload setMessageReactionPay
|
||||
c.logger.Warn("Telegram reaction request failed", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer func() {
|
||||
if closeErr := resp.Body.Close(); closeErr != nil {
|
||||
c.logger.Warn("Failed to close telegram reaction response body", zap.Error(closeErr))
|
||||
}
|
||||
}()
|
||||
|
||||
respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 16<<10))
|
||||
if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {
|
||||
|
||||
@@ -61,7 +61,7 @@ func (a *NotificationAPI) handleTelegramWebhook(w http.ResponseWriter, r *http.R
|
||||
if update.Message != nil {
|
||||
payload.Message = update.Message.ToModel()
|
||||
}
|
||||
env := tnotifications.TelegramUpdate(string(mservice.Notifications), payload)
|
||||
env := tnotifications.TelegramUpdate(mservice.Notifications, payload)
|
||||
if err := a.producer.SendMessage(env); err != nil {
|
||||
if a.logger != nil {
|
||||
a.logger.Warn("Failed to publish telegram webhook update", zap.Error(err), zap.Int64("update_id", update.UpdateID))
|
||||
|
||||
Reference in New Issue
Block a user