修改接口定义,增加了退款接口
diff --git a/payapi-spec/consumeapi.yaml b/payapi-spec/consumeapi.yaml
index 1aa2630..80df543 100644
--- a/payapi-spec/consumeapi.yaml
+++ b/payapi-spec/consumeapi.yaml
@@ -1,17 +1,5 @@
components:
schemas:
- ErrorResponse:
- type: object
- title: 请求错误
- required:
- - message
- properties:
- code:
- type: string
- title: 错误码
- message:
- type: string
- title: 错误信息
QrcodePayInitRequest:
type: object
title: QrCode请求初始化
@@ -97,12 +85,47 @@
title: 交易描述
result:
title: 交易结果
- type: string
- enum:
- - success
- - require_query
- - already_success
- - failed
+ $ref: 'definitions.yaml#/components/schemas/TransResult'
+ RefundRequest:
+ type: object
+ title: 退款申请
+ required:
+ - billno
+ - transDate
+ - transTime
+ - refno
+ - amount
+ properties:
+ billno:
+ title: 退款申请订单号
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ transDate:
+ $ref: 'definitions.yaml#/components/schemas/TransDate'
+ transTime:
+ $ref: 'definitions.yaml#/components/schemas/TransTime'
+ refno:
+ title: 退款申请原始订单交易参考号
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ amount:
+ type: integer
+ title: 退款金额, 正式
+ RefundResponse:
+ type: object
+ title: 退款申请应答
+ properties:
+ billno:
+ title: 退款申请订单号
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ hostDate:
+ $ref: 'definitions.yaml#/components/schemas/TransDate'
+ hostTime:
+ $ref: 'definitions.yaml#/components/schemas/TransTime'
+ refno:
+ title: 退款申请原始订单交易参考号
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ result:
+ title: 退款处理结果
+ $ref: 'definitions.yaml#/components/schemas/TransResult'
paths:
qrcodePayInit:
@@ -130,7 +153,8 @@
description: 请求错误
content:
application/json:
- $ref: '#/components/schemas/ErrorResponse'
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
qrcodePayConfirm:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
@@ -155,12 +179,14 @@
description: 交易正忙,稍后重试
content:
application/json:
- $ref: '#/components/schemas/ErrorResponse'
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
'default':
description: 交易失败
content:
application/json:
- $ref: '#/components/schemas/ErrorResponse'
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
qrcodePayQuery:
parameters:
- $ref: 'definitions.yaml#/components/headers/TenantId'
@@ -181,10 +207,77 @@
description: 查询成功
content:
application/json:
- $ref: '#/components/schemas/QrcodePayConfirmResponse'
+ schema:
+ $ref: '#/components/schemas/QrcodePayConfirmResponse'
'default':
description: 查询失败
content:
application/json:
- $ref: '#/components/schemas/ErrorResponse'
-
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ refund:
+ parameters:
+ - $ref: 'definitions.yaml#/components/headers/TenantId'
+ post:
+ description: 退款交易
+ tags:
+ - pos
+ operationId: refund
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/RefundRequest'
+ responses:
+ '200':
+ description: 退款申请成功,等待查询
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/RefundResponse'
+ '409':
+ description: 退款申请失败,订单号已存在或正在退款中
+ content:
+ application/json:
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ description: 退款申请失败
+ content:
+ application/json:
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ refundQuery:
+ parameters:
+ - $ref: 'definitions.yaml#/components/headers/TenantId'
+ - name: billno
+ in: path
+ description: 退款订单号
+ required: true
+ schema:
+ type: string
+ title: 退款订单号
+ get:
+ description: 退款申请查询
+ tags:
+ - pos
+ operationId: refundQuery
+ responses:
+ '200':
+ description: 退款申请查询成功
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/RefundResponse'
+ '404':
+ description: 退款申请订单不存在
+ content:
+ application/json:
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ description: 退款申请失败
+ content:
+ application/json:
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
diff --git a/payapi-spec/definitions.yaml b/payapi-spec/definitions.yaml
index fea5324..89e374d 100644
--- a/payapi-spec/definitions.yaml
+++ b/payapi-spec/definitions.yaml
@@ -10,6 +10,18 @@
schemas:
+ ErrorResponse:
+ type: object
+ title: 请求错误
+ required:
+ - message
+ properties:
+ code:
+ type: string
+ title: 错误码
+ message:
+ type: string
+ title: 错误信息
TransDate:
type: string
title: 交易日期
@@ -38,3 +50,10 @@
- plain
- base64
- hex
+ TransResult:
+ type: string
+ enum:
+ - success
+ - failed
+ - already_success
+ - require_query
diff --git a/payapi-spec/payapi-spec.yaml b/payapi-spec/payapi-spec.yaml
index 1b432bc..0c8efe9 100644
--- a/payapi-spec/payapi-spec.yaml
+++ b/payapi-spec/payapi-spec.yaml
@@ -11,3 +11,7 @@
$ref: consumeapi.yaml#/components/paths/qrcodePayConfirm
/consume/qrcode/query/{refno}:
$ref: consumeapi.yaml#/components/paths/qrcodePayQuery
+ /consume/refund:
+ $ref: consumeapi.yaml#/components/paths/refund
+ /consume/refund/query/{billno}:
+ $ref: consumeapi.yaml#/components/paths/refundQuery