function checkoutAction() { $auth = Zend_Auth::getInstance(); $userId = $auth->getIdentity()->guid; $modelUser = new Pandamp_Modules_Identity_User_Model_User(); $userDetailInfo = $modelUser->find($userId)->current(); $modelUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance(); $userFinanceInfo = $modelUserFinance->fetchRow("userId='" . $userId . "'"); if (empty($userFinanceInfo)) { $finance = $modelUserFinance->fetchNew(); $finance->userId = $userId; $finance->taxNumber = ''; $finance->taxCompany = $userDetailInfo->company; $finance->taxAddress = $userDetailInfo->address; $finance->taxCity = $userDetailInfo->city; $finance->taxProvince = $userDetailInfo->state; $finance->taxCountryId = $userDetailInfo->countryId; $finance->taxZip = $userDetailInfo->zip; $finance->save(); } $userFinanceInfo = $modelUserFinance->fetchRow("userId='" . $userId . "'"); $cart =& $_SESSION['jCart']; if (!is_object($cart)) { $cart = new jCart(); } $this->view->cart = $cart; $this->view->userInfo = $userFinanceInfo; if ($this->_isStoreClosed()) { $this->_forward('closed', 'store', 'site'); } }
function panelMembershipAction() { $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowInActive = $tblUser->fetchAll("isActive=0"); $rowActive = $tblUser->fetchAll("isActive=1"); $num_rows_active = count($rowActive); $num_rows_inactive = count($rowInActive); $this->view->active = $num_rows_active; $this->view->inactive = $num_rows_inactive; }
public function sendReceiptToUser($orderId, $paymentMethod = '', $statusText = '') { $config = new Zend_Config_Ini(ROOT_DIR . '/app/configs/mail.ini', 'general'); $siteOwner = "Hukumonline"; $siteName = $config->mail->sender->support->name; $contactEmail = $config->mail->sender->support->email; $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order(); $rowOrder = $tblOrder->find($orderId)->current(); $userId = $rowOrder->userId; //first check if orderId status is PAID, then send the email. switch ($rowOrder->orderStatus) { case 1: die('ORDER STATUS IS NOT YET PAID. CAN NOT SEND RECEIPT!.'); break; case 3: $orderStatus = "PAID"; break; case 5: $orderStatus = "POSTPAID PENDING"; break; case 6: $orderStatus = "PAYMENT REJECTED"; break; case 7: $orderStatus = "PAYMENT ERROR"; break; default: $orderStatus = "PAYMENT ERROR"; break; } $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tblUser->find($userId)->current(); $userEmail = $rowUser->email; $userFullname = $rowUser->fullName; switch (strtolower($paymentMethod)) { case 'paypal': case 'manual': case 'bank': case 'postpaid': default: $message = "\t\t\t\t\t\r\nDear {$userFullname},\r\n\r\nThis is a payment receipt for Invoice # {$rowOrder->invoiceNumber}\r\n\r\nTotal Amount: USD {$rowOrder->orderTotal}\r\nTransaction #:\r\nTotal Paid: USD {$rowOrder->orderTotal}\r\nStatus: {$orderStatus}\r\nYour payment method is: {$paymentMethod}\r\n\r\nYou may review your invoice history at any time by logging in to your account " . ROOT_URL . "/store/payment/list\r\n\r\nNote: This email will serve as an official receipt for this payment.\r\n\r\nSalam,\r\n\r\nHukumonline\r\n\r\n=============================="; } $this->send($config->mail->sender->support->email, $config->mail->sender->support->name, $userEmail, '', "Hukumonline Receipt Invoice# " . $rowOrder->invoiceNumber, $message); }
function redirectSubscriptionUrlAction() { $this->_helper->layout()->disableLayout(); $guid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowset = $tblUser->find($guid)->current(); $this->view->rowUser = $rowset; $modelUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance(); $userFinanceInfo = $modelUserFinance->fetchRow("userId='" . $guid . "'"); if (!$userFinanceInfo) { $finance = $modelUserFinance->fetchNew(); $finance->userId = $guid; $finance->taxNumber = ''; $finance->taxCompany = $userDetailInfo->company; $finance->taxAddress = $userDetailInfo->address; $finance->taxCity = $userDetailInfo->city; $finance->taxProvince = $userDetailInfo->state; $finance->taxCountryId = $userDetailInfo->countryId; $finance->taxZip = $userDetailInfo->zip; $finance->save(); } $userFinanceInfo = $modelUserFinance->fetchRow("userId='" . $guid . "'"); $this->view->userInfo = $userFinanceInfo; }
static function get_user_id($username) { $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tblUser->fetchRow("username='******'"); return $rowUser->guid; }
private function _checkAuth() { $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $sReturn = base64_encode($sReturn); $identity = Pandamp_Application::getResource('identity'); $loginUrl = $identity->loginUrl; //$loginUrl = ROOT_URL.'/helper/synclogin/generate/?returnTo='.$sReturn; $auth = Zend_Auth::getInstance(); $userId = $auth->getIdentity()->guid; if (!$auth->hasIdentity()) { //$this->_redirect($loginUrl); $this->_redirect($loginUrl . '?returnTo=' . $sReturn); } else { // [TODO] else: check if user has access to admin page $username = $auth->getIdentity()->username; $this->view->username = $username; } $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $this->_userDetailInfo = $tblUser->find($userId)->current(); $tblUserFinance = new Pandamp_Modules_Identity_UserFinance_Model_UserFinance(); $this->_userInfo = $tblUserFinance->find($userId)->current(); if (empty($this->_userInfo)) { $finance = $tblUserFinance->fetchNew(); $finance['userId'] = $userId; $finance->save(); $this->_userInfo = $tblUserFinance->find($userId)->current(); } }
public function save($aData) { $gman = new Pandamp_Core_Guid(); $guid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid(); //if not empty, there are 2 possibilities $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $row = $tblUser->fetchRow("guid='{$guid}'"); if (empty($row)) { if (empty($aData['username'])) { throw new Zend_Exception('Username can not be EMPTY!'); } if (empty($aData['password'])) { throw new Zend_Exception('Password can not be EMPTY!'); } $row = $tblUser->createRow(); if (isset($aData['password']) && !empty($aData['password'])) { $password = $aData['password']; $crypt = new Pandamp_Crypt_Password(); $password = $crypt->encryptPassword($password); $row->password = $password; } } if (isset($aData['username']) && !empty($aData['username'])) { //check if username was already taken $username = $aData['username']; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUsername = $tblUser->fetchRow("username='******'"); if ($rowUsername) { throw new Zend_Exception('Username exists'); } $row->username = $aData['username']; } if (isset($aData['email'])) { $row->email = $aData['email']; } if (isset($aData['fullName'])) { $row->fullName = $aData['fullName']; } if (isset($aData['chkGender'])) { $row->gender = $aData['chkGender'] == 1 ? 'L' : 'P'; } if (isset($aData['year'])) { $row->birthday = $aData['year'] . '-' . $aData['month'] . '-' . $aData['day']; } if (isset($aData['education'])) { $row->educationId = $aData['education']; } if (isset($aData['expense'])) { $row->expenseId = $aData['expense']; } if (isset($aData['company'])) { $row->company = $aData['company']; } if (isset($aData['businessType'])) { $row->businessTypeId = $aData['businessType']; } if (isset($aData['phone'])) { $row->phone = $aData['phone']; } if (isset($aData['fax'])) { $row->phone = $aData['fax']; } if (isset($aData['packageId'])) { $row->packageId = $aData['packageId']; } if (isset($aData['newArtikel']) && $aData['newArtikel'] == 1) { $row->newArticle = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->newArticle = 'N'; } } if (isset($aData['newRegulation']) && $aData['newRegulation'] == 1) { $row->monthlyList = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->monthlyList = 'N'; } } if (isset($aData['newWeeklyRegulation']) && $aData['newWeeklyRegulation'] == 1) { $row->weeklyList = 'Y'; } else { if (!isset($aData['email']) && !isset($aData['username'])) { $row->weeklyList = 'N'; } } $row->save(); return $row; }
public function getMeEmailAction() { $email = $this->_getParam('email') ? $this->_getParam('email') : ''; if ($email == "undefined") { $this->view->success = false; $this->view->message = 'Email is Empty'; } else { $tableUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tableUser->fetchRow("email='" . $email . "'"); if (!empty($rowUser->email)) { $this->view->success = false; $this->view->message = '<i><b>' . $email . '</b></i> is not available'; } else { $this->view->success = true; $this->view->message = '<i><b>' . $email . '</b></i> is available'; } } }
function completeAction() { $formater = new Pandamp_Core_Hol_User(); $defaultCurrency = 'Rp'; $guid = $this->_request->getParam('guid'); $method = $this->_request->getParam('method'); $tblPaymentSetting = new Pandamp_Modules_Payment_Setting_Model_PaymentSetting(); $usdIdrEx = $tblPaymentSetting->fetchRow(" settingKey= 'USDIDR'"); $currencyValue = $usdIdrEx->settingValue; $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'"); $taxRate = $rowTaxRate->settingValue; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tblUser->find($guid)->current(); $this->view->rowUser = $rowUser; // discount $disc = $formater->checkPromoValidation('Disc', $rowUser->packageId, $rowUser->promotionId, $rowUser->paymentId); $total = $formater->checkPromoValidation('Total', $rowUser->packageId, $rowUser->promotionId, $rowUser->paymentId); $tblPackage = new Pandamp_Modules_Identity_Package_Model_Package(); $rowPackage = $tblPackage->find($rowUser->packageId)->current(); $this->view->rowPackage = $rowPackage; $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order(); $row = $tblOrder->fetchNew(); $row->userId = $guid; if ($this->getRequest()->getPost()) { $value = $this->getRequest()->getPost(); $row->taxNumber = $value['taxNumber']; $row->taxCompany = $value['taxCompany']; $row->taxAddress = $value['taxAddress']; $row->taxCity = $value['taxCity']; $row->taxZip = $value['taxZip']; $row->taxProvince = $value['taxProvince']; $row->taxCountryId = $value['taxCountry']; $row->paymentMethod = $method; } $row->datePurchased = date('YmdHis'); $row->paymentMethodNote = "membership"; if ($method == "nsiapay") { $row->orderStatus = 8; } else { $row->orderStatus = 1; //pending } $row->currency = $defaultCurrency; $row->currencyValue = $currencyValue; $row->orderTotal = $total; $row->ipAddress = Pandamp_Lib_Formater::getRealIpAddr(); $orderId = $row->save(); $rowJustInserted = $tblOrder->find($orderId)->current(); $rowJustInserted->invoiceNumber = date('Ymd') . '.' . $orderId; $temptime = time(); $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime); $rowJustInserted->discount = $disc; $rowJustInserted->invoiceExpirationDate = strftime('%Y-%m-%d', $temptime); $rowJustInserted->save(); $this->view->invoiceNumber = $rowJustInserted->invoiceNumber; $this->view->datePurchased = $rowJustInserted->datePurchased; $tblOrderDetail = new Pandamp_Modules_Payment_OrderDetail_Model_OrderDetail(); $rowDetail = $tblOrderDetail->fetchNew(); $rowDetail->orderId = $orderId; $rowDetail->itemId = $rowPackage->packageId; if ($rowUser->packageId == 26) { $group = "Subsciption for Member Individual " . $rowUser->paymentId . " Months"; } else { if ($rowUser->packageId == 27) { $group = "Subsciption for Member Corporate" . $rowUser->paymentId . " Months"; } } $this->view->itemName = $group; $rowDetail->documentName = $group; $rowDetail->price = $total; $numOfUsers = $tblUser->getUserCount($rowUser->guid); $this->view->numOfUsers = $numOfUsers; $this->view->grandtotal = $grandTotal; $this->view->method = $method; $this->view->orderId = $orderId; $this->view->total = $total; $rowDetail->qty = $numOfUsers; $rowDetail->finalPrice = $total; $rowDetail->save(); $data = $this->_request->getParams(); $this->view->data = $data; $modDir = $this->getFrontController()->getModuleDirectory(); require_once $modDir . '/models/Store/Mailer.php'; $mod = new Holsite_Model_Store_Mailer(); switch (strtolower($method)) { case 'manual': case 'bank': //$mod->sendBankInvoiceToUser($orderId); break; case 'nsiapay': $mod->sendInvoiceToUser($orderId); break; } }
function userHistoryAction() { $guid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $req = $this->getRequest(); $sortDir = $req->getParam('dir') ? $req->getParam('dir') : 'ASC'; $sortBy = $req->getParam('sort') ? $req->getParam('sort') : 'username'; $start = $req->getParam('start') ? $req->getParam('start') : 0; $end = $req->getParam('limit') ? $req->getParam('limit') : 10; $fields = $req->getParam('fields') ? $req->getParam('fields') : ''; $query = $req->getParam('query') ? $req->getParam('query') : ''; $selectedRows = Zend_Json::decode($fields); $rowval = Zend_Json::decode($query); $rowset = $tblUser->fetchUserHistory($guid, "{$sortBy} {$sortDir}", $start, $end); $a = array(); $a['totalCount'] = count($rowset); $i = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['history'][$i]['id'] = $row->idUser; $a['history'][$i]['uid'] = $row->uidUser; $a['history'][$i]['fullName'] = $row->fullName; $a['history'][$i]['username'] = $row->username; $a['history'][$i]['company'] = !empty($row->company) ? $row->company : '-'; $a['history'][$i]['createdDate'] = Pandamp_Lib_Formater::get_date_english($row->createdDate); $a['history'][$i]['expirationDate'] = $row->expirationDate ? Pandamp_Lib_Formater::get_date_english($row->expirationDate) : '-'; $a['history'][$i]['paymentId'] = $row->paymentId; $a['history'][$i]['DaysLeft'] = $row->DaysLeft; $a['history'][$i]['value'] = $row->packageId; $a['history'][$i]['packageId'] = $row->value; $a['history'][$i]['periodeId'] = $row->status ? $row->status : "unknown"; $a['history'][$i]['isEmailSent'] = $row->isEmailSent; $a['history'][$i]['isActive'] = $row->isActive; $i++; } } if ($a['totalCount'] == 0) { $a['history'][0]['id'] = ''; $a['history'][0]['uid'] = ''; $a['history'][0]['fullName'] = ''; $a['history'][0]['username'] = ''; $a['history'][0]['company'] = ''; $a['history'][0]['createdDate'] = ''; $a['history'][0]['expirationDate'] = ''; $a['history'][0]['paymentId'] = ''; $a['history'][0]['DaysLeft'] = 'x'; $a['history'][0]['value'] = ''; $a['history'][0]['packageId'] = ''; $a['history'][0]['periodeId'] = ''; $a['history'][0]['isEmailSent'] = 'x'; $a['history'][0]['isActive'] = 'x'; } echo Zend_Json::encode($a); }
function getMeEmailAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $email = $request->getParam('email') ? $request->getParam('email') : ''; $response = array(); if ($email == "undefined") { $response['failure'] = true; $response['message'] = 'Email is Empty'; } else { $tableUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tableUser->fetchRow("email='" . $email . "'"); if (!empty($rowUser->email)) { $response['failure'] = true; $response['message'] = '<i><b>' . $email . '</b></i> is not available'; } else { $response['success'] = true; $response['message'] = '<i><b>' . $email . '</b></i> is available'; } } echo Zend_Json::encode($response); }