fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
"github.com/tech/sendico/pkg/mutil/mzap"
|
||||
ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
return nil, err
|
||||
}
|
||||
|
||||
accountsByRef := map[primitive.ObjectID]*pmodel.LedgerAccount{accountRef: account}
|
||||
accountsByRef := map[bson.ObjectID]*pmodel.LedgerAccount{accountRef: account}
|
||||
|
||||
eventTime := getEventTime(req.EventTime)
|
||||
creditAmount, _ := parseDecimal(req.Money.Amount)
|
||||
@@ -109,7 +109,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
|
||||
postingLines := make([]*model.PostingLine, 0, 2+len(charges))
|
||||
mainLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: accountRef,
|
||||
Amount: creditAmount.String(),
|
||||
Currency: req.Money.Currency,
|
||||
@@ -146,7 +146,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
entryTotal = entryTotal.Add(chargeAmount)
|
||||
|
||||
chargeLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: chargeAccountRef,
|
||||
Amount: chargeAmount.String(),
|
||||
Currency: charge.Money.Currency,
|
||||
@@ -170,7 +170,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
contraAmount := entryTotal.Neg()
|
||||
if !contraAmount.IsZero() || len(postingLines) == 1 {
|
||||
contraLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: *contraAccountID,
|
||||
Amount: contraAmount.String(),
|
||||
Currency: req.Money.Currency,
|
||||
|
||||
Reference in New Issue
Block a user