From f1840690e1d6c2738ff672fd71c2f295cfd32e98 Mon Sep 17 00:00:00 2001 From: Stephan D Date: Fri, 13 Mar 2026 01:28:51 +0100 Subject: [PATCH] docs format updated --- api/billing/documents/go.mod | 4 +- api/billing/documents/go.sum | 8 +- .../documents/internal/content/content.go | 109 ++++++---- .../internal/service/documents/service.go | 204 +++++++++++++++--- .../service/documents/service_test.go | 90 ++++++++ api/billing/fees/go.mod | 2 +- api/billing/fees/go.sum | 4 +- api/discovery/go.mod | 2 +- api/discovery/go.sum | 4 +- api/edge/bff/go.mod | 6 +- api/edge/bff/go.sum | 12 +- .../server/paymentapiimp/documents.go | 164 ++++++++++---- .../server/paymentapiimp/documents_test.go | 120 +++++++++++ .../server/paymentapiimp/paybatch_test.go | 4 + .../internal/server/paymentapiimp/service.go | 1 + api/edge/callbacks/go.mod | 2 +- api/edge/callbacks/go.sum | 4 +- api/fx/ingestor/go.mod | 2 +- api/fx/ingestor/go.sum | 4 +- api/fx/oracle/go.mod | 2 +- api/fx/oracle/go.sum | 4 +- api/gateway/aurora/go.mod | 2 +- api/gateway/aurora/go.sum | 4 +- api/gateway/chain/go.mod | 2 +- api/gateway/chain/go.sum | 4 +- api/gateway/chsettle/go.mod | 2 +- api/gateway/chsettle/go.sum | 4 +- api/gateway/mntx/go.mod | 2 +- api/gateway/mntx/go.sum | 4 +- api/gateway/tgsettle/go.mod | 2 +- api/gateway/tgsettle/go.sum | 4 +- api/gateway/tron/go.mod | 2 +- api/gateway/tron/go.sum | 4 +- api/ledger/go.mod | 2 +- api/ledger/go.sum | 4 +- api/notification/go.mod | 2 +- api/notification/go.sum | 4 +- api/payments/methods/go.mod | 2 +- api/payments/methods/go.sum | 4 +- api/payments/orchestrator/go.mod | 2 +- api/payments/orchestrator/go.sum | 4 +- api/payments/quotation/go.mod | 2 +- api/payments/quotation/go.sum | 4 +- api/pkg/go.mod | 2 +- api/pkg/go.sum | 4 +- .../billing/documents/v1/documents.proto | 2 + .../lib/service/payment/documents.dart | 2 + .../pweb/lib/app/router/payout_shell.dart | 2 +- .../lib/controllers/payments/details.dart | 14 +- .../pweb/lib/pages/report/details/page.dart | 15 +- frontend/pweb/lib/pages/report/table/row.dart | 3 +- .../pweb/lib/pages/report/table/widget.dart | 4 +- .../pweb/lib/utils/report/download_act.dart | 6 +- t.json | 0 54 files changed, 677 insertions(+), 195 deletions(-) create mode 100644 api/edge/bff/internal/server/paymentapiimp/documents_test.go delete mode 100644 t.json diff --git a/api/billing/documents/go.mod b/api/billing/documents/go.mod index 8f3a3457..49a68460 100644 --- a/api/billing/documents/go.mod +++ b/api/billing/documents/go.mod @@ -8,7 +8,7 @@ require ( github.com/aws/aws-sdk-go-v2 v1.41.3 github.com/aws/aws-sdk-go-v2/config v1.32.11 github.com/aws/aws-sdk-go-v2/credentials v1.19.11 - github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 + github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0 github.com/jung-kurt/gofpdf v1.16.2 github.com/prometheus/client_golang v1.23.2 github.com/shopspring/decimal v1.4.0 @@ -61,7 +61,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/billing/documents/go.sum b/api/billing/documents/go.sum index bb0999c7..89c85542 100644 --- a/api/billing/documents/go.sum +++ b/api/billing/documents/go.sum @@ -30,8 +30,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.19 h1:X1Tow7su github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.19/go.mod h1:/rARO8psX+4sfjUQXp5LLifjUt8DuATZ31WptNJTyQA= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.19 h1:JnQeStZvPHFHeyky/7LbMlyQjUa+jIBj36OlWm0pzIk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.19/go.mod h1:HGyasyHvYdFQeJhvDHfH7HXkHh57htcJGKDZ+7z+I24= -github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 h1:4ExZyubQ6LQQVuF2Qp9OsfEvsTdAWh5Gfwf6PgIdLdk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4/go.mod h1:NF3JcMGOiARAss1ld3WGORCw71+4ExDD2cbbdKS5PpA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0 h1:zyKY4OxzUImu+DigelJI9o49QQv8CjREs5E1CywjtIA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0/go.mod h1:NF3JcMGOiARAss1ld3WGORCw71+4ExDD2cbbdKS5PpA= github.com/aws/aws-sdk-go-v2/service/signin v1.0.7 h1:Y2cAXlClHsXkkOvWZFXATr34b0hxxloeQu/pAZz2row= github.com/aws/aws-sdk-go-v2/service/signin v1.0.7/go.mod h1:idzZ7gmDeqeNrSPkdbtMp9qWMgcBwykA7P7Rzh5DXVU= github.com/aws/aws-sdk-go-v2/service/sso v1.30.12 h1:iSsvB9EtQ09YrsmIc44Heqlx5ByGErqhPK1ZQLppias= @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/billing/documents/internal/content/content.go b/api/billing/documents/internal/content/content.go index c103d67c..4cb3659d 100644 --- a/api/billing/documents/internal/content/content.go +++ b/api/billing/documents/internal/content/content.go @@ -3,7 +3,8 @@ package content // Issuer details are intentionally centralized to avoid document text drift. const ( IssuerLegalName = "SMX Operations Limited" - IssuerLegalAddress = "Room 607, 12/F., Block C, Hong Kong Industrial Centre, 489-491 Castle Peak Road, Lai Chi Kok, Hong Kong" + IssuerLegalAddress = "Room 607, 12/F., Block C, Hong Kong Industrial Centre, 489-491 Castle Peak Road, Lai Chi Kok, HongKong" + IssuerEmail = "contact@sendico.io" ) const ( @@ -74,43 +75,77 @@ var AcceptanceTemplate = AcceptanceTemplateContent{ // OperationDocumentContent contains all static copy for operation documents. type OperationDocumentContent struct { - Title string - Subtitle string - MetaDocumentType string - SectionOperation string - SectionFailure string - RowOrganization string - RowGatewayService string - RowOperationRef string - RowPaymentRef string - RowCode string - RowState string - RowLabel string - RowStartedAtUTC string - RowCompletedAtUTC string - RowAmount string - RowFailureCode string - RowFailureReason string - MissingValuePlaceholder string + Title string + Subtitle string + MetaCertificateNumberLabel string + MetaDateLabel string + SectionParties string + PartiesIntro string + RowServiceProvider string + RowServiceProviderAddress string + RowServiceProviderEmail string + RowClient string + RowClientAddress string + RowClientReference string + SectionSubject string + SubjectIntro string + SectionServicePeriod string + RowPeriodFrom string + RowPeriodTo string + SectionTotalAmount string + RowTotalAmount string + SectionClientConfirmation string + ConfirmationLine1 string + ConfirmationLine2 string + ConfirmationLine3 string + SectionSignatures string + SignatureServiceProviderLine string + SignatureClientNamePrefix string + SignatureClientTitleLine string + SignatureClientLine string + SectionOperationStatus string + RowOperationStatus string + RowOperationCode string + RowOperationLabel string + RowFailureCode string + RowFailureReason string + MissingValuePlaceholder string } var OperationDocument = OperationDocumentContent{ - Title: "OPERATION BILLING DOCUMENT", - Subtitle: "Gateway operation statement", - MetaDocumentType: "Document Type: Operation", - SectionOperation: "OPERATION DETAILS", - SectionFailure: "FAILURE DETAILS", - RowOrganization: "Organization", - RowGatewayService: "Gateway Service", - RowOperationRef: "Operation Ref", - RowPaymentRef: "Payment Ref", - RowCode: "Code", - RowState: "State", - RowLabel: "Label", - RowStartedAtUTC: "Started At (UTC)", - RowCompletedAtUTC: "Completed At (UTC)", - RowAmount: "Amount", - RowFailureCode: "Failure Code", - RowFailureReason: "Failure Reason", - MissingValuePlaceholder: "n/a", + Title: "CERTIFICATE OF SERVICES RENDERED", + Subtitle: "Payment operation completion and acceptance statement", + MetaCertificateNumberLabel: "Certificate No.", + MetaDateLabel: "Date", + SectionParties: "PARTIES", + PartiesIntro: "This Certificate is made between:", + RowServiceProvider: "Service Provider", + RowServiceProviderAddress: "Service Provider Address", + RowServiceProviderEmail: "Service Provider Email", + RowClient: "Client", + RowClientAddress: "Client Address", + RowClientReference: "Client Reference", + SectionSubject: "SUBJECT OF THE CERTIFICATE", + SubjectIntro: "The Service Provider confirms that the following services have been fully rendered to the Client:", + SectionServicePeriod: "SERVICE PERIOD", + RowPeriodFrom: "From", + RowPeriodTo: "To", + SectionTotalAmount: "TOTAL AMOUNT", + RowTotalAmount: "Amount", + SectionClientConfirmation: "CLIENT CONFIRMATION", + ConfirmationLine1: "- the services were rendered in full;", + ConfirmationLine2: "- the services were rendered properly and within the agreed scope;", + ConfirmationLine3: "- the Client has no claims regarding the quality, quantity, or timing of the services rendered.", + SectionSignatures: "SIGNATURES", + SignatureServiceProviderLine: "Service Provider: Name: SMX Operations Limited | Signature: __________________", + SignatureClientNamePrefix: "Client: Name:", + SignatureClientTitleLine: "Title: Authorized Representative", + SignatureClientLine: "Signature: __________________", + SectionOperationStatus: "OPERATION STATUS", + RowOperationStatus: "Operation Status", + RowOperationCode: "Operation Code", + RowOperationLabel: "Operation Label", + RowFailureCode: "Failure Code", + RowFailureReason: "Failure Reason", + MissingValuePlaceholder: "n/a", } diff --git a/api/billing/documents/internal/service/documents/service.go b/api/billing/documents/internal/service/documents/service.go index 5257fc43..5710a9b7 100644 --- a/api/billing/documents/internal/service/documents/service.go +++ b/api/billing/documents/internal/service/documents/service.go @@ -289,6 +289,8 @@ type operationSnapshot struct { GatewayService string OperationRef string PaymentRef string + ClientName string + ClientAddress string OperationCode string OperationLabel string OperationState string @@ -306,6 +308,8 @@ func operationSnapshotFromRequest(req *documentsv1.GetOperationDocumentRequest) GatewayService: strings.TrimSpace(req.GetGatewayService()), OperationRef: strings.TrimSpace(req.GetOperationRef()), PaymentRef: strings.TrimSpace(req.GetPaymentRef()), + ClientName: strings.TrimSpace(req.GetClientName()), + ClientAddress: strings.TrimSpace(req.GetClientAddress()), OperationCode: strings.TrimSpace(req.GetOperationCode()), OperationLabel: strings.TrimSpace(req.GetOperationLabel()), OperationState: strings.TrimSpace(req.GetOperationState()), @@ -328,21 +332,6 @@ func operationSnapshotFromRequest(req *documentsv1.GetOperationDocumentRequest) func buildOperationBlocks(snapshot operationSnapshot) []renderer.Block { documentCopy := content.OperationDocument - rows := [][]string{ - {documentCopy.RowOrganization, snapshot.OrganizationRef}, - {documentCopy.RowGatewayService, snapshot.GatewayService}, - {documentCopy.RowOperationRef, snapshot.OperationRef}, - {documentCopy.RowPaymentRef, safeValue(snapshot.PaymentRef)}, - {documentCopy.RowCode, safeValue(snapshot.OperationCode)}, - {documentCopy.RowState, safeValue(snapshot.OperationState)}, - {documentCopy.RowLabel, safeValue(snapshot.OperationLabel)}, - {documentCopy.RowStartedAtUTC, formatSnapshotTime(snapshot.StartedAt)}, - {documentCopy.RowCompletedAtUTC, formatSnapshotTime(snapshot.CompletedAt)}, - } - if snapshot.Amount != "" || snapshot.Currency != "" { - rows = append(rows, []string{documentCopy.RowAmount, strings.TrimSpace(strings.TrimSpace(snapshot.Amount) + " " + strings.TrimSpace(snapshot.Currency))}) - } - blocks := []renderer.Block{ { Tag: renderer.TagTitle, @@ -355,30 +344,115 @@ func buildOperationBlocks(snapshot operationSnapshot) []renderer.Block { { Tag: renderer.TagMeta, Lines: []string{ - documentCopy.MetaDocumentType, + fmt.Sprintf("%s: %s", documentCopy.MetaCertificateNumberLabel, certificateNumber(snapshot)), + fmt.Sprintf("%s: %s", documentCopy.MetaDateLabel, formatCertificateDate(certificateDate(snapshot))), }, }, { Tag: renderer.TagSection, - Lines: []string{documentCopy.SectionOperation}, + Lines: []string{documentCopy.SectionParties}, }, { - Tag: renderer.TagKV, - Rows: rows, + Tag: renderer.TagText, + Lines: []string{documentCopy.PartiesIntro}, + }, + { + Tag: renderer.TagKV, + Rows: [][]string{ + {documentCopy.RowServiceProvider, content.IssuerLegalName}, + {documentCopy.RowServiceProviderAddress, content.IssuerLegalAddress}, + {documentCopy.RowServiceProviderEmail, content.IssuerEmail}, + {documentCopy.RowClient, certificateClientName(snapshot)}, + {documentCopy.RowClientAddress, certificateClientAddress(snapshot)}, + {documentCopy.RowClientReference, safeValue(snapshot.PaymentRef)}, + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionSubject}, + }, + { + Tag: renderer.TagText, + Lines: []string{ + documentCopy.SubjectIntro, + "", + "- Payment execution and orchestration services for payment reference " + safeValue(snapshot.PaymentRef) + ".", + "- Gateway service: " + safeValue(snapshot.GatewayService) + ".", + "- Operation reference: " + safeValue(snapshot.OperationRef) + ".", + "- Operation descriptor: " + operationDescriptor(snapshot) + ".", + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionServicePeriod}, + }, + { + Tag: renderer.TagKV, + Rows: [][]string{ + {documentCopy.RowPeriodFrom, formatSnapshotTime(snapshot.StartedAt)}, + {documentCopy.RowPeriodTo, formatSnapshotTime(snapshot.CompletedAt)}, + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionTotalAmount}, + }, + { + Tag: renderer.TagKV, + Rows: [][]string{ + {documentCopy.RowTotalAmount, operationAmount(snapshot)}, + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionClientConfirmation}, + }, + { + Tag: renderer.TagText, + Lines: []string{ + documentCopy.ConfirmationLine1, + documentCopy.ConfirmationLine2, + documentCopy.ConfirmationLine3, + "", + "This Certificate serves as confirmation of the completion and acceptance of the services.", + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionSignatures}, + }, + { + Tag: renderer.TagSign, + Lines: []string{ + documentCopy.SignatureServiceProviderLine, + "", + documentCopy.SignatureClientNamePrefix + " " + certificateClientName(snapshot), + documentCopy.SignatureClientTitleLine, + documentCopy.SignatureClientLine, + }, + }, + { + Tag: renderer.TagSection, + Lines: []string{documentCopy.SectionOperationStatus}, + }, + { + Tag: renderer.TagKV, + Rows: [][]string{ + {documentCopy.RowOperationStatus, safeValue(snapshot.OperationState)}, + {documentCopy.RowOperationCode, safeValue(snapshot.OperationCode)}, + {documentCopy.RowOperationLabel, safeValue(snapshot.OperationLabel)}, + }, }, } if snapshot.FailureCode != "" || snapshot.FailureReason != "" { - blocks = append(blocks, - renderer.Block{Tag: renderer.TagSection, Lines: []string{documentCopy.SectionFailure}}, - renderer.Block{ - Tag: renderer.TagKV, - Rows: [][]string{ - {documentCopy.RowFailureCode, safeValue(snapshot.FailureCode)}, - {documentCopy.RowFailureReason, safeValue(snapshot.FailureReason)}, - }, + blocks = append(blocks, renderer.Block{ + Tag: renderer.TagKV, + Rows: [][]string{ + {documentCopy.RowFailureCode, safeValue(snapshot.FailureCode)}, + {documentCopy.RowFailureReason, safeValue(snapshot.FailureReason)}, }, - ) + }) } return blocks @@ -392,6 +466,80 @@ func formatSnapshotTime(value time.Time) string { return value.UTC().Format(time.RFC3339) } +func certificateNumber(snapshot operationSnapshot) string { + if paymentRef := strings.TrimSpace(snapshot.PaymentRef); paymentRef != "" { + return paymentRef + } + + if operationRef := strings.TrimSpace(snapshot.OperationRef); operationRef != "" { + return operationRef + } + + return content.OperationDocument.MissingValuePlaceholder +} + +func certificateDate(snapshot operationSnapshot) time.Time { + if !snapshot.CompletedAt.IsZero() { + return snapshot.CompletedAt.UTC() + } + + if !snapshot.StartedAt.IsZero() { + return snapshot.StartedAt.UTC() + } + + return time.Now().UTC() +} + +func formatCertificateDate(value time.Time) string { + if value.IsZero() { + return content.OperationDocument.MissingValuePlaceholder + } + + return value.UTC().Format("January 2, 2006") +} + +func operationAmount(snapshot operationSnapshot) string { + amount := strings.TrimSpace(snapshot.Amount) + currency := strings.TrimSpace(snapshot.Currency) + if amount == "" && currency == "" { + return content.OperationDocument.MissingValuePlaceholder + } + + return strings.TrimSpace(amount + " " + currency) +} + +func operationDescriptor(snapshot operationSnapshot) string { + label := strings.TrimSpace(snapshot.OperationLabel) + code := strings.TrimSpace(snapshot.OperationCode) + + switch { + case label != "" && code != "": + return fmt.Sprintf("%s (%s)", label, code) + case label != "": + return label + case code != "": + return code + default: + return content.OperationDocument.MissingValuePlaceholder + } +} + +func certificateClientName(snapshot operationSnapshot) string { + if name := strings.TrimSpace(snapshot.ClientName); name != "" { + return name + } + + return "John Doe" +} + +func certificateClientAddress(snapshot operationSnapshot) string { + if address := strings.TrimSpace(snapshot.ClientAddress); address != "" { + return address + } + + return content.OperationDocument.MissingValuePlaceholder +} + func safeValue(value string) string { trimmed := strings.TrimSpace(value) if trimmed == "" { diff --git a/api/billing/documents/internal/service/documents/service_test.go b/api/billing/documents/internal/service/documents/service_test.go index bd102029..ba0640bd 100644 --- a/api/billing/documents/internal/service/documents/service_test.go +++ b/api/billing/documents/internal/service/documents/service_test.go @@ -3,6 +3,7 @@ package documents import ( "bytes" "context" + "strings" "testing" "time" @@ -191,3 +192,92 @@ func TestGetOperationDocument_RequiresOperationRef(t *testing.T) { t.Fatalf("expected InvalidArgument, got=%v err=%v", status.Code(err), err) } } + +func TestBuildOperationBlocks_CertificateIncludesPaymentData(t *testing.T) { + snapshot := operationSnapshot{ + OrganizationRef: "org-1", + GatewayService: "chain_gateway", + OperationRef: "op-123", + PaymentRef: "pay-123", + ClientName: "Jane Customer", + ClientAddress: "Main Street 1, City", + OperationCode: "transfer", + OperationLabel: "Outbound transfer", + OperationState: "completed", + Amount: "100.50", + Currency: "USDT", + StartedAt: time.Date(2026, 3, 1, 10, 0, 0, 0, time.UTC), + CompletedAt: time.Date(2026, 3, 2, 12, 0, 0, 0, time.UTC), + } + + blocks := buildOperationBlocks(snapshot) + if len(blocks) == 0 { + t.Fatalf("expected blocks") + } + + if got := blocks[0].Lines[0]; got != content.OperationDocument.Title { + t.Fatalf("title mismatch: got=%q want=%q", got, content.OperationDocument.Title) + } + + meta := findTaggedBlock(blocks, renderer.TagMeta) + if meta == nil { + t.Fatalf("expected meta block") + } + + metaText := strings.Join(meta.Lines, "\n") + if !strings.Contains(metaText, "Certificate No.: pay-123") { + t.Fatalf("meta should include certificate number, got=%q", metaText) + } + if !strings.Contains(metaText, "Date: March 2, 2026") { + t.Fatalf("meta should include certificate date, got=%q", metaText) + } + + amountFound := false + clientFound := false + for _, block := range blocks { + if block.Tag != renderer.TagKV { + continue + } + + for _, row := range block.Rows { + if len(row) >= 2 && row[0] == content.OperationDocument.RowTotalAmount && row[1] == "100.50 USDT" { + amountFound = true + } + if len(row) >= 2 && row[0] == content.OperationDocument.RowClient && row[1] == "Jane Customer" { + clientFound = true + } + } + } + if !amountFound { + t.Fatalf("expected total amount row with payment amount") + } + if !clientFound { + t.Fatalf("expected client row with customer name") + } +} + +func TestCertificateNumber_FallsBackToOperationRef(t *testing.T) { + got := certificateNumber(operationSnapshot{ + OperationRef: "op-777", + }) + + if got != "op-777" { + t.Fatalf("certificateNumber fallback mismatch: got=%q want=%q", got, "op-777") + } +} + +func TestCertificateClientName_Fallback(t *testing.T) { + if got := certificateClientName(operationSnapshot{}); got != "John Doe" { + t.Fatalf("certificateClientName fallback mismatch: got=%q want=%q", got, "John Doe") + } +} + +func findTaggedBlock(blocks []renderer.Block, tag renderer.Tag) *renderer.Block { + for i := range blocks { + if blocks[i].Tag == tag { + return &blocks[i] + } + } + + return nil +} diff --git a/api/billing/fees/go.mod b/api/billing/fees/go.mod index acf93e2c..8bc77c04 100644 --- a/api/billing/fees/go.mod +++ b/api/billing/fees/go.mod @@ -46,7 +46,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/billing/fees/go.sum b/api/billing/fees/go.sum index bc3c2396..5cfb933e 100644 --- a/api/billing/fees/go.sum +++ b/api/billing/fees/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/discovery/go.mod b/api/discovery/go.mod index 2c23914b..88d9c78d 100644 --- a/api/discovery/go.mod +++ b/api/discovery/go.mod @@ -39,7 +39,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/discovery/go.sum b/api/discovery/go.sum index bc3c2396..5cfb933e 100644 --- a/api/discovery/go.sum +++ b/api/discovery/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/edge/bff/go.mod b/api/edge/bff/go.mod index 4d81b54b..154aad45 100644 --- a/api/edge/bff/go.mod +++ b/api/edge/bff/go.mod @@ -18,7 +18,7 @@ require ( github.com/aws/aws-sdk-go-v2 v1.41.3 github.com/aws/aws-sdk-go-v2/config v1.32.11 github.com/aws/aws-sdk-go-v2/credentials v1.19.11 - github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 + github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0 github.com/go-chi/chi/v5 v5.2.5 github.com/go-chi/cors v1.2.2 github.com/go-chi/jwtauth/v5 v5.4.0 @@ -37,7 +37,7 @@ require ( github.com/testcontainers/testcontainers-go/modules/mongodb v0.33.0 go.mongodb.org/mongo-driver/v2 v2.5.0 go.uber.org/zap v1.27.1 - golang.org/x/net v0.51.0 + golang.org/x/net v0.52.0 google.golang.org/grpc v1.79.2 google.golang.org/protobuf v1.36.11 gopkg.in/yaml.v3 v3.0.1 @@ -88,7 +88,7 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/goccy/go-json v0.10.5 // indirect + github.com/goccy/go-json v0.10.6 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect diff --git a/api/edge/bff/go.sum b/api/edge/bff/go.sum index b7f8c921..c711b1e8 100644 --- a/api/edge/bff/go.sum +++ b/api/edge/bff/go.sum @@ -32,8 +32,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.19 h1:X1Tow7su github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.19/go.mod h1:/rARO8psX+4sfjUQXp5LLifjUt8DuATZ31WptNJTyQA= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.19 h1:JnQeStZvPHFHeyky/7LbMlyQjUa+jIBj36OlWm0pzIk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.19/go.mod h1:HGyasyHvYdFQeJhvDHfH7HXkHh57htcJGKDZ+7z+I24= -github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4 h1:4ExZyubQ6LQQVuF2Qp9OsfEvsTdAWh5Gfwf6PgIdLdk= -github.com/aws/aws-sdk-go-v2/service/s3 v1.96.4/go.mod h1:NF3JcMGOiARAss1ld3WGORCw71+4ExDD2cbbdKS5PpA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0 h1:zyKY4OxzUImu+DigelJI9o49QQv8CjREs5E1CywjtIA= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.0/go.mod h1:NF3JcMGOiARAss1ld3WGORCw71+4ExDD2cbbdKS5PpA= github.com/aws/aws-sdk-go-v2/service/signin v1.0.7 h1:Y2cAXlClHsXkkOvWZFXATr34b0hxxloeQu/pAZz2row= github.com/aws/aws-sdk-go-v2/service/signin v1.0.7/go.mod h1:idzZ7gmDeqeNrSPkdbtMp9qWMgcBwykA7P7Rzh5DXVU= github.com/aws/aws-sdk-go-v2/service/sso v1.30.12 h1:iSsvB9EtQ09YrsmIc44Heqlx5ByGErqhPK1ZQLppias= @@ -112,8 +112,8 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= -github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= +github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= @@ -346,8 +346,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/api/edge/bff/internal/server/paymentapiimp/documents.go b/api/edge/bff/internal/server/paymentapiimp/documents.go index 5244b121..27fe74ff 100644 --- a/api/edge/bff/internal/server/paymentapiimp/documents.go +++ b/api/edge/bff/internal/server/paymentapiimp/documents.go @@ -16,6 +16,8 @@ import ( "github.com/tech/sendico/pkg/mutil/mzap" documentsv1 "github.com/tech/sendico/pkg/proto/billing/documents/v1" connectorv1 "github.com/tech/sendico/pkg/proto/connector/v1" + endpointv1 "github.com/tech/sendico/pkg/proto/payments/endpoint/v1" + orchestrationv2 "github.com/tech/sendico/pkg/proto/payments/orchestration/v2" "github.com/tech/sendico/server/interface/api/sresponse" mutil "github.com/tech/sendico/server/internal/mutil/param" "go.mongodb.org/mongo-driver/v2/bson" @@ -24,7 +26,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/structpb" ) const ( @@ -61,6 +62,10 @@ func (a *PaymentAPI) getOperationDocument(r *http.Request, account *model.Accoun if operationRef == "" { return response.BadRequest(a.logger, a.Name(), "missing_parameter", "operation_ref is required") } + paymentRef := strings.TrimSpace(query.Get("payment_ref")) + if paymentRef == "" { + return response.BadRequest(a.logger, a.Name(), "missing_parameter", "payment_ref is required") + } service, gateway, h := a.resolveOperationDocumentDeps(r.Context(), gatewayService) if h != nil { @@ -73,7 +78,18 @@ func (a *PaymentAPI) getOperationDocument(r *http.Request, account *model.Accoun return documentErrorResponse(a.logger, a.Name(), err) } - req := operationDocumentRequest(orgRef.Hex(), gatewayService, operationRef, op) + req := operationDocumentRequest(orgRef.Hex(), gatewayService, operationRef, paymentRef, op) + if payment, paymentErr := a.fetchPayment(r.Context(), orgRef.Hex(), paymentRef); paymentErr != nil { + a.logger.Warn( + "Failed to fetch payment snapshot for operation document", + zap.Error(paymentErr), + mzap.ObjRef("organization_ref", orgRef), + zap.String("payment_ref", paymentRef), + zap.String("operation_ref", operationRef), + ) + } else { + enrichOperationDocumentRequestFromPayment(req, payment) + } docResp, err := a.fetchOperationDocument(r.Context(), service.InvokeURI, req) if err != nil { @@ -263,6 +279,28 @@ func (a *PaymentAPI) fetchGatewayOperation(ctx context.Context, invokeURI, opera return op, nil } +func (a *PaymentAPI) fetchPayment(ctx context.Context, organizationRef, paymentRef string) (*orchestrationv2.Payment, error) { + if a.execution == nil { + return nil, merrors.Internal("payment execution client is not configured") + } + + resp, err := a.execution.GetPayment(ctx, &orchestrationv2.GetPaymentRequest{ + Meta: requestMeta(organizationRef, ""), + PaymentRef: strings.TrimSpace(paymentRef), + }) + if err != nil { + return nil, err + } + if resp == nil { + return nil, merrors.NoData("payment orchestrator returned empty response") + } + if resp.GetPayment() == nil { + return nil, merrors.NoData("payment orchestrator returned empty payment") + } + + return resp.GetPayment(), nil +} + func findGatewayForService(gateways []discovery.GatewaySummary, gatewayService mservice.Type) *discovery.GatewaySummary { candidates := make([]discovery.GatewaySummary, 0, len(gateways)) for _, gw := range gateways { @@ -313,13 +351,14 @@ func findGatewayForService(gateways []discovery.GatewaySummary, gatewayService m return &best } -func operationDocumentRequest(organizationRef string, gatewayService mservice.Type, requestedOperationRef string, op *connectorv1.Operation) *documentsv1.GetOperationDocumentRequest { +func operationDocumentRequest(organizationRef string, gatewayService mservice.Type, requestedOperationRef string, paymentRef string, op *connectorv1.Operation) *documentsv1.GetOperationDocumentRequest { req := &documentsv1.GetOperationDocumentRequest{ OrganizationRef: strings.TrimSpace(organizationRef), GatewayService: gatewayService, OperationRef: firstNonEmpty(strings.TrimSpace(op.GetOperationRef()), strings.TrimSpace(requestedOperationRef)), + PaymentRef: strings.TrimSpace(paymentRef), OperationCode: strings.TrimSpace(op.GetType().String()), - OperationLabel: operationLabel(op.GetType()), + OperationLabel: strings.TrimSpace(op.GetType().String()), OperationState: strings.TrimSpace(op.GetStatus().String()), Amount: strings.TrimSpace(op.GetMoney().GetAmount()), Currency: strings.TrimSpace(op.GetMoney().GetCurrency()), @@ -332,63 +371,94 @@ func operationDocumentRequest(organizationRef string, gatewayService mservice.Ty req.CompletedAtUnixMs = ts.AsTime().UnixMilli() } - req.PaymentRef = operationParamValue(op.GetParams(), "payment_ref", "parent_payment_ref", "paymentRef", "parentPaymentRef") - req.FailureCode = firstNonEmpty( - operationParamValue(op.GetParams(), "failure_code", "provider_code", "error_code"), - failureCodeFromStatus(op.GetStatus()), - ) - req.FailureReason = operationParamValue(op.GetParams(), "failure_reason", "provider_message", "error", "message") + if isFailedOperationStatus(op.GetStatus()) { + req.FailureCode = strings.TrimSpace(op.GetStatus().String()) + } return req } -func operationLabel(opType connectorv1.OperationType) string { - switch opType { - case connectorv1.OperationType_CREDIT: - return "Credit" - case connectorv1.OperationType_DEBIT: - return "Debit" - case connectorv1.OperationType_TRANSFER: - return "Transfer" - case connectorv1.OperationType_PAYOUT: - return "Payout" - case connectorv1.OperationType_FEE_ESTIMATE: - return "Fee Estimate" - case connectorv1.OperationType_FX: - return "FX" - case connectorv1.OperationType_GAS_TOPUP: - return "Gas Top Up" - default: - return strings.TrimSpace(opType.String()) - } +func isFailedOperationStatus(status connectorv1.OperationStatus) bool { + return status == connectorv1.OperationStatus_OPERATION_FAILED || status == connectorv1.OperationStatus_OPERATION_CANCELLED } -func failureCodeFromStatus(status connectorv1.OperationStatus) string { - switch status { - case connectorv1.OperationStatus_OPERATION_FAILED, connectorv1.OperationStatus_OPERATION_CANCELLED: - return strings.TrimSpace(status.String()) - default: - return "" +func enrichOperationDocumentRequestFromPayment(req *documentsv1.GetOperationDocumentRequest, payment *orchestrationv2.Payment) { + if req == nil || payment == nil { + return } + + req.PaymentRef = firstNonEmpty(strings.TrimSpace(req.GetPaymentRef()), strings.TrimSpace(payment.GetPaymentRef())) + req.ClientName = firstNonEmpty(strings.TrimSpace(req.GetClientName()), paymentClientName(payment)) } -func operationParamValue(params *structpb.Struct, keys ...string) string { - if params == nil { +func paymentClientName(payment *orchestrationv2.Payment) string { + if payment == nil { return "" } - values := params.AsMap() - for _, key := range keys { - raw, ok := values[key] - if !ok { - continue - } - if text := strings.TrimSpace(fmt.Sprint(raw)); text != "" && text != "" { - return text - } + intent := payment.GetIntentSnapshot() + if intent == nil { + return "" } - return "" + if customerDescription := strings.TrimSpace(intent.GetComment()); customerDescription != "" { + return customerDescription + } + + return firstNonEmpty( + paymentEndpointClientName(intent.GetDestination()), + paymentEndpointClientName(intent.GetSource()), + ) +} + +func paymentEndpointClientName(endpoint *endpointv1.PaymentEndpoint) string { + if endpoint == nil { + return "" + } + + method := endpoint.GetPaymentMethod() + if method == nil { + return "" + } + + switch method.GetType() { + case endpointv1.PaymentMethodType_PAYMENT_METHOD_TYPE_CARD: + type cardMethodData struct { + FirstName string `bson:"firstName"` + LastName string `bson:"lastName"` + } + var payload cardMethodData + if err := bson.Unmarshal(method.GetData(), &payload); err != nil { + return "" + } + return strings.TrimSpace(strings.Join([]string{ + strings.TrimSpace(payload.FirstName), + strings.TrimSpace(payload.LastName), + }, " ")) + + case endpointv1.PaymentMethodType_PAYMENT_METHOD_TYPE_BANK_ACCOUNT: + type bankMethodData struct { + RecipientName string `bson:"recipientName"` + } + var payload bankMethodData + if err := bson.Unmarshal(method.GetData(), &payload); err != nil { + return "" + } + return strings.TrimSpace(payload.RecipientName) + + case endpointv1.PaymentMethodType_PAYMENT_METHOD_TYPE_IBAN: + type ibanMethodData struct { + AccountHolder string `bson:"accountHolder"` + } + var payload ibanMethodData + if err := bson.Unmarshal(method.GetData(), &payload); err != nil { + return "" + } + return strings.TrimSpace(payload.AccountHolder) + + default: + return "" + } } func findDocumentsService(services []discovery.ServiceSummary) *discovery.ServiceSummary { diff --git a/api/edge/bff/internal/server/paymentapiimp/documents_test.go b/api/edge/bff/internal/server/paymentapiimp/documents_test.go new file mode 100644 index 00000000..9160b44f --- /dev/null +++ b/api/edge/bff/internal/server/paymentapiimp/documents_test.go @@ -0,0 +1,120 @@ +package paymentapiimp + +import ( + "testing" + + "github.com/tech/sendico/pkg/mservice" + documentsv1 "github.com/tech/sendico/pkg/proto/billing/documents/v1" + moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1" + connectorv1 "github.com/tech/sendico/pkg/proto/connector/v1" + endpointv1 "github.com/tech/sendico/pkg/proto/payments/endpoint/v1" + orchestrationv2 "github.com/tech/sendico/pkg/proto/payments/orchestration/v2" + quotationv2 "github.com/tech/sendico/pkg/proto/payments/quotation/v2" + "go.mongodb.org/mongo-driver/v2/bson" +) + +func TestOperationDocumentRequest_UsesStructuredOperationFieldsOnly(t *testing.T) { + op := &connectorv1.Operation{ + OperationRef: "pay-123:hop_1", + Type: connectorv1.OperationType_TRANSFER, + Status: connectorv1.OperationStatus_OPERATION_SUCCESS, + Money: &moneyv1.Money{ + Amount: "100.50", + Currency: "USDT", + }, + } + + req := operationDocumentRequest("org-1", mservice.ChainGateway, "requested-op", "pay-123", op) + if req == nil { + t.Fatalf("expected request") + } + + if got, want := req.GetPaymentRef(), "pay-123"; got != want { + t.Fatalf("payment_ref mismatch: got=%q want=%q", got, want) + } + if got := req.GetClientName(); got != "" { + t.Fatalf("expected empty client_name from operation-only request, got=%q", got) + } + if got := req.GetClientAddress(); got != "" { + t.Fatalf("expected empty client_address from operation-only request, got=%q", got) + } +} + +func TestOperationDocumentRequest_FailureCodeFromStructuredStatus(t *testing.T) { + req := operationDocumentRequest("org-1", mservice.ChainGateway, "op", "pay-123", &connectorv1.Operation{ + OperationRef: "pay-123:hop_1", + Type: connectorv1.OperationType_TRANSFER, + Status: connectorv1.OperationStatus_OPERATION_FAILED, + }) + if req == nil { + t.Fatalf("expected request") + } + + if got, want := req.GetFailureCode(), "OPERATION_FAILED"; got != want { + t.Fatalf("failure_code mismatch: got=%q want=%q", got, want) + } +} + +func TestPaymentClientName_FromIntentComment(t *testing.T) { + payment := &orchestrationv2.Payment{ + IntentSnapshot: "ationv2.QuoteIntent{ + Comment: "Jane Customer", + }, + } + + if got, want := paymentClientName(payment), "Jane Customer"; got != want { + t.Fatalf("paymentClientName mismatch: got=%q want=%q", got, want) + } +} + +func TestPaymentClientName_FromStructuredCardEndpoint(t *testing.T) { + raw, err := bson.Marshal(map[string]string{ + "firstName": "Jane", + "lastName": "Doe", + }) + if err != nil { + t.Fatalf("Marshal: %v", err) + } + + payment := &orchestrationv2.Payment{ + IntentSnapshot: "ationv2.QuoteIntent{ + Destination: &endpointv1.PaymentEndpoint{ + Source: &endpointv1.PaymentEndpoint_PaymentMethod{ + PaymentMethod: &endpointv1.PaymentMethod{ + Type: endpointv1.PaymentMethodType_PAYMENT_METHOD_TYPE_CARD, + Data: raw, + }, + }, + }, + }, + } + + if got, want := paymentClientName(payment), "Jane Doe"; got != want { + t.Fatalf("paymentClientName mismatch: got=%q want=%q", got, want) + } +} + +func TestEnrichOperationDocumentRequestFromPayment_SetsClientName(t *testing.T) { + req := &documentsv1.GetOperationDocumentRequest{ + OperationRef: "pay-123:hop_1", + } + + payment := &orchestrationv2.Payment{ + PaymentRef: "pay-123", + IntentSnapshot: "ationv2.QuoteIntent{ + Comment: "Client Name", + }, + } + + enrichOperationDocumentRequestFromPayment(req, payment) + if got, want := req.GetPaymentRef(), "pay-123"; got != want { + t.Fatalf("payment_ref mismatch: got=%q want=%q", got, want) + } + if got, want := req.GetClientName(), "Client Name"; got != want { + t.Fatalf("client_name mismatch: got=%q want=%q", got, want) + } +} + +func TestOperationDocumentRequest_Compatibility(t *testing.T) { + var _ *documentsv1.GetOperationDocumentRequest = operationDocumentRequest("org-1", mservice.ChainGateway, "op", "pay-1", &connectorv1.Operation{}) +} diff --git a/api/edge/bff/internal/server/paymentapiimp/paybatch_test.go b/api/edge/bff/internal/server/paymentapiimp/paybatch_test.go index 598a5482..7c4aba3d 100644 --- a/api/edge/bff/internal/server/paymentapiimp/paybatch_test.go +++ b/api/edge/bff/internal/server/paymentapiimp/paybatch_test.go @@ -165,6 +165,10 @@ func (*fakeExecutionClientForBatch) ListPayments(context.Context, *orchestration return &orchestrationv2.ListPaymentsResponse{}, nil } +func (*fakeExecutionClientForBatch) GetPayment(context.Context, *orchestrationv2.GetPaymentRequest) (*orchestrationv2.GetPaymentResponse, error) { + return &orchestrationv2.GetPaymentResponse{}, nil +} + func (*fakeExecutionClientForBatch) Close() error { return nil } type fakeEnforcerForBatch struct { diff --git a/api/edge/bff/internal/server/paymentapiimp/service.go b/api/edge/bff/internal/server/paymentapiimp/service.go index e0a99f11..1b374ab1 100644 --- a/api/edge/bff/internal/server/paymentapiimp/service.go +++ b/api/edge/bff/internal/server/paymentapiimp/service.go @@ -32,6 +32,7 @@ import ( type executionClient interface { ExecutePayment(ctx context.Context, req *orchestrationv2.ExecutePaymentRequest) (*orchestrationv2.ExecutePaymentResponse, error) ExecuteBatchPayment(ctx context.Context, req *orchestrationv2.ExecuteBatchPaymentRequest) (*orchestrationv2.ExecuteBatchPaymentResponse, error) + GetPayment(ctx context.Context, req *orchestrationv2.GetPaymentRequest) (*orchestrationv2.GetPaymentResponse, error) ListPayments(ctx context.Context, req *orchestrationv2.ListPaymentsRequest) (*orchestrationv2.ListPaymentsResponse, error) Close() error } diff --git a/api/edge/callbacks/go.mod b/api/edge/callbacks/go.mod index 30883229..ff218508 100644 --- a/api/edge/callbacks/go.mod +++ b/api/edge/callbacks/go.mod @@ -53,7 +53,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/edge/callbacks/go.sum b/api/edge/callbacks/go.sum index b34db71b..cb339907 100644 --- a/api/edge/callbacks/go.sum +++ b/api/edge/callbacks/go.sum @@ -212,8 +212,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/fx/ingestor/go.mod b/api/fx/ingestor/go.mod index e5cb2808..7891c8bb 100644 --- a/api/fx/ingestor/go.mod +++ b/api/fx/ingestor/go.mod @@ -13,7 +13,7 @@ require ( github.com/tech/sendico/fx/storage v0.0.0 github.com/tech/sendico/pkg v0.1.0 go.uber.org/zap v1.27.1 - golang.org/x/net v0.51.0 + golang.org/x/net v0.52.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/api/fx/ingestor/go.sum b/api/fx/ingestor/go.sum index bc3c2396..5cfb933e 100644 --- a/api/fx/ingestor/go.sum +++ b/api/fx/ingestor/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/fx/oracle/go.mod b/api/fx/oracle/go.mod index 6996fd7d..e49d5d4c 100644 --- a/api/fx/oracle/go.mod +++ b/api/fx/oracle/go.mod @@ -44,7 +44,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/fx/oracle/go.sum b/api/fx/oracle/go.sum index bc3c2396..5cfb933e 100644 --- a/api/fx/oracle/go.sum +++ b/api/fx/oracle/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/aurora/go.mod b/api/gateway/aurora/go.mod index ddd956df..e7666da4 100644 --- a/api/gateway/aurora/go.mod +++ b/api/gateway/aurora/go.mod @@ -47,7 +47,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/aurora/go.sum b/api/gateway/aurora/go.sum index f5502ceb..2abb62ec 100644 --- a/api/gateway/aurora/go.sum +++ b/api/gateway/aurora/go.sum @@ -181,8 +181,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/chain/go.mod b/api/gateway/chain/go.mod index a56d9d91..3c0cd649 100644 --- a/api/gateway/chain/go.mod +++ b/api/gateway/chain/go.mod @@ -86,7 +86,7 @@ require ( go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/chain/go.sum b/api/gateway/chain/go.sum index 80c47a9e..8aa06042 100644 --- a/api/gateway/chain/go.sum +++ b/api/gateway/chain/go.sum @@ -322,8 +322,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/chsettle/go.mod b/api/gateway/chsettle/go.mod index a0ddd00e..44ab0e52 100644 --- a/api/gateway/chsettle/go.mod +++ b/api/gateway/chsettle/go.mod @@ -44,7 +44,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/chsettle/go.sum b/api/gateway/chsettle/go.sum index bc3c2396..5cfb933e 100644 --- a/api/gateway/chsettle/go.sum +++ b/api/gateway/chsettle/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/mntx/go.mod b/api/gateway/mntx/go.mod index f57b0c7c..97d7a975 100644 --- a/api/gateway/mntx/go.mod +++ b/api/gateway/mntx/go.mod @@ -47,7 +47,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/mntx/go.sum b/api/gateway/mntx/go.sum index f5502ceb..2abb62ec 100644 --- a/api/gateway/mntx/go.sum +++ b/api/gateway/mntx/go.sum @@ -181,8 +181,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/tgsettle/go.mod b/api/gateway/tgsettle/go.mod index 102869d8..2127548b 100644 --- a/api/gateway/tgsettle/go.mod +++ b/api/gateway/tgsettle/go.mod @@ -44,7 +44,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/tgsettle/go.sum b/api/gateway/tgsettle/go.sum index bc3c2396..5cfb933e 100644 --- a/api/gateway/tgsettle/go.sum +++ b/api/gateway/tgsettle/go.sum @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/gateway/tron/go.mod b/api/gateway/tron/go.mod index 72e31004..dfda5fcb 100644 --- a/api/gateway/tron/go.mod +++ b/api/gateway/tron/go.mod @@ -94,7 +94,7 @@ require ( go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/gateway/tron/go.sum b/api/gateway/tron/go.sum index b97322b4..727a62c6 100644 --- a/api/gateway/tron/go.sum +++ b/api/gateway/tron/go.sum @@ -337,8 +337,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/ledger/go.mod b/api/ledger/go.mod index 0f03acbe..a0e0692a 100644 --- a/api/ledger/go.mod +++ b/api/ledger/go.mod @@ -45,7 +45,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/ledger/go.sum b/api/ledger/go.sum index d63bca46..d24e8d60 100644 --- a/api/ledger/go.sum +++ b/api/ledger/go.sum @@ -181,8 +181,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/notification/go.mod b/api/notification/go.mod index 82fca8b6..f9abcdf3 100644 --- a/api/notification/go.mod +++ b/api/notification/go.mod @@ -47,7 +47,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260311181403-84a4fc48630c // indirect diff --git a/api/notification/go.sum b/api/notification/go.sum index 91fb1c36..af833fd5 100644 --- a/api/notification/go.sum +++ b/api/notification/go.sum @@ -196,8 +196,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/payments/methods/go.mod b/api/payments/methods/go.mod index 0b0d67f8..ed6d1895 100644 --- a/api/payments/methods/go.mod +++ b/api/payments/methods/go.mod @@ -45,7 +45,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/payments/methods/go.sum b/api/payments/methods/go.sum index d63bca46..d24e8d60 100644 --- a/api/payments/methods/go.sum +++ b/api/payments/methods/go.sum @@ -181,8 +181,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/payments/orchestrator/go.mod b/api/payments/orchestrator/go.mod index eae1ad51..af457b7d 100644 --- a/api/payments/orchestrator/go.mod +++ b/api/payments/orchestrator/go.mod @@ -60,7 +60,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/payments/orchestrator/go.sum b/api/payments/orchestrator/go.sum index 1e64e8c4..17d24405 100644 --- a/api/payments/orchestrator/go.sum +++ b/api/payments/orchestrator/go.sum @@ -182,8 +182,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/payments/quotation/go.mod b/api/payments/quotation/go.mod index 6b8d7f30..7ebace38 100644 --- a/api/payments/quotation/go.mod +++ b/api/payments/quotation/go.mod @@ -59,7 +59,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/payments/quotation/go.sum b/api/payments/quotation/go.sum index d24bb294..c9f4dd41 100644 --- a/api/payments/quotation/go.sum +++ b/api/payments/quotation/go.sum @@ -182,8 +182,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= diff --git a/api/pkg/go.mod b/api/pkg/go.mod index 256cf930..c8e3f928 100644 --- a/api/pkg/go.mod +++ b/api/pkg/go.mod @@ -108,7 +108,7 @@ require ( go.opentelemetry.io/otel/trace v1.39.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - golang.org/x/net v0.51.0 // indirect + golang.org/x/net v0.52.0 // indirect golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.42.0 // indirect golang.org/x/text v0.35.0 // indirect diff --git a/api/pkg/go.sum b/api/pkg/go.sum index c998370b..0efbb97f 100644 --- a/api/pkg/go.sum +++ b/api/pkg/go.sum @@ -289,8 +289,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= -golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= +golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/api/proto/billing/documents/v1/documents.proto b/api/proto/billing/documents/v1/documents.proto index 5fc5f5fa..a47bbd28 100644 --- a/api/proto/billing/documents/v1/documents.proto +++ b/api/proto/billing/documents/v1/documents.proto @@ -48,4 +48,6 @@ message GetOperationDocumentRequest { int64 started_at_unix_ms = 12; int64 completed_at_unix_ms = 13; + string client_name = 14; + string client_address = 15; } diff --git a/frontend/pshared/lib/service/payment/documents.dart b/frontend/pshared/lib/service/payment/documents.dart index ec05f41e..d5b8c52e 100644 --- a/frontend/pshared/lib/service/payment/documents.dart +++ b/frontend/pshared/lib/service/payment/documents.dart @@ -13,10 +13,12 @@ class PaymentDocumentsService { String organizationRef, String gatewayService, String operationRef, + String paymentRef, ) async { final query = { 'gateway_service': gatewayService, 'operation_ref': operationRef, + 'payment_ref': paymentRef, }; final queryString = Uri(queryParameters: query).query; final url = '/documents/operation/$organizationRef?$queryString'; diff --git a/frontend/pweb/lib/app/router/payout_shell.dart b/frontend/pweb/lib/app/router/payout_shell.dart index eb856533..0126de00 100644 --- a/frontend/pweb/lib/app/router/payout_shell.dart +++ b/frontend/pweb/lib/app/router/payout_shell.dart @@ -348,7 +348,7 @@ RouteBase payoutShellRoute() => ShellRoute( path: PayoutRoutes.reportPaymentPath, pageBuilder: (_, state) => NoTransitionPage( child: PaymentDetailsPage( - paymentId: + paymentRef: state.uri.queryParameters[PayoutRoutes.reportPaymentIdQuery] ?? '', ), diff --git a/frontend/pweb/lib/controllers/payments/details.dart b/frontend/pweb/lib/controllers/payments/details.dart index 5f3751a4..b96c1fb9 100644 --- a/frontend/pweb/lib/controllers/payments/details.dart +++ b/frontend/pweb/lib/controllers/payments/details.dart @@ -9,14 +9,14 @@ import 'package:pweb/utils/report/operations/document_rule.dart'; class PaymentDetailsController extends ChangeNotifier { - PaymentDetailsController({required String paymentId}) - : _paymentId = paymentId; + PaymentDetailsController({required String paymentRef}) + : _paymentRef = paymentRef; PaymentsProvider? _payments; - String _paymentId; + String _paymentRef; Payment? _payment; - String get paymentId => _paymentId; + String get paymentId => _paymentRef; Payment? get payment => _payment; bool get isLoading => _payments?.isLoading ?? false; Exception? get error => _payments?.error; @@ -44,8 +44,8 @@ class PaymentDetailsController extends ChangeNotifier { operationDocumentRequest(operation) != null; void update(PaymentsProvider provider, String paymentId) { - if (_paymentId != paymentId) { - _paymentId = paymentId; + if (_paymentRef != paymentId) { + _paymentRef = paymentId; } if (!identical(_payments, provider)) { @@ -60,7 +60,7 @@ class PaymentDetailsController extends ChangeNotifier { } void _rebuild() { - _payment = _findPayment(_payments?.payments ?? const [], _paymentId); + _payment = _findPayment(_payments?.payments ?? const [], _paymentRef); notifyListeners(); } diff --git a/frontend/pweb/lib/pages/report/details/page.dart b/frontend/pweb/lib/pages/report/details/page.dart index 0e529d03..fa07f30e 100644 --- a/frontend/pweb/lib/pages/report/details/page.dart +++ b/frontend/pweb/lib/pages/report/details/page.dart @@ -17,9 +17,9 @@ import 'package:pweb/generated/i18n/app_localizations.dart'; class PaymentDetailsPage extends StatelessWidget { - final String paymentId; + final String paymentRef; - const PaymentDetailsPage({super.key, required this.paymentId}); + const PaymentDetailsPage({super.key, required this.paymentRef}); @override Widget build(BuildContext context) { @@ -27,16 +27,18 @@ class PaymentDetailsPage extends StatelessWidget { PaymentsProvider, PaymentDetailsController >( - create: (_) => PaymentDetailsController(paymentId: paymentId), + create: (_) => PaymentDetailsController(paymentRef: paymentRef), update: (_, payments, controller) => - controller!..update(payments, paymentId), - child: const _PaymentDetailsView(), + controller!..update(payments, paymentRef), + child: _PaymentDetailsView(paymentRef: paymentRef), ); } } class _PaymentDetailsView extends StatelessWidget { - const _PaymentDetailsView(); + final String paymentRef; + + const _PaymentDetailsView({required this.paymentRef}); @override Widget build(BuildContext context) { @@ -73,6 +75,7 @@ class _PaymentDetailsView extends StatelessWidget { context, gatewayService: request.gatewayService, operationRef: request.operationRef, + paymentRef: paymentRef, ); }, ); diff --git a/frontend/pweb/lib/pages/report/table/row.dart b/frontend/pweb/lib/pages/report/table/row.dart index 1c2eab6b..9d946a80 100644 --- a/frontend/pweb/lib/pages/report/table/row.dart +++ b/frontend/pweb/lib/pages/report/table/row.dart @@ -13,7 +13,7 @@ import 'package:pweb/generated/i18n/app_localizations.dart'; class OperationRow { - static DataRow build(OperationItem op, BuildContext context) { + static DataRow build(String paymentRef, OperationItem op, BuildContext context) { final isUnknownDate = op.date.millisecondsSinceEpoch == 0; final localDate = op.date.toLocal(); final loc = AppLocalizations.of(context)!; @@ -33,6 +33,7 @@ class OperationRow { context, gatewayService: op.gatewayService ?? '', operationRef: op.operationRef ?? '', + paymentRef: paymentRef, ), icon: const Icon(Icons.download), label: Text(loc.downloadAct), diff --git a/frontend/pweb/lib/pages/report/table/widget.dart b/frontend/pweb/lib/pages/report/table/widget.dart index 83179bca..939a8d81 100644 --- a/frontend/pweb/lib/pages/report/table/widget.dart +++ b/frontend/pweb/lib/pages/report/table/widget.dart @@ -6,11 +6,13 @@ import 'package:pweb/pages/report/table/row.dart'; class OperationsTable extends StatelessWidget { + final String paymentRef; final List operations; final bool showFileNameColumn; const OperationsTable({ super.key, + required this.paymentRef, required this.operations, required this.showFileNameColumn, }); @@ -49,7 +51,7 @@ class OperationsTable extends StatelessWidget { }); // Use the DataRow built by OperationRow and extract its cells - final row = OperationRow.build(op, context); + final row = OperationRow.build(paymentRef, op, context); return DataRow.byIndex( index: index, color: color, diff --git a/frontend/pweb/lib/utils/report/download_act.dart b/frontend/pweb/lib/utils/report/download_act.dart index 55e7b8ea..20bdd530 100644 --- a/frontend/pweb/lib/utils/report/download_act.dart +++ b/frontend/pweb/lib/utils/report/download_act.dart @@ -10,10 +10,12 @@ import 'package:pweb/utils/error/snackbar.dart'; import 'package:pweb/generated/i18n/app_localizations.dart'; + Future downloadPaymentAct( BuildContext context, { required String gatewayService, required String operationRef, + required String paymentRef, }) async { final organizations = context.read(); if (!organizations.isOrganizationSet) { @@ -21,7 +23,8 @@ Future downloadPaymentAct( } final gateway = gatewayService.trim(); final operation = operationRef.trim(); - if (gateway.isEmpty || operation.isEmpty) { + final payment = paymentRef.trim(); + if (gateway.isEmpty || operation.isEmpty || payment.isEmpty) { return; } @@ -33,6 +36,7 @@ Future downloadPaymentAct( organizations.current.id, gateway, operation, + payment, ); await downloadFile(file); }, diff --git a/t.json b/t.json deleted file mode 100644 index e69de29b..00000000