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

@@ -2624,6 +2624,331 @@
}
}
},
"/dashboard/analytics/backlog": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: backlog",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/analytics/branches": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: branches",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/analytics/customers": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Loan applicants in range by age group, education, marriage status and number of guarantors, each with its approval rate. Needs the loans permission.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: customers",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/analytics/finance": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: finance",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/analytics/products": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: products",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/analytics/system": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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.",
"produces": [
"application/json"
],
"tags": [
"dashboard-analytics"
],
"summary": "Dashboard analytics: system",
"parameters": [
{
"type": "string",
"default": "Jan 1 of current year",
"description": "Start date YYYY-MM-DD (inclusive)",
"name": "from",
"in": "query"
},
{
"type": "string",
"default": "today",
"description": "End date YYYY-MM-DD (inclusive)",
"name": "to",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Number of operators to return",
"name": "operator_limit",
"in": "query"
}
],
"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"
}
}
}
}
},
"/dashboard/overview": {
"get": {
"security": [
@@ -2676,6 +3001,49 @@
}
}
},
"/dashboard/server-stats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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"
],
"tags": [
"dashboard"
],
"summary": "Server statistics",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/appresult.AppSuccess"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/sysstats.Stats"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/appresult.AppError"
}
}
}
}
},
"/file": {
"post": {
"security": [
@@ -4937,6 +5305,30 @@
"name": "search",
"in": "query"
},
{
"enum": [
"id",
"created_at",
"status",
"amount"
],
"type": "string",
"default": "id",
"description": "Sort column",
"name": "sort",
"in": "query"
},
{
"enum": [
"asc",
"desc"
],
"type": "string",
"default": "desc",
"description": "Sort direction",
"name": "order",
"in": "query"
},
{
"type": "integer",
"default": 1,
@@ -4974,6 +5366,64 @@
}
}
},
"/payment-history/payments/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"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",
"produces": [
"application/json"
],
"tags": [
"payment-history"
],
"summary": "Get a single payment attempt",
"parameters": [
{
"type": "integer",
"description": "Payment ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/payment-history/{id}": {
"get": {
"security": [
@@ -9408,12 +9858,24 @@
}
}
},
"paymenthistory.PaymentHistoryItemDTO": {
"paymenthistory.PaymentHistoryDetailDTO": {
"type": "object",
"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\nexchange_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\n(visa/master or sber) and Description the text sent with register.do -\nboth as visamasterpay's Pay picks them.",
"type": "string"
},
"bankFeeTmt": {
"type": "number"
},
@@ -9423,6 +9885,10 @@
"branchName": {
"$ref": "#/definitions/shared.LocalizedText"
},
"cardholderName": {
"description": "CardholderName/MaskedPan come from GBÜS's getOrderStatusExtended\ncardAuthInfo, so they're only known once an attempt has been\nfinalized by the callback/status check (unset while pending, and for\nattempts that never reached the card form).",
"type": "string"
},
"createdAt": {
"type": "string"
},
@@ -9432,6 +9898,124 @@
"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\n(awaiting the customer to finish paying on GBÜS's hosted page) - once\nan attempt is finalized (success/failed), gateway_response no longer\nholds 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"
}
}
},
"paymenthistory.PaymentHistoryItemDTO": {
"type": "object",
"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\nexchange_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\n(visa/master or sber) and Description the text sent with register.do -\nboth 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\ncardAuthInfo, so they're only known once an attempt has been\nfinalized by the callback/status check (unset while pending, and for\nattempts that never reached the card form).",
"type": "string"
},
"createdAt": {
"type": "string"
},
"createdById": {
"type": "integer"
},
"createdByName": {
"type": "string"
},
"description": {
"type": "string"
},
"exchangeRateRub": {
"type": "number"
},
@@ -9454,6 +10038,9 @@
"id": {
"type": "integer"
},
"maskedPan": {
"type": "string"
},
"orderId": {
"type": "integer"
},
@@ -9834,6 +10421,128 @@
}
}
},
"sysstats.CPU": {
"type": "object",
"properties": {
"cores": {
"type": "integer"
},
"loadAvg": {
"type": "array",
"items": {
"type": "number"
}
},
"usagePercent": {
"type": "number"
}
}
},
"sysstats.Disk": {
"type": "object",
"properties": {
"freeBytes": {
"type": "integer"
},
"path": {
"type": "string"
},
"totalBytes": {
"type": "integer"
},
"usagePercent": {
"type": "number"
},
"usedBytes": {
"type": "integer"
}
}
},
"sysstats.Memory": {
"type": "object",
"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"
}
}
},
"sysstats.Process": {
"type": "object",
"properties": {
"goroutines": {
"type": "integer"
},
"heapAllocBytes": {
"type": "integer"
},
"numGc": {
"type": "integer"
},
"sysBytes": {
"type": "integer"
},
"uptimeSeconds": {
"type": "integer"
}
}
},
"sysstats.Stats": {
"type": "object",
"properties": {
"arch": {
"type": "string"
},
"collectedAt": {
"type": "string"
},
"cpu": {
"$ref": "#/definitions/sysstats.CPU"
},
"disks": {
"type": "array",
"items": {
"$ref": "#/definitions/sysstats.Disk"
}
},
"goVersion": {
"type": "string"
},
"hostUptimeSeconds": {
"type": "integer"
},
"hostname": {
"type": "string"
},
"memory": {
"$ref": "#/definitions/sysstats.Memory"
},
"os": {
"type": "string"
},
"process": {
"$ref": "#/definitions/sysstats.Process"
}
}
},
"user.CreateUserDTO": {
"type": "object",
"required": [