mirror of
https://github.com/valitydev/swag-payments.git
synced 2024-11-06 09:35:22 +00:00
HG-58: Allow to refund payments (#105)
This commit is contained in:
parent
0dcdfc204d
commit
d3cf4735ba
@ -1,6 +1,5 @@
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/InvoiceStatus'
|
||||
- type: object
|
||||
required:
|
||||
- id
|
||||
@ -55,3 +54,4 @@ allOf:
|
||||
metadata:
|
||||
description: Связанные с инвойсом метаданные
|
||||
type: object
|
||||
- $ref: '#/definitions/InvoiceStatus'
|
||||
|
@ -11,3 +11,5 @@ properties:
|
||||
- PaymentStarted
|
||||
- PaymentStatusChanged
|
||||
- PaymentInteractionRequested
|
||||
- RefundStarted
|
||||
- RefundStatusChanged
|
||||
|
@ -9,7 +9,6 @@ properties:
|
||||
- unpaid
|
||||
- cancelled
|
||||
- paid
|
||||
- refunded
|
||||
- fulfilled
|
||||
reason:
|
||||
description: Причина отмены или погашения инвойса
|
||||
|
@ -26,4 +26,5 @@ allOf:
|
||||
- PaymentProcessed
|
||||
- PaymentCaptured
|
||||
- PaymentCancelled
|
||||
- PaymentRefunded
|
||||
- PaymentFailed
|
||||
|
@ -1,6 +1,5 @@
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/PaymentStatus'
|
||||
- type: object
|
||||
required:
|
||||
- id
|
||||
@ -65,3 +64,4 @@ allOf:
|
||||
description: Уникальный отпечаток user agent'а плательщика
|
||||
type: string
|
||||
maxLength: 1000
|
||||
- $ref: '#/definitions/PaymentStatus'
|
||||
|
@ -10,6 +10,7 @@ properties:
|
||||
- processed
|
||||
- captured
|
||||
- cancelled
|
||||
- refunded
|
||||
- failed
|
||||
error:
|
||||
$ref: '#/definitions/LogicError'
|
||||
|
18
spec/definitions/Refund.yaml
Normal file
18
spec/definitions/Refund.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
type: object
|
||||
allOf:
|
||||
- type: object
|
||||
required:
|
||||
- id
|
||||
- createdAt
|
||||
properties:
|
||||
id:
|
||||
description: Идентификатор возврата
|
||||
type: string
|
||||
createdAt:
|
||||
description: Дата и время осуществления
|
||||
type: string
|
||||
format: date-time
|
||||
reason:
|
||||
description: Причина осуществления возврата
|
||||
type: string
|
||||
- $ref: '#/definitions/RefundStatus'
|
12
spec/definitions/RefundStarted.yaml
Normal file
12
spec/definitions/RefundStarted.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/InvoiceChange'
|
||||
- type: object
|
||||
required:
|
||||
- paymentID
|
||||
- refund
|
||||
properties:
|
||||
paymentID:
|
||||
type: string
|
||||
refund:
|
||||
$ref: '#/definitions/Refund'
|
26
spec/definitions/RefundStatus.yaml
Normal file
26
spec/definitions/RefundStatus.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
description: Статус возврата
|
||||
type: string
|
||||
enum:
|
||||
- pending
|
||||
- succeeded
|
||||
- failed
|
||||
error:
|
||||
description: |
|
||||
Данные ошибки, возникшей в процессе проведения возврата, в случае если
|
||||
возврат был неуспешен
|
||||
type: object
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
properties:
|
||||
code:
|
||||
description: Код ошибки, пригодный для обработки автоматическими системами
|
||||
type: string
|
||||
message:
|
||||
description: Описание ошибки, пригодное для восприятия человеком
|
||||
type: string
|
13
spec/definitions/RefundStatusChanged.yaml
Normal file
13
spec/definitions/RefundStatusChanged.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: '#/definitions/InvoiceChange'
|
||||
- type: object
|
||||
required:
|
||||
- paymentID
|
||||
- refundID
|
||||
properties:
|
||||
paymentID:
|
||||
type: string
|
||||
refundID:
|
||||
type: string
|
||||
- $ref: '#/definitions/RefundStatus'
|
@ -19,7 +19,6 @@ get:
|
||||
- unpaid
|
||||
- cancelled
|
||||
- paid
|
||||
- refunded
|
||||
- fulfilled
|
||||
- name: paymentStatus
|
||||
in: query
|
||||
@ -31,6 +30,7 @@ get:
|
||||
- processed
|
||||
- captured
|
||||
- cancelled
|
||||
- refunded
|
||||
- failed
|
||||
- name: paymentFlow
|
||||
in: query
|
||||
|
@ -20,6 +20,7 @@ get:
|
||||
- processed
|
||||
- captured
|
||||
- cancelled
|
||||
- refunded
|
||||
- failed
|
||||
- name: paymentFlow
|
||||
in: query
|
||||
|
@ -0,0 +1,44 @@
|
||||
get:
|
||||
description: Получить все возвраты указанного платежа.
|
||||
tags:
|
||||
- Payments
|
||||
operationId: getRefunds
|
||||
parameters:
|
||||
- $ref: '#/parameters/requestID'
|
||||
- $ref: '#/parameters/invoiceID'
|
||||
- $ref: '#/parameters/paymentID'
|
||||
responses:
|
||||
'200':
|
||||
description: Данные возвратов по платежу
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/Refund'
|
||||
'400':
|
||||
$ref: '#/responses/BadRequest'
|
||||
'404':
|
||||
$ref: '#/responses/NotFound'
|
||||
post:
|
||||
description: Создать возврат указанного платежа
|
||||
tags:
|
||||
- Payments
|
||||
operationId: createRefund
|
||||
parameters:
|
||||
- $ref: '#/parameters/requestID'
|
||||
- $ref: '#/parameters/invoiceID'
|
||||
- $ref: '#/parameters/paymentID'
|
||||
- name: reason
|
||||
in: body
|
||||
description: Причина совершения возврата
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/definitions/Reason'
|
||||
responses:
|
||||
'201':
|
||||
description: Возврат создан
|
||||
schema:
|
||||
$ref: '#/definitions/Refund'
|
||||
'400':
|
||||
$ref: '#/responses/BadRequest'
|
||||
'404':
|
||||
$ref: '#/responses/NotFound'
|
@ -0,0 +1,19 @@
|
||||
get:
|
||||
description: Получить данные определённого возврата указанного платежа.
|
||||
tags:
|
||||
- Payments
|
||||
operationId: getRefundByID
|
||||
parameters:
|
||||
- $ref: '#/parameters/requestID'
|
||||
- $ref: '#/parameters/invoiceID'
|
||||
- $ref: '#/parameters/paymentID'
|
||||
- $ref: '#/parameters/refundID'
|
||||
responses:
|
||||
'200':
|
||||
description: Данные возврата
|
||||
schema:
|
||||
$ref: '#/definitions/Refund'
|
||||
'400':
|
||||
$ref: '#/responses/BadRequest'
|
||||
'404':
|
||||
$ref: '#/responses/NotFound'
|
@ -145,6 +145,13 @@ parameters:
|
||||
required: true
|
||||
type: string
|
||||
maxLength: 40
|
||||
refundID:
|
||||
name: refundID
|
||||
in: path
|
||||
description: Идентификатор возврата в рамках платежа
|
||||
required: true
|
||||
type: string
|
||||
maxLength: 40
|
||||
contractID:
|
||||
name: contractID
|
||||
in: path
|
||||
|
Loading…
Reference in New Issue
Block a user