Skip to content
Angelo Caporaso edited this page Oct 30, 2024 · 21 revisions

Wiki for pagopa-fdr!

image

Mongo DB Documents

Container Description
fdr_history  deprecated
fdr_insert  flow inserted
fdr_payment_history  deprecated
fdr_payment_insert payments inserted 
fdr_payment_publish payments published
fdr_publish flow published 

Sequence Diagram

Upon startup, the application retrieves the cache from ApiConfig Cache.

Note

We excluded the returns and certain alternatives for the sake of shortness.

Create Flow by PSP

sequenceDiagram
    autonumber
    PSP->>FDR3: POST /flows (Create Flow)
    FDR3-->FDR3: validate the flow (with apiconfig cache)
    FDR3->>Mongo: find in fdr_insert (409 if already exists)
    FDR3->>Mongo: find in fdr_publish (get revision number)
    FDR3->>Mongo: save in fdr_insert
    FDR3->>Blob Storage RE: save the flow Blob Storage RE
    FDR3->>Event Hub RE: save the flow EH RE

Loading

Add payments to a flow

sequenceDiagram
    autonumber
    PSP->>FDR3: PUT /payment-add (Add payment to flow)
    FDR3-->FDR3: validate the list of payments (with apiconfig cache)
    FDR3->>Mongo: find in fdr_insert (404 not found if the flow doesn't exist)
    FDR3->>Mongo: find in fdr_payment_insert (find duplicates)
    FDR3-->FDR3: validate the indexes
    FDR3->>Mongo: save the list of payments in fdr_payment_insert      
Loading

Publish the Flow

sequenceDiagram
    autonumber
    PSP->>FDR3: POST /publish (Add payment to flow)
    FDR3-->FDR3: validate the publish request (with apiconfig cache)
    FDR3->>Mongo: find in fdr_insert (404 not found if the flow doesn't exist)
    FDR3-->FDR3: validate the status of the flow
    FDR3-->FDR3: validate the total of the flow
    FDR3-->FDR3: validate the sum of the flow
    FDR3->>Mongo: find in fdr_payment_insert the list of the payments
    par parallel batch saving
    FDR3->>Mongo: save in fdr_payment_publish the list of the payments
    end
    FDR3->>Blob Storage History: save the zip with the fdr and all its payments
    FDR3->>Mongo: save in fdr_publish the flow with the link of the zip
    FDR3-->>PSP: response
    critical asynchronous operations
    FDR3-)Table Storage History: save in fdrpublish table the flow
    FDR3-)Table Storage History: save in fdrpaymentpublish table the payments of the flow
    FDR3-)Mongo: delete the flow from fdr_insert
    FDR3-)Mongo: delete the payments from fdr_payment_insert
    alt is NOT internal
    FDR3-)Conversion Queue: send the flow to the flowidsendqueue
    end
    FDR3-)Blob Storage RE: save the flow Blob Storage RE
    FDR3-)Event Hub RE: save the flow EH RE
    end
Loading

EC Get Paginated Published FDR

sequenceDiagram
    autonumber
    EC->>FDR3: GET /fdrs (get all published)
    FDR3-->FDR3: validate the request (with apiconfig cache)
    FDR3->>Mongo: find all in fdr_publish
    FDR3->>Mongo: page count fdr_publish
    FDR3->>Mongo: tot elements fdr_publish
Loading

EC Get A Published FDR

sequenceDiagram
    autonumber
    EC->>FDR3: GET /fdrs (get all published)
    FDR3-->FDR3: validate the request (with apiconfig cache)
    FDR3->>Mongo: find in fdr_publish
Loading

EC Get Paginated Payments

sequenceDiagram
    autonumber
    EC->>FDR3: GET /payments
    FDR3-->FDR3: validate the request (with apiconfig cache)
    FDR3->>Mongo: find in fdr_payment_publish
    FDR3->>Mongo: page count fdr_payment_publish
    FDR3->>Mongo: tot elements fdr_payment_publish
Loading

FDR1 notify by json-to-xml

sequenceDiagram
    JSON to XML - fn->>FDR1: POST /notify
    FDR1->>FDR3: GET /fdr
    FDR1->>FDR3: GET /payments
    FDR1-->FDR1: map to enitity
    FDR1->>Postgres: save on DB
    FDR1->>EH RE: save event
    FDR1->>EH QI Flow: save event
    FDR1->>EH QI IUV: save event
Loading

Tech Supp get xml from FDR1

sequenceDiagram
    Technical Support->>FDR1: GET getAllRevisionFdr
    FDR1->>Postgres: find xml
    FDR1->>EH RE: save event
    FDR1->>EH QI Flow: save event
    FDR1->>EH QI IUV: save event
Loading