fixed error
This commit is contained in:
1 parent
99788a853f
commit
febd190d6e
5 files changed
+15
-7
No files matched your search
+1
-1
@@ -9399,7 +9399,7 @@ const docTemplate = `{
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"branchName": {
|
"branchName": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/shared.LocalizedText"
|
||||||
},
|
},
|
||||||
"createdAt": {
|
"createdAt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
+1
-1
@@ -9393,7 +9393,7 @@
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"branchName": {
|
"branchName": {
|
||||||
"type": "string"
|
"$ref": "#/definitions/shared.LocalizedText"
|
||||||
},
|
},
|
||||||
"createdAt": {
|
"createdAt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
+1
-1
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
// 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
|
||||||
@@ -17,7 +21,7 @@ type PaymentHistoryItemDTO struct {
|
|||||||
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"`
|
||||||
|
|||||||
Reference in new issue
Block a user