예제 #1
0
 public function postProcess()
 {
     $this->context->smarty->assign(array("cfmmsg_flag" => Tools::getValue("cfmmsg_flag")));
     if (Tools::isSubmit("submitSellerAccount")) {
         AgileMultipleSeller::createSellerAccount(new Customer(self::$cookie->id_customer));
         Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true));
     }
     if (Tools::getValue("submitRequest") == "B2T") {
         $zbdpzet = "errmsg";
         ${${"GLOBALS"}["uswhdzhd"]} = AgileMultipleSeller::convert_balance_to_token(self::$cookie->id_customer, (double) Tools::getValue("amount_to_convert"), $this->l('CHANGE BALANCE TO TOKENS'));
         if (!empty(${$zbdpzet})) {
             $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]};
             return;
         }
         Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true));
     }
     if (Tools::getValue("submitRequest") == "MPR") {
         ${${"GLOBALS"}["uswhdzhd"]} = AgileMultipleSeller::make_fund_request(self::$cookie->id_customer, (double) Tools::getValue("amount_to_convert"), $this->l('MAKE FUND REQUEST'));
         if (!empty(${${"GLOBALS"}["uswhdzhd"]})) {
             $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]};
             return;
         }
         Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true));
     }
     if (Tools::getValue("submitRequest") == "T2B") {
         ${"GLOBALS"}["jjycov"] = "errmsg";
         ${${"GLOBALS"}["jjycov"]} = AgileMultipleSeller::convert_tokens_to_balance(self::$cookie->id_customer, (double) Tools::getValue("tokens_to_convert"), $this->l('CHANGE TOKENS TO BALANCE'));
         if (!empty(${${"GLOBALS"}["uswhdzhd"]})) {
             $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]};
             return;
         }
         Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true));
     }
 }
 private function create_seller_account($object)
 {
     if ($this->is_seller or Tools::getValue('create_seller_account') <= 0) {
         return;
     }
     if (!Module::isInstalled('agilemultipleseller')) {
         return;
     }
     include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
     $id_sellerinfo = SellerInfo::getIdByCustomerId($object->id);
     if ($id_sellerinfo > 0) {
         return;
     }
     include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
     AgileMultipleSeller::createSellerAccount($object);
 }
