/** * Place URL into engine's endpoints * * @return void */ protected function doActionLocate() { $engines = \XLite\Core\Request::getInstance()->engines; if ($engines) { foreach ($this->getEngines() as $key => $engine) { if (in_array($key, $engines)) { $url = urlencode(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::getCustomerScript()))); $url = str_replace('%url%', $url, $engine['url']); $request = new \XLite\Core\HTTP\Request($url); $response = $request->sendRequest(); if (200 == $response->code) { \XLite\Core\TopMessage::addInfo('Site map successfully registred on X', array('engine' => $key)); } else { \XLite\Core\TopMessage::addWarning('Site map has not been registred in X', array('engine' => $key)); } } } } $postedData = \XLite\Core\Request::getInstance()->getData(); $options = \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->findBy(array('category' => $this->getOptionsCategory())); $isUpdated = false; foreach ($options as $key => $option) { $name = $option->getName(); $type = $option->getType(); if (isset($postedData[$name]) || 'checkbox' == $type) { if ('checkbox' == $type) { $option->setValue(isset($postedData[$name]) ? 'Y' : 'N'); } else { $option->setValue($postedData[$name]); } $isUpdated = true; \XLite\Core\Database::getEM()->persist($option); } } if ($isUpdated) { \XLite\Core\Database::getEM()->flush(); } }
/** * Get webhook URL * * @return string */ public function getWebhookURL() { $url = explode('&xid=', \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('callback', null, array(), \XLite::getCustomerScript()), \XLite\Core\Config::getInstance()->Security->customer_security)); return $url[0]; }
/** * Preprocess Open Graph meta tags * * @param string $tags Tags content * * @return string */ protected function preprocessOpenGraphMetaTags($tags) { $categoryURL = $this->getParent() ? \XLite\Core\Converter::makeURLValid(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('category', '', array('category_id' => $this->getCategoryId()), \XLite::getCustomerScript()))) : \XLite::getInstance()->getShopURL(); return str_replace(array('[PAGE_URL]', '[IMAGE_URL]'), array($categoryURL, $this->getImage() ? $this->getImage()->getFrontURL() : ''), $tags); }
/** * Defines the product preview URL * * @param integer $productId Product id * * @return string */ public function buildProductPreviewURL($productId) { return \XLite\Core\Converter::buildURL('product', 'preview', array('product_id' => $productId), \XLite::getCustomerScript()); }
/** * Get sitemap URL * * @return string */ protected function getSitemapURL() { return \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::getCustomerScript())); }
/** * Get callback URL * * @param string $xpcBackReference Reference between X-Payments payment and X-Cart transaction * @param bool $forZeroAuth Call back for zero auth or regular order * * @return string */ public static function getCallbackUrl($xpcBackReference) { if (!$forZeroAuth) { // Order callback $url = \XLite\Core\Converter::buildUrl('callback', 'callback', array('xpcBackReference' => $xpcBackReference), \XLite::getCustomerScript()); } else { // Add new card callback $url = \XLite\Core\Converter::buildUrl('callback', 'callback', array('xpcBackReference' => $xpcBackReference, 'for_zero_auth' => '1'), \XLite::getCustomerScript()); } return \XLite::getInstance()->getShopUrl($url); }
/** * Get iframe URL * * @return string */ public function getIframeUrl() { static $url = null; if (!$url && $this->getAddressList()) { try { $url = \XLite\Module\CDev\XPaymentsConnector\Core\ZeroAuth::getInstance()->getIframeUrl($this->getProfile(), \XLite::getCustomerScript()); } catch (\Exception $e) { $this->error = $e->getMessage(); } } return $url; }
/** * Get download URL for customer front-end by key * * @return string */ public function getDownloadURL(\XLite\Module\CDev\Egoods\Model\OrderItem\PrivateAttachment $attachment) { $params = $this->getGetterParams(); $params['key'] = $attachment->getDownloadKey(); return \XLite\Core\Converter::buildFullURL('storage', 'download', $params, \XLite::getCustomerScript()); }
/** * Send notification about created profile to the user * * @param \XLite\Model\Order $order Order object * * @return void */ public static function sendOrderTrackingInformationCustomer(\XLite\Model\Order $order) { $orderUrl = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('order', '', array('order_number' => $order->getOrderNumber()), \XLite::getCustomerScript())); static::register(array('order' => $order, 'trackingNumbers' => $order->getTrackingNumbers(), 'orderURL' => $orderUrl, 'address' => $order->getProfile()->getBillingAddress(), 'recipientName' => $order->getProfile()->getName())); static::compose(static::TYPE_ORDER_TRACKING_INFORMATION_CUSTOMER, static::getOrdersDepartmentMail(), $order->getProfile()->getLogin(), 'order_tracking_information', array(), true, \XLite::CUSTOMER_INTERFACE, static::getMailer()->getLanguageCode(\XLite::CUSTOMER_INTERFACE, $order->getProfile()->getLanguage())); \XLite\Core\OrderHistory::getInstance()->registerCustomerEmailSent($order->getOrderId(), 'Tracking information is sent to the customer'); }
/** * Build location URL * * @param array $loc Locationb as array * * @return string */ protected function buildLoc(array $loc) { $target = $loc['target']; unset($loc['target']); return \XLite\Core\Converter::buildURL($target, '', $loc, \XLite::getCustomerScript()); }
/** * Get attachment getter URL * * @return string */ public function getGetterURL() { return \XLite\Core\Converter::buildURL('storage', 'download', $this->getGetterParams(), \XLite::getCustomerScript()); }
/** * Get front URL * * @return string */ public function getFrontURL() { return $this->getProductId() ? \XLite\Core\Converter::makeURLValid(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('product', '', array('product_id' => $this->getProductId()), \XLite::getCustomerScript()))) : null; }
/** * Get front URL * * @return string */ public function getFrontURL() { $url = null; if ($this->getId()) { $url = \XLite\Core\Converter::makeURLValid(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('newsMessage', '', array('id' => $this->getId()), \XLite::getCustomerScript(), true))); } return $url; }
/** * Get iframe URL * * @return string */ public function getIframeUrl(\XLite\Model\Profile $profile, $interface = false) { if (!$interface) { $interface = \XLite::getCustomerScript(); } $iframeUrl = false; // Prepare cart $cart = $this->createCart($profile); $preparedCart = $this->getPreparedCart($cart); if ($preparedCart) { $transaction = $cart->getFirstOpenPaymentTransaction(); $this->getPaymentMethod()->getProcessor()->savePaymentSettingsToTransaction($transaction); $xpcBackReference = $transaction->getPublicId(); $profile->setPendingZeroAuth($xpcBackReference); $profile->setPendingZeroAuthInterface($interface); \XLite\Core\Database::getEM()->flush(); // Data to send to X-Payments $data = array('confId' => intval($this->getPaymentMethod()->getSetting('id')), 'refId' => $xpcBackReference, 'cart' => $preparedCart, 'language' => 'en', 'returnUrl' => $this->getClient()->getReturnUrl($xpcBackReference, true), 'callbackUrl' => $this->getClient()->getCallbackUrl($xpcBackReference, true)); // For API v1.3 and higher we can send the template for iframe if (version_compare($this->getConfig()->xpc_api_version, '1.3') >= 0) { $data += array('saveCard' => 'Y', 'template' => 'xc5'); } $init = $this->getClient()->getApiRequest()->send('payment', 'init', $data); if ($init->isSuccess()) { $response = $init->getResponse(); $iframeUrl = $this->getConfig()->xpc_xpayments_url . '/payment.php?target=main&token=' . $response['token']; $transaction->setDataCell('xpc_txnid', $response['txnId'], 'X-Payments transaction id', 'C'); $transaction->setDataCell('xpcBackReference', $xpcBackReference, 'X-Payments back reference', 'C'); // AntiFraud service if (method_exists($transaction, 'processAntiFraudCheck')) { $transaction->processAntiFraudCheck(); } \XLite\Core\Database::getEM()->flush(); } else { throw new \Exception($init->getError()); } } return $iframeUrl; }
/** * Get Webhook URL * * @return string */ public function getWebhookURL() { return \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('callback', null, array(), \XLite::getCustomerScript()), \XLite\Core\Config::getInstance()->Security->customer_security); }