quotation v2 service
This commit is contained in:
@@ -2,6 +2,7 @@ package sresponse
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/api/http/response"
|
||||
@@ -148,8 +149,8 @@ func toFeeLines(lines []*feesv1.DerivedPostingLine) []FeeLine {
|
||||
result = append(result, FeeLine{
|
||||
LedgerAccountRef: line.GetLedgerAccountRef(),
|
||||
Amount: toMoney(line.GetMoney()),
|
||||
LineType: line.GetLineType().String(),
|
||||
Side: line.GetSide().String(),
|
||||
LineType: enumJSONName(line.GetLineType().String()),
|
||||
Side: enumJSONName(line.GetSide().String()),
|
||||
Meta: line.GetMeta(),
|
||||
})
|
||||
}
|
||||
@@ -178,7 +179,7 @@ func toFxQuote(q *oraclev1.Quote) *FxQuote {
|
||||
QuoteRef: q.GetQuoteRef(),
|
||||
BaseCurrency: base,
|
||||
QuoteCurrency: quote,
|
||||
Side: q.GetSide().String(),
|
||||
Side: enumJSONName(q.GetSide().String()),
|
||||
Price: q.GetPrice().GetValue(),
|
||||
BaseAmount: toMoney(q.GetBaseAmount()),
|
||||
QuoteAmount: toMoney(q.GetQuoteAmount()),
|
||||
@@ -260,11 +261,15 @@ func toPayment(p *sharedv1.Payment) *Payment {
|
||||
return &Payment{
|
||||
PaymentRef: p.GetPaymentRef(),
|
||||
IdempotencyKey: p.GetIdempotencyKey(),
|
||||
State: p.GetState().String(),
|
||||
FailureCode: p.GetFailureCode().String(),
|
||||
State: enumJSONName(p.GetState().String()),
|
||||
FailureCode: enumJSONName(p.GetFailureCode().String()),
|
||||
FailureReason: p.GetFailureReason(),
|
||||
LastQuote: toPaymentQuote(p.GetLastQuote()),
|
||||
CreatedAt: p.GetCreatedAt().AsTime(),
|
||||
Meta: p.GetMetadata(),
|
||||
}
|
||||
}
|
||||
|
||||
func enumJSONName(value string) string {
|
||||
return strings.ToLower(strings.TrimSpace(value))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user