fixed tests and compilation
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user