Skip to content

Commit

Permalink
task Yandex-Practicum#2: add solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonboom committed Oct 28, 2024
1 parent 8d82fe9 commit af4c9e3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,9 @@ $ npm run start # 3005 port
$ cd main
$ npm run start # 3000 port
```

## Задание 2

См. [./task2](./task2)

draw.io diagram – https://drive.google.com/file/d/1jYXtm3Q6eyCl1L4ptQ_8icRrmPVvCTBR/view?usp=sharing
Binary file added task2/sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions task2/sequence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@startuml
actor "Клиент" as Client
participant "Портал площадки" as Frontend
participant "API Gateway" as Gateway
participant "BFF для портала" as BFF
participant "Сервис пользователей" as UserService
participant "Севрис торговых площадок и товаров" as ProductService
participant "Сервис заказов" as OrderService
participant "Платёжный сервис" as PaymentService
participant "Внешняя платёжная система" as ExternalPaymentSystem
participant "Сервис уведомлений" as NotificationService
participant "Шина событий" as EventBus
participant "Vertica" as DWH

Client -> Frontend: Open Portal
Frontend -> Gateway: Authenticate Client
Gateway -> UserService: Verify Credentials
UserService -> Gateway: Authentication Response
Gateway -> Frontend: Authentication Success

Client -> Frontend: Search for Product
Frontend -> Gateway: Request Product List
Gateway -> BFF: Request Product List
BFF -> ProductService: Fetch Products from Marketplaces
ProductService -> BFF: Return Products
BFF -> Gateway: Forward Product List
Gateway -> Frontend: Display Products

Client -> Frontend: Place Order
Frontend -> Gateway: Create Order
Gateway -> BFF: Create Order Request
BFF -> OrderService: Validate Order & Create
OrderService -> ProductService: Reserve Product
ProductService -> OrderService: Product Reserved
OrderService -> BFF: Order Created
BFF -> Gateway: Order Confirmation
Gateway -> Frontend: Show Order Confirmation

Client -> Frontend: Proceed to Payment
Frontend -> Gateway: Initiate Payment
Gateway -> BFF: Payment Request
BFF -> PaymentService: Process Payment

PaymentService -> ExternalPaymentSystem: Execute Payment
ExternalPaymentSystem -> PaymentService: Payment Confirmation

PaymentService -> BFF: Payment Successful
BFF -> Gateway: Payment Status
Gateway -> Frontend: Show Payment Confirmation

OrderService -> EventBus: Publish "Order Created"
EventBus -> NotificationService: Order Created Event
NotificationService -> Client: Notify "Order Created"

PaymentService -> EventBus: Publish "Order Paid"
EventBus -> NotificationService: Order Paid Event
NotificationService -> Client: Notify "Order Paid"

OrderService -> DWH: Log Order Data
PaymentService -> DWH: Log Payment Data

@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af4c9e3

Please sign in to comment.