idempotency key delivery fix

This commit is contained in:
Stephan D
2026-01-21 16:50:47 +01:00
parent 87f99be01d
commit bd5dfb4f26
11 changed files with 63 additions and 24 deletions

View File

@@ -35,7 +35,6 @@ type FxQuote struct {
}
type PaymentQuote struct {
IdempotencyKey string `json:"idempotencyKey"`
QuoteRef string `json:"quoteRef,omitempty"`
DebitAmount *model.Money `json:"debitAmount,omitempty"`
ExpectedSettlementAmount *model.Money `json:"expectedSettlementAmount,omitempty"`
@@ -67,8 +66,9 @@ type Payment struct {
}
type paymentQuoteResponse struct {
authResponse `json:",inline"`
Quote *PaymentQuote `json:"quote"`
authResponse `json:",inline"`
IdempotencyKey string `json:"idempotencyKey,omitempty"`
Quote *PaymentQuote `json:"quote"`
}
type paymentQuotesResponse struct {
@@ -88,10 +88,11 @@ type paymentResponse struct {
}
// PaymentQuote wraps a payment quote with refreshed access token.
func PaymentQuoteResponse(logger mlogger.Logger, quote *orchestratorv1.PaymentQuote, token *TokenData) http.HandlerFunc {
func PaymentQuoteResponse(logger mlogger.Logger, idempotencyKey string, quote *orchestratorv1.PaymentQuote, token *TokenData) http.HandlerFunc {
return response.Ok(logger, paymentQuoteResponse{
Quote: toPaymentQuote(quote),
authResponse: authResponse{AccessToken: *token},
Quote: toPaymentQuote(quote),
IdempotencyKey: idempotencyKey,
authResponse: authResponse{AccessToken: *token},
})
}
@@ -216,9 +217,10 @@ func toPaymentQuotes(resp *orchestratorv1.QuotePaymentsResponse) *PaymentQuotes
quotes = nil
}
return &PaymentQuotes{
QuoteRef: resp.GetQuoteRef(),
Aggregate: toPaymentQuoteAggregate(resp.GetAggregate()),
Quotes: quotes,
IdempotencyKey: resp.GetIdempotencyKey(),
QuoteRef: resp.GetQuoteRef(),
Aggregate: toPaymentQuoteAggregate(resp.GetAggregate()),
Quotes: quotes,
}
}