visamaster: record order actions for the "Ammallar" table
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

Every create, update and delete of a visa/master or sber order is now
recorded in visa_master_order_actions: who did it, finished or failed
(with the exception), and for an update only the columns that changed -
original before, changes after. Marking an order paid when a payment is
finalized is recorded the same way, with no user when the GBÜS callback
did it.

Actions are written in the transaction that changes the order, so one is
on record exactly when its change is; failed ones are written after the
rollback with the values they attempted. The payment finalize records
after its commit instead, so recording never holds up a payment GBÜS has
already taken. Updates that change nothing and creates that fail (no
order to attach to) are not recorded.

GET /visa-master-payment-orders/{id}/actions lists them, newest first;
GET /visa-master-payment-orders/{id}/actions/{actionId} adds original,
changes and exception. Both are staff-only and order-scoped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 22:39:42 +05:00
parent 742e078090
commit 11e1fa4972
18 changed files with 1527 additions and 10 deletions

View File

@@ -9777,6 +9777,169 @@
}
}
},
"/visa-master-payment-orders/{id}/actions": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Bir Visa/Master ýa-da Sber sargydynyň ähli amallaryny gaýtarýar: goşmak, üýtgetmek, pozmak (name/nameLabel), kim tarapyndan (createdByName), haýsy sargyt (target: uniqueId we label, mysal üçin \"Sber töleg (talyplar üçin)\"), statusy (finished ýa-da failed) we senesi. Tertip: iň täzesi birinji. Bellik: näme üýtgändigi (original/changes) we ýalňyşlyk (exception) /visa-master-payment-orders/{id}/actions/{actionId} salgysynda; töleg tamamlananda sargydyň status/paid üýtgemegi hem şu ýere ýazylýar, GBÜS callback-dan gelse createdById null.",
"produces": [
"application/json"
],
"tags": [
"visa-master-order-actions"
],
"summary": "Sargydyň amallary (Ammallar)",
"parameters": [
{
"type": "integer",
"description": "Sargyt ID-si",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "Sahypa belgisi",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Bir sahypadaky ýazgy sany",
"name": "limit",
"in": "query"
},
{
"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": {
"$ref": "#/definitions/visamasteractions.ListOrderActionDTO"
}
},
"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"
}
}
}
}
},
"/visa-master-payment-orders/{id}/actions/{actionId}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Sargydyň bir amalyny näme üýtgändigi bilen gaýtarýar: original - üýtgän meýdanlaryň öňki bahalary (Asyl), changes - täze bahalary (Üýtgeşmeler), exception - şowsuz amalyň ýalňyşlygy. Tertip: ýeke ýazgy. Bellik: goşmakda original null we changes ähli meýdanlar, pozmakda original ähli meýdanlar we changes null; şowsuz amalda changes synanyşylan bahalar.",
"produces": [
"application/json"
],
"tags": [
"visa-master-order-actions"
],
"summary": "Sargydyň bir amaly",
"parameters": [
{
"type": "integer",
"description": "Sargyt ID-si",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Amalyň ID-si",
"name": "actionId",
"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": {
"$ref": "#/definitions/visamasteractions.OrderActionDetailDTO"
}
},
"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"
}
}
}
}
},
"/visa-master-payment-orders/{id}/pay": {
"post": {
"security": [
@@ -12931,6 +13094,110 @@
}
}
},
"visamasteractions.ListOrderActionDTO": {
"type": "object",
"properties": {
"actions": {
"type": "array",
"items": {
"$ref": "#/definitions/visamasteractions.OrderActionDTO"
}
},
"count": {
"type": "integer"
}
}
},
"visamasteractions.OrderActionDTO": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdById": {
"type": "integer"
},
"createdByName": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"nameLabel": {
"$ref": "#/definitions/shared.LocalizedText"
},
"orderId": {
"type": "integer"
},
"status": {
"type": "string"
},
"target": {
"$ref": "#/definitions/visamasteractions.OrderActionTargetDTO"
}
}
},
"visamasteractions.OrderActionDetailDTO": {
"type": "object",
"properties": {
"changes": {
"type": "object"
},
"createdAt": {
"type": "string"
},
"createdById": {
"type": "integer"
},
"createdByName": {
"type": "string"
},
"exception": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"nameLabel": {
"$ref": "#/definitions/shared.LocalizedText"
},
"orderId": {
"type": "integer"
},
"original": {
"type": "object"
},
"status": {
"type": "string"
},
"target": {
"$ref": "#/definitions/visamasteractions.OrderActionTargetDTO"
}
}
},
"visamasteractions.OrderActionTargetDTO": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"label": {
"$ref": "#/definitions/shared.LocalizedText"
},
"type": {
"type": "string"
},
"uniqueId": {
"type": "string"
}
}
},
"visamasterpay.CallbackResultDTO": {
"type": "object",
"properties": {
@@ -13128,6 +13395,10 @@
"description": "Visa/Master and Sber student-transfer orders: list, view, create, edit, delete",
"name": "visa-master-orders"
},
{
"description": "Visa/Master we Sber sargytlarynyň amallary (Ammallar): kim, haçan, näme goşdy, üýtgetdi ýa-da pozdy. Ulanylyş tertibi: 1) GET /visa-master-payment-orders/{id}/actions - sargydyň amallary; 2) GET /visa-master-payment-orders/{id}/actions/{actionId} - bir amalyň öňki we täze bahalary",
"name": "visa-master-order-actions"
},
{
"description": "Paying a Visa/Master or Sber order through GBÜS (HALKBANK): quote, pay, status re-check, bank callback",
"name": "visa-master-payment"