优化
增加账户相关交易接口
增加专款账户设计
优化错误返回结果
diff --git a/payapi-spec/accountapi.yaml b/payapi-spec/accountapi.yaml
index 93b7ad6..08c83a0 100644
--- a/payapi-spec/accountapi.yaml
+++ b/payapi-spec/accountapi.yaml
@@ -13,6 +13,8 @@
title: 子账户列表
type: array
items:
+ description: |
+ 需要查询的子账户名,如果查询所有子账户可以用 ['*'] 来查询
type: string
title: 子账户ID
AccountQueryResponse:
@@ -45,7 +47,6 @@
title: 预授权交易请求
required:
- userid
- - accountType
- preAuthorizedAmount
- shopaccno
- transDate
@@ -56,8 +57,8 @@
userid:
title: 用户ID
type: string
- accountType:
- title: 账户类型
+ accountName:
+ title: 账户名
type: string
preAuthorizedAmount:
title: 预授权金额(分)
@@ -114,7 +115,7 @@
type: integer
AccountPayRequest:
type: object
- title: 账户余额扣款交易
+ title: 主账户余额扣款交易
required:
- billno
- shopaccno
@@ -139,6 +140,9 @@
amount:
title: 扣款金额(分)
type: integer
+ accountName:
+ title: 账户名
+ type: string
description:
title: 交易描述
type: string
@@ -149,6 +153,8 @@
AccountPayResponse:
type: object
title: 账户余额扣款交易应答
+ required:
+ - refno
properties:
refno:
title: 系统交易参考号
@@ -159,7 +165,9 @@
aftbal:
title: 账户余额(分)
type: integer
-
+ realAmount:
+ title: 实际扣款金额(分)
+ type: integer
paths:
accountQuery:
@@ -188,11 +196,7 @@
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
default:
- description: 查询错误
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ $ref: 'definitions.yaml#/components/responses/CommonError'
accountPay:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
@@ -200,7 +204,7 @@
tags:
- pos
requestBody:
- description: 账户余额消费
+ description: 主账户余额消费
content:
application/json:
schema:
@@ -212,12 +216,17 @@
application/json:
schema:
$ref: '#/components/schemas/AccountPayResponse'
- default:
- description: 消费失败
+ '400':
+ description: |
+ 消费失败, code 用于定义错误信息
+ * short_of_balance 余额不足
+ * account_status_error 账户状态异常
content:
application/json:
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
accountPreAuthorizedDebit:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
@@ -237,6 +246,8 @@
application/json:
schema:
$ref: '#/components/schemas/PreAuthorizedDebitResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
accountPreAuthorizedSettle:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
@@ -249,7 +260,6 @@
application/json:
schema:
$ref: '#/components/schemas/PreAuthorizedSettleRequest'
-
responses:
'200':
description: 预授权交易清算成功
@@ -257,4 +267,6 @@
application/json:
schema:
$ref: '#/components/schemas/PreAuthorizedSettleResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
diff --git a/payapi-spec/build.gradle b/payapi-spec/build.gradle
index c4bc7c9..57f22e8 100644
--- a/payapi-spec/build.gradle
+++ b/payapi-spec/build.gradle
@@ -34,6 +34,10 @@
interfaceOnly : "true",
generateAliasAsModel : "false"
]
+
+ systemProperties = [
+ "hideGenerationTimestamp": true
+ ]
}
task copyApiSrc(type: Copy) {
diff --git a/payapi-spec/consumeapi.yaml b/payapi-spec/consumeapi.yaml
index 1df2d8c..a9b91b9 100644
--- a/payapi-spec/consumeapi.yaml
+++ b/payapi-spec/consumeapi.yaml
@@ -149,12 +149,8 @@
application/json:
schema:
$ref: '#/components/schemas/QrcodePayInitResponse'
- 'default':
- description: 请求错误
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
qrcodePayConfirm:
parameters:
- $ref: definitions.yaml#/components/headers/TenantId
@@ -181,12 +177,8 @@
application/json:
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
- 'default':
- description: 交易失败
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
qrcodePayQuery:
parameters:
- $ref: 'definitions.yaml#/components/headers/TenantId'
@@ -209,12 +201,8 @@
application/json:
schema:
$ref: '#/components/schemas/QrcodePayConfirmResponse'
- 'default':
- description: 查询失败
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ default:
+ $ref: 'definitions.yaml#/components/responses/CommonError'
refund:
parameters:
- $ref: 'definitions.yaml#/components/headers/TenantId'
@@ -236,17 +224,14 @@
schema:
$ref: '#/components/schemas/RefundResponse'
'409':
- description: 退款申请失败,订单号已存在或正在退款中
+ description: |
+ 退款申请失败,订单号已存在或正在退款中
content:
application/json:
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
default:
- description: 退款申请失败
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ $ref: 'definitions.yaml#/components/responses/CommonError'
refundQuery:
parameters:
- $ref: 'definitions.yaml#/components/headers/TenantId'
@@ -276,8 +261,4 @@
schema:
$ref: 'definitions.yaml#/components/schemas/ErrorResponse'
default:
- description: 退款申请失败
- content:
- application/json:
- schema:
- $ref: 'definitions.yaml#/components/schemas/ErrorResponse'
+ $ref: 'definitions.yaml#/components/responses/CommonError'
diff --git a/payapi-spec/definitions.yaml b/payapi-spec/definitions.yaml
index 4ca2848..ed1adb4 100644
--- a/payapi-spec/definitions.yaml
+++ b/payapi-spec/definitions.yaml
@@ -8,6 +8,14 @@
schema:
type: string
+ responses:
+ CommonError:
+ description: 请求失败
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+
schemas:
ErrorResponse:
@@ -60,3 +68,36 @@
- failed
- already_success
- require_query
+ UserStatus:
+ type: string
+ description: |
+ * normal 正常
+ * frozen 冻结
+ * canceled 注销
+ * closed 关闭
+ * notexists 不存在
+ enum:
+ - normal
+ - fronzen
+ - canceled
+ - closed
+ - notexists
+ SubAccountMetadata:
+ type: object
+ required:
+ - name
+ - status
+ properties:
+ name:
+ type: string
+ title: 子账户名
+ status:
+ title: 子账户状态
+ $ref: '#/components/schemas/UserStatus'
+ balance:
+ type: integer
+ title: 子账户余额
+ expire:
+ type: string
+ title: 余额有效期
+ format: date-time
diff --git a/payapi-spec/payapi-spec.yaml b/payapi-spec/payapi-spec.yaml
index 0c8efe9..b00d7ed 100644
--- a/payapi-spec/payapi-spec.yaml
+++ b/payapi-spec/payapi-spec.yaml
@@ -15,3 +15,11 @@
$ref: consumeapi.yaml#/components/paths/refund
/consume/refund/query/{billno}:
$ref: consumeapi.yaml#/components/paths/refundQuery
+ /account/query:
+ $ref: accountapi.yaml#/components/paths/accountQuery
+ /account/apy:
+ $ref: accountapi.yaml#/components/paths/accountPay
+ /account/preAuthorizedDebit:
+ $ref: accountapi.yaml#/components/paths/accountPreAuthorizedDebit
+ /account/preAuthorizedSettle:
+ $ref: accountapi.yaml#/components/paths/accountPreAuthorizedSettle