fixed tests and compilation

This commit is contained in:
Stephan D
2026-02-13 02:33:22 +01:00
parent 71a7a474c8
commit 1b3aa0f9ea
8 changed files with 27 additions and 73 deletions

View File

@@ -11,7 +11,7 @@ import (
"github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/model"
"github.com/tech/sendico/pkg/mservice"
methodsv1 "github.com/tech/sendico/pkg/proto/payments/methods/v1"
paginationv2 "github.com/tech/sendico/pkg/proto/common/pagination/v2"
"go.mongodb.org/mongo-driver/v2/bson"
)
@@ -53,7 +53,7 @@ func encodePaymentMethod(pm *model.PaymentMethod) ([]byte, error) {
return payload, nil
}
func toModelCursor(cursor *methodsv1.ViewCursor) *model.ViewCursor {
func toModelCursor(cursor *paginationv2.ViewCursor) *model.ViewCursor {
if cursor == nil {
return nil
}

View File

@@ -2,7 +2,6 @@ package orchestrator
import (
"context"
"strings"
"testing"
mntxclient "github.com/tech/sendico/gateway/mntx/client"
@@ -216,64 +215,3 @@ func TestExecutePaymentPlan_SourceBeforeDestination(t *testing.T) {
}
}
func TestExecutePaymentPlan_RejectsLegacyLedgerOperations(t *testing.T) {
ctx := context.Background()
store := newStubPaymentsStore()
repo := &stubRepository{store: store}
ledgerFake := &ledgerclient.Fake{}
svc := &Service{
logger: zap.NewNop(),
storage: repo,
deps: serviceDependencies{
ledger: ledgerDependency{
client: ledgerFake,
internal: ledgerFake,
},
},
}
executor := newPaymentExecutor(&svc.deps, svc.logger, svc)
payment := &model.Payment{
PaymentRef: "pay-legacy-1",
IdempotencyKey: "pay-legacy-1",
OrganizationBoundBase: mo.OrganizationBoundBase{
OrganizationRef: bson.NewObjectID(),
},
Intent: model.PaymentIntent{
Ref: "ref-legacy-1",
Kind: model.PaymentKindPayout,
Source: model.PaymentEndpoint{
Type: model.EndpointTypeManagedWallet,
ManagedWallet: &model.ManagedWalletEndpoint{
ManagedWalletRef: "wallet-src",
},
},
Destination: model.PaymentEndpoint{
Type: model.EndpointTypeCard,
Card: &model.CardEndpoint{MaskedPan: "4111"},
},
},
PaymentPlan: &model.PaymentPlan{
ID: "pay-legacy-1",
IdempotencyKey: "pay-legacy-1",
Steps: []*model.PaymentStep{
{StepID: "ledger_block", Rail: model.RailLedger, Action: model.RailOperationBlock, Amount: &paymenttypes.Money{Currency: "USD", Amount: "100"}},
},
},
}
store.payments[payment.PaymentRef] = payment
err := executor.executePaymentPlan(ctx, store, payment, &sharedv1.PaymentQuote{})
if err == nil {
t.Fatal("expected legacy ledger operation error")
}
if !strings.Contains(err.Error(), "unsupported action") {
t.Fatalf("unexpected error: %v", err)
}
}