Merge pull request 'fix' (#63) from bug-62 into main
Some checks failed
ci/woodpecker/push/bff Pipeline failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
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/fx_ingestor Pipeline failed
ci/woodpecker/push/frontend Pipeline failed
Some checks failed
ci/woodpecker/push/bff Pipeline failed
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
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/fx_ingestor Pipeline failed
ci/woodpecker/push/frontend Pipeline failed
Reviewed-on: #63
This commit was merged in pull request #63.
This commit is contained in:
@@ -109,7 +109,6 @@ func quoteSnapshotToModel(src *orchestratorv1.PaymentQuote) *model.PaymentQuoteS
|
|||||||
FeeRules: cloneFeeRules(src.GetFeeRules()),
|
FeeRules: cloneFeeRules(src.GetFeeRules()),
|
||||||
FXQuote: cloneFXQuote(src.GetFxQuote()),
|
FXQuote: cloneFXQuote(src.GetFxQuote()),
|
||||||
NetworkFee: cloneNetworkEstimate(src.GetNetworkFee()),
|
NetworkFee: cloneNetworkEstimate(src.GetNetworkFee()),
|
||||||
FeeQuoteToken: strings.TrimSpace(src.GetFeeQuoteToken()),
|
|
||||||
QuoteRef: strings.TrimSpace(src.GetQuoteRef()),
|
QuoteRef: strings.TrimSpace(src.GetQuoteRef()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +263,6 @@ func modelQuoteToProto(src *model.PaymentQuoteSnapshot) *orchestratorv1.PaymentQ
|
|||||||
FeeRules: cloneFeeRules(src.FeeRules),
|
FeeRules: cloneFeeRules(src.FeeRules),
|
||||||
FxQuote: cloneFXQuote(src.FXQuote),
|
FxQuote: cloneFXQuote(src.FXQuote),
|
||||||
NetworkFee: cloneNetworkEstimate(src.NetworkFee),
|
NetworkFee: cloneNetworkEstimate(src.NetworkFee),
|
||||||
FeeQuoteToken: src.FeeQuoteToken,
|
|
||||||
QuoteRef: strings.TrimSpace(src.QuoteRef),
|
QuoteRef: strings.TrimSpace(src.QuoteRef),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ func (h *initiatePaymentCommand) Execute(ctx context.Context, req *orchestratorv
|
|||||||
Meta: req.GetMeta(),
|
Meta: req.GetMeta(),
|
||||||
Intent: intent,
|
Intent: intent,
|
||||||
QuoteRef: req.GetQuoteRef(),
|
QuoteRef: req.GetQuoteRef(),
|
||||||
FeeQuoteToken: req.GetFeeQuoteToken(),
|
|
||||||
IdempotencyKey: req.GetIdempotencyKey(),
|
IdempotencyKey: req.GetIdempotencyKey(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc
|
|||||||
FeeRules: cloneFeeRules(feeQuote.GetApplied()),
|
FeeRules: cloneFeeRules(feeQuote.GetApplied()),
|
||||||
FxQuote: fxQuote,
|
FxQuote: fxQuote,
|
||||||
NetworkFee: networkFee,
|
NetworkFee: networkFee,
|
||||||
FeeQuoteToken: feeQuote.GetFeeQuoteToken(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expiresAt := quoteExpiry(s.clock.Now(), feeQuote, fxQuote)
|
expiresAt := quoteExpiry(s.clock.Now(), feeQuote, fxQuote)
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ type quoteResolutionInput struct {
|
|||||||
Meta *orchestratorv1.RequestMeta
|
Meta *orchestratorv1.RequestMeta
|
||||||
Intent *orchestratorv1.PaymentIntent
|
Intent *orchestratorv1.PaymentIntent
|
||||||
QuoteRef string
|
QuoteRef string
|
||||||
FeeQuoteToken string
|
|
||||||
IdempotencyKey string
|
IdempotencyKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,10 +130,6 @@ func (s *Service) resolvePaymentQuote(ctx context.Context, in quoteResolutionInp
|
|||||||
return quote, nil
|
return quote, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if token := strings.TrimSpace(in.FeeQuoteToken); token != "" {
|
|
||||||
return &orchestratorv1.PaymentQuote{FeeQuoteToken: token}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
req := &orchestratorv1.QuotePaymentRequest{
|
req := &orchestratorv1.QuotePaymentRequest{
|
||||||
Meta: in.Meta,
|
Meta: in.Meta,
|
||||||
IdempotencyKey: in.IdempotencyKey,
|
IdempotencyKey: in.IdempotencyKey,
|
||||||
|
|||||||
@@ -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) {
|
func TestInitiatePaymentIdempotency(t *testing.T) {
|
||||||
logger := mloggerfactory.NewLogger(false)
|
logger := mloggerfactory.NewLogger(false)
|
||||||
org := primitive.NewObjectID()
|
org := primitive.NewObjectID()
|
||||||
@@ -141,7 +122,6 @@ func TestInitiatePaymentIdempotency(t *testing.T) {
|
|||||||
Meta: &orchestratorv1.RequestMeta{OrganizationRef: org.Hex()},
|
Meta: &orchestratorv1.RequestMeta{OrganizationRef: org.Hex()},
|
||||||
Intent: intent,
|
Intent: intent,
|
||||||
IdempotencyKey: "k1",
|
IdempotencyKey: "k1",
|
||||||
FeeQuoteToken: "fq",
|
|
||||||
}
|
}
|
||||||
resp, err := svc.h.commands.InitiatePayment().Execute(context.Background(), req)(context.Background())
|
resp, err := svc.h.commands.InitiatePayment().Execute(context.Background(), req)(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -92,14 +92,14 @@ type CardEndpoint struct {
|
|||||||
|
|
||||||
// CardPayout stores gateway payout tracking info.
|
// CardPayout stores gateway payout tracking info.
|
||||||
type CardPayout struct {
|
type CardPayout struct {
|
||||||
PayoutRef string `bson:"payoutRef,omitempty" json:"payoutRef,omitempty"`
|
PayoutRef string `bson:"payoutRef,omitempty" json:"payoutRef,omitempty"`
|
||||||
ProviderPaymentID string `bson:"providerPaymentId,omitempty" json:"providerPaymentId,omitempty"`
|
ProviderPaymentID string `bson:"providerPaymentId,omitempty" json:"providerPaymentId,omitempty"`
|
||||||
Status string `bson:"status,omitempty" json:"status,omitempty"`
|
Status string `bson:"status,omitempty" json:"status,omitempty"`
|
||||||
FailureReason string `bson:"failureReason,omitempty" json:"failureReason,omitempty"`
|
FailureReason string `bson:"failureReason,omitempty" json:"failureReason,omitempty"`
|
||||||
CardCountry string `bson:"cardCountry,omitempty" json:"cardCountry,omitempty"`
|
CardCountry string `bson:"cardCountry,omitempty" json:"cardCountry,omitempty"`
|
||||||
MaskedPan string `bson:"maskedPan,omitempty" json:"maskedPan,omitempty"`
|
MaskedPan string `bson:"maskedPan,omitempty" json:"maskedPan,omitempty"`
|
||||||
ProviderCode string `bson:"providerCode,omitempty" json:"providerCode,omitempty"`
|
ProviderCode string `bson:"providerCode,omitempty" json:"providerCode,omitempty"`
|
||||||
GatewayReference string `bson:"gatewayReference,omitempty" json:"gatewayReference,omitempty"`
|
GatewayReference string `bson:"gatewayReference,omitempty" json:"gatewayReference,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaymentEndpoint is a polymorphic payment destination/source.
|
// PaymentEndpoint is a polymorphic payment destination/source.
|
||||||
@@ -143,7 +143,6 @@ type PaymentQuoteSnapshot struct {
|
|||||||
FeeRules []*feesv1.AppliedRule `bson:"feeRules,omitempty" json:"feeRules,omitempty"`
|
FeeRules []*feesv1.AppliedRule `bson:"feeRules,omitempty" json:"feeRules,omitempty"`
|
||||||
FXQuote *oraclev1.Quote `bson:"fxQuote,omitempty" json:"fxQuote,omitempty"`
|
FXQuote *oraclev1.Quote `bson:"fxQuote,omitempty" json:"fxQuote,omitempty"`
|
||||||
NetworkFee *chainv1.EstimateTransferFeeResponse `bson:"networkFee,omitempty" json:"networkFee,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"`
|
QuoteRef string `bson:"quoteRef,omitempty" json:"quoteRef,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ message PaymentQuote {
|
|||||||
repeated fees.v1.AppliedRule fee_rules = 5;
|
repeated fees.v1.AppliedRule fee_rules = 5;
|
||||||
oracle.v1.Quote fx_quote = 6;
|
oracle.v1.Quote fx_quote = 6;
|
||||||
chain.gateway.v1.EstimateTransferFeeResponse network_fee = 7;
|
chain.gateway.v1.EstimateTransferFeeResponse network_fee = 7;
|
||||||
string fee_quote_token = 8;
|
string quote_ref = 8;
|
||||||
string quote_ref = 9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ExecutionRefs {
|
message ExecutionRefs {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:pshared/api/responses/base.dart';
|
|||||||
import 'package:pshared/api/responses/token.dart';
|
import 'package:pshared/api/responses/token.dart';
|
||||||
import 'package:pshared/data/dto/payment/method.dart';
|
import 'package:pshared/data/dto/payment/method.dart';
|
||||||
|
|
||||||
part 'payment_method.g.dart';
|
part 'method.g.dart';
|
||||||
|
|
||||||
|
|
||||||
@JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
|||||||
@@ -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/data/mapper/payment/method.dart';
|
||||||
import 'package:pshared/models/payment/methods/type.dart';
|
import 'package:pshared/models/payment/methods/type.dart';
|
||||||
import 'package:pshared/service/services.dart';
|
import 'package:pshared/service/services.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user