/** * Resubmit an order. * * @param Mage_Sales_Model_Order * @return void */ protected function resubmit(Mage_Sales_Model_Order $order) { if (!$order->hasEb2cOrderCreateRequest()) { $this->logger->warning('Unable to resubmit "{order_id}". Please see documentation for possible solutions.', $this->logContext->getMetaData(['order_id' => $order->getIncrementId()])); return; } $api = $this->coreHelper->getSdkApi($this->orderCfg->apiService, $this->orderCfg->apiCreateOperation); $createArgs = ['api' => $api, 'config' => $this->orderCfg, 'is_payload_prebuilt' => true, 'order' => $order, 'payload' => $api->getRequestBody()]; $this->getOrderCreateModel($createArgs)->send(); }
/** * Retry order create requests on unsubmitted orders. * Run this on cron. * * @return void */ public function handleEbayEnterpriseOrderCreateRetryJob() { $orders = $this->getUnsubmittedOrders(); $this->logger->debug('Found {order_retry_count} order(s) to be resubmitted.', $this->logContext->getMetaData(__CLASS__, ['order_retry_count' => $orders->getSize()])); $api = $this->coreHelper->getSdkApi($this->orderCfg->apiService, $this->orderCfg->apiCreateOperation); $createArgs = ['api' => $api, 'config' => $this->orderCfg, 'payload' => $api->getRequestBody(), 'is_payload_prebuilt' => true]; foreach ($orders as $order) { $this->resubmit($order, $createArgs); } $this->logger->debug('Order retry complete.', $this->logContext->getMetaData(__CLASS__)); }
/** * Perform the web request for address validation and return the response * @param Mage_Customer_Model_Address_Abstract $address * @return EbayEnterprise_Address_Model_Validation_Response|null */ protected function _makeRequestForAddress(Mage_Customer_Model_Address_Abstract $address) { $config = $this->_helper->getConfigModel(); $api = $this->_coreHelper->getSdkApi($config->apiService, $config->apiOperation); try { $this->_prepareApiForAddressRequest($address, $api); $api->send(); return $this->_getValidationResponse($api); } catch (NetworkError $e) { $logMessage = 'Address validation service returned empty response.'; $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__)); } catch (Exception $e) { $logMessage = 'Unexpected exception from SDK.'; $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__)); $this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e)); throw $e; } return null; }
/** * Perform the web request for address validation and return the response * @param Mage_Customer_Model_Address_Abstract $address * @return EbayEnterprise_Address_Model_Validation_Response|null */ protected function _makeRequestForAddress(Mage_Customer_Model_Address_Abstract $address) { $config = $this->_helper->getConfigModel(); $api = $this->_coreHelper->getSdkApi($config->apiService, $config->apiOperation); $logger = $this->_logger; $logContext = $this->_context; try { $this->_prepareApiForAddressRequest($address, $api); $api->send(); return $this->_getValidationResponse($api); } catch (InvalidPayload $e) { $logMessage = 'Invalid payload for address validate operation. See exception log for more details.'; $logger->warning($logMessage, $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e)); throw $e; } catch (NetworkError $e) { $logMessage = 'Caught network error sending the address validation. See exception log for more details.'; $logger->warning($logMessage, $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e)); // Allow network errors to be bypassed, exception is caught and not re-thrown. } catch (UnsupportedOperation $e) { $logMessage = 'The address validate operation is unsupported in the current configuration. See exception log for more details.'; $logger->warning($logMessage, $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e)); throw $e; } catch (UnsupportedHttpAction $e) { $logMessage = 'The address validate operation is configured with an unsupported HTTP action. See exception log for more details.'; $logger->warning($logMessage, $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e)); throw $e; } catch (Exception $e) { $logMessage = 'Encountered unexpected exception from address validate operation. See exception log for more details.'; $logger->warning($logMessage, $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()])); $logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e)); throw $e; } return null; }
/** * Get the API SDK for the operation. * * @param Varien_Object * @return IBidirectionalApi */ protected function getSdk($operation) { return $this->coreHelper->getSdkApi($this->config->apiService, $operation); }
/** * configure and get the API * * @param string * @return IBidirectionalApi */ public function prepareApi() { $config = $this->helper->getConfigModel(); $api = $this->coreHelper->getSdkApi($config->apiService, $config->apiAllocationCreateOperation); return $api; }
/** * Get the API SDK for the payment auth request. * @param Varien_Object $payment * @return Api\IBidirectionalApi */ protected function _getApi(Varien_Object $payment) { $config = $this->_helper->getConfigModel(); return $this->_coreHelper->getSdkApi($config->apiService, $config->apiOperation, [$this->_helper->getTenderTypeForCcType($payment->getCcType())], $this->_apiLogger); }
/** * get an api object configured to perform a tender type lookup * operation. * * @return IBidirectionalApi */ protected function getTenderTypeLookupApi() { $config = $this->getConfig(); return $this->coreHelper->getSdkApi($config->apiService, $config->apiOperationTenderTypeLookup, [], $this->apiLogger); }
/** * Get and configure the api */ protected function prepareApi() { $config = $this->helper->getConfigModel(); $api = $this->coreHelper->getSdkApi($config->apiService, $config->apiDetailsOperation); return $api; }
/** * @see EbayEnterprise_Order_Model_IApi::_getApi() */ public function getApi() { return $this->_coreHelper->getSdkApi($this->_orderCfg->apiService, $this->_orderCfg->apiDetailOperation); }
/** * Get an API object for the SDK to make the TDF request. * * @return IBidirectionalApi */ protected function _getSdkApi() { return $this->_coreHelper->getSdkApi($this->_inventoryConfig->apiService, $this->_inventoryConfig->quantityApiOperation); }
/** * Get a new SDK Api instance for an API call. * @param string $operation * @return Api\IBidirectionalApi */ protected function _getApi($operation) { return $this->_coreHelper->getSdkApi($this->_helper->getConfigModel()->apiService, $operation, [$this->getTenderType()], $this->_apiLogger); }
/** * Get a new SDK Api instance for an API call. * @param string $operation * @return IBidirectionalApi */ protected function getApi($operation) { return $this->coreHelper->getSdkApi($this->config->apiService, $operation, [$this->getTenderType()], $this->apiLogger); }
/** * Get an API object for the SDK to make the TDF request. * * @return IBidirectionalApi */ protected function getSdkApi() { $taxConfig = $this->getConfigModel(); return $this->coreHelper->getSdkApi($taxConfig->apiService, $taxConfig->apiOperation); }
/** * Get an API object for the SDK to make the TDF request. * * @return IBidirectionalApi */ protected function _getSdkApi() { return $this->_coreHelper->getSdkApi($this->_taxConfig->apiService, $this->_taxConfig->apiOperation); }