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
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:
@@ -46,11 +46,33 @@ func (p *paymentExecutor) buildProviderSettlementTransferRequest(payment *model.
|
||||
if strings.TrimSpace(metadata[providerSettlementMetaOutgoingLeg]) == "" {
|
||||
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{
|
||||
OrganizationRef: payment.OrganizationRef.Hex(),
|
||||
FromAccountID: sourceWalletRef,
|
||||
ToAccountID: destRef,
|
||||
Currency: strings.TrimSpace(amount.GetCurrency()),
|
||||
Amount: strings.TrimSpace(amount.GetAmount()),
|
||||
IdempotencyKey: requestID,
|
||||
DestinationMemo: paymentRef,
|
||||
Metadata: metadata,
|
||||
ClientReference: paymentRef,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user