Merge pull request 'fixed settlement flow' (#276) from settlement-275 into main
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/discovery Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful
ci/woodpecker/push/gateway_mntx Pipeline was successful
ci/woodpecker/push/gateway_chain Pipeline was successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful

Reviewed-on: #276
This commit was merged in pull request #276.
This commit is contained in:
2026-01-19 14:27:01 +00:00

View File

@@ -46,11 +46,33 @@ func (p *paymentExecutor) buildProviderSettlementTransferRequest(payment *model.
if strings.TrimSpace(metadata[providerSettlementMetaOutgoingLeg]) == "" { if strings.TrimSpace(metadata[providerSettlementMetaOutgoingLeg]) == "" {
metadata[providerSettlementMetaOutgoingLeg] = strings.ToLower(strings.TrimSpace(string(step.Rail))) metadata[providerSettlementMetaOutgoingLeg] = strings.ToLower(strings.TrimSpace(string(step.Rail)))
} }
sourceWalletRef := ""
if payment.Intent.Source.ManagedWallet != nil {
sourceWalletRef = strings.TrimSpace(payment.Intent.Source.ManagedWallet.ManagedWalletRef)
}
if sourceWalletRef == "" {
return rail.TransferRequest{}, merrors.InvalidArgument("provider settlement: source managed wallet is required")
}
destRef := ""
if payment.Intent.Destination.Type == model.EndpointTypeCard {
if route, err := p.resolveCardRoute(payment.Intent); err == nil {
destRef = strings.TrimSpace(route.FundingAddress)
}
}
if destRef == "" {
destRef = paymentRef
}
return rail.TransferRequest{ return rail.TransferRequest{
OrganizationRef: payment.OrganizationRef.Hex(), OrganizationRef: payment.OrganizationRef.Hex(),
FromAccountID: sourceWalletRef,
ToAccountID: destRef,
Currency: strings.TrimSpace(amount.GetCurrency()), Currency: strings.TrimSpace(amount.GetCurrency()),
Amount: strings.TrimSpace(amount.GetAmount()), Amount: strings.TrimSpace(amount.GetAmount()),
IdempotencyKey: requestID, IdempotencyKey: requestID,
DestinationMemo: paymentRef,
Metadata: metadata, Metadata: metadata,
ClientReference: paymentRef, ClientReference: paymentRef,
}, nil }, nil