Merge pull request 'extended logging' (#453) from mntx-452 into main
All checks were successful
ci/woodpecker/push/gateway_mntx Pipeline was successful

Reviewed-on: #453
This commit was merged in pull request #453.
This commit is contained in:
2026-02-10 10:25:09 +00:00

View File

@@ -10,6 +10,7 @@ import (
ri "github.com/tech/sendico/pkg/db/repository/index"
"github.com/tech/sendico/pkg/merrors"
"github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/mutil/mzap"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
"go.uber.org/zap"
@@ -85,10 +86,19 @@ func (p *Payouts) Upsert(ctx context.Context, record *model.CardPayout) error {
}
if record.ID == bson.NilObjectID {
return p.repository.Insert(ctx, record, nil)
if err := p.repository.Insert(ctx, record, nil); err != nil {
p.logger.Warn("Failed to insert new record", zap.Error(err), zap.String("operation_Ref", record.OperationRef))
return err
}
return nil
}
return p.repository.Update(ctx, record)
if err := p.repository.Update(ctx, record); err != nil {
p.logger.Warn("Failed to update existing record", zap.Error(err),
zap.String("operation_Ref", record.OperationRef), mzap.ObjRef("payout_ref", record.ID))
return err
}
return nil
}
var _ storage.PayoutsStore = (*Payouts)(nil)