swagger: split the Visa/Master tag and document payment-history in Turkmen
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

visa-master-payment-orders mixed order CRUD with the GBÜS payment flow;
they are now visa-master-orders and visa-master-payment. payment-history
summaries, descriptions and params are in Turkmen with one shape
(what it returns, Tertip, Bellik), and its tag description lists the
endpoints in the order they are used.

@securityDefinitions.apikey moves to the end of the general info block:
swag read every line after it as its attributes, so @schemes and all
@tag.* declarations were silently dropped from the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 23:21:07 +05:00
parent 78e1976e53
commit d7e5d1f989
7 changed files with 377 additions and 198 deletions

View File

@@ -43,7 +43,7 @@ func (h *handler) Register(router *gin.RouterGroup) {
// list godoc
// @Summary List visa/master payment orders
// @Description Returns paginated visa/master payment orders; sber orders are excluded (see /visa-master-payment-orders/sber)
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Produce json
// @Security BearerAuth
// @Param name query string false "Filter by passport name or surname"
@@ -72,7 +72,7 @@ func (h *handler) list(c *gin.Context) {
// listSber godoc
// @Summary List sber payment orders
// @Description Returns paginated payment orders of type sber
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Produce json
// @Security BearerAuth
// @Param name query string false "Filter by passport name or surname"
@@ -111,7 +111,7 @@ func (h *handler) respondList(c *gin.Context, filter ListFilter) {
// getByID godoc
// @Summary Get visa/master payment order by ID
// @Description Returns a single visa/master payment order with branch and user details
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Produce json
// @Security BearerAuth
// @Param id path int true "Visa/master payment order ID"
@@ -148,7 +148,7 @@ func (h *handler) getByID(c *gin.Context) {
// create godoc
// @Summary Create visa/master payment order
// @Description Creates a new visa/master payment order
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Accept json
// @Produce json
// @Security BearerAuth
@@ -178,7 +178,7 @@ func (h *handler) create(c *gin.Context) {
// update godoc
// @Summary Update visa/master payment order
// @Description Updates an existing visa/master payment order
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Accept json
// @Produce json
// @Security BearerAuth
@@ -224,7 +224,7 @@ func (h *handler) update(c *gin.Context) {
// delete godoc
// @Summary Delete visa/master payment order
// @Description Deletes a visa/master payment order
// @Tags visa-master-payment-orders
// @Tags visa-master-orders
// @Produce json
// @Security BearerAuth
// @Param id path int true "Visa/master payment order ID"

View File

@@ -38,21 +38,21 @@ func (h *handler) Register(router *gin.RouterGroup) {
}
// list godoc
// @Summary List payment history
// @Description Returns a paginated, branch-scoped audit trail of visa/master/sber payout attempts (paid, failed, or pending), across orders
// @Summary Tölegleriň taryhy
// @Description Ähli sargytlaryň Visa/Master we Sber töleg synanyşyklaryny (tölenen, şowsuz, garaşylýan) sahypalap gaýtarýar. Tertip: sort/order boýunça (adaty ýagdaýda iň täzesi birinji). Bellik: diňe ulanyjynyň öz şahamçasynyň tölegleri görünýär.
// @Tags payment-history
// @Produce json
// @Security BearerAuth
// @Param order_id query int false "Filter by order ID"
// @Param branch_id query int false "Filter by branch ID"
// @Param user_id query int false "Filter by order owner (client) user ID"
// @Param status query string false "Filter by gateway status (pending, success, failed)"
// @Param search query string false "Filter by passport name/surname or order unique ID"
// @Param sort query string false "Sort column" Enums(id, created_at, status, amount) default(id)
// @Param order query string false "Sort direction" Enums(asc, desc) default(desc)
// @Param page query int false "Page number" default(1)
// @Param limit query int false "Items per page" default(10)
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)
// @Param order_id query int false "Sargyt ID-si boýunça süzmek"
// @Param branch_id query int false "Şahamça ID-si boýunça süzmek"
// @Param user_id query int false "Sargyt eýesiniň (müşderiniň) ulanyjy ID-si boýunça süzmek"
// @Param status query string false "GBÜS statusy boýunça süzmek (pending, success, failed)"
// @Param search query string false "Pasport ady/familiýasy ýa-da sargydyň unique ID-si boýunça gözlemek"
// @Param sort query string false "Tertiplenýän sütün" Enums(id, created_at, status, amount) default(id)
// @Param order query string false "Tertip ugry" Enums(asc, desc) default(desc)
// @Param page query int false "Sahypa belgisi" default(1)
// @Param limit query int false "Bir sahypadaky ýazgy sany" default(10)
// @Param lang query string false "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri" Enums(tm, ru, en, all) default(tm)
// @Success 200 {object} ListPaymentHistoryDTO
// @Failure 400 {object} appresult.AppError
// @Failure 500 {object} appresult.AppError
@@ -75,13 +75,13 @@ func (h *handler) list(c *gin.Context) {
}
// get godoc
// @Summary Get a single payment attempt
// @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
// @Summary Bir tölegiň jikme-jikligi
// @Description Töleg ID-si boýunça bir Visa/Master ýa-da Sber töleg synanyşygyny GBÜS-iň soňky jogaby (gatewayResponse) bilen gaýtarýar. Tertip: ýeke ýazgy. Bellik: taryh sanawyndaky bir setiriň jikme-jik görnüşi.
// @Tags payment-history
// @Produce json
// @Security BearerAuth
// @Param id path int true "Payment ID"
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)
// @Param id path int true "Töleg ID-si"
// @Param lang query string false "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri" Enums(tm, ru, en, all) default(tm)
// @Success 200 {object} PaymentHistoryDetailDTO
// @Failure 400 {object} appresult.AppError
// @Failure 403 {object} appresult.AppError
@@ -113,13 +113,13 @@ func (h *handler) get(c *gin.Context) {
}
// gateway godoc
// @Summary List an order's payments with their HALKBANK responses
// @Description Returns every payment of one order, newest first, the way the per-order payment table shows them - paid or not, the card it was paid from (cardholderName/maskedPan, null until GBÜS reports them), its time (createdAt), payment year/month, amounts and reference (orderNumber) - each together with the last GBÜS (HALKBANK) response stored for it (gatewayResponse, null if GBÜS never answered). Backs the table's storage icon.
// @Summary Sargydyň tölegleri GBÜS jogaplary bilen
// @Description Bir sargydyň ähli tölegini her biriniň GBÜS (HALKBANK) soňky jogaby (gatewayResponse) bilen gaýtarýar: tölendimi, haýsy kartdan tölendi (cardholderName/maskedPan), wagty (createdAt), töleg ýyly/aýy, mukdarlary we belgisi (orderNumber). Tertip: iň täzesi birinji. Bellik: GBÜS kart maglumatyny habar berýänçä cardholderName/maskedPan null, GBÜS asla jogap bermedik bolsa gatewayResponse null; tablisadaky ammar nyşany şu endpoint-den işleýär.
// @Tags payment-history
// @Produce json
// @Security BearerAuth
// @Param id path int true "Order ID"
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)
// @Param id path int true "Sargyt ID-si"
// @Param lang query string false "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri" Enums(tm, ru, en, all) default(tm)
// @Success 200 {array} PaymentGatewayDTO
// @Failure 400 {object} appresult.AppError
// @Failure 403 {object} appresult.AppError
@@ -153,13 +153,13 @@ func (h *handler) gateway(c *gin.Context) {
}
// orderPayments godoc
// @Summary List an order's payments
// @Description Returns every visa/master/sber payout attempt of one order, newest first - one row per payment with whether it was paid (paid/gatewayStatus), the card it was paid from (cardholderName/maskedPan, once GBÜS reports them), its time (createdAt) and period (paymentPeriod). The raw GBÜS response of a row is at /payment-history/payments/{id}, of every row at once at /payment-history/{id}/gateway; the step-by-step logs are at /payment-history/{id}/logs.
// @Summary Sargydyň tölegleri
// @Description Bir sargydyň ähli Visa/Master we Sber töleg synanyşyklaryny gaýtarýar: her töleg üçin bir setir - tölendimi (paid/gatewayStatus), haýsy kartdan tölendi (cardholderName/maskedPan), wagty (createdAt) we döwri (paymentPeriod). Tertip: iň täzesi birinji. Bellik: bir tölegiň GBÜS jogaby /payment-history/payments/{id}, ähli tölegleriňki /payment-history/{id}/gateway, ädimme-ädim loglar /payment-history/{id}/logs salgysynda.
// @Tags payment-history
// @Produce json
// @Security BearerAuth
// @Param id path int true "Order ID"
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)
// @Param id path int true "Sargyt ID-si"
// @Param lang query string false "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri" Enums(tm, ru, en, all) default(tm)
// @Success 200 {array} PaymentHistoryItemDTO
// @Failure 400 {object} appresult.AppError
// @Failure 403 {object} appresult.AppError
@@ -188,13 +188,13 @@ func (h *handler) orderPayments(c *gin.Context) {
}
// logs godoc
// @Summary Get payment logs for an order
// @Description Returns the full step-by-step audit trail (visa_master_payment_logs) recorded while processing an order's payout, newest first - evidence of what actually happened, independent of the summary rows returned by /payment-history/{id}
// @Summary Sargydyň töleg loglary
// @Description Sargydyň tölegi işlenende ýazylan ähli ädimleri (visa_master_payment_logs) gaýtarýar. Tertip: iň täzesi birinji. Bellik: /payment-history/{id} setirlerinden garaşsyz, hakykatda näme bolandygynyň subutnamasy.
// @Tags payment-history
// @Produce json
// @Security BearerAuth
// @Param id path int true "Order ID"
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)
// @Param id path int true "Sargyt ID-si"
// @Param lang query string false "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri" Enums(tm, ru, en, all) default(tm)
// @Success 200 {array} PaymentLogDTO
// @Failure 400 {object} appresult.AppError
// @Failure 403 {object} appresult.AppError

View File

@@ -40,7 +40,7 @@ func (h *handler) Register(router *gin.RouterGroup) {
// quote godoc
// @Summary Quote a visa/master/sber payment
// @Description Returns the current rate, configured fees, and max payable amount for an order's payout
// @Tags visa-master-payment-orders
// @Tags visa-master-payment
// @Produce json
// @Security BearerAuth
// @Param id path int true "Visa/master payment order ID"
@@ -72,7 +72,7 @@ func (h *handler) quote(c *gin.Context) {
// pay godoc
// @Summary Start a visa/master/sber payout
// @Description Registers the payment with GBÜS and returns the hosted-payment-page URL to complete it on. The final outcome is only known once GBÜS redirects back to the callback, which verifies and finalizes it.
// @Tags visa-master-payment-orders
// @Tags visa-master-payment
// @Accept json
// @Produce json
// @Security BearerAuth
@@ -115,7 +115,7 @@ func (h *handler) pay(c *gin.Context) {
// status godoc
// @Summary Re-check a visa/master/sber order's latest payment attempt
// @Description For when the frontend can't rely on GBÜS's redirect having reached the callback (e.g. the user closed the hosted payment page first) - re-verifies the latest attempt with GBÜS server-to-server, the same way the callback does, and finalizes it if needed. Safe to call repeatedly.
// @Tags visa-master-payment-orders
// @Tags visa-master-payment
// @Produce json
// @Security BearerAuth
// @Param id path int true "Visa/master payment order ID"
@@ -152,7 +152,7 @@ func (h *handler) status(c *gin.Context) {
// callback godoc
// @Summary GBÜS payment callback
// @Description GBÜS redirects the browser here after payment; the real outcome is verified server-to-server before anything is finalized
// @Tags visa-master-payment-orders
// @Tags visa-master-payment
// @Produce json
// @Param paymentId query int true "Payment attempt ID"
// @Param lang query string false "Language of localized fields; all returns the full {en, ru, tm} objects" Enums(tm, ru, en, all) default(tm)