增加账户相关接口
diff --git a/payapi-spec/accountapi.yaml b/payapi-spec/accountapi.yaml
index 08c83a0..043f4fd 100644
--- a/payapi-spec/accountapi.yaml
+++ b/payapi-spec/accountapi.yaml
@@ -41,7 +41,7 @@
title: 子账户列表
items:
title: 子账户属性
- $ref: 'definitions.yaml#/components/schemas/SubAccountMetadata'
+ $ref: 'definitions.yaml#/components/schemas/SubAccountBalance'
PreAuthorizedDebitRequest:
type: object
title: 预授权交易请求
@@ -168,6 +168,79 @@
realAmount:
title: 实际扣款金额(分)
type: integer
+ SubAccountPayRequest:
+ type: object
+ description: 子账户消费接口
+ required:
+ - billno
+ - shopaccno
+ - transDate
+ - transTime
+ - amount
+ - overdraft
+ - accountList
+ properties:
+ billno:
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ shopaccno:
+ $ref: 'definitions.yaml#/components/schemas/ShopAccNo'
+ transDate:
+ $ref: 'definitions.yaml#/components/schemas/TransDate'
+ transTime:
+ $ref: 'definitions.yaml#/components/schemas/TransTime'
+ userid:
+ title: 用户ID
+ type: string
+ amount:
+ title: 扣款金额(分)
+ type: integer
+ overdraft:
+ type: boolean
+ title: 是否允许主账户透支
+ useMainAccount:
+ type: boolean
+ title: 是否扣款账户
+ accountList:
+ type: array
+ description: 按照账户列表顺序扣款
+ items:
+ type: object
+ description: 扣款账户列表
+ properties:
+ name:
+ type: string
+ title: 账户名
+ SubAccountPayResponse:
+ type: object
+ description: 账户消费应答
+ properties:
+ refno:
+ $ref: 'definitions.yaml#/components/schemas/Refno'
+ hostDate:
+ $ref: 'definitions.yaml#/components/schemas/TransDate'
+ hostTime:
+ $ref: 'definitions.yaml#/components/schemas/TransTime'
+ result:
+ $ref: 'definitions.yaml#/components/schemas/TransResult'
+ description:
+ title: 扣款情况描述
+ type: string
+ accountList:
+ type: array
+ description: 账户扣款情况
+ items:
+ type: object
+ description: 账户结果
+ properties:
+ name:
+ title: 账户名
+ type: string
+ payAmount:
+ title: 扣款金额
+ type: integer
+ aftbal:
+ title: 交易后余额
+ type: integer
paths:
accountQuery:
@@ -195,7 +268,7 @@
application/json:
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
- default:
+ '500':
$ref: 'definitions.yaml#/components/responses/CommonError'
accountPay:
parameters:
@@ -203,6 +276,7 @@
post:
tags:
- pos
+ - pay
requestBody:
description: 主账户余额消费
content:
@@ -225,14 +299,47 @@
application/json:
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
- default:
+ '500':
$ref: 'definitions.yaml#/components/responses/CommonError'
+ subaccPay:
+ parameters:
+ - $ref: definitions.yaml#/components/headers/TenantId
+ post:
+ tags:
+ - pay
+ requestBody:
+ description: |
+ 子账户消费, 请求时指定扣款列表,系统安装账户顺序扣款
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SubAccountPayRequest'
+ responses:
+ '200':
+ description: 扣款成功
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SubAccountPayResponse'
+ '400':
+ description: |
+ 扣款失败, code 定义错误信息
+ * short_of_balance 余额不足
+ * account_status_error 账户状态异常
+ content:
+ application/json:
+ schema:
+ $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ '500':
+ $ref: 'definitions.yaml#/components/responses/CommonError'
+
accountPreAuthorizedDebit:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
post:
tags:
- pos
+ - pay
requestBody:
description: 账户预授权交易
content:
@@ -246,7 +353,7 @@
application/json:
schema:
$ref: '#/components/schemas/PreAuthorizedDebitResponse'
- default:
+ '500':
$ref: 'definitions.yaml#/components/responses/CommonError'
accountPreAuthorizedSettle:
parameters:
@@ -254,6 +361,7 @@
post:
tags:
- pos
+ - pay
requestBody:
description: 预授权交易清算
content:
@@ -267,6 +375,23 @@
application/json:
schema:
$ref: '#/components/schemas/PreAuthorizedSettleResponse'
- default:
+ '500':
+ $ref: 'definitions.yaml#/components/responses/CommonError'
+ querySubAccountMetadata:
+ parameters:
+ - $ref: definitions.yaml#/components/headers/TenantId
+ get:
+ tags:
+ - sa
+ responses:
+ '200':
+ description: 子账户元数据信息
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: 'definitions.yaml#/components/schemas/SubAccountMetadata'
+ '500':
$ref: 'definitions.yaml#/components/responses/CommonError'