Skip to content
Snippets Groups Projects
Commit 7272e00b authored by DmitriiPetrov's avatar DmitriiPetrov
Browse files

MP-1378 Document Expiry email not sending for RGI, HEI cart & remote sale purchases

parent c411aa35
Branches
Tags b0.37.3
No related merge requests found
......@@ -84,3 +84,7 @@ issues:
- text: "GetTypes? is deprecated: Do not use."
linters:
- staticcheck
- text: "fieldalignment: struct with \\d+ pointer bytes could be \\d+"
linters:
- govet
......@@ -19,9 +19,9 @@ import (
document "gitlab.mashplace.com/mashplace/backend/document/api"
"gitlab.mashplace.com/mashplace/backend/document/internal/model"
"gitlab.mashplace.com/mashplace/backend/document/internal/model/mongo"
"gitlab.mashplace.com/mashplace/backend/document/internal/model/mongo/migrations/data/d1v0000"
"gitlab.mashplace.com/mashplace/backend/document/internal/model/mongo/migrations/data/d1v0001"
"gitlab.mashplace.com/mashplace/backend/document/internal/model/mongo/migrations/data/d1v0003"
//"gitlab.mashplace.com/mashplace/backend/document/internal/model/mongo/migrations/data/d1v0001"
"gitlab.mashplace.com/mashplace/backend/document/internal/service"
"gitlab.mashplace.com/mashplace/backend/document/internal/storage/filesystem"
documentExpire "gitlab.mashplace.com/mashplace/backend/document/internal/task/document/expire"
......@@ -130,9 +130,9 @@ func main() {
repository.MigrateData(
ctx,
backoff.WithContext(backoff.NewConstantBackOff(time.Minute), ctx),
d1v0003.Migration(envInvoiceService),
d1v0000.Migration(storage),
d1v0001.Migration(),
//d1v0003.Migration(envInvoiceService),
//d1v0000.Migration(storage),
//d1v0001.Migration(),
)
}()
......
......@@ -17,7 +17,6 @@ import (
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/timestamppb"
logger "gitlab.mashplace.com/mashplace/backend/common/generic/log"
"gitlab.mashplace.com/mashplace/backend/document/internal/model"
)
......@@ -27,12 +26,12 @@ func (srv *serviceImpl) ScheduleExpiringDocumentsNotification() {
for {
select {
case <-ctx.Done():
logger.Error(ctx.Err())
log.Error(ctx.Err())
default:
go func() {
err := srv.notifyAboutExpiringDocuments(ctx)
if err != nil {
logger.Error(err)
log.Error(err)
}
}()
time.Sleep(6 * time.Hour)
......@@ -80,6 +79,7 @@ func (srv *serviceImpl) notifyAboutExpiringDocumentsInDays(ctx context.Context,
}
d.ExpirationNotification.LastNotificationDate = time.Now().UTC().Truncate(24 * time.Hour)
err = srv.config.Repository.DocumentUpdate(ctx, d)
if err != nil {
log.WithError(err).Info("LastNotificationDate field update error")
......@@ -139,14 +139,19 @@ func (srv *serviceImpl) exportCloseOpportunity(ctx context.Context, d *model.Doc
service := extrResp.GetService()
var (
invResp *invoice.ProductGetResponse
extrasResp *extras.GetResponse
)
if service == nil && d.ProductID != "" {
prodResp, err := srv.config.Connections.Invoice.ProductGet(ctx, &invoice.ProductGetRequest{Id: d.ProductID})
invResp, err = srv.config.Connections.Invoice.ProductGet(ctx, &invoice.ProductGetRequest{Id: d.ProductID})
if err != nil && errors.Is(err, grpcerr.NotFound) {
return err
}
extrasResp, err := srv.config.Connections.Extras.Get(ctx, &extras.GetRequest{
Id: prodResp.GetProduct().ServiceId,
extrasResp, err = srv.config.Connections.Extras.Get(ctx, &extras.GetRequest{
Id: invResp.GetProduct().ServiceId,
})
if err != nil {
return err
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment