Exemple #1
0
 public static function Send($id_lang, $template, $subject, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false, $id_shop = NULL, $bcc = null)
 {
     if (Module::isInstalled('agileprepaidcredit') and $template == 'payment_error') {
         if (AgilePrepaidCredit::isPaymentErrorCausedByTokens($templateVars) > 0) {
             return true;
         }
     }
     $order_info_templates = array('order_conf', 'bankwire', 'cheque', 'new_order');
     if (Module::isInstalled('agilesellershipping') and in_array($template, $order_info_templates)) {
         AgileSellerManager::adjust_shipping_cost_carriers($templateVars);
     }
     if (Module::isInstalled('agilepickupcenter') and $template == 'order_conf') {
         require_once _PS_ROOT_DIR_ . "/modules/agilepickupcenter/agilepickupcenter.php";
         $amodule = new AgilePickupCenter();
         $templateVars = $amodule->transform_mail_data($templateVars);
         if (isset($templateVars['{carrier_email}']) and Validate::isEmail($templateVars['{carrier_email}'])) {
             parent::Send($id_lang, $template, $subject, $templateVars, $templateVars['{carrier_email}'], $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
         }
     }
     if (in_array($template, $order_info_templates)) {
         $shop_email = Configuration::get('PS_SHOP_EMAIL');
         if (Module::isInstalled('agilemultipleseller')) {
             require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
             $templateVars = AgileSellerManager::appendMailTemplateVars($templateVars, $id_lang);
         }
         if (Module::isInstalled('agileprepaidcredit') and in_array($template, array('bankwire', 'cheque'))) {
             require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
             $templateVars = AgilePrepaidCredit::replace_amount2pay($templateVars);
         }
         parent::Send($id_lang, $template, $subject, $templateVars, $shop_email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
     }
     if (Module::isInstalled('agilemultipleseller') and $template == 'order_customer_comment') {
         $id_order = intval($templateVars['{id_order}']);
         $id_seller = AgileSellerManager::getObjectOwnerID('order', $id_order);
         $seller = new Employee($id_seller);
         parent::Send($id_lang, $template, $subject, $templateVars, $seller->email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
     }
     if (Module::isInstalled('agilemultipleseller') and $template == 'order_conf') {
         require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
         AgileMultipleSeller::sendNewOrderMail($id_lang, $templateVars, $from, $fromName, $fileAttachment, $modeSMTP, $die, $id_shop, $bcc);
     }
     return parent::Send($id_lang, $template, $subject, $templateVars, $to, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc);
 }
 public static function convert_balance_to_token($id_customer, $amount_to_convert, $desc)
 {
     $cakdiwup = "account_balance";
     ${"GLOBALS"}["wydinnxpjg"] = "currency";
     global $cookie;
     ${"GLOBALS"}["qdzrwqyyfe"] = "token_units";
     if (!Module::isInstalled("agileprepaidcredit")) {
         return;
     }
     if (!Module::isInstalled("agilesellercommission")) {
         return;
     }
     ${"GLOBALS"}["vwmwnyrlbhw"] = "token_units";
     require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
     $czpafvny = "sellerinfo";
     $sssdvetl = "apcm";
     $cebtzbvhkvjb = "amount_to_convert";
     require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/CustomerCredit.php";
     require_once _PS_ROOT_DIR_ . "/modules/agilesellercommission/SellerCommission.php";
     require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
     if (${${"GLOBALS"}["xnhalilbkn"]} <= 0) {
         return Tools::displayError("Invalid convert amount.");
     }
     ${${"GLOBALS"}["atnqtpp"]} = new SellerInfo(SellerInfo::getIdByCustomerId(${${"GLOBALS"}["tivjjbgb"]}));
     ${"GLOBALS"}["cdokbpvfy"] = "amount_to_convert";
     if (!Validate::isLoadedObject(${$czpafvny})) {
         return Tools::displayError("Seller info can not be found.");
     }
     ${${"GLOBALS"}["mvofkxku"]} = AgileSellerManager::getAccountBalance($sellerinfo->id_seller);
     if (${$cakdiwup} < ${${"GLOBALS"}["cdokbpvfy"]}) {
         return Tools::displayError("You do not have enough account balance.");
     }
     ${${"GLOBALS"}["wydinnxpjg"]} = new Currency(Configuration::get("ASC_COMMISSION_CURRENCY"));
     ${${"GLOBALS"}["vwmwnyrlbhw"]} = AgilePrepaidCredit::ConvertPrice2Tokens($currency->id, ${${"GLOBALS"}["xnhalilbkn"]});
     ${${"GLOBALS"}["givutwwah"]} = new CustomerCredit();
     $cc->id = 0;
     $cc->id_customer = $cookie->id_customer;
     $cc->id_order = 0;
     ${$sssdvetl} = new AgilePrepaidCredit();
     if (version_compare($apcm->version, "1.4.9", ">=")) {
         $cc->id_reason = AgilePrepaidCredit::CREDIT_REASON_FROM_SELLERCOMMISSION;
     }
     $cc->units = ${${"GLOBALS"}["qdzrwqyyfe"]};
     $cc->date_add = date("Y-m-d H:i:s");
     $cc->add();
     SellerCommission::addCreditMemoRecord($sellerinfo->id_seller, SellerCommission::RECORD_TYPE_SELLER_DEBIT, ${$cebtzbvhkvjb}, ${${"GLOBALS"}["uzllxeigbbj"]});
     return "";
 }
 public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
 {
     @session_start();
     @set_time_limit(120);
     $_SESSION['id_cart_validating'] = (int) $id_cart;
     if (Module::isInstalled('agileprepaidcredit')) {
         require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
         AgilePrepaidCredit::set_token_payment_processing_marker($id_cart, true);
     }
     if (!Module::isInstalled('agilemultipleseller')) {
         $ret = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ret;
     }
     require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
     $paymode = (int) Configuration::get('AGILE_MS_PAYMENT_MODE');
     $sellers = AgileMultipleSeller::getSellersByCart($id_cart);
     if (count($sellers) <= 1) {
         $id_cart_patent = AgileMultipleSeller::get_subcart_parentid($id_cart);
         $ordervalided = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if ($ordervalided and $id_cart_patent > 0) {
             AgileMultipleSeller::remove_subcart_items_from_maincart($id_cart, $this->currentOrder);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ordervalided;
     }
     $cartinfos = AgileMultipleSeller::split_shopping_cart($id_cart, $sellers);
     if (empty($cartinfos)) {
         $ret = parent::validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
         return $ret;
     }
     $ret = true;
     foreach ($cartinfos as $cartinfo) {
         $_SESSION['id_cart_validating'] = (int) $cartinfo['id_cart'];
         $this->context->cart = new Cart(intval($cartinfo['id_cart']));
         $this->context->cart->getPackageList(true);
         $filter = CartRule::FILTER_ACTION_ALL;
         $cache_key = 'Cart::getCartRules' . $cartinfo['id_cart'] . '-' . $filter;
         if (Cache::isStored($cache_key)) {
             Cache::clean($cache_key);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::set_token_payment_processing_marker($cartinfo['id_cart'], true);
         }
         $ret = $ret and parent::validateOrder($cartinfo['id_cart'], $id_order_state, $cartinfo['amountPaid'], $paymentMethod, $message, $extraVars, $currency_special, $dont_touch_amount, $secure_key);
         $this->updateSellerCommissionRecordType($paymode, $message);
         if ($this->name == 'agilepaypalparallel') {
             $this->updateTxnDetailCartID($message, $this->currentOrder, $cartinfo['id_cart']);
         }
         if (Module::isInstalled('agileprepaidcredit')) {
             AgilePrepaidCredit::adjustOrderForTokens($this->currentOrder);
             if ($this->name == 'agilepaypalparallel' || ($this->name = 'agilepaypaladaptive')) {
                 AgilePrepaidCredit::adjustOrderPaymentAmount($this->currentOrder, $this->name);
                 AgilePrepaidCredit::checkOrderInvoicePayment($this->currentOrder);
             }
         }
     }
     return $ret;
 }
Exemple #4
0
 public function initContent()
 {
     $dujxmdimr = "cms";
     $jewjbpezikv = "link_terms";
     parent::initContent();
     $fojrmoqrqht = "paycommission_url";
     global $cookie, $link, $smarty;
     $this->context->controller->addJQueryPlugin("fancybox");
     $this->context->controller->addJQueryUI("ui.sortable");
     ${"GLOBALS"}["rfvrgtigtrw"] = "account_balance";
     $this->context->controller->addJQueryUI("ui.draggable");
     $this->context->controller->addJQueryUI("effects.transfer");
     ${${"GLOBALS"}["xwbhtra"]} = Context::getContext()->cookie->id_lang;
     ${${"GLOBALS"}["hnxcwphyjtg"]} = new CMS((int) Configuration::get("AGILE_MS_SELLER_TERMS"), (int) $cookie->id_lang);
     $xmyqsx = "paycommission_url";
     ${${"GLOBALS"}["cgxcwcw"]} = $link->getCMSLink(${$dujxmdimr}, $cms->link_rewrite, true);
     $mwkwpdd = "link_terms";
     if (!strpos(${${"GLOBALS"}["cgxcwcw"]}, "?")) {
         ${${"GLOBALS"}["cgxcwcw"]} .= "?content_only=1";
     } else {
         ${$mwkwpdd} .= "&content_only=1";
     }
     $smarty->assign(array("link_terms" => ${$jewjbpezikv}, "id_cms_seller_terms" => intval(Configuration::get("AGILE_MS_SELLER_TERMS"))));
     ${${"GLOBALS"}["xfocwqwkpk"]} = 0;
     ${$fojrmoqrqht} = "";
     $dsmoyovxdiy = "token_balance";
     if (Module::isInstalled("agilesellercommission")) {
         ${"GLOBALS"}["gfmbcvrxuee"] = "account_balance";
         $conmijg = "account_balance";
         include_once _PS_ROOT_DIR_ . "/modules/agilesellercommission/agilesellercommission.php";
         ${"GLOBALS"}["xteysyfbyd"] = "paycommission_url";
         include_once _PS_ROOT_DIR_ . "/modules/agilesellercommission/SellerCommission.php";
         $kgsttmvgw = "paydata";
         ${"GLOBALS"}["qsgosovu"] = "paydata";
         ${$conmijg} = AgileSellerManager::getAccountBalance($this->sellerinfo->id_seller);
         ${${"GLOBALS"}["qsgosovu"]} = array("record_type" => SellerCommission::RECORD_TYPE_SELLER_PAY_STORE, "id_seller" => $this->sellerinfo->id_seller, "amount_to_pay" => -${${"GLOBALS"}["gfmbcvrxuee"]}, "retkey" => Tools::getValue("token"), "paykey" => Tools::encrypt($this->sellerinfo->id_seller), "isfront" => 1);
         ${${"GLOBALS"}["xteysyfbyd"]} = AgileSellerCommission::get_paycommission_url(${$kgsttmvgw});
     }
     ${${"GLOBALS"}["gmrvjuvp"]} = 0;
     if (Module::isInstalled("agileprepaidcredit")) {
         include_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php";
         ${${"GLOBALS"}["gmrvjuvp"]} = AgilePrepaidCredit::GetTokenBalance($cookie->id_customer);
     }
     ${${"GLOBALS"}["pqffvnkmpnf"]} = (int) Configuration::get("PS_CURRENCY_DEFAULT");
     self::$smarty->assign(array("seller_tab_id" => 1, "num_products" => $this->isSeller ? AgileSellerManager::getNumOfProducts($this->sellerinfo->id_seller) : 0, "num_orders" => $this->isSeller ? AgileSellerManager::getNumOfOrders($this->sellerinfo->id_seller) : 0, "totals_sold" => AgileSellerManager::getTotalAmountSold($this->sellerinfo->id_seller), "currency" => new Currency(${${"GLOBALS"}["pqffvnkmpnf"]}), "comcurrency" => new Currency((int) Configuration::get("ASC_COMMISSION_CURRENCY")), "paycommission_url" => ${$xmyqsx}, "account_balance" => ${${"GLOBALS"}["rfvrgtigtrw"]}, "token_balance" => ${$dsmoyovxdiy}, "membership_module_integrated" => (Module::isInstalled("agilemembership") and intval(Configuration::get("AGILE_MEMBERSHIP_SELLER_INTE")) > 0) ? 1 : 0, "request_T2B" => $this->l('CHANGE TOKENS TO BALANCE'), "request_B2T" => $this->l('CHANGE BALANCE TO TOKENS'), "request_MPR" => $this->l('MAKE A PEYMENT REQUEST')));
     $this->setTemplate("sellersummary.tpl");
 }