payment-history: payment detail with GBÜS response, sorting, newest-first logs
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

- GET /payment-history/payments/{id}: single payment attempt with the raw
  gateway_response (last HALKBANK JSON) for the "storage" icon modal
- GET /payment-history: sort (id/created_at/status/amount) and order
  (asc/desc, default desc) query params
- GET /payment-history/{id}: order logs now newest first
- index on visa_master_order_payments (gateway_status, id DESC)
- regenerate swagger docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 13:32:36 +05:00
parent e5f01d0e94
commit a715cd23ea
10 changed files with 2140 additions and 60 deletions

View File

@@ -1304,22 +1304,136 @@ definitions:
$ref: '#/definitions/paymenthistory.PaymentHistoryItemDTO'
type: array
type: object
paymenthistory.PaymentHistoryItemDTO:
paymenthistory.PaymentHistoryDetailDTO:
properties:
amountMinor:
description: AmountMinor is the amount registered with GBÜS, in tetri.
type: integer
amountTmt:
type: number
amountUsd:
description: |-
AmountUsd is amount_tmt converted back at the attempt's own
exchange_rate_usd - the USD figure the payout was quoted in.
type: number
apiClient:
description: |-
ApiClient is the branch's GBÜS merchant username for this order type
(visa/master or sber) and Description the text sent with register.do -
both as visamasterpay's Pay picks them.
type: string
bankFeeTmt:
type: number
branchId:
type: integer
branchName:
$ref: '#/definitions/shared.LocalizedText'
cardholderName:
description: |-
CardholderName/MaskedPan come from GBÜS's getOrderStatusExtended
cardAuthInfo, so they're only known once an attempt has been
finalized by the callback/status check (unset while pending, and for
attempts that never reached the card form).
type: string
createdAt:
type: string
createdById:
type: integer
createdByName:
type: string
description:
type: string
exchangeRateRub:
type: number
exchangeRateUsd:
type: number
formUrl:
description: |-
FormUrl/SuccessUrl are only set while the attempt is still pending
(awaiting the customer to finish paying on GBÜS's hosted page) - once
an attempt is finalized (success/failed), gateway_response no longer
holds a formUrl, so there's nothing left to resume.
type: string
gatewayReference:
type: string
gatewayResponse:
type: object
gatewayStatus:
type: string
gbusFeeTmt:
type: number
id:
type: integer
maskedPan:
type: string
orderId:
type: integer
orderNumber:
type: string
orderUniqueId:
type: string
paid:
type: boolean
passportName:
type: string
passportSurname:
type: string
paymentPeriod:
type: string
successUrl:
type: string
totalAmountTmt:
type: number
tvebFeeTmt:
type: number
tvebFeeUsd:
type: number
type:
type: string
updatedAt:
type: string
userId:
type: integer
type: object
paymenthistory.PaymentHistoryItemDTO:
properties:
amountMinor:
description: AmountMinor is the amount registered with GBÜS, in tetri.
type: integer
amountTmt:
type: number
amountUsd:
description: |-
AmountUsd is amount_tmt converted back at the attempt's own
exchange_rate_usd - the USD figure the payout was quoted in.
type: number
apiClient:
description: |-
ApiClient is the branch's GBÜS merchant username for this order type
(visa/master or sber) and Description the text sent with register.do -
both as visamasterpay's Pay picks them.
type: string
bankFeeTmt:
type: number
branchId:
type: integer
branchName:
$ref: '#/definitions/shared.LocalizedText'
cardholderName:
description: |-
CardholderName/MaskedPan come from GBÜS's getOrderStatusExtended
cardAuthInfo, so they're only known once an attempt has been
finalized by the callback/status check (unset while pending, and for
attempts that never reached the card form).
type: string
createdAt:
type: string
createdById:
type: integer
createdByName:
type: string
description:
type: string
exchangeRateRub:
type: number
exchangeRateUsd:
@@ -1339,6 +1453,8 @@ definitions:
type: number
id:
type: integer
maskedPan:
type: string
orderId:
type: integer
orderNumber:
@@ -1600,6 +1716,86 @@ definitions:
tm:
type: string
type: object
sysstats.CPU:
properties:
cores:
type: integer
loadAvg:
items:
type: number
type: array
usagePercent:
type: number
type: object
sysstats.Disk:
properties:
freeBytes:
type: integer
path:
type: string
totalBytes:
type: integer
usagePercent:
type: number
usedBytes:
type: integer
type: object
sysstats.Memory:
properties:
availableBytes:
type: integer
limitBytes:
description: LimitBytes is the container (cgroup) memory limit, nil when unlimited.
type: integer
swapTotalBytes:
type: integer
swapUsedBytes:
type: integer
totalBytes:
type: integer
usagePercent:
type: number
usedBytes:
type: integer
type: object
sysstats.Process:
properties:
goroutines:
type: integer
heapAllocBytes:
type: integer
numGc:
type: integer
sysBytes:
type: integer
uptimeSeconds:
type: integer
type: object
sysstats.Stats:
properties:
arch:
type: string
collectedAt:
type: string
cpu:
$ref: '#/definitions/sysstats.CPU'
disks:
items:
$ref: '#/definitions/sysstats.Disk'
type: array
goVersion:
type: string
hostUptimeSeconds:
type: integer
hostname:
type: string
memory:
$ref: '#/definitions/sysstats.Memory'
os:
type: string
process:
$ref: '#/definitions/sysstats.Process'
type: object
user.CreateUserDTO:
properties:
active:
@@ -3588,6 +3784,228 @@ paths:
summary: Update currency rate
tags:
- currencies
/dashboard/analytics/backlog:
get:
description: Open (unhandled) orders per order type aged under 1 day / 1-3 days
/ over 3 days, the oldest open order, and the average processing time of orders
finished in range; plus exact visa/master payout timing from the payment log.
Order types are limited to the modules the caller can open.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: backlog'
tags:
- dashboard-analytics
/dashboard/analytics/branches:
get:
description: Per-branch leaderboard (orders per type, open/approved/rejected,
approval rate, average processing hours) and order counts per region, for
orders created in range.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: branches'
tags:
- dashboard-analytics
/dashboard/analytics/customers:
get:
description: Loan applicants in range by age group, education, marriage status
and number of guarantors, each with its approval rate. Needs the loans permission.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: customers'
tags:
- dashboard-analytics
/dashboard/analytics/finance:
get:
description: Successful visa/master payouts (amount, bank/GBÜS/TVEB fees), gateway
status breakdown and success rate, monthly payout totals, and the total loan
amount requested. Payouts need the cards permission, the loan total the loans
permission.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: finance'
tags:
- dashboard-analytics
/dashboard/analytics/products:
get:
description: Loan orders by source (web/mobile) and loan type, card orders by
card type, and paid vs unpaid card orders, for orders created in range.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: products'
tags:
- dashboard-analytics
/dashboard/analytics/system:
get:
description: Registration funnel (all-scope callers with the users permission),
operator activity and error rate per module (activity-logs permission), order
peak hours heatmap in Ashgabat time, and card balance check stats (cards permission).
Widgets the caller cannot see are null or empty.
parameters:
- default: Jan 1 of current year
description: Start date YYYY-MM-DD (inclusive)
in: query
name: from
type: string
- default: today
description: End date YYYY-MM-DD (inclusive)
in: query
name: to
type: string
- default: 10
description: Number of operators to return
in: query
name: operator_limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/appresult.AppSuccess'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: 'Dashboard analytics: system'
tags:
- dashboard-analytics
/dashboard/overview:
get:
description: Returns the KPI cards, loan/card trend, loan status breakdown,
@@ -3622,6 +4040,32 @@ paths:
summary: Dashboard overview
tags:
- dashboard
/dashboard/server-stats:
get:
description: Returns host CPU, RAM and disk usage plus the API process's own
memory and uptime. CPU usage is sampled over ~250ms; host fields are null
when the OS cannot report them.
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/appresult.AppSuccess'
- properties:
data:
$ref: '#/definitions/sysstats.Stats'
type: object
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: Server statistics
tags:
- dashboard
/file:
post:
consumes:
@@ -5069,6 +5513,24 @@ paths:
in: query
name: search
type: string
- default: id
description: Sort column
enum:
- id
- created_at
- status
- amount
in: query
name: sort
type: string
- default: desc
description: Sort direction
enum:
- asc
- desc
in: query
name: order
type: string
- default: 1
description: Page number
in: query
@@ -5138,6 +5600,45 @@ paths:
summary: Get payment logs for an order
tags:
- payment-history
/payment-history/payments/{id}:
get:
description: Returns one visa/master/sber payout attempt by its payment ID,
with the raw GBÜS response - the detail view behind a payment-history list
row
parameters:
- description: Payment ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/paymenthistory.PaymentHistoryDetailDTO'
"400":
description: Bad Request
schema:
$ref: '#/definitions/appresult.AppError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/appresult.AppError'
"404":
description: Not Found
schema:
$ref: '#/definitions/appresult.AppError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/appresult.AppError'
security:
- BearerAuth: []
summary: Get a single payment attempt
tags:
- payment-history
/payment-settings:
get:
description: Returns the admin-configurable bank and GBÜS commission fees used