refactored payment orchestration
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/tech/sendico/pkg/api/routers/gsresponse"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
pmodel "github.com/tech/sendico/pkg/model"
|
||||
"github.com/tech/sendico/pkg/model/account_role"
|
||||
"github.com/tech/sendico/pkg/mutil/mzap"
|
||||
ledgerv1 "github.com/tech/sendico/pkg/proto/ledger/v1"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
@@ -28,7 +29,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
if req.OrganizationRef == "" {
|
||||
return nil, merrors.InvalidArgument("organization_ref is required")
|
||||
}
|
||||
roleModel := pmodel.AccountRole("")
|
||||
roleModel := account_role.AccountRole("")
|
||||
if req.Role != ledgerv1.AccountRole_ACCOUNT_ROLE_UNSPECIFIED {
|
||||
var err error
|
||||
roleModel, err = protoAccountRoleToModel(req.Role)
|
||||
@@ -36,7 +37,7 @@ func (s *Service) postCreditResponder(_ context.Context, req *ledgerv1.PostCredi
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.TrimSpace(req.LedgerAccountRef) == "" {
|
||||
roleModel = pmodel.AccountRoleOperating
|
||||
roleModel = account_role.AccountRoleOperating
|
||||
}
|
||||
if strings.TrimSpace(req.LedgerAccountRef) == "" && roleModel == "" {
|
||||
return nil, merrors.InvalidArgument("ledger_account_ref or role is required")
|
||||
|
||||
Reference in New Issue
Block a user