diff --git a/common/constant/operation.go b/common/constant/operation.go new file mode 100644 index 00000000..40d28fb0 --- /dev/null +++ b/common/constant/operation.go @@ -0,0 +1,6 @@ +package constant + +const ( + DEBIT = "DEBIT" + CREDIT = "CREDIT" +) diff --git a/common/mcasdoor/casdoor.go b/common/mcasdoor/casdoor.go index 7f7f75a4..df9c3cd3 100644 --- a/common/mcasdoor/casdoor.go +++ b/common/mcasdoor/casdoor.go @@ -51,7 +51,7 @@ func (cc *CasdoorConnection) Connect() error { if client == nil || !cc.healthCheck() { cc.Connected = false err := errors.New("can't connect casdoor") - cc.Logger.Fatalf("CasdoorConnection.Ping %v", zap.Error(err)) + cc.Logger.Fatalf("Casdoor.HealthCheck %v", zap.Error(err)) return err } diff --git a/components/transaction/internal/app/command/create-operation.go b/components/transaction/internal/app/command/create-operation.go index 60f75b37..2fb81909 100644 --- a/components/transaction/internal/app/command/create-operation.go +++ b/components/transaction/internal/app/command/create-operation.go @@ -2,6 +2,7 @@ package command import ( "context" + "github.com/LerianStudio/midaz/common/constant" "reflect" "time" @@ -47,11 +48,18 @@ func (uc *UseCase) CreateOperation(ctx context.Context, accounts []*account.Acco description = dsl.Description } + var typeOperation string + if fromTo[i].IsFrom { + typeOperation = constant.DEBIT + } else { + typeOperation = constant.CREDIT + } + save := &o.Operation{ ID: uuid.New().String(), TransactionID: transactionID, Description: description, - Type: acc.Type, + Type: typeOperation, AssetCode: dsl.Send.Asset, ChartOfAccounts: fromTo[i].ChartOfAccounts, Amount: amount,