payment recipient data

This commit is contained in:
Stephan D
2025-12-26 15:14:31 +01:00
parent 3836ff5ef3
commit 8adfab94b5
20 changed files with 442 additions and 68 deletions

View File

@@ -82,13 +82,14 @@ type ExternalChainEndpoint struct {
// CardEndpoint describes a card payout destination.
type CardEndpoint struct {
Pan string `bson:"pan,omitempty" json:"pan,omitempty"`
Token string `bson:"token,omitempty" json:"token,omitempty"`
Cardholder string `bson:"cardholder,omitempty" json:"cardholder,omitempty"`
ExpMonth uint32 `bson:"expMonth,omitempty" json:"expMonth,omitempty"`
ExpYear uint32 `bson:"expYear,omitempty" json:"expYear,omitempty"`
Country string `bson:"country,omitempty" json:"country,omitempty"`
MaskedPan string `bson:"maskedPan,omitempty" json:"maskedPan,omitempty"`
Pan string `bson:"pan,omitempty" json:"pan,omitempty"`
Token string `bson:"token,omitempty" json:"token,omitempty"`
Cardholder string `bson:"cardholder,omitempty" json:"cardholder,omitempty"`
CardholderSurname string `bson:"cardholderSurname,omitempty" json:"cardholderSurname,omitempty"`
ExpMonth uint32 `bson:"expMonth,omitempty" json:"expMonth,omitempty"`
ExpYear uint32 `bson:"expYear,omitempty" json:"expYear,omitempty"`
Country string `bson:"country,omitempty" json:"country,omitempty"`
MaskedPan string `bson:"maskedPan,omitempty" json:"maskedPan,omitempty"`
}
// CardPayout stores gateway payout tracking info.
@@ -134,6 +135,21 @@ type PaymentIntent struct {
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"`
Customer *Customer `bson:"customer,omitempty" json:"customer,omitempty"`
}
// Customer captures payer/recipient identity details for downstream processing.
type Customer struct {
ID string `bson:"id,omitempty" json:"id,omitempty"`
FirstName string `bson:"firstName,omitempty" json:"firstName,omitempty"`
MiddleName string `bson:"middleName,omitempty" json:"middleName,omitempty"`
LastName string `bson:"lastName,omitempty" json:"lastName,omitempty"`
IP string `bson:"ip,omitempty" json:"ip,omitempty"`
Zip string `bson:"zip,omitempty" json:"zip,omitempty"`
Country string `bson:"country,omitempty" json:"country,omitempty"`
State string `bson:"state,omitempty" json:"state,omitempty"`
City string `bson:"city,omitempty" json:"city,omitempty"`
Address string `bson:"address,omitempty" json:"address,omitempty"`
}
// PaymentQuoteSnapshot stores the latest quote info.
@@ -172,8 +188,8 @@ type ExecutionStep struct {
// ExecutionPlan captures the ordered list of steps to execute a payment.
type ExecutionPlan struct {
Steps []*ExecutionStep `bson:"steps,omitempty" json:"steps,omitempty"`
TotalNetworkFee *moneyv1.Money `bson:"totalNetworkFee,omitempty" json:"totalNetworkFee,omitempty"`
Steps []*ExecutionStep `bson:"steps,omitempty" json:"steps,omitempty"`
TotalNetworkFee *moneyv1.Money `bson:"totalNetworkFee,omitempty" json:"totalNetworkFee,omitempty"`
}
// Payment persists orchestrated payment lifecycle.
@@ -231,6 +247,18 @@ func (p *Payment) Normalize() {
p.Intent.Attributes[k] = strings.TrimSpace(v)
}
}
if p.Intent.Customer != nil {
p.Intent.Customer.ID = strings.TrimSpace(p.Intent.Customer.ID)
p.Intent.Customer.FirstName = strings.TrimSpace(p.Intent.Customer.FirstName)
p.Intent.Customer.MiddleName = strings.TrimSpace(p.Intent.Customer.MiddleName)
p.Intent.Customer.LastName = strings.TrimSpace(p.Intent.Customer.LastName)
p.Intent.Customer.IP = strings.TrimSpace(p.Intent.Customer.IP)
p.Intent.Customer.Zip = strings.TrimSpace(p.Intent.Customer.Zip)
p.Intent.Customer.Country = strings.TrimSpace(p.Intent.Customer.Country)
p.Intent.Customer.State = strings.TrimSpace(p.Intent.Customer.State)
p.Intent.Customer.City = strings.TrimSpace(p.Intent.Customer.City)
p.Intent.Customer.Address = strings.TrimSpace(p.Intent.Customer.Address)
}
if p.Execution != nil {
p.Execution.DebitEntryRef = strings.TrimSpace(p.Execution.DebitEntryRef)
p.Execution.CreditEntryRef = strings.TrimSpace(p.Execution.CreditEntryRef)
@@ -293,6 +321,7 @@ func normalizeEndpoint(ep *PaymentEndpoint) {
ep.Card.Pan = strings.TrimSpace(ep.Card.Pan)
ep.Card.Token = strings.TrimSpace(ep.Card.Token)
ep.Card.Cardholder = strings.TrimSpace(ep.Card.Cardholder)
ep.Card.CardholderSurname = strings.TrimSpace(ep.Card.CardholderSurname)
ep.Card.Country = strings.TrimSpace(ep.Card.Country)
ep.Card.MaskedPan = strings.TrimSpace(ep.Card.MaskedPan)
}