---
# System prepended metadata

title: '#evermpe-api'

---

# Shopee End to End
```plantuml
    actor user as user
    entity dashboard as dashboard
    entity evermpe as evermpe
    database database 
    database redis 
    queue queue as Queue

    user -> dashboard: choose marketplace, brand, store and fill the id
    user -> dashboard : upload csv
    dashboard -> dashboard: validate file
    dashboard -> evermpe : request to preview csv data
    evermpe -> evermpe : compose csv to json
    evermpe --> dashboard : return json data
    dashboard --> user : return preview data
    user -> dashboard : click `send` button
    dashboard -> evermpe: send file csv

    evermpe -> evermpe : validate payload
    alt #red bad request
        evermpe --> user: response bad request
    end
    evermpe -> evermpe : chunk orders payload
    evermpe -> redis : insert upload csv information
    redis --> evermpe : return insert result
    loop orders
          evermpe -> Queue: publish order payload
    end 

    evermpe --> user: return ok

    loop listen queue
        Queue -> evermpe: receive event message
        alt #lightgreen marketplace is tokopedia
            evermpe -> database: get data order by invoice_number, name_product
            database --> evermpe: return data order 
            evermpe -> evermpe: compose data order which need update or create action
            alt has update data 
                evermpe -> database : update data 
                database --> evermpe : return result
            end
            alt has create data 
                evermpe -> database : create data 
                database --> evermpe : return result
            end
        end
        alt #lightyellow marketplace is shopee
            evermpe -> database: get data order by order no, reference_sku, name_product, variation
            database --> evermpe: return data order 
            evermpe -> evermpe: compose data order which need update or create action
            alt has update data 
                evermpe -> database : update data 
                database --> evermpe : return result
            end
            alt has create data 
                evermpe -> database : create data 
                database --> evermpe : return result
            end
        end
        alt #lightblue marketplace is tiktok
            evermpe -> database: get data order by order_id
            database --> evermpe: return data order 
            evermpe -> evermpe: compose data order which need update or create action
            alt has update data 
                evermpe -> database : update data 
                database --> evermpe : return result
            end
            alt has create data 
                evermpe -> database : create data 
                database --> evermpe : return result
            end
        end
        alt  marketplace is blibli or lazada
            evermpe -> database: get data order by order_no
            database --> evermpe: return data order 
            evermpe -> evermpe: compose data order which need update or create action
            alt has update data 
                evermpe -> database : update data 
                database --> evermpe : return result
            end
            alt has create data 
                evermpe -> database : create data 
                database --> evermpe : return result
            end
        end
        evermpe -> redis : lock request id
        evermpe -> redis : get request status
        redis --> evermpe : return upload csv status
        evermpe -> evermpe : set new status
        evermpe -> redis : update request status
        redis --> evermpe : return result
        evermpe -> redis : release lock
        alt has finished
            evermpe -> n8n : hit webhook to trigger processing
            n8n --> evermpe : return result
        end 
    end
```

# Tokopedia End to End
```plantuml
    actor user as user
    entity dashboard as dashboard
    entity evermpe as evermpe
    database database 
    queue queue as Queue

    user -> dashboard: choose marketplace, brand, store and fill the id
    user -> dashboard : upload csv
    dashboard -> evermpe : request to preview csv data
    evermpe -> evermpe : compose csv to json
    evermpe --> dashboard : return json data
    dashboard --> user : return preview data
    user -> dashboard : click `send` button
    dashboard -> evermpe: send data json


    alt bad request
        evermpe --> user: response bad request
    end

    alt when unique keys same
        evermpe -> database: get order_no
        database --> evermpe: return order no
        evermpe -> database: get invoice_number, name_product
        database --> evermpe: return invoice_number, name_product
        evermpe ->> evermpe: collect invoice_number, name_product
    end

        evermpe ->> Queue: publish message (update or create list)
    

    evermpe -->> user: return ok

    loop listen queue
        Queue ->> evermpe: receive event message
        evermpe ->> database: send message (update or create list)
    end
```
# Shopee
```plantuml
    actor user as User
    entity evermpe as EverMPE
    database database as MPE
    queue queue as Queue

    User -> EverMPE: request
    EverMPE -> EverMPE: validate request

    alt bad request
        EverMPE --> User: response bad request
    end

    alt when unique keys same
        EverMPE -->> User: get order_no
        EverMPE ->> MPE: get order_no
        MPE -->> EverMPE: return order no
        EverMPE ->> MPE: get order no, reference_sku, name_product, variation
        MPE -->> EverMPE: return order no, reference_sku, name_product, variation
        EverMPE ->> EverMPE: collect order no, reference_sku, name_product, variation
    end

    alt
        EverMPE ->> Queue: publish message (update or create list)
    end

    EverMPE -->> User: return ok

    loop
        Queue ->> EverMPE: receive event message
        EverMPE ->> MPE: send message (update or create list)
    end
```
# Tokopedia
```plantuml
actor       Actor   as user
entity      EverMPE as evermpe
database    MPE     as database
queue       Queue       as queue
user -> evermpe : request
evermpe -> evermpe : validate request
alt validation
evermpe --> user : response bad request
end
alt when unique keys same
evermpe --> user : get order_no
evermpe -> database : get order_no
database --> evermpe : return order no
evermpe -> database : get  invoice_number,name_product
database --> evermpe : return  invoice_number,name_product
evermpe -> evermpe : collect invoice_number,name_product
end
alt
evermpe -> queue : publish message (update or create list)
end
evermpe --> user : return ok
loop
queue -> evermpe : receive event message
evermpe -> database : send message (update or create list)
end
```
# Lazada & Blibli
```plantuml
    actor user as user
    entity dashboard as dashboard
    entity evermpe as evermpe
    database database 
    queue queue as queue

    user -> dashboard: select marketplace,brand,store, fill the id
    user -> dashboard: upload csv
    dashboard -> evermpe : request to preview csv
    evermpe -> evermpe : compose csv
    evermpe --> dashboard : return json data
    dashboard --> user : return preview data
    dashboard -> evermpe: send data json
alt validation
evermpe --> user : response bad request
end
alt when unique keys same
evermpe --> user : get order_no
evermpe -> database : get order_no
database --> evermpe : return order no
end
alt
evermpe -> queue : publish message (update or create list)
end
evermpe --> user : return ok
loop
queue -> evermpe : receive event message
evermpe -> database : send message (update or create list)
end

```
# Tiktok
```plantuml
    actor user as user
    entity dashboard as dashboard
    entity evermpe as evermpe
    database database 
    queue queue as queue
    user -> dashboard: select marketplace,brand,store, fill the id
    user -> dashboard: upload csv
    dashboard -> evermpe : request to preview csv
    evermpe -> evermpe : compose csv
    evermpe --> dashboard : return json data
    dashboard --> user : return preview data
    dashboard -> evermpe: send data json
alt validation
evermpe --> user : response bad request
end
alt when unique keys same
evermpe -> database : get order_id
database --> evermpe : return order id
end
alt
evermpe -> queue : publish message (update or create list)
end
evermpe --> user : return ok
loop
queue -> evermpe : receive event message
evermpe -> database : send message (update or create list)
end
```