fixed error
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-09-21 18:31:31 +05:00
parent 99788a853f
commit febd190d6e
5 changed files with 39 additions and 31 deletions

View File

@@ -9399,7 +9399,7 @@ const docTemplate = `{
"type": "integer" "type": "integer"
}, },
"branchName": { "branchName": {
"type": "string" "$ref": "#/definitions/shared.LocalizedText"
}, },
"createdAt": { "createdAt": {
"type": "string" "type": "string"

View File

@@ -9393,7 +9393,7 @@
"type": "integer" "type": "integer"
}, },
"branchName": { "branchName": {
"type": "string" "$ref": "#/definitions/shared.LocalizedText"
}, },
"createdAt": { "createdAt": {
"type": "string" "type": "string"

View File

@@ -1313,7 +1313,7 @@ definitions:
branchId: branchId:
type: integer type: integer
branchName: branchName:
type: string $ref: '#/definitions/shared.LocalizedText'
createdAt: createdAt:
type: string type: string
createdById: createdById:

View File

@@ -29,7 +29,7 @@ LEFT JOIN branches b ON b.id = o.branch_id
LEFT JOIN users u ON u.id = p.created_by` LEFT JOIN users u ON u.id = p.created_by`
const historySelectColumns = `p.id, p.order_id, COALESCE(o.unique_id, ''), COALESCE(o.type, ''), const historySelectColumns = `p.id, p.order_id, COALESCE(o.unique_id, ''), COALESCE(o.type, ''),
o.branch_id, COALESCE(b.name, ''), COALESCE(o.passport_name, ''), COALESCE(o.passport_surname, ''), p.user_id, o.branch_id, b.name, COALESCE(o.passport_name, ''), COALESCE(o.passport_surname, ''), p.user_id,
p.amount_tmt, p.bank_fee_tmt, p.gbus_fee_tmt, p.tveb_fee_usd, p.tveb_fee_tmt, p.total_amount_tmt, p.amount_tmt, p.bank_fee_tmt, p.gbus_fee_tmt, p.tveb_fee_usd, p.tveb_fee_tmt, p.total_amount_tmt,
p.exchange_rate_usd, p.exchange_rate_rub, p.payment_period, p.exchange_rate_usd, p.exchange_rate_rub, p.payment_period,
p.gateway_status, p.gateway_reference, p.created_by, ` + shared.UserDisplaySQL + `, p.gateway_status, p.gateway_reference, p.created_by, ` + shared.UserDisplaySQL + `,
@@ -112,9 +112,10 @@ func buildListQuery(filter paymenthistory.ListFilter) (whereClause string, args
func scanHistoryItem(row pgx.Row) (paymenthistory.PaymentHistoryItemDTO, error) { func scanHistoryItem(row pgx.Row) (paymenthistory.PaymentHistoryItemDTO, error) {
var item paymenthistory.PaymentHistoryItemDTO var item paymenthistory.PaymentHistoryItemDTO
var gatewayStatus string var gatewayStatus string
var branchNameJSON []byte
if err := row.Scan( if err := row.Scan(
&item.Id, &item.OrderId, &item.OrderUniqueId, &item.Type, &item.Id, &item.OrderId, &item.OrderUniqueId, &item.Type,
&item.BranchId, &item.BranchName, &item.PassportName, &item.PassportSurname, &item.UserId, &item.BranchId, &branchNameJSON, &item.PassportName, &item.PassportSurname, &item.UserId,
&item.AmountTmt, &item.BankFeeTmt, &item.GbusFeeTmt, &item.TvebFeeUsd, &item.TvebFeeTmt, &item.TotalAmountTmt, &item.AmountTmt, &item.BankFeeTmt, &item.GbusFeeTmt, &item.TvebFeeUsd, &item.TvebFeeTmt, &item.TotalAmountTmt,
&item.ExchangeRateUsd, &item.ExchangeRateRub, &item.PaymentPeriod, &item.ExchangeRateUsd, &item.ExchangeRateRub, &item.PaymentPeriod,
&gatewayStatus, &item.GatewayReference, &item.CreatedById, &item.CreatedByName, &gatewayStatus, &item.GatewayReference, &item.CreatedById, &item.CreatedByName,
@@ -122,6 +123,9 @@ func scanHistoryItem(row pgx.Row) (paymenthistory.PaymentHistoryItemDTO, error)
); err != nil { ); err != nil {
return paymenthistory.PaymentHistoryItemDTO{}, err return paymenthistory.PaymentHistoryItemDTO{}, err
} }
if err := shared.UnmarshalLocalized(branchNameJSON, &item.BranchName); err != nil {
return paymenthistory.PaymentHistoryItemDTO{}, err
}
item.GatewayStatus = gatewayStatus item.GatewayStatus = gatewayStatus
item.Paid = gatewayStatus == "success" item.Paid = gatewayStatus == "success"
return item, nil return item, nil

View File

@@ -6,37 +6,41 @@
// without N+1 calls. // without N+1 calls.
package paymenthistory package paymenthistory
import "time" import (
"time"
"online-back/internal/shared"
)
// PaymentHistoryItemDTO is one payout attempt (paid, failed, or still // PaymentHistoryItemDTO is one payout attempt (paid, failed, or still
// pending) enriched with the order/branch/client/operator context needed to // pending) enriched with the order/branch/client/operator context needed to
// display it in a history list, without requiring a separate lookup per row. // display it in a history list, without requiring a separate lookup per row.
type PaymentHistoryItemDTO struct { type PaymentHistoryItemDTO struct {
Id int64 `json:"id"` Id int64 `json:"id"`
OrderId int64 `json:"orderId"` OrderId int64 `json:"orderId"`
OrderUniqueId string `json:"orderUniqueId"` OrderUniqueId string `json:"orderUniqueId"`
Type string `json:"type"` Type string `json:"type"`
BranchId int64 `json:"branchId"` BranchId int64 `json:"branchId"`
BranchName string `json:"branchName"` BranchName shared.LocalizedText `json:"branchName"`
PassportName string `json:"passportName"` PassportName string `json:"passportName"`
PassportSurname string `json:"passportSurname"` PassportSurname string `json:"passportSurname"`
UserId int64 `json:"userId"` UserId int64 `json:"userId"`
Paid bool `json:"paid"` Paid bool `json:"paid"`
AmountTmt float64 `json:"amountTmt"` AmountTmt float64 `json:"amountTmt"`
BankFeeTmt float64 `json:"bankFeeTmt"` BankFeeTmt float64 `json:"bankFeeTmt"`
GbusFeeTmt *float64 `json:"gbusFeeTmt,omitempty"` GbusFeeTmt *float64 `json:"gbusFeeTmt,omitempty"`
TvebFeeUsd *float64 `json:"tvebFeeUsd,omitempty"` TvebFeeUsd *float64 `json:"tvebFeeUsd,omitempty"`
TvebFeeTmt *float64 `json:"tvebFeeTmt,omitempty"` TvebFeeTmt *float64 `json:"tvebFeeTmt,omitempty"`
TotalAmountTmt float64 `json:"totalAmountTmt"` TotalAmountTmt float64 `json:"totalAmountTmt"`
ExchangeRateUsd float64 `json:"exchangeRateUsd"` ExchangeRateUsd float64 `json:"exchangeRateUsd"`
ExchangeRateRub *float64 `json:"exchangeRateRub,omitempty"` ExchangeRateRub *float64 `json:"exchangeRateRub,omitempty"`
PaymentPeriod time.Time `json:"paymentPeriod"` PaymentPeriod time.Time `json:"paymentPeriod"`
GatewayStatus string `json:"gatewayStatus"` GatewayStatus string `json:"gatewayStatus"`
GatewayReference *string `json:"gatewayReference,omitempty"` GatewayReference *string `json:"gatewayReference,omitempty"`
CreatedById *int64 `json:"createdById,omitempty"` CreatedById *int64 `json:"createdById,omitempty"`
CreatedByName string `json:"createdByName,omitempty"` CreatedByName string `json:"createdByName,omitempty"`
CreatedAt time.Time `json:"createdAt"` CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"` UpdatedAt time.Time `json:"updatedAt"`
} }
// ListFilter narrows the history list. BranchIds is populated by // ListFilter narrows the history list. BranchIds is populated by