예제 #3
0
 protected function processSubmitSellerinfo()
 {
     $cugxxpwlfps = "firstname";
     ${"GLOBALS"}["gmnuknt"] = "lastname";
     $eoemtqhasop = "passwd";
     ${$cugxxpwlfps} = trim(Tools::getValue("firstname"));
     ${${"GLOBALS"}["gmnuknt"]} = trim(Tools::getValue("lastname"));
     $ufvrdeas = "customer";
     $seqgjbwpajto = "email";
     ${$eoemtqhasop} = trim(Tools::getValue("passwd"));
     ${${"GLOBALS"}["cyutgacgwj"]} = trim(Tools::getValue("email"));
     if (empty(${${"GLOBALS"}["efoxtmc"]})) {
         $this->errors[] = Tools::displayError("First name is required field.");
     }
     if (empty(${${"GLOBALS"}["ptvgwodrri"]})) {
         $this->errors[] = Tools::displayError("Last name is required field.");
     }
     ${"GLOBALS"}["yqbqcnmck"] = "email";
     ${"GLOBALS"}["utmvhz"] = "passwd";
     ${"GLOBALS"}["tgijpv"] = "country";
     if (empty(${$seqgjbwpajto})) {
         $this->errors[] = Tools::displayError("An email address required.");
     } elseif (!Validate::isEmail(${${"GLOBALS"}["yqbqcnmck"]})) {
         $this->errors[] = Tools::displayError("Invalid email address.");
     } elseif (empty(${${"GLOBALS"}["trolpj"]})) {
         $this->errors[] = Tools::displayError("Password is required.");
     } elseif (!Validate::isPasswd(${${"GLOBALS"}["utmvhz"]})) {
         $this->errors[] = Tools::displayError("Invalid password.");
     }
     if (Customer::customerExists(${${"GLOBALS"}["cyutgacgwj"]})) {
         $this->errors[] = Tools::displayError("An account using this email address has already been registered.", false);
     }
     if (empty($_POST["postcode"])) {
         $this->errors[] = Tools::displayError("Postcode is required field.");
     }
     ${"GLOBALS"}["hdrwdzkfjgu"] = "zip_code_format";
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     if (!(${${"GLOBALS"}["tgijpv"]} = new Country($this->sellerinfo->id_country)) || !Validate::isLoadedObject(${${"GLOBALS"}["lqineuzwfyx"]})) {
         throw new PrestaShopException("Country cannot be loaded with address->id_country");
     }
     if ((int) $country->contains_states && !(int) $this->sellerinfo->id_state) {
         $this->errors[] = Tools::displayError("This country requires a state selection.");
     }
     ${${"GLOBALS"}["hdrwdzkfjgu"]} = $country->zip_code_format;
     $mlynabrtypu = "firstname";
     if ($country->need_zip_code) {
         $pttheklyj = "zip_code_format";
         $rbigoogxf = "postcode";
         $eyigihyebms = "postcode";
         ${"GLOBALS"}["plwthxmbdlo"] = "zip_code_format";
         $cxtukbkhyi = "postcode";
         if ((${$rbigoogxf} = Tools::getValue("postcode")) && ${${"GLOBALS"}["sjdohmx"]}) {
             ${"GLOBALS"}["svnohdsrl"] = "zip_code_format";
             ${"GLOBALS"}["izxvxdtqx"] = "zip_regexp";
             ${${"GLOBALS"}["izxvxdtqx"]} = "/^" . ${${"GLOBALS"}["sjdohmx"]} . "\$/ui";
             ${"GLOBALS"}["qrxaqqsef"] = "zip_regexp";
             ${"GLOBALS"}["sjdvshef"] = "zip_regexp";
             $tvchozgsi = "zip_regexp";
             ${"GLOBALS"}["ttwdyf"] = "zip_regexp";
             $vvtylsjtq = "postcode";
             ${"GLOBALS"}["ncdyrvfvd"] = "zip_regexp";
             ${$tvchozgsi} = str_replace(" ", "( |)", ${${"GLOBALS"}["ncdyrvfvd"]});
             ${"GLOBALS"}["jzxhhwlf"] = "zip_regexp";
             ${${"GLOBALS"}["sjdvshef"]} = str_replace("-", "(-|)", ${${"GLOBALS"}["rjvnbwy"]});
             ${${"GLOBALS"}["rjvnbwy"]} = str_replace("N", "[0-9]", ${${"GLOBALS"}["qrxaqqsef"]});
             ${${"GLOBALS"}["rjvnbwy"]} = str_replace("L", "[a-zA-Z]", ${${"GLOBALS"}["jzxhhwlf"]});
             ${${"GLOBALS"}["ttwdyf"]} = str_replace("C", $country->iso_code, ${${"GLOBALS"}["rjvnbwy"]});
             if (!preg_match(${${"GLOBALS"}["rjvnbwy"]}, ${$vvtylsjtq})) {
                 $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["svnohdsrl"]})));
             }
         } else {
             if (${$pttheklyj}) {
                 $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is required.");
             } else {
                 if (${$eyigihyebms} && !preg_match("/^[0-9a-zA-Z -]{4,9}\$/ui", ${$cxtukbkhyi})) {
                     $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["plwthxmbdlo"]})));
                 }
             }
         }
     }
     if ($country->isNeedDni() && (!Tools::getValue("dni") || !Validate::isDniLite(Tools::getValue("dni")))) {
         $this->errors[] = Tools::displayError("Identification number is incorrect or has already been used.");
     }
     $this->sellerinfo->dni = Tools::getValue("dni");
     $this->sellerinfo->latitude = Tools::getValue("latitude");
     $this->sellerinfo->longitude = Tools::getValue("longitude");
     $this->sellerinfo->id_sellertype1 = Tools::getValue("id_sellertype1");
     $this->sellerinfo->id_sellertype2 = Tools::getValue("id_sellertype2");
     SellerInfo::processLogoUpload($this->sellerinfo);
     $this->errors = array_merge($this->errors, $this->sellerinfo->validateController());
     if (!empty($this->errors)) {
         return;
     }
     ${${"GLOBALS"}["rdkumopydcrd"]} = new Customer();
     $customer->firstname = ${$mlynabrtypu};
     $customer->lastname = ${${"GLOBALS"}["ptvgwodrri"]};
     $customer->email = ${${"GLOBALS"}["cyutgacgwj"]};
     $customer->is_guest = 1;
     $customer->active = 1;
     $lkenglu = "customer";
     if ($customer->add()) {
         if (!$this->sendConfirmationMail(${${"GLOBALS"}["rdkumopydcrd"]})) {
             $this->errors[] = Tools::displayError("The email cannot be sent.");
         }
     } else {
         $this->errors[] = Tools::displayError("Error during create a new customer account.");
         return;
     }
     $this->updateContext(${$ufvrdeas});
     Hook::exec("actionCustomerAccountAdd", array("_POST" => $_POST, "newCustomer" => ${$lkenglu}));
     if (empty($this->_errors)) {
         ${"GLOBALS"}["brdlwjleiw"] = "url";
         ${"GLOBALS"}["fnsbgq"] = "url";
         AgileMultipleSeller::createSellerAccount(${${"GLOBALS"}["rdkumopydcrd"]});
         ${${"GLOBALS"}["brdlwjleiw"]} = $this->context->link->getModuleLink("agilemultipleseller", "sellersignup", array(), true);
         Tools::redirect(${${"GLOBALS"}["fnsbgq"]});
     }
 }
    }
} else {
    $errors .= $paypal->getL('verified');
}
if (!empty($errors) and isset($_POST['custom'])) {
    $_SESSION['agile_paypal_validating_order'] = 1;
    if ($_POST['payment_status'] == 'Pending') {
        $paypal->validateOrder(intval($_POST['custom']), _PS_OS_PAYPAL_, floatval($_POST['mc_gross']), $paypal->displayName, $paypal->getL('transaction') . $_POST['txn_id'] . '<br />' . $errors, array(), NULL, false, $customer->secure_key);
    } else {
        $paypal->validateOrder(intval($_POST['custom']), _PS_OS_ERROR_, 0, $paypal->displayName, $errors . '<br />', array(), NULL, false, $customer->secure_key);
    }
    $_SESSION['agile_paypal_validating_order'] = 0;
}
if (intval($paypal->currentOrder) > 0) {
    $apt = new AgilePaypalTxn();
    $apt->id_cart = intval($_POST['custom']);
    $apt->id_order = $paypal->currentOrder;
    $apt->paypal_txn = $_POST['txn_id'];
    $apt->subscr_id = isset($_POST['subscr_id']) ? $_POST['subscr_id'] : '';
    $apt->remark = 'Payment status:' . $_POST['payment_status'];
    $apt->add();
}
if (intval($paypal->currentOrder) > 0 and Module::isInstalled('agilesellercommission')) {
    include_once dirname(__FILE__) . '/../../modules/agilesellercommission/agilesellercommission.php';
    include_once dirname(__FILE__) . '/../../modules/agilesellercommission/SellerCommission.php';
    SellerCommission::updateRecordType($paypal->currentOrder, intval(Tools::getValue('invoice')), $_POST['txn_id']);
}
if ($customer_isnew == 1 and Module::isInstalled('agilemultipleseller') and intval(Configuration::get('AGILE_MS_CUSTOMER_SELLER')) == 1 and intval(Configuration::get('AGILE_MS_AUTO_SIGNUP')) == 1) {
    include_once dirname(__FILE__) . '/../../modules/agilemultipleseller/agilemultipleseller.php';
    AgileMultipleSeller::createSellerAccount(new Customer($customer->id));
}