Orchestrator refactoring + planned amounts
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/tech/sendico/payments/quotation/internal/shared"
|
||||
"github.com/tech/sendico/payments/storage/model"
|
||||
"github.com/tech/sendico/pkg/merrors"
|
||||
paymenttypes "github.com/tech/sendico/pkg/payments/types"
|
||||
@@ -23,10 +24,7 @@ type moneyGetter interface {
|
||||
}
|
||||
|
||||
func cloneMoney(input *paymenttypes.Money) *paymenttypes.Money {
|
||||
if input == nil {
|
||||
return nil
|
||||
}
|
||||
return &paymenttypes.Money{Currency: input.GetCurrency(), Amount: input.GetAmount()}
|
||||
return shared.CloneModelMoneyRaw(input)
|
||||
}
|
||||
|
||||
func cloneStringList(values []string) []string {
|
||||
@@ -100,10 +98,7 @@ func protoMoney(m *paymenttypes.Money) *moneyv1.Money {
|
||||
}
|
||||
|
||||
func cloneProtoMoney(input *moneyv1.Money) *moneyv1.Money {
|
||||
if input == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{Currency: input.GetCurrency(), Amount: input.GetAmount()}
|
||||
return shared.CloneProtoMoneyRaw(input)
|
||||
}
|
||||
|
||||
func decimalFromProto(value *moneyv1.Decimal) *paymenttypes.Decimal {
|
||||
|
||||
@@ -67,13 +67,7 @@ func BuildFundingGateFromProfile(
|
||||
}
|
||||
|
||||
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{
|
||||
Amount: strings.TrimSpace(src.GetAmount()),
|
||||
Currency: strings.TrimSpace(src.GetCurrency()),
|
||||
}
|
||||
return shared.CloneProtoMoneyTrim(src)
|
||||
}
|
||||
|
||||
func clonePaymentEndpoint(src *model.PaymentEndpoint) *model.PaymentEndpoint {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
oracleclient "github.com/tech/sendico/fx/oracle/client"
|
||||
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
|
||||
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
|
||||
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@@ -31,13 +32,7 @@ const (
|
||||
)
|
||||
|
||||
func cloneProtoMoney(input *moneyv1.Money) *moneyv1.Money {
|
||||
if input == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{
|
||||
Currency: input.GetCurrency(),
|
||||
Amount: input.GetAmount(),
|
||||
}
|
||||
return qshared.CloneProtoMoneyRaw(input)
|
||||
}
|
||||
|
||||
func cloneMetadata(input map[string]string) map[string]string {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
|
||||
"github.com/tech/sendico/payments/storage/model"
|
||||
payecon "github.com/tech/sendico/pkg/payments/economics"
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
@@ -38,13 +39,7 @@ func firstNonEmpty(values ...string) string {
|
||||
}
|
||||
|
||||
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{
|
||||
Amount: strings.TrimSpace(src.GetAmount()),
|
||||
Currency: strings.ToUpper(strings.TrimSpace(src.GetCurrency())),
|
||||
}
|
||||
return qshared.CloneProtoMoneyTrimUpperCurrency(src)
|
||||
}
|
||||
|
||||
func resolvedSettlementModeFromModel(mode model.SettlementMode) paymentv1.SettlementMode {
|
||||
|
||||
@@ -3,19 +3,14 @@ package quote_computation_service
|
||||
import (
|
||||
"strings"
|
||||
|
||||
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
|
||||
"github.com/tech/sendico/payments/storage/model"
|
||||
paymenttypes "github.com/tech/sendico/pkg/payments/types"
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
)
|
||||
|
||||
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{
|
||||
Amount: strings.TrimSpace(src.GetAmount()),
|
||||
Currency: strings.TrimSpace(src.GetCurrency()),
|
||||
}
|
||||
return qshared.CloneProtoMoneyTrim(src)
|
||||
}
|
||||
|
||||
func protoMoneyFromModel(src *paymenttypes.Money) *moneyv1.Money {
|
||||
@@ -58,13 +53,7 @@ func cloneAsset(src *paymenttypes.Asset) *paymenttypes.Asset {
|
||||
}
|
||||
|
||||
func cloneModelMoney(src *paymenttypes.Money) *paymenttypes.Money {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
return &paymenttypes.Money{
|
||||
Amount: strings.TrimSpace(src.GetAmount()),
|
||||
Currency: strings.ToUpper(strings.TrimSpace(src.GetCurrency())),
|
||||
}
|
||||
return qshared.CloneModelMoneyTrimUpperCurrency(src)
|
||||
}
|
||||
|
||||
func clonePaymentIntent(src model.PaymentIntent) model.PaymentIntent {
|
||||
|
||||
@@ -3,6 +3,7 @@ package quote_response_mapper_v2
|
||||
import (
|
||||
"strings"
|
||||
|
||||
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
|
||||
feesv1 "github.com/tech/sendico/pkg/proto/billing/fees/v1"
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
paymentv1 "github.com/tech/sendico/pkg/proto/common/payment/v1"
|
||||
@@ -12,13 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func cloneMoney(src *moneyv1.Money) *moneyv1.Money {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
return &moneyv1.Money{
|
||||
Amount: strings.TrimSpace(src.GetAmount()),
|
||||
Currency: strings.TrimSpace(src.GetCurrency()),
|
||||
}
|
||||
return qshared.CloneProtoMoneyTrim(src)
|
||||
}
|
||||
|
||||
func cloneFeeLines(src []*feesv1.DerivedPostingLine) []*feesv1.DerivedPostingLine {
|
||||
|
||||
Reference in New Issue
Block a user