## Existing Flow ```plantuml participant "JNE" as jne participant "everpro-logistic" as el participant "NSQ" as nsq database "popaket_logistic" as db jne -> el : send a callback to our webhook if there is an update status activate el el -> el : validate request el -> el : map the JNE Pod Code with our status el -> nsq : send the message to topic "callback-update-status" el -> db : save the `photo` to our `proof_of_delivery` table el -> jne : return success deactivate el ``` ## Single tracking from CMS ```plantuml participant "frontend/mobile" as fe participant "everpro-logistic-client" as elc participant "evm-3pl-client-gateway" as evm database "popaket_logistic" as db fe -> elc : user click button `Lacak`,\nhit endpoint "/v2/public/shipment/tracking/{tracking_number}" activate elc elc -> db : validate order and get from proof_of_delivery table db --> elc elc -> evm : tracking to get the track history note left for 3pl JNE, ID Express, SAP, Sicepat, J&T endnote evm -> elc : return tracking history note right the evm-3pl-client-gateway should return image_url and podReceiverName if they failed giving those information, we will using the data from database endnote alt if callback is set to false elc -> db : update order status end alt if no data in proof_of_delivery table elc -> db : save the `image_url` and `podReceiverName` to our `proof_of_delivery` table end elc -> fe : return the tracking response deactivate elc ``` ## 3pl aggregator ```plantuml participant "everpro" as evp participant "evm-3pl-client-gateway" as gateway participant "evm-3pl-auth" as auth participant "evm-3pl-aggregator" as aggregator participant "3PL" as 3pl == authentication == evp -> gateway : hit "/v1/authentication" to get the bearer token activate gateway gateway -> auth : validate the user credential activate auth auth -> gateway : return the access token deactivate auth gateway -> evp : return the access token deactivate gateway == tracking == evp -> gateway : hit "/v1/tracking/:awb" with the token activate gateway gateway -> gateway : validate token gateway -> aggregator : request tracking for specific awb activate aggregator aggregator -> 3pl : track the awb 3pl -> aggregator : return the tracking history aggregator -> aggregator : build the tracking response note left add podReceiverName endnote aggregator -> gateway : return the tracking response deactivate aggregator gateway -> evp : return the tracking response deactivate gateway ``` ## Download order report ```plantuml participant "frontend" as fe participant "everpro-logistic-client" as elc database "popaket_logistic" as db participant "everpro-utility" as eu participant "AWS S3" as s3 fe -> elc : hit endpoint "/v2/public/orders/reports" activate elc elc -> db : get order list db --> elc elc -> eu : request to generate excel based on orders data activate eu eu -> eu : generating excel/csv file note right add 2 columns, proof_of_delivery and receiver_name endnote eu -> s3 : upload the file to S3 bucket eu -> elc : return the file link deactivate eu elc -> fe : return the file link deactivate elc ``` ## backfill proof of delivery ```plantuml actor "user" as u participant "n8n" as n8n database "popaket_logistic" as db participant "evm-3pl-client-gateway" as evm u -> n8n : run the workflow activate n8n n8n -> db : get empty receiver_name from table proof_of_delivery db --> n8n loop n8n -> evm : track the order to get the podReceiverName evm --> n8n : return tracking n8n -> db : update the receiver name end n8n -> u : finish deactivate n8n ```