This commit is contained in:
Stephan D
2025-12-11 01:30:28 +01:00
parent 97d1470515
commit e6b001dc61
9 changed files with 11 additions and 42 deletions

View File

@@ -109,7 +109,6 @@ func quoteSnapshotToModel(src *orchestratorv1.PaymentQuote) *model.PaymentQuoteS
FeeRules: cloneFeeRules(src.GetFeeRules()),
FXQuote: cloneFXQuote(src.GetFxQuote()),
NetworkFee: cloneNetworkEstimate(src.GetNetworkFee()),
FeeQuoteToken: strings.TrimSpace(src.GetFeeQuoteToken()),
QuoteRef: strings.TrimSpace(src.GetQuoteRef()),
}
}
@@ -264,7 +263,6 @@ func modelQuoteToProto(src *model.PaymentQuoteSnapshot) *orchestratorv1.PaymentQ
FeeRules: cloneFeeRules(src.FeeRules),
FxQuote: cloneFXQuote(src.FXQuote),
NetworkFee: cloneNetworkEstimate(src.NetworkFee),
FeeQuoteToken: src.FeeQuoteToken,
QuoteRef: strings.TrimSpace(src.QuoteRef),
}
}

View File

@@ -109,7 +109,6 @@ func (h *initiatePaymentCommand) Execute(ctx context.Context, req *orchestratorv
Meta: req.GetMeta(),
Intent: intent,
QuoteRef: req.GetQuoteRef(),
FeeQuoteToken: req.GetFeeQuoteToken(),
IdempotencyKey: req.GetIdempotencyKey(),
})
if err != nil {

View File

@@ -73,7 +73,6 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc
FeeRules: cloneFeeRules(feeQuote.GetApplied()),
FxQuote: fxQuote,
NetworkFee: networkFee,
FeeQuoteToken: feeQuote.GetFeeQuoteToken(),
}
expiresAt := quoteExpiry(s.clock.Now(), feeQuote, fxQuote)

View File

@@ -93,7 +93,6 @@ type quoteResolutionInput struct {
Meta *orchestratorv1.RequestMeta
Intent *orchestratorv1.PaymentIntent
QuoteRef string
FeeQuoteToken string
IdempotencyKey string
}
@@ -131,10 +130,6 @@ func (s *Service) resolvePaymentQuote(ctx context.Context, in quoteResolutionInp
return quote, nil
}
if token := strings.TrimSpace(in.FeeQuoteToken); token != "" {
return &orchestratorv1.PaymentQuote{FeeQuoteToken: token}, nil
}
req := &orchestratorv1.QuotePaymentRequest{
Meta: in.Meta,
IdempotencyKey: in.IdempotencyKey,

View File

@@ -106,25 +106,6 @@ func TestResolvePaymentQuote_Expired(t *testing.T) {
}
}
func TestResolvePaymentQuote_FeeToken(t *testing.T) {
org := primitive.NewObjectID()
intent := &orchestratorv1.PaymentIntent{Amount: &moneyv1.Money{Currency: "USD", Amount: "1"}}
svc := &Service{clock: clockpkg.NewSystem()}
quote, err := svc.resolvePaymentQuote(context.Background(), quoteResolutionInput{
OrgRef: org.Hex(),
OrgID: org,
Meta: &orchestratorv1.RequestMeta{OrganizationRef: org.Hex()},
Intent: intent,
FeeQuoteToken: "token",
})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if quote.GetFeeQuoteToken() != "token" {
t.Fatalf("expected fee token preserved")
}
}
func TestInitiatePaymentIdempotency(t *testing.T) {
logger := mloggerfactory.NewLogger(false)
org := primitive.NewObjectID()
@@ -141,7 +122,6 @@ func TestInitiatePaymentIdempotency(t *testing.T) {
Meta: &orchestratorv1.RequestMeta{OrganizationRef: org.Hex()},
Intent: intent,
IdempotencyKey: "k1",
FeeQuoteToken: "fq",
}
resp, err := svc.h.commands.InitiatePayment().Execute(context.Background(), req)(context.Background())
if err != nil {

View File

@@ -143,7 +143,6 @@ type PaymentQuoteSnapshot struct {
FeeRules []*feesv1.AppliedRule `bson:"feeRules,omitempty" json:"feeRules,omitempty"`
FXQuote *oraclev1.Quote `bson:"fxQuote,omitempty" json:"fxQuote,omitempty"`
NetworkFee *chainv1.EstimateTransferFeeResponse `bson:"networkFee,omitempty" json:"networkFee,omitempty"`
FeeQuoteToken string `bson:"feeQuoteToken,omitempty" json:"feeQuoteToken,omitempty"`
QuoteRef string `bson:"quoteRef,omitempty" json:"quoteRef,omitempty"`
}

View File

@@ -122,8 +122,7 @@ message PaymentQuote {
repeated fees.v1.AppliedRule fee_rules = 5;
oracle.v1.Quote fx_quote = 6;
chain.gateway.v1.EstimateTransferFeeResponse network_fee = 7;
string fee_quote_token = 8;
string quote_ref = 9;
string quote_ref = 8;
}
message ExecutionRefs {

View File

@@ -4,7 +4,7 @@ import 'package:pshared/api/responses/base.dart';
import 'package:pshared/api/responses/token.dart';
import 'package:pshared/data/dto/payment/method.dart';
part 'payment_method.g.dart';
part 'method.g.dart';
@JsonSerializable(explicitToJson: true)

View File

@@ -1,4 +1,4 @@
import 'package:pshared/api/responses/payment_method.dart';
import 'package:pshared/api/responses/payment/method.dart';
import 'package:pshared/data/mapper/payment/method.dart';
import 'package:pshared/models/payment/methods/type.dart';
import 'package:pshared/service/services.dart';