Merge pull request 'fixed dropping of settlement mode' (#108) from settlement-106 into main
Some checks failed
ci/woodpecker/push/fx_oracle Pipeline is pending
ci/woodpecker/push/ledger Pipeline is pending
ci/woodpecker/push/mntx_gateway Pipeline is pending
ci/woodpecker/push/nats Pipeline is pending
ci/woodpecker/push/notification Pipeline is pending
ci/woodpecker/push/payments_orchestrator Pipeline is pending
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline failed
ci/woodpecker/push/frontend Pipeline failed
Some checks failed
ci/woodpecker/push/fx_oracle Pipeline is pending
ci/woodpecker/push/ledger Pipeline is pending
ci/woodpecker/push/mntx_gateway Pipeline is pending
ci/woodpecker/push/nats Pipeline is pending
ci/woodpecker/push/notification Pipeline is pending
ci/woodpecker/push/payments_orchestrator Pipeline is pending
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline failed
ci/woodpecker/push/frontend Pipeline failed
Reviewed-on: #108
This commit was merged in pull request #108.
This commit is contained in:
@@ -26,6 +26,7 @@ func intentFromProto(src *orchestratorv1.PaymentIntent) model.PaymentIntent {
|
|||||||
Amount: cloneMoney(src.GetAmount()),
|
Amount: cloneMoney(src.GetAmount()),
|
||||||
RequiresFX: src.GetRequiresFx(),
|
RequiresFX: src.GetRequiresFx(),
|
||||||
FeePolicy: src.GetFeePolicy(),
|
FeePolicy: src.GetFeePolicy(),
|
||||||
|
SettlementMode: src.GetSettlementMode(),
|
||||||
Attributes: cloneMetadata(src.GetAttributes()),
|
Attributes: cloneMetadata(src.GetAttributes()),
|
||||||
}
|
}
|
||||||
if src.GetFx() != nil {
|
if src.GetFx() != nil {
|
||||||
@@ -159,6 +160,7 @@ func protoIntentFromModel(src model.PaymentIntent) *orchestratorv1.PaymentIntent
|
|||||||
Amount: cloneMoney(src.Amount),
|
Amount: cloneMoney(src.Amount),
|
||||||
RequiresFx: src.RequiresFX,
|
RequiresFx: src.RequiresFX,
|
||||||
FeePolicy: src.FeePolicy,
|
FeePolicy: src.FeePolicy,
|
||||||
|
SettlementMode: src.SettlementMode,
|
||||||
Attributes: cloneMetadata(src.Attributes),
|
Attributes: cloneMetadata(src.Attributes),
|
||||||
}
|
}
|
||||||
if src.FX != nil {
|
if src.FX != nil {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ func TestNewPayment(t *testing.T) {
|
|||||||
org := primitive.NewObjectID()
|
org := primitive.NewObjectID()
|
||||||
intent := &orchestratorv1.PaymentIntent{
|
intent := &orchestratorv1.PaymentIntent{
|
||||||
Amount: &moneyv1.Money{Currency: "USD", Amount: "10"},
|
Amount: &moneyv1.Money{Currency: "USD", Amount: "10"},
|
||||||
|
SettlementMode: orchestratorv1.SettlementMode_SETTLEMENT_MODE_FIX_RECEIVED,
|
||||||
}
|
}
|
||||||
quote := &orchestratorv1.PaymentQuote{QuoteRef: "q1"}
|
quote := &orchestratorv1.PaymentQuote{QuoteRef: "q1"}
|
||||||
p := newPayment(org, intent, "idem", map[string]string{"k": "v"}, quote)
|
p := newPayment(org, intent, "idem", map[string]string{"k": "v"}, quote)
|
||||||
@@ -58,6 +59,9 @@ func TestNewPayment(t *testing.T) {
|
|||||||
if p.Intent.Amount == nil || p.Intent.Amount.GetAmount() != "10" {
|
if p.Intent.Amount == nil || p.Intent.Amount.GetAmount() != "10" {
|
||||||
t.Fatalf("intent not copied")
|
t.Fatalf("intent not copied")
|
||||||
}
|
}
|
||||||
|
if p.Intent.SettlementMode != orchestratorv1.SettlementMode_SETTLEMENT_MODE_FIX_RECEIVED {
|
||||||
|
t.Fatalf("settlement mode not preserved")
|
||||||
|
}
|
||||||
if p.LastQuote == nil || p.LastQuote.QuoteRef != "q1" {
|
if p.LastQuote == nil || p.LastQuote.QuoteRef != "q1" {
|
||||||
t.Fatalf("quote not copied")
|
t.Fatalf("quote not copied")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||||
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
|
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
|
||||||
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
|
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
|
||||||
|
orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PaymentKind captures the orchestrator intent type.
|
// PaymentKind captures the orchestrator intent type.
|
||||||
@@ -131,6 +132,7 @@ type PaymentIntent struct {
|
|||||||
RequiresFX bool `bson:"requiresFx,omitempty" json:"requiresFx,omitempty"`
|
RequiresFX bool `bson:"requiresFx,omitempty" json:"requiresFx,omitempty"`
|
||||||
FX *FXIntent `bson:"fx,omitempty" json:"fx,omitempty"`
|
FX *FXIntent `bson:"fx,omitempty" json:"fx,omitempty"`
|
||||||
FeePolicy *feesv1.PolicyOverrides `bson:"feePolicy,omitempty" json:"feePolicy,omitempty"`
|
FeePolicy *feesv1.PolicyOverrides `bson:"feePolicy,omitempty" json:"feePolicy,omitempty"`
|
||||||
|
SettlementMode orchestratorv1.SettlementMode `bson:"settlementMode,omitempty" json:"settlementMode,omitempty"`
|
||||||
Attributes map[string]string `bson:"attributes,omitempty" json:"attributes,omitempty"`
|
Attributes map[string]string `bson:"attributes,omitempty" json:"attributes,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user