Skip to content

Commit

Permalink
LIMS_817: Update shipping service requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPrit committed Jul 5, 2023
1 parent 641e884 commit 56e9c6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,9 @@ function _dispatch_dewar_in_shipping_service($dispatch_info, $dewar)
"shipper_contact_email" => $facility_email,
"internal_contact_name" => $this->has_arg('LOCALCONTACT') ? $this->args['LOCALCONTACT'] : null,
"shipment_reference" => $dispatch_info['VISIT'],
"external_id" => (int) $dispatch_info['DEWARID']
"external_id" => (int) $dispatch_info['DEWARID'],
"journey_type" => "FROM_FACILITY",
"packages" => array(array("external_id" => $dispatch_info['DEWARID']))
);

# Split up address. Necessary as address is a single field in ispyb
Expand All @@ -970,8 +972,8 @@ function _dispatch_dewar_in_shipping_service($dispatch_info, $dewar)
if ($create === true) {
$response = $this->shipping_service->create_shipment($shipment_data);
} else {
$this->shipping_service->update_shipment($dispatch_info['DEWARID'], $shipment_data);
$response = $this->shipping_service->get_shipment($dispatch_info['DEWARID']);
$this->shipping_service->update_shipment($dispatch_info['DEWARID'], $shipment_data, "FROM_FACILITY");
$response = $this->shipping_service->get_shipment($dispatch_info['DEWARID'], "FROM_FACILITY");
}
$shipment_id = $response['shipmentId'];
$this->shipping_service->dispatch_shipment($shipment_id);
Expand Down
12 changes: 6 additions & 6 deletions api/src/Shipment/ShippingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,21 @@ function create_shipment($shipment_data)
}


function get_shipment($external_id)
function get_shipment($external_id, $journey_type)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/external_id/' . $external_id,
$this->shipping_api_url . '/shipments/external_id/' . $external_id . '?journey_type=' . $journey_type,
"GET",
null,
200
);
}


function update_shipment($external_id, $shipment_data)
function update_shipment($external_id, $shipment_data, $journey_type)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/external_id/' . $external_id,
$this->shipping_api_url . '/shipments/external_id/' . $external_id . '?journey_type=' . $journey_type,
"PUT",
$shipment_data,
204
Expand All @@ -102,9 +102,9 @@ function update_shipment($external_id, $shipment_data)
function dispatch_shipment($shipment_id)
{
return $this->_send_request(
$this->shipping_api_url . '/shipments/' . $shipment_id . '/dispatch',
$this->shipping_api_url . '/shipments/' . $shipment_id . '/dispatch?pickup_requested=false',
"POST",
array(),
null,
201
);
}
Expand Down

0 comments on commit 56e9c6f

Please sign in to comment.