public function buildOutRequest() { $this->request->setReservationId($this->reservation->getId())->setRequestId($this->reservation->getRequestId()); foreach ($this->selectedItems->getSelectionIterator() as $data) { list($address, $item) = $data; $this->addItemPayload($item, $address); } }
/** * fill out the request payload to send * * @param IBidirectionalApi * @param EbayEnterprise_Inventory_Model_Allocation_Item_Selector * @return self */ protected function prepareRequest(IBidirectionalApi $api, EbayEnterprise_Inventory_Model_Allocation_Item_Selector $selector) { $this->logger->debug('Building inventory allocation request reservation id {reservation_id}', $this->logContext->getMetaData(__CLASS__, ['reservation_id' => $this->reservation->getId()])); try { $request = $api->getRequestBody(); $builder = $this->createRequestBuilder($request, $selector, $this->reservation); $builder->buildOutRequest(); $api->setRequestBody($request); return $this; } catch (UnsupportedOperation $e) { $this->logger->critical('The inventory allocation operation is unsupported in the current configuration. See exception log for more details.', $this->logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $this->logger->logException($e, $this->logContext->getMetaData(__CLASS__, [], $e)); } $this->handleAllocationFailure(); }
/** * fill out the request payload to send * * @param IBidirectionalApi * @param EbayEnterprise_Inventory_Model_Allocation_Item_Selector * @return self */ protected function prepareRequest(IBidirectionalApi $api, EbayEnterprise_Inventory_Model_Allocation_Item_Selector $selector) { $this->logger->debug('Building inventory allocation request reservation id {reservation_id}', $this->logContext->getMetaData(__CLASS__, ['reservation_id' => $this->reservation->getId()])); try { $request = $api->getRequestBody(); $builder = $this->createRequestBuilder($request, $selector, $this->reservation); $builder->buildOutRequest(); // rule out the possibility of exceptions from the request // being thrown during the send. $request->serialize(); $api->setRequestBody($request); return $request; } catch (UnsupportedOperation $e) { $this->logger->critical('The allocation operation is unsupported by the currently configured SDK', $this->logContext->getMetaData(__CLASS__, [], $e)); } catch (InvalidPayload $e) { $this->logger->error('The allocation request is invalid', $this->logContext->getMetaData(__CLASS__, [], $e)); } $this->handleAllocationFailure(); }
/** * prepare the request to be sent * * return IBidirectionalApi */ protected function prepareRequest(IBidirectionalApi $api, EbayEnterprise_Inventory_Model_Allocation_Reservation $reservation) { $request = $api->getRequestBody(); $request->setReservationId($reservation->getId())->setRequestId(uniqid()); $api->setRequestBody($request); return $this; }