/** * Modify the status for an order. * * @param string $reference The reference for an order * @param string $status The new status, allowed values are: OPEN, PENDING, CANCELLED, COMPLETED, ON-HOLD or PRINTED * * @return bool * @throws BpostCurlException * @throws BpostInvalidResponseException * @throws BpostInvalidSelectionException * @throws BpostInvalidValueException */ public function modifyOrderStatus($reference, $status) { $status = strtoupper($status); if (!in_array($status, Box::getPossibleStatusValues())) { throw new BpostInvalidValueException('status', $status, Box::getPossibleStatusValues()); } $url = '/orders/' . $reference; $document = new \DOMDocument('1.0', 'utf-8'); $document->preserveWhiteSpace = false; $document->formatOutput = true; $orderUpdate = $document->createElement('orderUpdate'); $orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/'); $orderUpdate->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $orderUpdate->appendChild($document->createElement('status', $status)); $document->appendChild($orderUpdate); $headers = array('Content-type: application/vnd.bpost.shm-orderUpdate-v3+XML'); return $this->doCall($url, $document->saveXML(), $headers, 'POST', false) == ''; }