/** * @param ConsignmentRequest $consignmentRequest * @param string|null $shopId * @param string|null $apiKey * @return CreateConsignmentResponse */ public function createConsignment(ConsignmentRequest $consignmentRequest, $shopId = null, $apiKey = null) { $shop = isset($shopId) ? $shopId : $this->shopId; $key = isset($apiKey) ? $apiKey : $this->apiKey; $resource = Resource::CONSIGNMENTS; $data = $this->formatter->formatCreateConsignmentRequest($consignmentRequest); $requestEnvelope = new RequestEnvelope($data, $resource, Method::POST, $shop, $key); $requestEnvelopeWithHeaders = $this->attachBasicHeadersToRequest($requestEnvelope); $connectorResponse = $this->connector->sendRequest($requestEnvelopeWithHeaders); $formattedResponse = $this->formatter->formatCreateConsignmentResponse($connectorResponse); return $formattedResponse; }