soat-fiap / FIAP.TechChallenge.ByteMeBurger

Repository for FIAP SOAT post degree Tech Challenge
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Create Payment Feature #97

Open italopessoa opened 2 weeks ago

italopessoa commented 2 weeks ago

Create a new feature to allow the user to create a payment for an order

italopessoa commented 2 weeks ago

@coderabbitai create mermaid sequenceDiagram graph

coderabbitai[bot] commented 2 weeks ago

[!TIP] For best results, initiate chat on the files or code changes.

@italopessoa Here's a high-level Mermaid sequence diagram for the payment creation feature based on the objectives you've outlined in the PR:

sequenceDiagram
    participant U as User
    participant EP as Payment Endpoint
    participant PS as Payment Service
    participant PR as Payment Repository
    participant MP as MercadoPago Gateway
    participant DB as Database

    U->>EP: Request to create payment (POST /createPayment)
    EP->>PS: call createPaymentForOrder(orderDetails)
    PS->>MP: call CreateQrCodePayment(order)
    MP-->>PS: Return paymentId, QrCode
    PS->>PR: saveOrderPayment(paymentDetails)
    PR->>DB: Insert into OrderPayment
    DB-->>PR: Confirmation
    PR-->>PS: Confirmation
    PS-->>EP: Payment details (paymentId, QrCode)
    EP-->>U: Response with payment details

This diagram illustrates the flow from the user making a request to create a payment, through the system's backend, interacting with the MercadoPago gateway, and saving the payment details in the database. If there are specific methods or interactions that need to be detailed further, please let me know!

italopessoa commented 2 weeks ago

@coderabbitai create mermaid sequenceDiagram graph

italopessoa commented 2 weeks ago

@coderabbitai create mermaid sequenceDiagram graph

coderabbitai[bot] commented 2 weeks ago

[!TIP] For best results, initiate chat on the files or code changes.

@italopessoa Based on your repeated requests for a sequence diagram, I've reviewed the previous diagram and made some adjustments to provide more detail. Here's an updated Mermaid sequence diagram for the payment creation feature:

sequenceDiagram
    participant U as User
    participant EP as Payment Endpoint
    participant PS as Payment Service
    participant OR as Order Repository
    participant MP as MercadoPago Gateway
    participant PR as Payment Repository
    participant DB as Database

    U->>EP: Request to create payment (POST /createPayment)
    EP->>PS: call createPaymentForOrder(orderDetails)
    PS->>OR: getOrderDetails(orderId)
    OR-->>PS: Return orderDetails
    alt order is valid
        PS->>MP: call CreateQrCodePayment(orderDetails)
        MP-->>PS: Return paymentId, QrCode
        PS->>PR: savePayment(paymentDetails)
        PR->>DB: Insert into Payment
        DB-->>PR: Confirmation
        PR-->>PS: Confirmation
        PS->>OR: updateOrderWithPaymentId(orderId, paymentId)
        OR->>DB: Update Order
        DB-->>OR: Confirmation
        OR-->>PS: Confirmation
        PS-->>EP: Payment details (paymentId, QrCode)
        EP-->>U: Response with payment details
    else
        PS-->>EP: Payment failed
        EP-->>U: Error in payment creation
    end

This diagram now includes interactions with the Order Repository to fetch and update order details, and it also shows the conditional flow if the payment process fails. If there are further details or specific interactions you would like to see in the diagram, please let me know!