Пример #1
0
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     $ewayCvnAusValues = array("ewayCardNumber" => _xls_number_only($this->CheckoutForm->cardNumber), "ewayCardHoldersName" => $this->CheckoutForm->cardNameOnCard, "ewayCardExpiryMonth" => $this->CheckoutForm->cardExpiryMonth, "ewayCardExpiryYear" => $this->CheckoutForm->cardExpiryYear, "ewayCVN" => $this->CheckoutForm->cardCVV, "ewayCustomerInvoiceRef" => $this->objCart->id_str, "ewayTotalAmount" => round($this->objCart->total * 100), "ewayCustomerFirstName" => $this->CheckoutForm->contactFirstName, "ewayCustomerLastName" => $this->CheckoutForm->contactLastName, "ewayCustomerAddress" => ($this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1) . ", " . $this->CheckoutForm->billingCity . " " . $this->CheckoutForm->billingStateCode, "ewayCustomerPostcode" => $this->CheckoutForm->billingPostal, "ewayCustomerEmail" => $this->CheckoutForm->contactEmail, "ewayCustomerInvoiceDescription" => _xls_get_conf('STORE_NAME', "Online") . " Order", "ewayTrxnNumber" => '', "ewayOption1" => '', "ewayOption2" => '', "ewayOption3" => '');
     $xmlRequest = "<ewaygateway><ewayCustomerID>" . $this->config['login'] . "</ewayCustomerID>";
     foreach ($ewayCvnAusValues as $key => $value) {
         $xmlRequest .= "<{$key}>{$value}</{$key}>";
     }
     $xmlRequest .= "</ewaygateway>";
     Yii::log(sprintf("%s sending %s for amt %s\nRequest: %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($ewayCvnAusValues), true)), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $xmlResponse = $this->sendTransactionToEway($xmlRequest);
     if ($xmlResponse !== '') {
         $oXML = new SimpleXMLElement($xmlResponse);
         if ((string) $oXML->ewayTrxnStatus != "True") {
             // unsuccessful
             $arrReturn['success'] = false;
             $arrReturn['amount_paid'] = 0;
             $arrReturn['result'] = Yii::t('global', (string) $oXML->ewayTrxnError);
             Yii::log("Declined: " . (string) $oXML->ewayTrxnError, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         } else {
             //We have success
             $arrReturn['success'] = true;
             $arrReturn['amount_paid'] = stripos((string) $oXML->ewayTrxnError, "Tests CVN Gateway") > 0 ? 0.0 : (string) $oXML->ewayReturnAmount / 100;
             $arrReturn['result'] = (string) $oXML->ewayAuthCode;
         }
     } else {
         // Curl call failed.
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $arrReturn['result'] = Yii::t('global', "There was an error processing your payment, please try again later.");
         Yii::log("Curl Error: curl call failed.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     return $arrReturn;
 }
Пример #2
0
 public function actionUpgrayedd()
 {
     $online = _xls_number_only($_POST['online']);
     switch ($online) {
         case 10:
             $this->actionDownload();
             break;
         case 20:
             $this->actionVerifyVersion();
             break;
         case 30:
             $this->actionVerifyWriteAccess();
             break;
         case 40:
             $this->actionPlaceFiles();
             break;
         case 50:
         case 55:
         case 60:
         case 65:
         case 70:
         case 75:
         case 80:
         case 85:
         case 90:
         case 95:
             $this->actionDatabaseUpgrade($online);
             break;
     }
 }
 /**
  * Run the payment process
  * @return mixed
  */
 public function run()
 {
     $auth_net_login_id = $this->config['login'];
     $auth_net_tran_key = $this->config['trans_key'];
     /**
      * This option, and the commented $ret['live']->AddItem('dev' , 'dev') above, are only for API development work.
      * Regular Authorize.net customers will only use "live" and "test" modes through their account, which can be
      * chosen through the Web Admin panel.
      *
      */
     if ($this->config['live'] == 'test') {
         $auth_net_url = "https://test.authorize.net/gateway/transact.dll";
     } else {
         $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
     }
     $str = "";
     $str .= sprintf('<FORM action="%s" method="POST">', $auth_net_url);
     $str .= $this->InsertFP($auth_net_login_id, $auth_net_tran_key, round($this->objCart->Total, 2), $this->objCart->currency);
     $str .= _xls_make_hidden('x_invoice_num', $this->objCart->id_str);
     $str .= _xls_make_hidden('x_first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('x_last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('x_company', $this->CheckoutForm->contactCompany);
     $str .= _xls_make_hidden('x_address', $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2);
     $str .= _xls_make_hidden('x_city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('x_state', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('x_zip', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('x_country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('x_phone', _xls_number_only($this->CheckoutForm->contactPhone));
     $str .= _xls_make_hidden('x_email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('x_cust_id', "WC-" . $this->objCart->customer_id);
     $str .= _xls_make_hidden('x_ship_to_first_name', $this->CheckoutForm->shippingFirstName);
     $str .= _xls_make_hidden('x_ship_to_last_name', $this->CheckoutForm->shippingLastName);
     $str .= _xls_make_hidden('x_ship_to_company', $this->CheckoutForm->shippingCompany);
     $str .= _xls_make_hidden('x_ship_to_address', $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2);
     $str .= _xls_make_hidden('x_ship_to_city', $this->CheckoutForm->shippingCity);
     $str .= _xls_make_hidden('x_ship_to_state', $this->CheckoutForm->shippingStateCode);
     $str .= _xls_make_hidden('x_ship_to_zip', $this->CheckoutForm->shippingPostal);
     $str .= _xls_make_hidden('x_ship_to_country', $this->CheckoutForm->shippingCountryCode);
     $str .= _xls_make_hidden('x_description', _xls_get_conf('STORE_NAME', "Online") . " Order");
     $str .= _xls_make_hidden('x_login', $auth_net_login_id);
     $str .= _xls_make_hidden('x_solution_id', 'A1000010');
     $str .= _xls_make_hidden('x_type', 'AUTH_CAPTURE');
     $str .= _xls_make_hidden('x_currency_code', $this->objCart->currency);
     //trying to get currency code to submit
     $str .= _xls_make_hidden('x_amount', round($this->objCart->Total, 2));
     $str .= _xls_make_hidden('x_show_form', 'PAYMENT_FORM');
     $str .= _xls_make_hidden('x_relay_response', 'TRUE');
     $str .= _xls_make_hidden('x_relay_url', Yii::app()->controller->createAbsoluteUrl('cart/payment', array(), 'http') . '/' . $this->modulename);
     $str .= _xls_make_hidden('x_cancel_url', Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $this->objCart->linkid), 'http'));
     if (Yii::app()->params['LIGHTSPEED_MT'] > 0) {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image("https:" . Yii::app()->params['HEADER_IMAGE'], Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     } else {
         $str .= _xls_make_hidden('x_header_html_payment_form', str_replace("\"", "'", CHtml::image(Yii::app()->controller->createAbsoluteUrl(Yii::app()->params['HEADER_IMAGE'], array(), 'https'), Yii::app()->params['STORE_NAME'], array('style' => 'max-width:580px'))));
     }
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->id_str, $str), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     if ($this->config['live'] == 'test') {
         $auth_net_url = "https://test.authorize.net/gateway/transact.dll";
     } else {
         $auth_net_url = "https://secure.authorize.net/gateway/transact.dll";
     }
     $authnet_values = array("x_login" => $this->config['login'], "x_delim_char" => self::x_delim_char, "x_delim_data" => "TRUE", "x_type" => "AUTH_CAPTURE", "x_method" => "CC", "x_tran_key" => $this->config['trans_key'], "x_relay_response" => "FALSE", "x_card_num" => _xls_number_only($this->CheckoutForm->cardNumber), "x_exp_date" => $this->CheckoutForm->cardExpiryMonth . "-" . $this->CheckoutForm->cardExpiryYear, "x_description" => $this->objCart->id_str, "x_amount" => round($this->objCart->total, 2), "x_first_name" => $this->CheckoutForm->contactFirstName, "x_last_name" => $this->CheckoutForm->contactLastName, "x_phone" => _xls_number_only($this->CheckoutForm->contactPhone), "x_address" => $this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1, "x_city" => $this->CheckoutForm->billingCity, "x_state" => $this->CheckoutForm->billingStateCode, "x_zip" => str_replace(" ", "", $this->CheckoutForm->billingPostal), "x_country" => $this->CheckoutForm->billingCountryCode, "x_customer_ip" => $_SERVER['REMOTE_ADDR'], "x_email" => $this->CheckoutForm->contactEmail, "SpecialCode" => $this->config['specialcode'], "x_ship_to_first_name" => $this->CheckoutForm->shippingFirstName, "x_ship_to_last_name" => $this->CheckoutForm->shippingLastName, "x_ship_to_company" => $this->CheckoutForm->shippingCompany, "x_ship_to_address" => $this->CheckoutForm->shippingAddress2 != '' ? $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2 : $this->CheckoutForm->shippingAddress1, "x_ship_to_city" => $this->CheckoutForm->shippingCity, "x_ship_to_state" => $this->CheckoutForm->shippingStateCode, "x_ship_to_zip" => $this->CheckoutForm->shippingPostal, "x_ship_to_country" => $this->CheckoutForm->shippingCountryCode, "x_invoice_num" => $this->objCart->id_str, "x_solution_id" => 'A1000010', "x_cust_id" => $this->objCart->customer_id, "x_freight" => $this->objCart->shippingCharge);
     if ($this->config['ccv'] == '1') {
         $authnet_values['x_card_code'] = $this->CheckoutForm->cardCVV;
     }
     Yii::log(sprintf("%s sending %s for amt %s\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($authnet_values), true)), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $authNetFields = "";
     foreach ($authnet_values as $key => $value) {
         $authNetFields .= "{$key}=" . urlencode($value) . "&";
     }
     $ch = curl_init($auth_net_url);
     // Eliminate header info from response.
     curl_setopt($ch, CURLOPT_HEADER, 0);
     // Return response data instead of true(1).
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Use HTTP POST to send form data.
     curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($authNetFields, "& "));
     // Force the use of TLS instead of SSLv3.
     //  http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Important-POODLE-Information-Updated/ba-p/48163
     curl_setopt($ch, CURLOPT_SSLVERSION, 1);
     // Uncomment the following line if you get 'no gateway response' errors.
     //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     // Execute post and get results
     $resp = curl_exec($ch);
     curl_close($ch);
     Yii::log(sprintf("%s receiving %s", __CLASS__, $resp), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     $respVals = explode(self::x_delim_char, $resp);
     $respVals = array_values($respVals);
     if ($resp === false) {
         // Curl call failed.
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $arrReturn['result'] = Yii::t('global', "There was an error processing your payment, please try again later.");
         Yii::log("Curl Error: curl call failed.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     } elseif ($respVals[0] != '1') {
         // Curl call succeeded but transaction was unsuccessful.
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $arrReturn['result'] = Yii::t('global', $respVals[3]);
         Yii::log("Declined: " . $respVals[3], 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     } else {
         // Curl call succeeded and the transaction was successful.
         $arrReturn['success'] = true;
         $arrReturn['amount_paid'] = $this->objCart->total;
         $arrReturn['result'] = $respVals[4];
         if ($this->config['live'] == 'test') {
             $arrReturn['amount_paid'] = 0;
             $arrReturn['result'] = "TEST " . $respVals[4];
         }
     }
     return $arrReturn;
 }
Пример #5
0
 public static function LoadGallery($id)
 {
     $id = _xls_number_only($id);
     if ($id > 1000) {
         $id = 1000;
     }
     $gallery = Gallery::model()->findByPk($id);
     if (!$gallery) {
         $gallery = new Gallery();
         $gallery->id = $id;
         $gallery->name = true;
         $gallery->description = true;
         $gallery->versions = array('small' => array('resize' => array(200, null)), 'medium' => array('resize' => array(800, null)));
         $gallery->save();
     }
     return $gallery;
 }
Пример #6
0
    /**
     * The run() function is called from Web Store to run the process.
     * @return array
     */
    public function run()
    {
        // URL Configuration
        $merchantware_url = "https://ps1.merchantware.net/MerchantWARE/ws/RetailTransaction/TXRetail31.asmx";
        // MerchantWARE specific values
        $trans_info_transactionid = '';
        // Transaction id
        $trans_info_allow_duplicate = '';
        // Turn duplicate checking on or off
        $trans_info_register_num = '';
        // Register number
        //MerchantWARE expects expiry in 4 digit format
        $cardInfoExpiry = _xls_number_only($this->CheckoutForm->cardExpiryMonth . substr($this->CheckoutForm->cardExpiryYear, 2, 2));
        //MerchantWARE expects no dashes in WO number
        $wo = str_replace("-", "", $this->objCart->id_str);
        // MerchantWARE does not fully support Canadian postal codes.
        // See: http://confluence.atlightspeed.net/display/webstore/MerchantWare+Online
        if ($this->CheckoutForm->billingCountry == 39) {
            $this->CheckoutForm->billingPostal = 0;
        }
        // Construct SOAP packet for delivery
        $xmlData = '<soap:Envelope
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
				<soap:Body>
					<IssueKeyedSale
					xmlns="http://merchantwarehouse.com/MerchantWARE/Client3_1/TransactionRetail">
						<strName>' . $this->config['name'] . '</strName>
                        <strSiteId>' . $this->config['site_id'] . '</strSiteId>
                        <strKey>' . $this->config['trans_key'] . '</strKey>
                        <strOrderNumber>' . $wo . '</strOrderNumber>
                        <strAmount>' . $this->objCart->total . '</strAmount>
                        <strPAN>' . _xls_number_only($this->CheckoutForm->cardNumber) . '</strPAN>
                        <strExpDate>' . $cardInfoExpiry . '</strExpDate>
                        <strCardHolder>' . $this->CheckoutForm->contactFirstName . " " . $this->CheckoutForm->contactLastName . '</strCardHolder>
                        <strAVSStreetAddress>' . $this->CheckoutForm->billingAddress1 . '</strAVSStreetAddress>
                        <strAVSZipCode>' . str_pad(str_replace(" ", "", $this->CheckoutForm->billingPostal), 5, '0', STR_PAD_RIGHT) . '</strAVSZipCode>
                        <strCVCode>' . $this->CheckoutForm->cardCVV . '</strCVCode>
                        <strAllowDuplicates>' . $trans_info_allow_duplicate . '</strAllowDuplicates>
                        <strRegisterNum>' . $trans_info_register_num . '</strRegisterNum>
                        <strTransactionId>' . $trans_info_transactionid . '</strTransactionId>
                    </IssueKeyedSale>
                </soap:Body>
            </soap:Envelope>';
        $ch = curl_init($merchantware_url);
        // Set header with SOAP Action
        $soapaction = "http://merchantwarehouse.com/MerchantWARE/Client3_1/TransactionRetail/IssueKeyedSale";
        $headers = array("Content-Type: text/xml; charset=utf-8", "SOAPAction: " . $soapaction);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        // Eliminate header info from response.
        curl_setopt($ch, CURLOPT_HEADER, 0);
        // Do a regular HTTP POST
        curl_setopt($ch, CURLOPT_POST, 1);
        // Do not follow 'Location:' headers
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
        // Return response data instead of true(1).
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        // Force the use of TLS instead of SSLv3.
        //  http://merchantwarehouse.com/what-you-need-to-know-about-the-poodle-security-vulnerability
        curl_setopt($ch, CURLOPT_SSLVERSION, 1);
        // Use HTTP POST to send form data.
        curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
        // Execute post and get results
        $resp = curl_exec($ch);
        curl_close($ch);
        Yii::log(sprintf("%s sending %s for amt %s\nSoap: %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, $this->obfuscate($xmlData)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
        Yii::log(__CLASS__ . " receiving " . $resp, $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
        if ($resp !== false) {
            $resp = preg_replace("/(<\\/?)(\\w+):([^>]*>)/", "\$1\$2\$3", $resp);
            // Parse xml for response values
            $oXML = new SimpleXMLElement($resp);
            if (isset($oXML->soapBody->soapFault)) {
                $responseStatus = "DECLINED;00;" . $oXML->soapBody->soapFault->faultstring;
                $responseAuthorizationCode = "";
            } else {
                $responseStatus = $oXML->soapBody->IssueKeyedSaleResponse->IssueKeyedSaleResult->ApprovalStatus;
                $responseAuthorizationCode = (string) $oXML->soapBody->IssueKeyedSaleResponse->IssueKeyedSaleResult->AuthCode;
                if ($responseStatus == "DECLINED,DUPLICATE;1110;duplicate transaction") {
                    $code = (string) $oXML->soapBody->IssueKeyedSaleResponse->IssueKeyedSaleResult->ExtData;
                    $arrResponse = explode(";", $code);
                    $responseAuthorizationCode = str_replace("Original AuthCode=", "", $arrResponse[1]);
                    Yii::log("MerchantWare flagging this as duplicate: " . $arrResponse[0] . ': ' . $arrResponse[1], 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                }
            }
            if ($responseStatus != 'APPROVED') {
                //unsuccessful
                $arrReturn['success'] = false;
                $arrReturn['amount_paid'] = 0;
                $arrResponse = explode(";", $responseStatus);
                $arrReturn['result'] = Yii::t('global', $arrResponse[0] . ': ' . $arrResponse[2]);
                $arrReturn['code'] = $arrResponse[1];
                Yii::log("Declined: " . $arrResponse[0] . ', ' . $arrResponse[1] . ': ' . $arrResponse[2], 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
            } else {
                //We have success
                $arrReturn['success'] = true;
                $arrReturn['amount_paid'] = $this->objCart->total;
                $arrReturn['result'] = $responseAuthorizationCode;
                Yii::log("Approved: " . $responseStatus, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
            }
        } else {
            // Curl call failed.
            $arrReturn['success'] = false;
            $arrReturn['amount_paid'] = 0;
            $arrReturn['result'] = Yii::t('global', "There was an error processing your payment, please try again later.");
            Yii::log("Curl Error: curl call failed.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
        }
        return $arrReturn;
    }
 /**
  * Short Description.
  *
  * @return void
  */
 public function actionIntegration()
 {
     $this->registerAsset("js/tiers.js");
     //This is just to set assetUrl
     $id = Yii::app()->getRequest()->getQuery('id');
     Yii::import('application.extensions.' . $id . '.' . $id);
     $objModule = Modules::LoadByName($id);
     $objComponent = new $id();
     $adminForm = $id . "AdminForm";
     Yii::import('application.extensions.' . $id . '.models.' . $adminForm);
     $model = new $adminForm();
     if (!is_null($model)) {
         //Get form elements (Admin panel configuration) and add our layout formatting so the form looks nice within Admin Panel
         $this->editSectionInstructions = $this->getInstructions(get_class($this)) . "<p>" . $this->editSectionInstructions;
         $objModule = Modules::LoadByName($id);
         if (isset($_POST[$adminForm])) {
             $model->attributes = $_POST[$adminForm];
             $this->registerOnOff($objModule->id, 'Modules_active', _xls_number_only($_POST['Modules']['active']));
             if ($model->validate()) {
                 $objModule->active = _xls_number_only($_POST['Modules']['active']);
                 $objModule->configuration = serialize($model->attributes);
                 if (!$objModule->save()) {
                     Yii::app()->user->setFlash('error', print_r($objModule->getErrors(), true));
                 } else {
                     Yii::app()->user->setFlash('success', Yii::t('admin', 'Configuration updated on {time}.', array('{time}' => date("d F, Y  h:i:sa"))));
                 }
             } else {
                 if (YII_DEBUG) {
                     Yii::app()->user->setFlash('error', print_r($model->getErrors(), true));
                 } else {
                     Yii::app()->user->setFlash('error', Yii::t('global', 'Error saving, check form fields for specific errors'));
                 }
             }
         } else {
             //Load current attributes
             $this->registerOnOff($objModule->id, 'Modules_active', $objModule->active);
             $model->attributes = $objModule->getConfigValues();
         }
         // At this point, our $model has our values, so they are available
         // for our form definition.
         $formDefinition = $model->getAdminForm();
         foreach ($formDefinition['elements'] as $key => $value) {
             $formDefinition['elements'][$key]['layout'] = '<div class="span5 optionlabel">{label}</div><div class="span5 optionvalue">{input}</div>{error}<div class="span2 maxhint">{hint}</div>';
         }
         $this->render('admin.views.default.moduleedit', array('objModule' => $objModule, 'model' => $model, 'form' => new CForm($formDefinition, $model)));
     } else {
         // If null it means the AdminForm model file is missing.
         $this->render('admin.views.default.noconfig');
     }
 }
 /**
  * Get payment choice and have end user confirm and place order.
  * A user can choose a simple integration method which will redirect
  * them to the confirmation page. If they put their cc details directly
  * in the form to checkout with an advanced method, the confirmation
  * page is immediately rendered.
  *
  * @return void
  */
 public function actionFinal()
 {
     $this->checkoutForm = MultiCheckoutForm::loadFromSessionOrNew();
     $arrCheckbox = array('id' => 1, 'name' => 'MultiCheckoutForm[billingSameAsShipping]', 'label' => Yii::t('checkout', 'Use my shipping address as my billing address'), 'address' => $this->checkoutForm->strShippingAddress);
     $objCart = Yii::app()->shoppingcart;
     // check to see if we have any advanced methods and if not redirect to the simple payment action
     $arrModules = $this->checkoutForm->getAimPaymentMethods();
     if (count($arrModules) < 1) {
         $this->redirect($this->createAbsoluteUrl('/checkout/paymentsimple'));
     }
     // set cardholder name to default i.e. contact name
     $this->checkoutForm->cardNameOnCard = $this->checkoutForm->contactFirstName . ' ' . $this->checkoutForm->contactLastName;
     // is an existing user changing their billing address?
     if (isset($_POST['BillingAddress']) && !isset($_POST['MultiCheckoutForm']['intBillingAddress'])) {
         $val = $_POST['BillingAddress'];
         if (is_numeric($val)) {
             if (isset($_POST['MultiCheckoutForm'])) {
                 $this->checkoutForm->attributes = $_POST['MultiCheckoutForm'];
             }
             $this->checkoutForm->intBillingAddress = $val;
             $this->checkoutForm->fillAddressFields($val);
             $arrCheckbox['id'] = $val;
             $arrCheckbox['name'] = 'MultiCheckoutForm[intBillingAddress]';
             $arrCheckbox['label'] = Yii::t('checkout', 'Use this as my billing address');
             $arrCheckbox['address'] = $this->checkoutForm->strBillingAddress;
             $arrAddresses = CustomerAddress::getActiveAddresses();
             // remove shipping address from the address array
             // to prevent someone attempting to edit it
             foreach ($arrAddresses as $key => $objAddress) {
                 if ($objAddress->id === $this->checkoutForm->intShippingAddress) {
                     unset($arrAddresses[$key]);
                     break;
                 }
             }
             $this->checkoutForm->objAddresses = $arrAddresses;
             $this->layout = '/layouts/checkout';
             $this->render('paymentaddress', array('model' => $this->checkoutForm, 'checkbox' => $arrCheckbox, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
         }
     } elseif (isset($_POST['Payment']) || isset($_POST['Paypal'])) {
         if (isset($_POST['MultiCheckoutForm'])) {
             $this->checkoutForm->attributes = $_POST['MultiCheckoutForm'];
             if (_xls_get_conf('SHIP_SAME_BILLSHIP') == 1) {
                 $this->checkoutForm->billingSameAsShipping = 1;
             }
             // get all the active alternative / offline payment methods
             $alternatePaymentMethods = $this->checkoutForm->getAlternativePaymentMethods();
             if (array_key_exists($this->checkoutForm->paymentProvider, $alternatePaymentMethods) || isset($_POST['Paypal'])) {
                 // end user has either chosen an alternative payment method or hit the Paypal button
                 // clear sensitive data just in case
                 $this->checkoutForm->clearCCdata();
                 // set billing address to be the same as shipping so that the form passes validation
                 $this->checkoutForm->billingSameAsShipping = 1;
                 $blnBillAddressHandled = true;
                 // user chose paypal
                 if (isset($_POST['Paypal'])) {
                     $this->checkoutForm->paymentProvider = $_POST['Paypal'];
                 }
                 $this->checkoutForm->saveFormToSession();
                 // set scenario
                 if ($objCart->shipping->isStorePickup) {
                     $this->checkoutForm->setScenario('PaymentStorePickup');
                     // no customer addresses required
                 } else {
                     $this->checkoutForm->setScenario('PaymentSim');
                     // shipping address is required
                     $blnBillAddressHandled = $this->checkoutForm->updateAddressId('billing');
                     // set billing address to shipping address to pass validation
                 }
                 // validate and update payment
                 $objPayment = CartPayment::getOrCreateCartPayment();
                 if ($blnBillAddressHandled && $this->checkoutForm->validate() && $this->checkoutForm->handleSubform() && $objPayment->updateCartPayment($this->checkoutForm, $this->checkoutForm->subFormModel)) {
                     // save the passed scenario
                     $this->checkoutForm->passedScenario = $this->checkoutForm->getScenario();
                     $this->checkoutForm->saveFormToSession();
                     $this->redirect($this->createAbsoluteUrl('/checkout/confirmation'));
                 }
                 $this->checkoutForm->addErrors($objPayment->getErrors());
                 $this->publishJS('payment');
                 $this->publishJS('zippo');
                 $this->layout = '/layouts/checkout';
                 if (count($this->checkoutForm->objAddresses) > 0) {
                     $this->render('paymentaddress', array('model' => $this->checkoutForm, 'checkbox' => $arrCheckbox, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
                 } else {
                     $this->render('payment', array('model' => $this->checkoutForm, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
                 }
             } else {
                 // if we are here, the end user has entered their card details directly (AIM)
                 // ensure form is populated with billing address
                 if (isset($this->checkoutForm->intBillingAddress)) {
                     $this->checkoutForm->fillAddressFields($this->checkoutForm->intBillingAddress);
                     $this->checkoutForm->billingSameAsShipping = null;
                 }
                 // payment processors require the cardNumber formatted as an
                 // actual number so remove whitespace from the cardNumber
                 $this->checkoutForm->cardNumber = _xls_number_only($this->checkoutForm->cardNumber);
                 $this->checkoutForm->cardNumberLast4 = substr($this->checkoutForm->cardNumber, -4);
                 // only the last 4 digits
                 // prevent an exception if cardExpiry is left blank
                 if (isset($this->checkoutForm->cardExpiry) && $this->checkoutForm->cardExpiry !== '') {
                     $arrCardExpiry = explode('/', $this->checkoutForm->cardExpiry);
                     $this->checkoutForm->cardExpiryMonth = $arrCardExpiry[0];
                     $this->checkoutForm->cardExpiryYear = $arrCardExpiry[1] + 2000;
                 }
                 // set scenario
                 if ($objCart->shipping->isStorePickup) {
                     $this->checkoutForm->setScenario('PaymentStorePickupCC');
                     // only billing address required
                 } else {
                     $this->checkoutForm->setScenario('Payment');
                     // shipping and billing address required
                 }
                 // validate the form
                 $objPayment = CartPayment::getOrCreateCartPayment();
                 if ($this->checkoutForm->updateAddressId('billing') && $this->checkoutForm->validate() && $objPayment->updateCartPayment($this->checkoutForm)) {
                     $this->layout = '/layouts/checkout-confirmation';
                     $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => Yii::app()->shoppingcart, 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'error' => $this->formatErrors()));
                 } else {
                     $this->checkoutForm->addErrors($objPayment->getErrors());
                     // clear sensitive data and force user to re-enter them
                     $this->checkoutForm->clearCCdata();
                     $this->publishJS('payment');
                     $this->publishJS('zippo');
                     $this->layout = '/layouts/checkout';
                     if (count($this->checkoutForm->objAddresses) > 0) {
                         $this->render('paymentaddress', array('model' => $this->checkoutForm, 'checkbox' => $arrCheckbox, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
                     } else {
                         $this->render('payment', array('model' => $this->checkoutForm, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
                     }
                 }
             }
         }
     } elseif (isset($_POST['Confirmation'])) {
         $haveCartItemsBeenUpdated = false;
         if (isset($_POST['MultiCheckoutForm'])) {
             $this->checkoutForm->attributes = $_POST['MultiCheckoutForm'];
             if ($objCart->shipping->isStorePickup) {
                 $this->checkoutForm->setScenario('ConfirmationStorePickupCC');
                 // only billing address required
             } else {
                 $this->checkoutForm->setScenario('Confirmation');
                 // shipping and billing address required
             }
             // validate form and cart
             if ($this->checkoutForm->updateCartCustomerId() && $this->checkoutForm->validate()) {
                 // if the cart was modified stop checkout and re-render the page with the message to the end user
                 if (Yii::app()->shoppingcart->wasCartModified === false) {
                     // cart is as we expect, continue
                     $result = $this->executeCheckoutProcess();
                     if (isset($result['success']) && isset($result['cartlink'])) {
                         // send user to receipt
                         $this->redirect($this->createAbsoluteUrl("/checkout/thankyou/" . $result['cartlink']));
                     }
                 }
             }
         }
         $this->layout = '/layouts/checkout-confirmation';
         $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => Yii::app()->shoppingcart, 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'error' => $this->formatErrors(), 'recalculateShippingOnLoad' => Yii::app()->shoppingcart->wasCartModified));
     } else {
         $this->layout = '/layouts/checkout';
         $this->publishJS('payment');
         $this->publishJS('zippo');
         // clear sensitive data
         $this->checkoutForm->clearCCdata();
         // existing user with existing addresses
         if (count($this->checkoutForm->objAddresses) > 0) {
             $arrCheckbox['name'] = 'MultiCheckoutForm[intBillingAddress]';
             // if the billing address was defined before, set the checkbox label
             if (isset($this->checkoutForm->intBillingAddress) && $this->checkoutForm->intBillingAddress !== $this->checkoutForm->intShippingAddress) {
                 $arrCheckbox['label'] = Yii::t('checkout', 'Use this as my billing address');
             }
             // get up to date address info
             $arrAddresses = CustomerAddress::getActiveAddresses();
             // find the selected address id
             $selectedAddressId = null;
             $blnDefaultBilling = true;
             if (isset($_POST['BillingAddress']) === false && isset($this->checkoutForm->intBillingAddress) === false) {
                 // Check to see if the customer has a default billing address set
                 if ($objCart->customer->default_billing_id !== null) {
                     $objTemp = $objCart->customer->defaultBilling;
                     if ($objTemp->active == 1) {
                         $selectedAddressId = $objTemp->id;
                     } else {
                         $blnDefaultBilling = false;
                     }
                 } else {
                     $blnDefaultBilling = false;
                 }
                 if ($blnDefaultBilling === false) {
                     // No default billing address available so just use the first address in the array
                     $objAddress = current($arrAddresses);
                     $selectedAddressId = $objAddress->id;
                 }
             } else {
                 $selectedAddressId = $this->checkoutForm->intShippingAddress;
             }
             // remove the selected address from the array
             foreach ($arrAddresses as $key => $objAddress) {
                 if ($objAddress->id === $selectedAddressId) {
                     $arrCheckbox['id'] = $objAddress->id;
                     $arrCheckbox['address'] = _xls_string_address($objAddress);
                     break;
                 }
             }
             // remove the shipping address from the array
             foreach ($arrAddresses as $key => $objAddress) {
                 if ($objAddress->id === $this->checkoutForm->intShippingAddress) {
                     unset($arrAddresses[$key]);
                     break;
                 }
             }
             $this->checkoutForm->objAddresses = $arrAddresses;
             $this->checkoutForm->saveFormToSession();
             $this->render('paymentaddress', array('model' => $this->checkoutForm, 'checkbox' => $arrCheckbox, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
         } else {
             $this->render('payment', array('model' => $this->checkoutForm, 'error' => $this->formatErrors(), 'paymentFormModules' => $this->checkoutForm->getAlternativePaymentMethodsThatUseSubForms()));
         }
     }
 }
Пример #9
0
 public function UpdateItemQuantity($objItem, $qty)
 {
     $this->clearCachedShipping();
     return $this->model->UpdateItemQuantity($objItem, _xls_number_only($qty));
 }
Пример #10
0
 public function run()
 {
     $ps_store_id = $this->config['ps_store_id'];
     $hpp_key = $this->config['hpp_key'];
     if ($this->config['live'] == 'live') {
         $moneris_url = "https://www3.moneris.com/HPPDP/index.php";
     } else {
         $moneris_url = "https://esqa.moneris.com/HPPDP/index.php";
     }
     $str = "";
     $str .= sprintf('<FORM method="POST" action="%s">', $moneris_url);
     $str .= _xls_make_hidden('ps_store_id', $ps_store_id);
     $str .= _xls_make_hidden('hpp_key', $hpp_key);
     $str .= _xls_make_hidden('order_id', $this->objCart->id_str . '-' . date("YmdHis"));
     foreach ($this->objCart->cartItems as $id => $item) {
         $str .= _xls_make_hidden('description' . $id, $item->description);
         $str .= _xls_make_hidden('id' . $id, $item->code);
         $str .= _xls_make_hidden('quantity' . $id, $item->qty);
         $str .= _xls_make_hidden('price' . $id, self::formatCurrencyValue($item->sell_total));
     }
     foreach ($this->objCart->Taxes as $tax => $taxvalue) {
         switch (strtolower($tax)) {
             case 'gst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('gst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
             case 'pst':
             case 'qst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('pst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
             case 'hst':
                 if ($taxvalue > 0) {
                     $str .= _xls_make_hidden('hst', self::formatCurrencyValue($taxvalue));
                 }
                 break;
                 // todo - account for electronics tax
         }
     }
     $str .= _xls_make_hidden('shipping_cost', self::formatCurrencyValue($this->objCart->shippingCharge));
     $str .= _xls_make_hidden('note', $this->CheckoutForm->orderNotes);
     $str .= _xls_make_hidden('bill_first_name', $this->CheckoutForm->contactFirstName);
     $str .= _xls_make_hidden('bill_last_name', $this->CheckoutForm->contactLastName);
     $str .= _xls_make_hidden('bill_company_name', $this->CheckoutForm->contactCompany);
     $str .= _xls_make_hidden('bill_address_one', $this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1);
     $str .= _xls_make_hidden('bill_city', $this->CheckoutForm->billingCity);
     $str .= _xls_make_hidden('bill_state_or_province', $this->CheckoutForm->billingStateCode);
     $str .= _xls_make_hidden('bill_postal_code', $this->CheckoutForm->billingPostal);
     $str .= _xls_make_hidden('bill_country', $this->CheckoutForm->billingCountryCode);
     $str .= _xls_make_hidden('bill_phone', _xls_number_only($this->CheckoutForm->contactPhone));
     $str .= _xls_make_hidden('email', $this->CheckoutForm->contactEmail);
     $str .= _xls_make_hidden('cust_id', "WC-" . $this->objCart->customer_id);
     $str .= _xls_make_hidden('ship_first_name', $this->CheckoutForm->shippingFirstName);
     $str .= _xls_make_hidden('ship_last_name', $this->CheckoutForm->shippingLastName);
     $str .= _xls_make_hidden('ship_company_name', $this->CheckoutForm->shippingCompany);
     $str .= _xls_make_hidden('ship_address_one', $this->CheckoutForm->shippingAddress1 . " " . $this->CheckoutForm->shippingAddress2);
     $str .= _xls_make_hidden('ship_city', $this->CheckoutForm->shippingCity);
     $str .= _xls_make_hidden('ship_state_or_province', $this->CheckoutForm->shippingStateCode);
     $str .= _xls_make_hidden('ship_postal_code', $this->CheckoutForm->shippingPostal);
     $str .= _xls_make_hidden('ship_country', $this->CheckoutForm->shippingCountryCode);
     $str .= _xls_make_hidden('charge_total', self::formatCurrencyValue($this->objCart->total));
     $str .= '</FORM>';
     Yii::log(sprintf("%s sending %s in %s mode\nRequest %s", __CLASS__, $this->objCart->id_str, $this->config['live'], $str), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = $str;
     return $arrReturn;
 }
Пример #11
0
 /**
  * Load anything we need globally, such as items we're going to use in our main.php template.
  * If you create init() in any other controller, you need to run parent::init() too or this
  * will be skipped. If you run your own init() and don't call this, you must call Controller::initParams();
  * or nothing will work.
  */
 public function init()
 {
     self::initParams();
     if (isset($_GET['nosni'])) {
         Yii::app()->user->setFlash('warning', Yii::t('global', 'NOTE: Your older operating system does not support certain security features this site uses. You have been redirected to {link} for your session which will ensure your information is properly protected.', array('{link}' => "<b>" . Yii::app()->params['LIGHTSPEED_HOSTING_LIGHTSPEED_URL'] . "</b>")));
     }
     $filename = Yii::getPathOfAlias('webroot.themes') . DIRECTORY_SEPARATOR . DEFAULT_THEME;
     if (!file_exists($filename) && _xls_get_conf('LIGHTSPEED_MT', 0) == '0') {
         if (!downloadTheme(DEFAULT_THEME)) {
             die("missing " . DEFAULT_THEME);
         } else {
             $this->redirect(Yii::app()->createUrl("site/index"));
         }
     }
     if (!Yii::app()->theme) {
         if (_xls_get_conf('THEME')) {
             //We can't find our theme for some reason, switch back to default
             _xls_set_conf('THEME', DEFAULT_THEME);
             _xls_set_conf('CHILD_THEME', 'light');
             Yii::log("Couldn't find our theme, switched back to " . DEFAULT_THEME . " for emergency", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             $this->redirect(Yii::app()->createUrl('site/index'));
         } else {
             die("you have no theme set");
         }
     }
     if (isset($_GET['theme']) && isset($_GET['themekey'])) {
         $strTheme = CHtml::encode($_GET['theme']);
         $strThemeKey = CHtml::encode($_GET['themekey']);
         if ($this->verifyPreviewThemeKey($strTheme, $strThemeKey)) {
             Yii::app()->theme = $strTheme;
             $this->registerPreviewThemeScript($strTheme, $strThemeKey);
         } else {
             Yii::log("Invalid theme preview link for" . $strTheme . ". Navigate to Admin Panel to generate a new link.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         }
     }
     $this->buildBootstrap();
     if (_xls_facebook_login()) {
         $this->setFacebookComponent();
     }
     if (Yii::app()->params['STORE_OFFLINE'] != '0' || Yii::app()->params['INSTALLED'] != '1') {
         if (isset($_GET['offline'])) {
             Yii::app()->session['STORE_OFFLINE'] = _xls_number_only($_GET['offline']);
         }
         //If uninstalled on a new Multitenant store, direct to license acceptance to get going
         if (Yii::app()->params['INSTALLED'] != '1' && Yii::app()->params['LIGHTSPEED_MT'] == '1') {
             $url = Yii::app()->createUrl("admin/license");
             $url = str_replace("https:", "http:", $url);
             $this->redirect($url, true);
         }
         if (Yii::app()->session['STORE_OFFLINE'] != Yii::app()->params['STORE_OFFLINE'] || Yii::app()->params['INSTALLED'] != '1') {
             $this->render('/site/offline');
             Yii::app()->end();
         }
     }
     $this->logoutUrl = $this->createUrl("site/logout");
     $strViewset = Yii::app()->theme->info->viewset;
     if (!empty($strViewset)) {
         Yii::app()->setViewPath(Yii::getPathOfAlias('application') . "/views-" . $strViewset);
     }
     $strLayoutFile = Yii::app()->theme->config->layoutFile;
     if (empty($strLayoutFile)) {
         $strLayoutFile = "column2";
         //This is for backwards compatibility only
     }
     if (Yii::app()->theme && file_exists('webroot.themes.' . Yii::app()->theme->name . '.layouts.' . $strLayoutFile)) {
         $this->layout = 'webroot.themes.' . Yii::app()->theme->name . '.layouts.' . $strLayoutFile;
     } else {
         $this->layout = $strLayoutFile;
     }
     //Set defaults
     $this->getUserLanguage();
     $this->pageTitle = Yii::app()->name . " : " . Yii::app()->params['STORE_TAGLINE'];
     $this->pageCanonicalUrl = $this->getCanonicalUrl();
     $this->pageDescription = Yii::app()->params['STORE_TAGLINE'];
     $this->pageImageUrl = '';
     $pageHeaderImage = Yii::app()->params['HEADER_IMAGE'];
     if (substr($pageHeaderImage, 0, 4) != "http") {
         if (substr($pageHeaderImage, 0, 2) != "//") {
             $this->pageAbsoluteHeaderImage = Yii::app()->createAbsoluteUrl($pageHeaderImage, array(), Yii::app()->params['ENABLE_SSL'] ? 'https' : 'http');
             // we prefix with baseUrl to handle instances where Web Store is installed in a sub folder
             $this->pageHeaderImage = Yii::app()->baseUrl . $pageHeaderImage;
         } else {
             $this->pageAbsoluteHeaderImage = Yii::app()->params['ENABLE_SSL'] ? 'https:' . $pageHeaderImage : 'http:' . $pageHeaderImage;
             $this->pageHeaderImage = $pageHeaderImage;
         }
     } else {
         $this->pageAbsoluteHeaderImage = $pageHeaderImage;
         $this->pageHeaderImage = $pageHeaderImage;
     }
     Yii::app()->shoppingcart->updateMissingProducts();
     Yii::app()->shoppingcart->revalidatePromoCode();
     //Run other functions to create some data we always need
     $this->buildGoogle();
     $this->buildSidebars();
     if (_xls_get_conf('SHOW_SHARING', 0)) {
         $this->buildSharing();
     }
     $this->buildAccessWarning();
     $this->gridProductsPerRow = _xls_get_conf('PRODUCTS_PER_ROW', 3);
     Yii::app()->clientScript->registerMetaTag("Lightspeed Web Store " . XLSWS_VERSION, 'generator', null, array(), 'generator');
 }
Пример #12
0
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     require_once "usaepay.php";
     $DEBUGGING = 1;
     # Display additional information to track down problems
     $TESTING = 1;
     # Set the testing flag so that transactions are not live
     $ERROR_RETRIES = 2;
     # Number of transactions to post if soft errors occur
     $source_key = $this->config['source_key'];
     $source_key_pin = isset($this->config['source_key_pin']) ? $this->config['source_key_pin'] : false;
     $tran = new umTransaction();
     $tran->key = $source_key;
     if ($source_key_pin) {
         $tran->pin = $source_key_pin;
     }
     $tran->ip = $_SERVER['REMOTE_ADDR'];
     // This allows fraud blocking on the customers ip address
     if ($this->config['live'] == 'test') {
         $tran->testmode = 1;
     } else {
         $tran->testmode = 0;
     }
     $tran->card = _xls_number_only($this->CheckoutForm->cardNumber);
     // card number, no dashes, no spaces
     $tran->exp = $this->CheckoutForm->cardExpiryMonth . substr($this->CheckoutForm->cardExpiryYear, 2, 2);
     // expiration date 4 digits no /
     $tran->amount = $this->objCart->total;
     // charge amount in dollars
     $tran->invoice = $this->objCart->id_str;
     // invoice number.  must be unique.
     $tran->cardholder = $this->CheckoutForm->cardNameOnCard;
     // name of card holder
     $tran->street = $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2;
     // street address
     $tran->zip = str_replace(" ", "", $this->CheckoutForm->billingPostal);
     // zip code
     $tran->description = _xls_get_conf('STORE_NAME') . " " . $this->objCart->id_str;
     // description of charge
     $tran->cvv2 = $this->CheckoutForm->cardCVV;
     // cvv2 code
     $tran->billfname = $this->CheckoutForm->contactFirstName;
     $tran->billlname = $this->CheckoutForm->contactLastName;
     $tran->billstreet = $this->CheckoutForm->billingAddress1;
     $tran->billstreet2 = $this->CheckoutForm->billingAddress2;
     $tran->billcity = $this->CheckoutForm->billingCity;
     $tran->billstate = $this->CheckoutForm->billingStateCode;
     $tran->billzip = $this->CheckoutForm->billingPostal;
     $tran->billcountry = $this->CheckoutForm->billingCountryCode;
     $tran->billphone = $this->CheckoutForm->contactPhone;
     $tran->email = $this->CheckoutForm->contactEmail;
     $tran->shipfname = $this->CheckoutForm->shippingFirstName;
     $tran->shiplname = $this->CheckoutForm->shippingLastName;
     $tran->shipstreet = $this->CheckoutForm->shippingAddress1;
     $tran->shipstreet2 = $this->CheckoutForm->shippingAddress2;
     $tran->shipcity = $this->CheckoutForm->shippingCity;
     $tran->shipstate = $this->CheckoutForm->shippingStateCode;
     $tran->shipzip = $this->CheckoutForm->shippingPostal;
     $tran->shipcountry = $this->CheckoutForm->shippingCountryCode;
     $tran->custid = Yii::app()->user->id;
     $tranTemp = clone $tran;
     Yii::log(sprintf("%s sending %s for amt %s\nRequest %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($tranTemp), true)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     if ($tran->Process()) {
         //We have success
         $arrReturn['success'] = true;
         $arrReturn['amount_paid'] = $this->objCart->total;
         $arrReturn['result'] = $tran->refnum;
     } else {
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $errortext = Yii::t('global', $tran->error);
         $arrReturn['result'] = Yii::t('global', $errortext);
         Yii::log("Declined: " . $errortext, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     unset($tran->card);
     unset($tran->exp);
     unset($tran->key);
     unset($tran->pin);
     Yii::log(sprintf("%s receiving %s", __CLASS__, print_r($tran, true)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     return $arrReturn;
 }
Пример #13
0
 /**
  * The run() function is called from Web Store to run the process.
  * @return array
  */
 public function run()
 {
     $beanstream_url = "https://www.beanstream.com/scripts/process_transaction.asp";
     $strState = $this->CheckoutForm->billingStateCode;
     $strBillCountry = $this->CheckoutForm->billingCountryCode;
     if ($strBillCountry != "US" && $strBillCountry != "CA") {
         $strState = "--";
     }
     $strShipState = $this->CheckoutForm->shippingStateCode;
     $strShipCountry = $this->CheckoutForm->shippingCountryCode;
     if ($strShipCountry != "US" && $strShipCountry != "CA" && is_null($strShipCountry) === false) {
         $strShipState = "--";
     }
     $beanstream_values = array("requestType" => "BACKEND", "merchant_id" => $this->config['login'], "trnCardNumber" => _xls_number_only($this->CheckoutForm->cardNumber), "trnCardOwner" => $this->CheckoutForm->cardNameOnCard, "trnExpMonth" => trim($this->CheckoutForm->cardExpiryMonth), "trnExpYear" => substr($this->CheckoutForm->cardExpiryYear, 2, 2), "trnCardCvd" => $this->CheckoutForm->cardCVV, "trnOrderNumber" => $this->objCart->id_str, "trnAmount" => $this->objCart->total, "ordName" => $this->CheckoutForm->contactFirstName . " " . $this->CheckoutForm->contactLastName, "ordAddress1" => $this->CheckoutForm->billingAddress1, "ordAddress2" => $this->CheckoutForm->billingAddress2, "ordPostalCode" => str_replace(" ", "", $this->CheckoutForm->billingPostal), "ordEmailAddress" => $this->CheckoutForm->contactEmail, "ordPhoneNumber" => _xls_number_only($this->CheckoutForm->contactPhone), "ordCity" => $this->CheckoutForm->billingCity, "ordProvince" => $strState, "ordCountry" => $strBillCountry, "shipName" => $this->CheckoutForm->shippingFirstName . " " . $this->CheckoutForm->shippingLastName, "shipAddress1" => $this->CheckoutForm->shippingAddress1, "shipAddress2" => $this->CheckoutForm->shippingAddress2, "shipCity" => $this->CheckoutForm->shippingCity, "shipProvince" => $strShipState, "shipPostalCode" => $this->CheckoutForm->shippingPostal, "shipCountry" => $strShipCountry, "shippingMethod" => substr($this->objCart->shipping->shipping_data, 0, 63));
     $beanstream_values = array_filter($beanstream_values);
     Yii::log(sprintf("%s sending %s for amt %s\nResponse %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, print_r($this->obfuscateRequestArray($beanstream_values), true)), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     $beanstremFields = "";
     foreach ($beanstream_values as $key => $value) {
         $beanstremFields .= "{$key}=" . urlencode($value) . "&";
     }
     $ch = curl_init($beanstream_url);
     // Eliminate header info from response.
     curl_setopt($ch, CURLOPT_HEADER, 0);
     // Return response data instead of true(1).
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Use HTTP POST to send form data.
     curl_setopt($ch, CURLOPT_POSTFIELDS, rtrim($beanstremFields, "& "));
     // Force the use of TLS instead of SSLv3
     //  http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Important-POODLE-Information-Updated/ba-p/48163
     curl_setopt($ch, CURLOPT_SSLVERSION, 1);
     // Uncomment the following line if you get 'no gateway response' errors.
     //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     // Execute post and get results
     $resp = curl_exec($ch);
     curl_close($ch);
     $respVals = array();
     Yii::log(sprintf("%s receiving %s", __CLASS__, $resp), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     parse_str($resp, $respVals);
     // Handle the results of the curl call
     if ($resp === false) {
         // Curl call failed
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $arrReturn['result'] = Yii::t('global', "There was an error processing your payment, please try again later.");
         Yii::log("Curl Error: curl call failed.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     } elseif ($respVals['trnApproved'] != '1') {
         // Curl call succeeded but transaction was unsuccessful
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         // beanstream sometimes returns messages prefixed with <li> and suffixed with <br>
         // we handle these bonkers messages here
         $htmlMessage = urldecode($respVals['messageText']);
         $message = strip_tags($htmlMessage, '<br>');
         // remove the last <br> tag
         $intPos = strrpos($message, '<br>');
         if (empty($intPos) === false) {
             $message = substr($message, 0, $intPos);
         }
         $arrReturn['result'] = $message;
         Yii::log("Declined: " . urldecode($respVals['messageText']), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         if (stripos($respVals['messageText'], "Enter your phone number") > 0) {
             $arrReturn['result'] = Yii::t('global', "Declined: Your phone number is missing in your profile, which is required by the credit card processor. Click {link} to update your account with your phone number. Then return to checkout.", array("{link}" => CHtml::link(Yii::t('global', 'Edit Account'), Yii::app()->createUrl("myaccount/edit"))));
         }
     } else {
         // Curl call succeeded and the transaction was successful
         $arrReturn['success'] = true;
         $arrReturn['amount_paid'] = $respVals['authCode'] == "TEST" ? 0.0 : $respVals['trnAmount'];
         $arrReturn['result'] = $respVals['authCode'];
         $arrReturn['payment_date'] = $respVals['trnDate'];
     }
     return $arrReturn;
 }
Пример #14
0
 /**
  * Master function to call the other upgrade steps
  */
 public function actionUpgrade()
 {
     Controller::initParams();
     $this->online = _xls_number_only($_POST['online']);
     if (isset($_GET['debug'])) {
         Yii::log("InstallController on line " . $this->online, 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
     if ($this->online == 1) {
         $retval = $this->actionConvertStart();
     }
     if ($this->online == 3) {
         $retval = $this->actionConvertAddressBook();
     }
     if ($this->online == 8) {
         $retval = $this->actionConvertModules();
     }
     if ($this->online >= 9 && $this->online <= 13) {
         $retval = $this->actionConvertGoogle();
     }
     if ($this->online == 14) {
         $retval = $this->actionConvertKeywordsToTags();
     }
     if ($this->online == 15) {
         $retval = $this->actionConvertFamilies();
     }
     if ($this->online == 16) {
         $retval = $this->actionConvertClasses();
     }
     if ($this->online == 18) {
         $retval = $this->actionConvertDestinationTables();
     }
     if ($this->online == 19) {
         $retval = $this->actionDropcartfields1();
     }
     if ($this->online == 20) {
         $retval = $this->actionDropcartfields2();
     }
     if ($this->online == 21) {
         $retval = $this->actionDropcartfields3();
     }
     if ($this->online == 25) {
         $retval = $this->actionConvertProductSEO();
     }
     if ($this->online == 26) {
         $retval = $this->actionDropcustomerfields();
     }
     if ($this->online == 27) {
         $retval = $this->actionDropProductFields();
     }
     if ($this->online == 28) {
         $retval = $this->actionCalculateInventory();
     }
     if ($this->online == 29) {
         $retval = $this->actionUpdateConfiguration();
     }
     if ($this->online == 2) {
         $result = $this->runMigration();
         if ($result == 50) {
             $this->online = 3;
         }
         $retval = array('result' => "success", 'makeline' => $this->online, 'tag' => 'Migrating Database', 'total' => 50);
     }
     if ($retval != null) {
         if (isset($_GET['debug'])) {
             if (isset($retval['tag'])) {
                 $retval['tag'] .= " online " . $this->online;
             } else {
                 $retval['tag'] = " online " . $this->online;
             }
         }
         echo json_encode($retval);
     }
 }
Пример #15
0
 /**
  * The run() function is called from Web Store to run the process.
  * The return array should have two elements: the first is true/false if the transaction was successful. The second
  * string is either the successful Transaction ID, or the failure Error String to display to the user.
  * @return array
  */
 public function run()
 {
     $strCardType = $this->CheckoutForm->cardType;
     if ($strCardType == "AMERICAN_EXPRESS" || $strCardType == "American Express") {
         $strCardType = "Amex";
     }
     $str = "&PAYMENTACTION=" . 'Sale';
     $str .= "&ITEMAMT=" . $this->objCart->subtotal;
     $str .= "&SHIPPINGAMT=" . $this->objCart->shippingCharge;
     $str .= "&AMT=" . round($this->objCart->total, 2);
     $str .= "&TAXAMT=" . $this->objCart->TaxTotal;
     $str .= "&INVNUM=" . $this->objCart->id_str . date('YmdHis');
     // append the datetime to prevent duplicate id error if payment must be re-tried
     $str .= "&CREDITCARDTYPE=" . $strCardType;
     $str .= "&ACCT=" . _xls_number_only($this->CheckoutForm->cardNumber);
     //AAAABBBBCCCCDDDD
     $str .= "&EXPDATE=" . _xls_number_only($this->CheckoutForm->cardExpiryMonth . $this->CheckoutForm->cardExpiryYear);
     //MMYYYY
     $str .= "&CVV2=" . $this->CheckoutForm->cardCVV;
     $str .= "&FIRSTNAME=" . urlencode($this->CheckoutForm->contactFirstName);
     $str .= "&LASTNAME=" . urlencode($this->CheckoutForm->contactLastName);
     $str .= "&STREET=" . urlencode($this->CheckoutForm->billingAddress2 != '' ? $this->CheckoutForm->billingAddress1 . " " . $this->CheckoutForm->billingAddress2 : $this->CheckoutForm->billingAddress1);
     $str .= "&CITY=" . urlencode($this->CheckoutForm->billingCity);
     $str .= "&STATE=" . strtoupper($this->CheckoutForm->billingStateCode);
     $str .= "&ZIP=" . str_replace(" ", "", $this->CheckoutForm->billingPostal);
     $str .= "&COUNTRYCODE=" . strtoupper($this->CheckoutForm->billingCountryCode);
     $str .= "&EMAIL=" . $this->CheckoutForm->contactEmail;
     $str .= "&CURRENCYCODE=" . strtoupper(_xls_get_conf('CURRENCY_DEFAULT', 'USD'));
     //CAD or USD
     $str .= "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
     if ($this->config['live'] == 'test') {
         $API_Endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
         $API_UserName = $this->config['api_username_sb'];
         $API_Password = $this->config['api_password_sb'];
         $API_Signature = $this->config['api_signature_sb'];
     } else {
         $API_Endpoint = 'https://api-3t.paypal.com/nvp';
         $API_UserName = $this->config['api_username'];
         $API_Password = $this->config['api_password'];
         $API_Signature = $this->config['api_signature'];
     }
     $version = '57.0';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
     curl_setopt($ch, CURLOPT_VERBOSE, 1);
     // Force the use of TLS instead of SSLv3.
     //  https://ppmts.custhelp.com/app/answers/detail/a_id/1182/session/L3RpbWUvMTQxNjg0NzY2Mi9zaWQvb0t6Y3llOG0%3D
     curl_setopt($ch, CURLOPT_SSLVERSION, 1);
     // TODO - Verify if this is still the recommended way to connect to paypal (WS-3516)
     // Turn off the server and peer verification (TrustManager Concept).
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
     // Return response data instead of true(1).
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Do a regular HTTP POST
     curl_setopt($ch, CURLOPT_POST, 1);
     // Set the API operation, version, and API signature in the request.
     $strPaypalPost = "METHOD=doDirectPayment&VERSION=" . urlencode($version) . "&PWD=" . urlencode($API_Password) . "&USER="******"&SIGNATURE=" . urlencode($API_Signature) . $str;
     if (isset($this->CheckoutForm->debug) && $this->CheckoutForm->debug) {
         return $strPaypalPost;
     }
     // Set the request as a POST FIELD for curl.
     curl_setopt($ch, CURLOPT_POSTFIELDS, $strPaypalPost);
     $resp = curl_exec($ch);
     //converting NVPResponse to an Associative Array
     $nvpResArray = $this->deformatNVP($resp);
     $strPaypalPost = $this->obfuscateStr($strPaypalPost);
     Yii::log(sprintf("%s sending %s for amt %s\nString %s", __CLASS__, $this->objCart->id_str, $this->objCart->total, $strPaypalPost), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     Yii::log(sprintf('%s receiving %s', __CLASS__, print_r($nvpResArray, true)), $this->logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__);
     if (curl_errno($ch)) {
         // moving to display page to display curl errors
         Yii::log("curl_error " . curl_errno($ch), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
         Yii::log("curl_error_msg " . curl_error($ch), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
         $errortext = _sp("There was a PayPal system error. Check error logs.");
         curl_close($ch);
         return FALSE;
     } else {
         //closing the curl
         curl_close($ch);
         $nvpResArray['ACK'] = strtoupper($nvpResArray['ACK']);
     }
     /*
     	Sample returned
     	[TIMESTAMP] => 2009-06-09T22:23:58Z
     	[CORRELATIONID] => aa77bb77aa77
     	[ACK] => SUCCESS
     	[VERSION] => 57.0
     	[BUILD] => 921486
     	[AMT] => 52.49
     	[CURRENCYCODE] => USD
     	[AVSCODE] => X
     	[CVV2MATCH] => M
     	[TRANSACTIONID] => 2SK51234GE217235G
     
     	[TIMESTAMP] => 2009-06-09T22:24:03Z
     	[CORRELATIONID] => aa77bb77aa77
     	[ACK] => Failure
     	[VERSION] => 57.0
     	[BUILD] => 921486
     	[L_ERRORCODE0] => 10508
     	[L_SHORTMESSAGE0] => Invalid Data
     	[L_LONGMESSAGE0] => This transaction cannot be processed. Please enter a valid credit card expiration date.
     	[L_SEVERITYCODE0] => Error
     	[AMT] => 52.49
     	[CURRENCYCODE] => USD
     */
     $arrReturn['jump_url'] = false;
     $arrReturn['api'] = $this->apiVersion;
     $arrReturn['jump_form'] = null;
     if ($nvpResArray['ACK'] != 'SUCCESS') {
         $arrReturn['success'] = false;
         $arrReturn['amount_paid'] = 0;
         $errortext = _sp($nvpResArray['L_SHORTMESSAGE0'] . ": " . $nvpResArray['L_LONGMESSAGE0']);
         $arrReturn['result'] = $errortext;
         Yii::log($errortext, 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__);
     } else {
         //We have success
         $arrReturn['success'] = true;
         $arrReturn['amount_paid'] = $nvpResArray['AMT'];
         $arrReturn['result'] = $nvpResArray['TRANSACTIONID'];
         $arrReturn['payment_date'] = $nvpResArray['TIMESTAMP'];
     }
     return $arrReturn;
 }
Пример #16
0
 public function run()
 {
     // place the action logic here
     //Load some information we'll use within the loops
     $intStockHandling = _xls_get_conf('INVENTORY_OUT_ALLOW_ADD', 0);
     $intGoogleMPN = _xls_get_conf('GOOGLE_MPN', 0);
     $strQueryAddl = $intStockHandling == 0 ? " AND inventory_avail>0" : "";
     header("content-type: text/xml;charset=UTF-8");
     echo '<?xml version="1.0" encoding="UTF-8"?>' . chr(13);
     echo ' <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">' . chr(13);
     echo '<channel>' . chr(13);
     echo '		<title><![CDATA[' . _xls_get_conf('STORE_NAME', 'Lightspeed Web Store') . ']]></title>' . chr(13);
     echo '		<link>' . _xls_site_url() . '</link>' . chr(13);
     echo '		<description><![CDATA[' . _xls_get_conf('STORE_TAGLINE') . ']]></description>' . chr(13);
     // We only want active web products that are not master products
     // https://support.google.com/merchants/answer/188494
     $sql = 'SELECT * FROM ' . Product::model()->tableName() . ' WHERE current=1 AND web=1 AND master_model=0 ' . $strQueryAddl . ' ORDER BY id';
     if (isset($_GET['group'])) {
         $intGroup = _xls_number_only($_GET['group']);
         if ($intGroup < 1) {
             $intGroup = 1;
         }
         $parse = _xls_get_conf('GOOGLE_PARSE', 5000);
         switch ($intGroup) {
             case 1:
                 $sql .= " limit " . $parse;
                 break;
             default:
                 $sql .= " limit " . ($intGroup - 1) * $parse . "," . $parse;
                 break;
         }
     }
     $arrProducts = Yii::app()->db->createCommand($sql)->query();
     while (($arrItem = $arrProducts->read()) !== false) {
         $objProduct = Product::model()->findByPk($arrItem['id']);
         $arrGoogle = _xls_get_googlecategory($objProduct->id);
         $strGoogle = $arrGoogle['Category'];
         $arrTaxGrids = $objProduct->GetTaxRateGrid();
         $arrTrail = Category::GetTrailByProductId($objProduct->id, 'names');
         //If our current category doesn't have Google set but we have a parent that does, use it
         if (empty($strGoogle) && count($arrTrail) > 1) {
             $arrGoogle = _xls_get_googleparentcategory($objProduct->id);
             $strGoogle = $arrGoogle['Category'];
         }
         echo '<item>' . chr(13);
         echo chr(9) . "<g:id>" . $objProduct->id . "</g:id>" . chr(13);
         echo chr(9) . '<title><![CDATA[' . strip_tags($objProduct->Title) . ']]></title>' . chr(13);
         if ($objProduct->description_long) {
             echo chr(9) . '<description><![CDATA[' . $objProduct->WebLongDescription . ']]></description>' . chr(13);
         }
         if ($strGoogle) {
             echo chr(9) . '<g:google_product_category>' . $strGoogle . '</g:google_product_category>' . chr(13);
         }
         if ($arrTrail) {
             echo chr(9) . '<g:product_type><![CDATA[' . implode(" &gt; ", $arrTrail) . ']]></g:product_type>' . chr(13);
         }
         echo chr(9) . '<link>' . $objProduct->directUrl . '</link>' . chr(13);
         if ($objProduct->image_id) {
             $arrProductImages = $objProduct->getProductPhotos(true);
             if ($arrProductImages) {
                 echo chr(9) . '<g:image_link>' . $arrProductImages[0]['image'] . '</g:image_link>' . chr(13);
                 for ($index = 1; $index < count($arrProductImages); $index++) {
                     echo chr(9) . '<g:additional_image_link>' . $arrProductImages[$index]['image'] . '</g:additional_image_link>' . chr(13);
                 }
             }
         }
         echo chr(9) . '<g:condition>new</g:condition>' . chr(13);
         if ($objProduct->IsAddable) {
             echo chr(9) . '<g:availability>in stock</g:availability>' . chr(13);
         } else {
             echo chr(9) . '<g:availability>out of stock</g:availability>' . chr(13);
         }
         echo chr(9) . '<g:price>' . $objProduct->PriceValue . '</g:price>' . chr(13);
         echo chr(9) . '<g:brand><![CDATA[' . $objProduct->Family . ']]></g:brand>' . chr(13);
         echo chr(9) . '<g:gtin>' . $objProduct->upc . '</g:gtin>' . chr(13);
         if ($intGoogleMPN) {
             echo chr(9) . '<g:mpn><![CDATA[' . $objProduct->code . ']]></g:mpn>' . chr(13);
         }
         if (substr($strGoogle, 0, 7) == "Apparel") {
             echo chr(9) . '<g:gender>' . $arrGoogle['Gender'] . '</g:gender>' . chr(13);
             echo chr(9) . '<g:age_group>' . $arrGoogle['Age'] . '</g:age_group>' . chr(13);
         }
         echo chr(9) . '<g:color><![CDATA[' . $objProduct->product_color . ']]></g:color>' . chr(13);
         echo chr(9) . '<g:size><![CDATA[' . $objProduct->product_size . ']]></g:size>' . chr(13);
         if ($objProduct->parent > 0) {
             echo chr(9) . '<item_group_id>' . $objProduct->parent . '</item_group_id>' . chr(13);
         }
         foreach ($arrTaxGrids as $arrTaxGrid) {
             echo chr(9) . '<g:tax>' . chr(13);
             echo chr(9) . '   <g:country>' . $arrTaxGrid[0] . '</g:country>' . chr(13);
             echo chr(9) . '  <g:region>' . $arrTaxGrid[1] . '</g:region>' . chr(13);
             echo chr(9) . '  <g:rate>' . $arrTaxGrid[2] . '</g:rate>' . chr(13);
             echo chr(9) . '  <g:tax_ship>' . $arrTaxGrid[3] . '</g:tax_ship>' . chr(13);
             echo chr(9) . '</g:tax>	' . chr(13);
         }
         echo chr(9) . '<g:shipping_weight>' . $objProduct->product_weight . '</g:shipping_weight>' . chr(13);
         echo '</item>' . chr(13);
     }
     echo '</channel>' . chr(13);
     echo '</rss>';
     Yii::app()->db->createCommand("UPDATE xlsws_modules set active=1 where module='wsgooglemerchant'")->execute();
 }