Compare commits
2 Commits
a715cd23ea
...
payment-ga
| Author | SHA1 | Date | |
|---|---|---|---|
| ae6bf0b7e3 | |||
| c209f338c2 |
196
docs/docs.go
196
docs/docs.go
@@ -5430,6 +5430,64 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/payment-history/payments/{id}/gateway": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns one payment the way the per-order payment table shows it - 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) - together with the last GBÜS (HALKBANK) response stored for it (gatewayResponse, null if GBÜS never answered). Backs the table's storage icon.",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"payment-history"
|
||||||
|
],
|
||||||
|
"summary": "Get a payment with its HALKBANK response",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Payment ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$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}": {
|
"/payment-history/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -5437,7 +5495,68 @@ const docTemplate = `{
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Returns the full step-by-step audit trail (visa_master_payment_logs) recorded while processing an order's payout - evidence of what actually happened, independent of the summary rows returned by the list endpoint",
|
"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}; the step-by-step logs are at /payment-history/{id}/logs.",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"payment-history"
|
||||||
|
],
|
||||||
|
"summary": "List an order's payments",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/paymenthistory.PaymentHistoryItemDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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}/logs": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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}",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -5458,7 +5577,10 @@ const docTemplate = `{
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/appresult.AppSuccess"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/paymenthistory.PaymentLogDTO"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
@@ -9864,6 +9986,50 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"paymenthistory.PaymentGatewayDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"amountTmt": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"amountUsd": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"cardholderName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"gatewayResponse": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"gatewayStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"maskedPan": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"orderNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"paid": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"paymentMonth": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"paymentYear": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"paymenthistory.PaymentHistoryDetailDTO": {
|
"paymenthistory.PaymentHistoryDetailDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -10091,6 +10257,32 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"paymenthistory.PaymentLogDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createdById": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"createdByName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"orderId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"step": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"paymentsettings.PaymentSettingsDTO": {
|
"paymentsettings.PaymentSettingsDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -5424,6 +5424,64 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/payment-history/payments/{id}/gateway": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Returns one payment the way the per-order payment table shows it - 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) - together with the last GBÜS (HALKBANK) response stored for it (gatewayResponse, null if GBÜS never answered). Backs the table's storage icon.",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"payment-history"
|
||||||
|
],
|
||||||
|
"summary": "Get a payment with its HALKBANK response",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Payment ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$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}": {
|
"/payment-history/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -5431,7 +5489,68 @@
|
|||||||
"BearerAuth": []
|
"BearerAuth": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Returns the full step-by-step audit trail (visa_master_payment_logs) recorded while processing an order's payout - evidence of what actually happened, independent of the summary rows returned by the list endpoint",
|
"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}; the step-by-step logs are at /payment-history/{id}/logs.",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"payment-history"
|
||||||
|
],
|
||||||
|
"summary": "List an order's payments",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Order ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/paymenthistory.PaymentHistoryItemDTO"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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}/logs": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"BearerAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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}",
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -5452,7 +5571,10 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/appresult.AppSuccess"
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/paymenthistory.PaymentLogDTO"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"400": {
|
"400": {
|
||||||
@@ -9858,6 +9980,50 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"paymenthistory.PaymentGatewayDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"amountTmt": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"amountUsd": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"cardholderName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"gatewayResponse": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"gatewayStatus": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"maskedPan": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"orderId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"orderNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"paid": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"paymentMonth": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"paymentYear": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"paymenthistory.PaymentHistoryDetailDTO": {
|
"paymenthistory.PaymentHistoryDetailDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -10085,6 +10251,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"paymenthistory.PaymentLogDTO": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"createdAt": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createdById": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"createdByName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"detail": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"orderId": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"step": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"paymentsettings.PaymentSettingsDTO": {
|
"paymentsettings.PaymentSettingsDTO": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -1304,6 +1304,35 @@ definitions:
|
|||||||
$ref: '#/definitions/paymenthistory.PaymentHistoryItemDTO'
|
$ref: '#/definitions/paymenthistory.PaymentHistoryItemDTO'
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
|
paymenthistory.PaymentGatewayDTO:
|
||||||
|
properties:
|
||||||
|
amountTmt:
|
||||||
|
type: number
|
||||||
|
amountUsd:
|
||||||
|
type: number
|
||||||
|
cardholderName:
|
||||||
|
type: string
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
gatewayResponse:
|
||||||
|
type: object
|
||||||
|
gatewayStatus:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
maskedPan:
|
||||||
|
type: string
|
||||||
|
orderId:
|
||||||
|
type: integer
|
||||||
|
orderNumber:
|
||||||
|
type: string
|
||||||
|
paid:
|
||||||
|
type: boolean
|
||||||
|
paymentMonth:
|
||||||
|
type: integer
|
||||||
|
paymentYear:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
paymenthistory.PaymentHistoryDetailDTO:
|
paymenthistory.PaymentHistoryDetailDTO:
|
||||||
properties:
|
properties:
|
||||||
amountMinor:
|
amountMinor:
|
||||||
@@ -1484,6 +1513,23 @@ definitions:
|
|||||||
userId:
|
userId:
|
||||||
type: integer
|
type: integer
|
||||||
type: object
|
type: object
|
||||||
|
paymenthistory.PaymentLogDTO:
|
||||||
|
properties:
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
createdById:
|
||||||
|
type: integer
|
||||||
|
createdByName:
|
||||||
|
type: string
|
||||||
|
detail:
|
||||||
|
type: object
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
orderId:
|
||||||
|
type: integer
|
||||||
|
step:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
paymentsettings.PaymentSettingsDTO:
|
paymentsettings.PaymentSettingsDTO:
|
||||||
properties:
|
properties:
|
||||||
bankFeeTmt:
|
bankFeeTmt:
|
||||||
@@ -5563,9 +5609,11 @@ paths:
|
|||||||
- payment-history
|
- payment-history
|
||||||
/payment-history/{id}:
|
/payment-history/{id}:
|
||||||
get:
|
get:
|
||||||
description: Returns the full step-by-step audit trail (visa_master_payment_logs)
|
description: Returns every visa/master/sber payout attempt of one order, newest
|
||||||
recorded while processing an order's payout - evidence of what actually happened,
|
first - one row per payment with whether it was paid (paid/gatewayStatus),
|
||||||
independent of the summary rows returned by the list endpoint
|
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}; the step-by-step logs are at /payment-history/{id}/logs.
|
||||||
parameters:
|
parameters:
|
||||||
- description: Order ID
|
- description: Order ID
|
||||||
in: path
|
in: path
|
||||||
@@ -5578,7 +5626,50 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/appresult.AppSuccess'
|
items:
|
||||||
|
$ref: '#/definitions/paymenthistory.PaymentHistoryItemDTO'
|
||||||
|
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: List an order's payments
|
||||||
|
tags:
|
||||||
|
- payment-history
|
||||||
|
/payment-history/{id}/logs:
|
||||||
|
get:
|
||||||
|
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}
|
||||||
|
parameters:
|
||||||
|
- description: Order ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/paymenthistory.PaymentLogDTO'
|
||||||
|
type: array
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
schema:
|
schema:
|
||||||
@@ -5639,6 +5730,48 @@ paths:
|
|||||||
summary: Get a single payment attempt
|
summary: Get a single payment attempt
|
||||||
tags:
|
tags:
|
||||||
- payment-history
|
- payment-history
|
||||||
|
/payment-history/payments/{id}/gateway:
|
||||||
|
get:
|
||||||
|
description: Returns one payment the way the per-order payment table shows it
|
||||||
|
- 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) - together with the last GBÜS (HALKBANK) response
|
||||||
|
stored for it (gatewayResponse, null if GBÜS never answered). Backs the table's
|
||||||
|
storage icon.
|
||||||
|
parameters:
|
||||||
|
- description: Payment ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$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'
|
||||||
|
security:
|
||||||
|
- BearerAuth: []
|
||||||
|
summary: Get a payment with its HALKBANK response
|
||||||
|
tags:
|
||||||
|
- payment-history
|
||||||
/payment-settings:
|
/payment-settings:
|
||||||
get:
|
get:
|
||||||
description: Returns the admin-configurable bank and GBÜS commission fees used
|
description: Returns the admin-configurable bank and GBÜS commission fees used
|
||||||
|
|||||||
@@ -105,6 +105,31 @@ func (r *repository) Get(ctx context.Context, paymentID int64) (paymenthistory.P
|
|||||||
return detail, nil
|
return detail, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *repository) OrderPayments(ctx context.Context, orderID int64) ([]paymenthistory.PaymentHistoryItemDTO, error) {
|
||||||
|
whereClause, args := buildListQuery(paymenthistory.ListFilter{OrderId: &orderID})
|
||||||
|
query := `SELECT ` + historySelectColumns + historyFromClause + whereClause + ` ORDER BY p.id DESC`
|
||||||
|
|
||||||
|
rows, err := r.client.Query(ctx, query, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
|
||||||
|
items := []paymenthistory.PaymentHistoryItemDTO{}
|
||||||
|
for rows.Next() {
|
||||||
|
item, err := r.scanHistoryItem(rows)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
items = append(items, item)
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
// OwnerInfo returns orderID's owning user/branch, so the handler can run
|
// OwnerInfo returns orderID's owning user/branch, so the handler can run
|
||||||
// rbac.GuardOrder before returning its logs to a branch/own-scoped caller.
|
// rbac.GuardOrder before returning its logs to a branch/own-scoped caller.
|
||||||
func (r *repository) OwnerInfo(ctx context.Context, orderID int64) (*int64, int64, error) {
|
func (r *repository) OwnerInfo(ctx context.Context, orderID int64) (*int64, int64, error) {
|
||||||
|
|||||||
@@ -75,6 +75,50 @@ type PaymentHistoryDetailDTO struct {
|
|||||||
GatewayResponse json.RawMessage `json:"gatewayResponse,omitempty" swaggertype:"object"`
|
GatewayResponse json.RawMessage `json:"gatewayResponse,omitempty" swaggertype:"object"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PaymentGatewayDTO is one payment the way the per-order payment table
|
||||||
|
// shows it (paid or not, from which card, when, for which month) together
|
||||||
|
// with the last GBÜS (HALKBANK) response stored for it. Card fields are
|
||||||
|
// null until GBÜS reports cardAuthInfo; gatewayResponse is null if GBÜS
|
||||||
|
// never answered.
|
||||||
|
type PaymentGatewayDTO struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
OrderId int64 `json:"orderId"`
|
||||||
|
CardholderName *string `json:"cardholderName"`
|
||||||
|
MaskedPan *string `json:"maskedPan"`
|
||||||
|
PaymentYear int `json:"paymentYear"`
|
||||||
|
PaymentMonth int `json:"paymentMonth"`
|
||||||
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
AmountUsd float64 `json:"amountUsd"`
|
||||||
|
AmountTmt float64 `json:"amountTmt"`
|
||||||
|
OrderNumber string `json:"orderNumber"`
|
||||||
|
Paid bool `json:"paid"`
|
||||||
|
GatewayStatus string `json:"gatewayStatus"`
|
||||||
|
GatewayResponse json.RawMessage `json:"gatewayResponse" swaggertype:"object"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPaymentGatewayDTO trims a payment detail down to PaymentGatewayDTO.
|
||||||
|
func NewPaymentGatewayDTO(detail PaymentHistoryDetailDTO) PaymentGatewayDTO {
|
||||||
|
gatewayResponse := detail.GatewayResponse
|
||||||
|
if len(gatewayResponse) == 0 {
|
||||||
|
gatewayResponse = json.RawMessage("null")
|
||||||
|
}
|
||||||
|
return PaymentGatewayDTO{
|
||||||
|
Id: detail.Id,
|
||||||
|
OrderId: detail.OrderId,
|
||||||
|
CardholderName: detail.CardholderName,
|
||||||
|
MaskedPan: detail.MaskedPan,
|
||||||
|
PaymentYear: detail.PaymentPeriod.Year(),
|
||||||
|
PaymentMonth: int(detail.PaymentPeriod.Month()),
|
||||||
|
CreatedAt: detail.CreatedAt,
|
||||||
|
AmountUsd: detail.AmountUsd,
|
||||||
|
AmountTmt: detail.AmountTmt,
|
||||||
|
OrderNumber: detail.OrderNumber,
|
||||||
|
Paid: detail.Paid,
|
||||||
|
GatewayStatus: detail.GatewayStatus,
|
||||||
|
GatewayResponse: gatewayResponse,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ListFilter narrows the history list. BranchIds is populated by
|
// ListFilter narrows the history list. BranchIds is populated by
|
||||||
// rbac.BindBranchIDs and takes priority over BranchId when set (see
|
// rbac.BindBranchIDs and takes priority over BranchId when set (see
|
||||||
// rbac.AppendBranchIDs), the same way visamaster.ListFilter works.
|
// rbac.AppendBranchIDs), the same way visamaster.ListFilter works.
|
||||||
@@ -112,7 +156,7 @@ type PaymentLogDTO struct {
|
|||||||
Id int64 `json:"id"`
|
Id int64 `json:"id"`
|
||||||
OrderId int64 `json:"orderId"`
|
OrderId int64 `json:"orderId"`
|
||||||
Step string `json:"step"`
|
Step string `json:"step"`
|
||||||
Detail json.RawMessage `json:"detail,omitempty"`
|
Detail json.RawMessage `json:"detail,omitempty" swaggertype:"object"`
|
||||||
CreatedById *int64 `json:"createdById,omitempty"`
|
CreatedById *int64 `json:"createdById,omitempty"`
|
||||||
CreatedByName string `json:"createdByName,omitempty"`
|
CreatedByName string `json:"createdByName,omitempty"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ func (h *handler) Register(router *gin.RouterGroup) {
|
|||||||
group := rbac.Group(router, baseURL, rbac.RequireStaff(perm.Cards))
|
group := rbac.Group(router, baseURL, rbac.RequireStaff(perm.Cards))
|
||||||
group.GET("", h.list)
|
group.GET("", h.list)
|
||||||
group.GET("/payments/:id", h.get)
|
group.GET("/payments/:id", h.get)
|
||||||
group.GET("/:id", h.logs)
|
group.GET("/payments/:id/gateway", h.gateway)
|
||||||
|
group.GET("/:id", h.orderPayments)
|
||||||
|
group.GET("/:id/logs", h.logs)
|
||||||
}
|
}
|
||||||
|
|
||||||
// list godoc
|
// list godoc
|
||||||
@@ -84,24 +86,88 @@ func (h *handler) list(c *gin.Context) {
|
|||||||
// @Failure 500 {object} appresult.AppError
|
// @Failure 500 {object} appresult.AppError
|
||||||
// @Router /payment-history/payments/{id} [get]
|
// @Router /payment-history/payments/{id} [get]
|
||||||
func (h *handler) get(c *gin.Context) {
|
func (h *handler) get(c *gin.Context) {
|
||||||
|
result, ok := h.loadPayment(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData(result))
|
||||||
|
}
|
||||||
|
|
||||||
|
// gateway godoc
|
||||||
|
// @Summary Get a payment with its HALKBANK response
|
||||||
|
// @Description Returns one payment the way the per-order payment table shows it - 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) - together with the last GBÜS (HALKBANK) response stored for it (gatewayResponse, null if GBÜS never answered). Backs the table's storage icon.
|
||||||
|
// @Tags payment-history
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param id path int true "Payment ID"
|
||||||
|
// @Success 200 {object} PaymentGatewayDTO
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 403 {object} appresult.AppError
|
||||||
|
// @Failure 404 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /payment-history/payments/{id}/gateway [get]
|
||||||
|
func (h *handler) gateway(c *gin.Context) {
|
||||||
|
result, ok := h.loadPayment(c)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.JSON(http.StatusOK, appresult.SuccessWithData(NewPaymentGatewayDTO(result)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// loadPayment loads the :id payment and runs the order guard on it,
|
||||||
|
// answering the request itself when that fails.
|
||||||
|
func (h *handler) loadPayment(c *gin.Context) (PaymentHistoryDetailDTO, bool) {
|
||||||
paymentID, ok := shared.ParseID(c.Param("id"))
|
paymentID, ok := shared.ParseID(c.Param("id"))
|
||||||
if !ok {
|
if !ok {
|
||||||
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
return
|
return PaymentHistoryDetailDTO{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := h.repository.Get(c.Request.Context(), paymentID)
|
result, err := h.repository.Get(c.Request.Context(), paymentID)
|
||||||
if errors.Is(err, pgx.ErrNoRows) {
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
c.JSON(http.StatusNotFound, appresult.ErrNotFound)
|
c.JSON(http.StatusNotFound, appresult.ErrNotFound)
|
||||||
return
|
return PaymentHistoryDetailDTO{}, false
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.logger.Errorf("get payment history failed (payment %d): %v", paymentID, err)
|
h.logger.Errorf("get payment history failed (payment %d): %v", paymentID, err)
|
||||||
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
return
|
return PaymentHistoryDetailDTO{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !h.guardOrder(c, result.OrderId) {
|
if !h.guardOrder(c, result.OrderId) {
|
||||||
|
return PaymentHistoryDetailDTO{}, false
|
||||||
|
}
|
||||||
|
return result, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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}; the step-by-step logs are at /payment-history/{id}/logs.
|
||||||
|
// @Tags payment-history
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Param id path int true "Order ID"
|
||||||
|
// @Success 200 {array} PaymentHistoryItemDTO
|
||||||
|
// @Failure 400 {object} appresult.AppError
|
||||||
|
// @Failure 403 {object} appresult.AppError
|
||||||
|
// @Failure 404 {object} appresult.AppError
|
||||||
|
// @Failure 500 {object} appresult.AppError
|
||||||
|
// @Router /payment-history/{id} [get]
|
||||||
|
func (h *handler) orderPayments(c *gin.Context) {
|
||||||
|
orderID, ok := shared.ParseID(c.Param("id"))
|
||||||
|
if !ok {
|
||||||
|
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !h.guardOrder(c, orderID) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := h.repository.OrderPayments(c.Request.Context(), orderID)
|
||||||
|
if err != nil {
|
||||||
|
h.logger.Errorf("list order payments failed (order %d): %v", orderID, err)
|
||||||
|
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,17 +176,17 @@ func (h *handler) get(c *gin.Context) {
|
|||||||
|
|
||||||
// logs godoc
|
// logs godoc
|
||||||
// @Summary Get payment logs for an order
|
// @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 - evidence of what actually happened, independent of the summary rows returned by the list endpoint
|
// @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}
|
||||||
// @Tags payment-history
|
// @Tags payment-history
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Security BearerAuth
|
// @Security BearerAuth
|
||||||
// @Param id path int true "Order ID"
|
// @Param id path int true "Order ID"
|
||||||
// @Success 200 {object} appresult.AppSuccess
|
// @Success 200 {array} PaymentLogDTO
|
||||||
// @Failure 400 {object} appresult.AppError
|
// @Failure 400 {object} appresult.AppError
|
||||||
// @Failure 403 {object} appresult.AppError
|
// @Failure 403 {object} appresult.AppError
|
||||||
// @Failure 404 {object} appresult.AppError
|
// @Failure 404 {object} appresult.AppError
|
||||||
// @Failure 500 {object} appresult.AppError
|
// @Failure 500 {object} appresult.AppError
|
||||||
// @Router /payment-history/{id} [get]
|
// @Router /payment-history/{id}/logs [get]
|
||||||
func (h *handler) logs(c *gin.Context) {
|
func (h *handler) logs(c *gin.Context) {
|
||||||
orderID, ok := shared.ParseID(c.Param("id"))
|
orderID, ok := shared.ParseID(c.Param("id"))
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
115
internal/payment/paymenthistory/handler_test.go
Normal file
115
internal/payment/paymenthistory/handler_test.go
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package paymenthistory
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"online-back/internal/identity/rbac"
|
||||||
|
"online-back/pkg/logging"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/jackc/pgx/v4"
|
||||||
|
)
|
||||||
|
|
||||||
|
type fakeRepository struct {
|
||||||
|
Repository
|
||||||
|
payments map[int64]PaymentHistoryDetailDTO
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fakeRepository) Get(_ context.Context, paymentID int64) (PaymentHistoryDetailDTO, error) {
|
||||||
|
p, ok := f.payments[paymentID]
|
||||||
|
if !ok {
|
||||||
|
return PaymentHistoryDetailDTO{}, pgx.ErrNoRows
|
||||||
|
}
|
||||||
|
return p, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func strPtr(s string) *string { return &s }
|
||||||
|
|
||||||
|
func gatewayRequest(t *testing.T, repo Repository, path string) *httptest.ResponseRecorder {
|
||||||
|
t.Helper()
|
||||||
|
gin.SetMode(gin.TestMode)
|
||||||
|
// Register's rbac.Group also demands a signed JWT; mount the handler
|
||||||
|
// directly behind an all-scope principal instead.
|
||||||
|
h := &handler{logger: logging.GetLogger(), repository: repo}
|
||||||
|
router := gin.New()
|
||||||
|
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)
|
||||||
|
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
router.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/payment-history/payments/"+path, nil))
|
||||||
|
return rec
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGatewayReturnsTableRowWithHalkbankJSON(t *testing.T) {
|
||||||
|
created := time.Date(2026, 10, 22, 8, 19, 57, 0, time.UTC)
|
||||||
|
paid := PaymentHistoryDetailDTO{
|
||||||
|
PaymentHistoryItemDTO: PaymentHistoryItemDTO{
|
||||||
|
Id: 2922, OrderId: 9437, OrderNumber: "221026131957",
|
||||||
|
CardholderName: strPtr("Amanowa guljemal"), MaskedPan: strPtr("993404**2453"),
|
||||||
|
PaymentPeriod: time.Date(2026, 10, 31, 0, 0, 0, 0, time.UTC), CreatedAt: created,
|
||||||
|
AmountUsd: 250, AmountTmt: 1063.44, Paid: true, GatewayStatus: "success",
|
||||||
|
Description: "Visa/Master tölegi",
|
||||||
|
},
|
||||||
|
GatewayResponse: json.RawMessage(`{"orderStatus":2,"actionCode":0}`),
|
||||||
|
}
|
||||||
|
repo := fakeRepository{payments: map[int64]PaymentHistoryDetailDTO{2922: paid}}
|
||||||
|
|
||||||
|
rec := gatewayRequest(t, repo, "2922/gateway")
|
||||||
|
if rec.Code != http.StatusOK {
|
||||||
|
t.Fatalf("got %d %s", rec.Code, rec.Body.String())
|
||||||
|
}
|
||||||
|
var body struct {
|
||||||
|
Data map[string]json.RawMessage `json:"data"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
want := map[string]string{
|
||||||
|
"id": `2922`, "orderId": `9437`, "cardholderName": `"Amanowa guljemal"`, "maskedPan": `"993404**2453"`,
|
||||||
|
"paymentYear": `2026`, "paymentMonth": `10`, "createdAt": `"2026-10-22T08:19:57Z"`,
|
||||||
|
"amountUsd": `250`, "amountTmt": `1063.44`, "orderNumber": `"221026131957"`,
|
||||||
|
"paid": `true`, "gatewayStatus": `"success"`, "gatewayResponse": `{"orderStatus":2,"actionCode":0}`,
|
||||||
|
}
|
||||||
|
if len(body.Data) != len(want) {
|
||||||
|
t.Errorf("got fields %v, want exactly %d", body.Data, len(want))
|
||||||
|
}
|
||||||
|
for key, value := range want {
|
||||||
|
if got := string(body.Data[key]); got != value {
|
||||||
|
t.Errorf("%s: got %s, want %s", key, got, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGatewayNullsWhenHalkbankNeverAnswered(t *testing.T) {
|
||||||
|
repo := fakeRepository{payments: map[int64]PaymentHistoryDetailDTO{
|
||||||
|
7: {PaymentHistoryItemDTO: PaymentHistoryItemDTO{Id: 7, GatewayStatus: "failed"}},
|
||||||
|
}}
|
||||||
|
rec := gatewayRequest(t, repo, "7/gateway")
|
||||||
|
var body struct {
|
||||||
|
Data map[string]json.RawMessage `json:"data"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, key := range []string{"cardholderName", "maskedPan", "gatewayResponse"} {
|
||||||
|
if got := string(body.Data[key]); got != "null" {
|
||||||
|
t.Errorf("%s: got %q, want null", key, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGatewayErrors(t *testing.T) {
|
||||||
|
repo := fakeRepository{payments: map[int64]PaymentHistoryDetailDTO{}}
|
||||||
|
for path, want := range map[string]int{"abc/gateway": http.StatusBadRequest, "999/gateway": http.StatusNotFound} {
|
||||||
|
if rec := gatewayRequest(t, repo, path); rec.Code != want {
|
||||||
|
t.Errorf("%s: got %d, want %d", path, rec.Code, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,9 @@ type Repository interface {
|
|||||||
List(ctx context.Context, filter ListFilter) (ListPaymentHistoryDTO, error)
|
List(ctx context.Context, filter ListFilter) (ListPaymentHistoryDTO, error)
|
||||||
// Get returns a single payout attempt by its visa_master_order_payments id.
|
// Get returns a single payout attempt by its visa_master_order_payments id.
|
||||||
Get(ctx context.Context, paymentID int64) (PaymentHistoryDetailDTO, error)
|
Get(ctx context.Context, paymentID int64) (PaymentHistoryDetailDTO, error)
|
||||||
|
// OrderPayments returns every payout attempt of a single order, newest
|
||||||
|
// first - the per-order payment table, without paging.
|
||||||
|
OrderPayments(ctx context.Context, orderID int64) ([]PaymentHistoryItemDTO, error)
|
||||||
// Logs returns the full visa_master_payment_logs audit trail for a
|
// Logs returns the full visa_master_payment_logs audit trail for a
|
||||||
// single order, newest first.
|
// single order, newest first.
|
||||||
Logs(ctx context.Context, orderID int64) ([]PaymentLogDTO, error)
|
Logs(ctx context.Context, orderID int64) ([]PaymentLogDTO, error)
|
||||||
|
|||||||
Reference in New Issue
Block a user