This new request called FinalizeShipmentRequest is designed to handle the finalization of a single shipment in a draft state. Unlike the existing CloseShipmentsRequest, which is used for closing draft shipments which will then be finalized by the store, this new call is explicitly intended to book the shipment with the carrier and generate the shipping label.
After a shipment has been created in a draft state via the new API mechanism (<IsDraft> = true) as seen here, the draft shipment's response gives an MBE tracking ID.
When putting within the FinalizeShipmentRequest this MBE tracking ID, its response gives an official shipping label of the created shipment (status of the shipment goes from DRAFT_TO_BE_CLOSED to CREATED).
Note: please take into account that if there are courier errors or other general issues, the response for this new request will return the usual response returned by the ShipmentRequestResponse.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.onlinembe.eu/ws/">
<soapenv:Header/>
<soapenv:Body>
<ws:FinalizeShipmentRequest>
<RequestContainer>
<!--Optional:-->
<SystemType>?</SystemType>
<!--Optional:-->
<Credentials>
<Username></Username>
<Passphrase></Passphrase>
</Credentials>
<!--Optional:-->
<InternalReferenceID>?</InternalReferenceID>
<MbeTrackingNumber>IT0001-0L-0000003JDT</MbeTrackingNumber>
</RequestContainer>
</ws:FinalizeShipmentRequest>
</soapenv:Body>
</soapenv:Envelope>
Following below, a few examples that can occur when using this FinalizeShipment request:
IF the MBE Tracking ID provided in the request doesn't exist, the operation returns <Description>Shipment not found</Description>
IF the shipment's status is not DRAFT_TO_BE_CLOSED, the operation returns <Description>This shipment cannot be finalized</Description>
IF the shipment' status is DRAFT_TO_BE_CLOSED but is a "legacy" draft (i.e., it was NOT created via the new is_draft: true flow), the operation is rejected with a clear message, such as <Description>This draft can only be processed by the center. Use CloseShipmentsRequest instead</Description>
IF the MBE Tracking ID exists, the shipment status is DRAFT_TO_BE_CLOSED and the draft shipment was created via the is_draft: true flow, but the MOL user DOES NOT have permission to print labels, the operation is rejected with a clear message, such as <Description>User is not authorized to finalize shipments and print labels</Description>
IF finalization fails due to data validation errors or a carrier API error, the shipment remains in DRAFT_TO_BE_CLOSED status.