payment-history: drop /payments/{id}/gateway in favour of /{id}/gateway
Both routes served the same handler and took an order ID, while
/payments/{id} takes a payment ID - so the /payments/ one read as
per-payment and showed up twice in Swagger. /payment-history/{id}/gateway
is the one to use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
74
docs/docs.go
74
docs/docs.go
@@ -6682,80 +6682,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/payment-history/payments/{id}/gateway": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"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.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"payment-history"
|
||||
],
|
||||
"summary": "Sargydyň tölegleri GBÜS jogaplary bilen",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Sargyt ID-si",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"tm",
|
||||
"ru",
|
||||
"en",
|
||||
"all"
|
||||
],
|
||||
"type": "string",
|
||||
"default": "tm",
|
||||
"description": "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri",
|
||||
"name": "lang",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/paymenthistory.PaymentGatewayDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": [
|
||||
|
||||
@@ -6679,80 +6679,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/payment-history/payments/{id}/gateway": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"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.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"payment-history"
|
||||
],
|
||||
"summary": "Sargydyň tölegleri GBÜS jogaplary bilen",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Sargyt ID-si",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"tm",
|
||||
"ru",
|
||||
"en",
|
||||
"all"
|
||||
],
|
||||
"type": "string",
|
||||
"default": "tm",
|
||||
"description": "Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri",
|
||||
"name": "lang",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/paymenthistory.PaymentGatewayDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": [
|
||||
|
||||
@@ -6880,60 +6880,6 @@ paths:
|
||||
summary: Bir tölegiň jikme-jikligi
|
||||
tags:
|
||||
- payment-history
|
||||
/payment-history/payments/{id}/gateway:
|
||||
get:
|
||||
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.'
|
||||
parameters:
|
||||
- description: Sargyt ID-si
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- default: tm
|
||||
description: Lokallaşdyrylan meýdanlaryň dili; all - doly {en, ru, tm} obýektleri
|
||||
enum:
|
||||
- tm
|
||||
- ru
|
||||
- en
|
||||
- all
|
||||
in: query
|
||||
name: lang
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/paymenthistory.PaymentGatewayDTO'
|
||||
type: array
|
||||
"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: Sargydyň tölegleri GBÜS jogaplary bilen
|
||||
tags:
|
||||
- payment-history
|
||||
/payment-settings:
|
||||
get:
|
||||
description: Returns the admin-configurable bank and GBÜS commission fees used
|
||||
|
||||
@@ -31,7 +31,6 @@ func (h *handler) Register(router *gin.RouterGroup) {
|
||||
group := rbac.Group(router, baseURL, rbac.RequireStaff(perm.Cards))
|
||||
group.GET("", h.list)
|
||||
group.GET("/payments/:id", h.get)
|
||||
group.GET("/payments/:id/gateway", h.gateway)
|
||||
group.GET("/:id/gateway", h.gateway)
|
||||
group.GET("/:id", h.orderPayments)
|
||||
group.GET("/:id/logs", h.logs)
|
||||
@@ -125,7 +124,6 @@ func (h *handler) get(c *gin.Context) {
|
||||
// @Failure 403 {object} appresult.AppError
|
||||
// @Failure 404 {object} appresult.AppError
|
||||
// @Failure 500 {object} appresult.AppError
|
||||
// @Router /payment-history/payments/{id}/gateway [get]
|
||||
// @Router /payment-history/{id}/gateway [get]
|
||||
func (h *handler) gateway(c *gin.Context) {
|
||||
orderID, ok := shared.ParseID(c.Param("id"))
|
||||
|
||||
@@ -35,10 +35,10 @@ func gatewayRequest(t *testing.T, repo Repository, path string) *httptest.Respon
|
||||
router.Use(func(c *gin.Context) {
|
||||
c.Set("rbacPrincipal", &rbac.Principal{UserID: 1, Scope: rbac.ScopeAll})
|
||||
})
|
||||
router.GET("/payment-history/payments/:id/gateway", h.gateway)
|
||||
router.GET("/payment-history/:id/gateway", h.gateway)
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
router.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/payment-history/payments/"+path, nil))
|
||||
router.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/payment-history/"+path, nil))
|
||||
return rec
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user