/** * prepare to send the request * * @param ILookupRequest * @param string * @param string * @return ILookupRequest */ protected function prepareApiForSend() { $request = $this->api->getRequestBody(); $this->buildOutRequest($request); $this->logRequest($request, 'Gift card tender type request'); $this->api->setRequestBody($request); return $request; }
/** * Prepare the API request with data from the quote - fill out and set * the request payload. * * @param IBidirectionalApi * @param Mage_Sales_Model_Quote_Item_Abstract[] * @return self */ protected function _prepareRequest(IBidirectionalApi $api, array $items) { try { $requestBody = $api->getRequestBody(); } catch (UnsupportedOperation $e) { // If the SDK cannot handle sending requests to the inventory/quantity // service operation but is expected to, the SDK is likely broken. // As this would fall into the "human intervention required" // category of errors, log crit the exception. $this->_logger->critical('Inventory quantity service request unsupported by SDK.', $this->_logContext->getMetaData(__CLASS__, [], $e)); // Throw a more generic, expected exception to prevent // this from being a blocking failure. throw $this->_failQuantityCollection(); } $quantityRequest = $this->_inventoryQuantityFactory->createRequestBuilder($requestBody, $items)->getRequest(); $api->setRequestBody($quantityRequest); return $this; }
/** * 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(); }
/** * @param array $initParams Must have these keys: * - 'api' => IBidirectionalApi * - 'order_id' => string */ public function __construct(array $initParams) { list($this->_api, $this->_orderId) = $this->_checkTypes($initParams['api'], $initParams['order_id']); $this->_payload = $this->_api->getRequestBody(); }
/** * Update payment objects with details of the auth request and response. Validate * that a successful response was received. * @param ApiIBidirectionalApi $api * @param Varien_Object $payment * @return self */ protected function _handleApiResponse(Api\IBidirectionalApi $api, Varien_Object $payment) { $request = $api->getRequestBody(); $response = $api->getResponseBody(); return $this->_updatePaymentsWithAuthData($payment, $request, $response)->_validateResponse($response); }
/** * Prepare an API instance for a balance request - fill out and set the * request payload with gift card data. * @param Api\IBidirectionalApi $api * @return self */ protected function _prepareApiForVoid(Api\IBidirectionalApi $api) { $this->setRedeemVoidRequestId($this->_coreHelper->generateRequestId(self::VOID_REQUST_ID_PREFIX)); $payload = $api->getRequestBody(); $payload->setRequestId($this->getRedeemVoidRequestId())->setPin($this->getPin())->setAmount($this->getAmountRedeemed())->setCurrencyCode($this->getRedeemCurrencyCode()); $this->_setPayloadPaymentContext($payload); $api->setRequestBody($payload); return $this; }
/** * 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; }
/** * Prepare the API request with data from the quote - fill out and set * the request payload. * * @param IBidirectionalApi * @param Mage_Sales_Model_Order_Quote * @return self */ protected function _prepareRequest(IBidirectionalApi $api, Mage_Sales_Model_Quote $quote) { try { $requestBody = $api->getRequestBody(); } catch (UnsupportedOperation $e) { // If the SDK cannot handle sending requests to the tax/quote // service operation but is expected to, the SDK is likely broken. // As this would fall into the "human intervention required" // category of errors, log crit the exception. $this->logger->critical('Tax quote service request unsupported by SDK.', $this->logContext->getMetaData(__CLASS__, [], $e)); // Throw a more generic, expected exception to prevent // this from being a blocking failure. throw $this->_failTaxCollection(); } $taxRequest = $this->taxFactory->createRequestBuilderQuote($requestBody, $quote)->getTaxRequest(); $api->setRequestBody($taxRequest); return $this; }
/** * @param array $initParams Must have these keys: * - 'api' => IBidirectionalApi * - 'order' => Mage_Sales_Model_Order */ public function __construct(array $initParams) { list($this->_api, $this->_order, $this->_orderHelper) = $this->_checkTypes($initParams['api'], $initParams['order'], $this->_nullCoalesce($initParams, 'order_helper', Mage::helper('ebayenterprise_order'))); $this->_payload = $this->_api->getRequestBody(); }
/** * @param array */ public function __construct(array $args = []) { list($this->_helper, $this->_address, $this->_api) = $this->_checkTypes($this->_nullCoalesce($args, 'helper', Mage::helper('ebayenterprise_address')), $args['address'], $args['api']); $this->_requestPayload = $this->_api->getRequestBody(); }
/** * @param array $initParams Must have these keys: * - 'api' => IBidirectionalApi * - 'customer_id' => string */ public function __construct(array $initParams) { list($this->_api, $this->_customerId, $this->_orderId) = $this->_checkTypes($initParams['api'], $initParams['customer_id'], $this->_nullCoalesce($initParams, 'order_id', null)); $this->_payload = $this->_api->getRequestBody(); }