[hw-6] add notifier service, kafka

This commit is contained in:
Никита Шубин
2025-07-17 19:20:27 +00:00
parent 424d6905da
commit 6e1ad86128
33 changed files with 1412 additions and 92 deletions

View File

@@ -1,5 +1,5 @@
### create normal order
POST http://192.168.64.4:8084/order/create
POST http://localhost:8084/order/create
Content-Type: application/json
{
@@ -19,14 +19,14 @@ Content-Type: application/json
### get info, assert status="awaiting payment"
GET http://192.168.64.4:8084/order/info?orderId=1
GET http://localhost:8084/order/info?orderId=1
Content-Type: application/json
### expected: 200 (OK) {"status":"awaiting payment","user":31337,"Items":[{"sku":1076963,"count":3},{"sku":135717466,"count":2}]}
### pay order
POST http://192.168.64.4:8084/order/pay
POST http://localhost:8084/order/pay
Content-Type: application/json
{
@@ -36,14 +36,14 @@ Content-Type: application/json
### check actual status is "payed"
GET http://192.168.64.4:8084/order/info?orderId=1
GET http://localhost:8084/order/info?orderId=1
Content-Type: application/json
### expected: 200 (OK) {"status":"payed","user":31337,"Items":[{"sku":1076963,"count":3},{"sku":135717466,"count":2}]}
### unable to cancel payed order
POST http://192.168.64.4:8084/order/cancel
POST http://localhost:8084/order/cancel
Content-Type: application/json
{
@@ -53,14 +53,14 @@ Content-Type: application/json
### get unknown order
GET http://192.168.64.4:8084/order/info?orderId=404
GET http://localhost:8084/order/info?orderId=404
Content-Type: application/json
### expected: 404 (Not Found) {"code": 5, ... }
### cancel order not exists
POST http://192.168.64.4:8084/order/cancel
POST http://localhost:8084/order/cancel
Content-Type: application/json
{
@@ -70,7 +70,7 @@ Content-Type: application/json
### create order with item that has no stocks info
POST http://192.168.64.4:8084/order/create
POST http://localhost:8084/order/create
Content-Type: application/json
{
@@ -86,13 +86,13 @@ Content-Type: application/json
### check order status is failed (not necessary, because no orderId after creation if any fails)
GET http://192.168.64.4:8084/order/info?orderId=2
GET http://localhost:8084/order/info?orderId=2
Content-Type: application/json
### expected: 200 (OK) {"status":"failed","userId":31337,"Items":[{"sku":404,"count":3}]}
### cancel failed order
POST http://192.168.64.4:8084/order/cancel
POST http://localhost:8084/order/cancel
Content-Type: application/json
{
@@ -102,21 +102,21 @@ Content-Type: application/json
### stock info for unknown sku
GET http://192.168.64.4:8084/stock/info?sku=404
GET http://localhost:8084/stock/info?sku=404
Content-Type: application/json
### expected: 404 Not Found {"code":5, ... }
### stock info for normal sku
GET http://192.168.64.4:8084/stock/info?sku=135717466
GET http://localhost:8084/stock/info?sku=135717466
Content-Type: application/json
### expected: 200 (OK) {"count":78}
### create order with count for sku more than stock
POST http://192.168.64.4:8084/order/create
POST http://localhost:8084/order/create
Content-Type: application/json
{
@@ -131,13 +131,13 @@ Content-Type: application/json
### expected: 400 (Bad Request) {"code":9, ... }
### no change in stock info after failed order creation
GET http://192.168.64.4:8084/stock/info?sku=135717466
GET http://localhost:8084/stock/info?sku=135717466
Content-Type: application/json
### expected: 200 (OK) {"count":78}
### create normal order for cancellation
POST http://192.168.64.4:8084/order/create
POST http://localhost:8084/order/create
Content-Type: application/json
{
@@ -153,7 +153,7 @@ Content-Type: application/json
### cancel order
POST http://192.168.64.4:8084/order/cancel
POST http://localhost:8084/order/cancel
Content-Type: application/json
{
@@ -163,14 +163,14 @@ Content-Type: application/json
### check canceled order status
GET http://192.168.64.4:8084/order/info?orderId=4
GET http://localhost:8084/order/info?orderId=4
Content-Type: application/json
### expected: {"status":"cancelled","user":31337,"Items":[{"sku":1076963,"count":2}]}
### check stocks returns
GET http://192.168.64.4:8084/stock/info?sku=135717466
GET http://localhost:8084/stock/info?sku=135717466
Content-Type: application/json
### expected: {"count":78}; 200 OK