-
Notifications
You must be signed in to change notification settings - Fork 1
Main flow sequence Diagrams (Phase 2)
Italo Pessoa edited this page Jul 23, 2024
·
2 revisions
sequenceDiagram
actor HttpClient
HttpClient ->>+ OrderController: Create order
OrderController ->>+ OrderService: Send payload
OrderService ->>+ CreateOrderUseCase: Send Payload
CreateOrderUseCase ->>+ CustomerRepository: Validate customer
CustomerRepository -->>- CreateOrderUseCase: response
CreateOrderUseCase ->>+ ProductRepository: Validate Products
ProductRepository -->>- CreateOrderUseCase: response
CreateOrderUseCase ->>+ IOrderTrackingCodeService: Get order code
IOrderTrackingCodeService -->>- CreateOrderUseCase: response
CreateOrderUseCase ->>+ OrderRepository: Save order
OrderRepository -->>- CreateOrderUseCase: response
CreateOrderUseCase -->>- OrderService: response
OrderService -->>- OrderController: response
OrderController -->>- HttpClient: Update order payment id
sequenceDiagram
actor HttpClient
HttpClient ->>+ PaymentController: Create Payment
PaymentController ->>+ PaymentService: Send payload
PaymentService ->>+ CreatePaymentUseCase: Create payment
CreatePaymentUseCase ->>+ IPaymentGateway: Create payment with provider
IPaymentGateway -->>- CreatePaymentUseCase: payment created
CreatePaymentUseCase ->>+ IPaymentRepository: Save payment on database
IPaymentRepository -->>- CreatePaymentUseCase: Payment saved
CreatePaymentUseCase -->>- PaymentService: return Payment
alt update order payment
PaymentService ->>+ UpdareOrderPaymentUseCase: Update order payment Id
UpdareOrderPaymentUseCase -->>- PaymentService: respose
end
PaymentService -->>- PaymentController: Order id
PaymentController -->>- HttpClient: Order id
sequenceDiagram
actor MercadoPago
MercadoPago ->>+ WebhookController: Send notification
WebhookController ->>+ MercadoPagoHmacSignatureValidator: Validate HMAC
MercadoPagoHmacSignatureValidator -->>- WebhookController: validation response
WebhookController -->>- MercadoPago: confirm notification received
WebhookController ->>+ PaymentService: SyncPaymentStatusWithGatewayAsync
PaymentService ->>+ PaymentRepository: Check if Payment exists
PaymentRepository -->>- PaymentService: response
PaymentService ->>+ IPaymentGateway: Get Payment status
IPaymentGateway -->>- PaymentService: response
PaymentService ->>+ UpdatePaymentStatusUseCase: Update payment status
alt if payment is Approved
UpdatePaymentStatusUseCase ->>+ UpdateOrderStatusUseCase: Raise PaymentStatusUpdated event
UpdateOrderStatusUseCase -->>- UpdatePaymentStatusUseCase: response
end
UpdatePaymentStatusUseCase -->>- PaymentService: response
PaymentService -->>- WebhookController: response
If you find yourself lost in this Wiki, don't worry, we're all lost together.
- What's the Tech Challenge
- DDD Artifacts
- Event Storming
- Architecture
- Integrations
- Business Requirements