Print Label BE
# Flow
```plantuml
participant "frontend" as fe
participant "everpro-logistic-client" as elc
participant "AWS S3" as s3
database "popaket_logistic" as db
participant "evm-3pl-client-gateway" as 3pl
participant "everdoc" as everdoc
fe -> elc : print label request by shipment order numbers
activate elc
elc -> elc : validate request
note left
- set the paper_size unit to milimeters
if paper_size is empty, set the default to A4 (210 x 297mm)
- generate the print_date with time.Now()
endnote
elc -> db : get order to shipment_orders
note left
query ref : [[https://github.com/evermos/everpro-logistic-client/blob/main/module/logistic/store/logistic_repository.go#L5262]]\n
**without join to logistic_codes**
endnote
db --> elc
alt if logistic is JNE or sicepat
elc -> 3pl : get location code using endpoint [[http://evm-3pl-client-gateway.prod.internal/v1/location/full get location]]
3pl -> elc : return location detail
end
elc -> elc : generate a barcode image using an awb number
elc -> s3 : upload the barcode image to S3
note left
bucket : everpro
path : /label/temp_barcode
we need to put it in S3, because everdoc need to access the barcode image in HTML template
endnote
elc -> elc : build the html template data
alt if show_ongkir is true
elc -> elc : set the `shipmentPriceFormatted` in template data
end
alt if show_origin is true
elc -> elc : set the `shipper.address` in template data
end
alt if show_sender_phone is true
elc -> elc : set the `shipper.phone` in template data
end
alt if show_destination_sub_district is true
elc -> elc : set the `receiver.address` **without subdistrict** in template data
end
alt if show_receiver_phone is true
elc -> elc : set the `receiver.phone` in template data
end
alt if show_everpro_logo is true
elc -> elc : set the `everproLogoUrl` in template data
end
alt if show_print_date is true
elc -> elc : set the print date to `printedDate` template data
end
elc -> everdoc : generate pdf using template data
everdoc -> elc : return a internal download link
elc -> everdoc : get the PDF public link
everdoc -> elc : return the PDF public link
elc -> s3 : delete the temporary barcode image from S3
note left
We need to delete the barcode image, because the generate process is finish. The barcode image is no longer needed.
endnote
elc -> fe : return the download link
deactivate elc
```