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"
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ func (s *Service) postExternalCreditResponder(_ context.Context, req *ledgerv1.P
|
||||
return nil, merrors.Internal("system account missing identifier")
|
||||
}
|
||||
|
||||
accountsByRef := map[primitive.ObjectID]*pmodel.LedgerAccount{
|
||||
accountsByRef := map[bson.ObjectID]*pmodel.LedgerAccount{
|
||||
accountRef: account,
|
||||
*systemAccountID: systemAccount,
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (s *Service) postExternalCreditResponder(_ context.Context, req *ledgerv1.P
|
||||
|
||||
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,
|
||||
@@ -160,7 +160,7 @@ func (s *Service) postExternalCreditResponder(_ context.Context, req *ledgerv1.P
|
||||
entryTotal = entryTotal.Add(chargeAmount)
|
||||
|
||||
chargeLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: chargeAccountRef,
|
||||
Amount: chargeAmount.String(),
|
||||
Currency: charge.Money.Currency,
|
||||
@@ -173,7 +173,7 @@ func (s *Service) postExternalCreditResponder(_ context.Context, req *ledgerv1.P
|
||||
contraAmount := entryTotal.Neg()
|
||||
if !contraAmount.IsZero() || len(postingLines) == 1 {
|
||||
contraLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: *systemAccountID,
|
||||
Amount: contraAmount.String(),
|
||||
Currency: req.Money.Currency,
|
||||
@@ -333,7 +333,7 @@ func (s *Service) postExternalDebitResponder(_ context.Context, req *ledgerv1.Po
|
||||
return nil, merrors.Internal("system account missing identifier")
|
||||
}
|
||||
|
||||
accountsByRef := map[primitive.ObjectID]*pmodel.LedgerAccount{
|
||||
accountsByRef := map[bson.ObjectID]*pmodel.LedgerAccount{
|
||||
accountRef: account,
|
||||
*systemAccountID: systemAccount,
|
||||
}
|
||||
@@ -356,7 +356,7 @@ func (s *Service) postExternalDebitResponder(_ context.Context, req *ledgerv1.Po
|
||||
|
||||
postingLines := make([]*model.PostingLine, 0, 2+len(charges))
|
||||
mainLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: accountRef,
|
||||
Amount: debitAmount.Neg().String(),
|
||||
Currency: req.Money.Currency,
|
||||
@@ -393,7 +393,7 @@ func (s *Service) postExternalDebitResponder(_ context.Context, req *ledgerv1.Po
|
||||
entryTotal = entryTotal.Add(chargeAmount)
|
||||
|
||||
chargeLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: chargeAccountRef,
|
||||
Amount: chargeAmount.String(),
|
||||
Currency: charge.Money.Currency,
|
||||
@@ -406,7 +406,7 @@ func (s *Service) postExternalDebitResponder(_ context.Context, req *ledgerv1.Po
|
||||
contraAmount := entryTotal.Neg()
|
||||
if !contraAmount.IsZero() || len(postingLines) == 1 {
|
||||
contraLine := &model.PostingLine{
|
||||
JournalEntryRef: primitive.NilObjectID,
|
||||
JournalEntryRef: bson.NilObjectID,
|
||||
AccountRef: *systemAccountID,
|
||||
Amount: contraAmount.String(),
|
||||
Currency: req.Money.Currency,
|
||||
|
||||
Reference in New Issue
Block a user