Skip to content

Commit 554fdd6

Browse files
authored
feat: add POST method for /v3/transactions (#838)
1 parent 0878cda commit 554fdd6

21 files changed

+508
-44
lines changed

api/docs.go

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,6 +3958,56 @@ const docTemplate = `{
39583958
}
39593959
}
39603960
},
3961+
"post": {
3962+
"description": "Creates transactions from the list of submitted transaction data. The response code is the highest response code number that a single transaction creation would have caused. If it is not equal to 201, at least one transaction has an error.",
3963+
"produces": [
3964+
"application/json"
3965+
],
3966+
"tags": [
3967+
"Transactions"
3968+
],
3969+
"summary": "Create transactions",
3970+
"parameters": [
3971+
{
3972+
"description": "Transactions",
3973+
"name": "transactions",
3974+
"in": "body",
3975+
"required": true,
3976+
"schema": {
3977+
"type": "array",
3978+
"items": {
3979+
"$ref": "#/definitions/models.TransactionCreate"
3980+
}
3981+
}
3982+
}
3983+
],
3984+
"responses": {
3985+
"201": {
3986+
"description": "Created",
3987+
"schema": {
3988+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3989+
}
3990+
},
3991+
"400": {
3992+
"description": "Bad Request",
3993+
"schema": {
3994+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3995+
}
3996+
},
3997+
"404": {
3998+
"description": "Not Found",
3999+
"schema": {
4000+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
4001+
}
4002+
},
4003+
"500": {
4004+
"description": "Internal Server Error",
4005+
"schema": {
4006+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
4007+
}
4008+
}
4009+
}
4010+
},
39614011
"options": {
39624012
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
39634013
"tags": [
@@ -4882,7 +4932,7 @@ const docTemplate = `{
48824932
"example": "Lunch"
48834933
},
48844934
"reconciled": {
4885-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
4935+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
48864936
"type": "boolean",
48874937
"default": false,
48884938
"example": true
@@ -4911,6 +4961,22 @@ const docTemplate = `{
49114961
}
49124962
}
49134963
},
4964+
"controllers.TransactionCreateResponseV3": {
4965+
"type": "object",
4966+
"properties": {
4967+
"data": {
4968+
"description": "List of created transactions",
4969+
"type": "array",
4970+
"items": {
4971+
"$ref": "#/definitions/controllers.TransactionResponseV3"
4972+
}
4973+
},
4974+
"error": {
4975+
"description": "The error, if any occurred",
4976+
"type": "string"
4977+
}
4978+
}
4979+
},
49144980
"controllers.TransactionListResponse": {
49154981
"type": "object",
49164982
"properties": {
@@ -4960,6 +5026,23 @@ const docTemplate = `{
49605026
}
49615027
}
49625028
},
5029+
"controllers.TransactionResponseV3": {
5030+
"type": "object",
5031+
"properties": {
5032+
"data": {
5033+
"description": "The transaction data, if creation was successful",
5034+
"allOf": [
5035+
{
5036+
"$ref": "#/definitions/controllers.TransactionV3"
5037+
}
5038+
]
5039+
},
5040+
"error": {
5041+
"description": "The error, if any occurred for this transaction",
5042+
"type": "string"
5043+
}
5044+
}
5045+
},
49635046
"controllers.TransactionV2": {
49645047
"type": "object",
49655048
"properties": {
@@ -5033,7 +5116,7 @@ const docTemplate = `{
50335116
"example": "Lunch"
50345117
},
50355118
"reconciled": {
5036-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5119+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
50375120
"type": "boolean",
50385121
"default": false,
50395122
"example": true
@@ -5135,7 +5218,7 @@ const docTemplate = `{
51355218
"example": "Lunch"
51365219
},
51375220
"reconciled": {
5138-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5221+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
51395222
"type": "boolean",
51405223
"default": false,
51415224
"example": true
@@ -5792,7 +5875,7 @@ const docTemplate = `{
57925875
"example": "Lunch"
57935876
},
57945877
"reconciled": {
5795-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5878+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
57965879
"type": "boolean",
57975880
"default": false,
57985881
"example": true

api/swagger.json

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,6 +3947,56 @@
39473947
}
39483948
}
39493949
},
3950+
"post": {
3951+
"description": "Creates transactions from the list of submitted transaction data. The response code is the highest response code number that a single transaction creation would have caused. If it is not equal to 201, at least one transaction has an error.",
3952+
"produces": [
3953+
"application/json"
3954+
],
3955+
"tags": [
3956+
"Transactions"
3957+
],
3958+
"summary": "Create transactions",
3959+
"parameters": [
3960+
{
3961+
"description": "Transactions",
3962+
"name": "transactions",
3963+
"in": "body",
3964+
"required": true,
3965+
"schema": {
3966+
"type": "array",
3967+
"items": {
3968+
"$ref": "#/definitions/models.TransactionCreate"
3969+
}
3970+
}
3971+
}
3972+
],
3973+
"responses": {
3974+
"201": {
3975+
"description": "Created",
3976+
"schema": {
3977+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3978+
}
3979+
},
3980+
"400": {
3981+
"description": "Bad Request",
3982+
"schema": {
3983+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3984+
}
3985+
},
3986+
"404": {
3987+
"description": "Not Found",
3988+
"schema": {
3989+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3990+
}
3991+
},
3992+
"500": {
3993+
"description": "Internal Server Error",
3994+
"schema": {
3995+
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
3996+
}
3997+
}
3998+
}
3999+
},
39504000
"options": {
39514001
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
39524002
"tags": [
@@ -4871,7 +4921,7 @@
48714921
"example": "Lunch"
48724922
},
48734923
"reconciled": {
4874-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
4924+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
48754925
"type": "boolean",
48764926
"default": false,
48774927
"example": true
@@ -4900,6 +4950,22 @@
49004950
}
49014951
}
49024952
},
4953+
"controllers.TransactionCreateResponseV3": {
4954+
"type": "object",
4955+
"properties": {
4956+
"data": {
4957+
"description": "List of created transactions",
4958+
"type": "array",
4959+
"items": {
4960+
"$ref": "#/definitions/controllers.TransactionResponseV3"
4961+
}
4962+
},
4963+
"error": {
4964+
"description": "The error, if any occurred",
4965+
"type": "string"
4966+
}
4967+
}
4968+
},
49034969
"controllers.TransactionListResponse": {
49044970
"type": "object",
49054971
"properties": {
@@ -4949,6 +5015,23 @@
49495015
}
49505016
}
49515017
},
5018+
"controllers.TransactionResponseV3": {
5019+
"type": "object",
5020+
"properties": {
5021+
"data": {
5022+
"description": "The transaction data, if creation was successful",
5023+
"allOf": [
5024+
{
5025+
"$ref": "#/definitions/controllers.TransactionV3"
5026+
}
5027+
]
5028+
},
5029+
"error": {
5030+
"description": "The error, if any occurred for this transaction",
5031+
"type": "string"
5032+
}
5033+
}
5034+
},
49525035
"controllers.TransactionV2": {
49535036
"type": "object",
49545037
"properties": {
@@ -5022,7 +5105,7 @@
50225105
"example": "Lunch"
50235106
},
50245107
"reconciled": {
5025-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5108+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
50265109
"type": "boolean",
50275110
"default": false,
50285111
"example": true
@@ -5124,7 +5207,7 @@
51245207
"example": "Lunch"
51255208
},
51265209
"reconciled": {
5127-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5210+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
51285211
"type": "boolean",
51295212
"default": false,
51305213
"example": true
@@ -5781,7 +5864,7 @@
57815864
"example": "Lunch"
57825865
},
57835866
"reconciled": {
5784-
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
5867+
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
57855868
"type": "boolean",
57865869
"default": false,
57875870
"example": true

api/swagger.yaml

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ definitions:
648648
default: false
649649
description: DEPRECATED. Do not use, this field does not work as intended.
650650
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
651-
and reconciledDestination instead.
651+
and reconciledDestination instead. This field will be removed in 4.0.0
652652
example: true
653653
type: boolean
654654
reconciledDestination:
@@ -670,6 +670,17 @@ definitions:
670670
example: "2022-04-17T20:14:01.048145Z"
671671
type: string
672672
type: object
673+
controllers.TransactionCreateResponseV3:
674+
properties:
675+
data:
676+
description: List of created transactions
677+
items:
678+
$ref: '#/definitions/controllers.TransactionResponseV3'
679+
type: array
680+
error:
681+
description: The error, if any occurred
682+
type: string
683+
type: object
673684
controllers.TransactionListResponse:
674685
properties:
675686
data:
@@ -700,6 +711,16 @@ definitions:
700711
- $ref: '#/definitions/controllers.Transaction'
701712
description: Data for the transaction
702713
type: object
714+
controllers.TransactionResponseV3:
715+
properties:
716+
data:
717+
allOf:
718+
- $ref: '#/definitions/controllers.TransactionV3'
719+
description: The transaction data, if creation was successful
720+
error:
721+
description: The error, if any occurred for this transaction
722+
type: string
723+
type: object
703724
controllers.TransactionV2:
704725
properties:
705726
amount:
@@ -765,7 +786,7 @@ definitions:
765786
default: false
766787
description: DEPRECATED. Do not use, this field does not work as intended.
767788
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
768-
and reconciledDestination instead.
789+
and reconciledDestination instead. This field will be removed in 4.0.0
769790
example: true
770791
type: boolean
771792
reconciledDestination:
@@ -852,7 +873,7 @@ definitions:
852873
default: false
853874
description: DEPRECATED. Do not use, this field does not work as intended.
854875
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
855-
and reconciledDestination instead.
876+
and reconciledDestination instead. This field will be removed in 4.0.0
856877
example: true
857878
type: boolean
858879
reconciledDestination:
@@ -1375,7 +1396,7 @@ definitions:
13751396
default: false
13761397
description: DEPRECATED. Do not use, this field does not work as intended.
13771398
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
1378-
and reconciledDestination instead.
1399+
and reconciledDestination instead. This field will be removed in 4.0.0
13791400
example: true
13801401
type: boolean
13811402
reconciledDestination:
@@ -4221,6 +4242,42 @@ paths:
42214242
summary: Allowed HTTP verbs
42224243
tags:
42234244
- Transactions
4245+
post:
4246+
description: Creates transactions from the list of submitted transaction data.
4247+
The response code is the highest response code number that a single transaction
4248+
creation would have caused. If it is not equal to 201, at least one transaction
4249+
has an error.
4250+
parameters:
4251+
- description: Transactions
4252+
in: body
4253+
name: transactions
4254+
required: true
4255+
schema:
4256+
items:
4257+
$ref: '#/definitions/models.TransactionCreate'
4258+
type: array
4259+
produces:
4260+
- application/json
4261+
responses:
4262+
"201":
4263+
description: Created
4264+
schema:
4265+
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
4266+
"400":
4267+
description: Bad Request
4268+
schema:
4269+
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
4270+
"404":
4271+
description: Not Found
4272+
schema:
4273+
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
4274+
"500":
4275+
description: Internal Server Error
4276+
schema:
4277+
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
4278+
summary: Create transactions
4279+
tags:
4280+
- Transactions
42244281
/version:
42254282
get:
42264283
description: Returns the software version of the API

0 commit comments

Comments
 (0)