Exemplo n.º 1
0
 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');
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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();
     }
 }
Exemplo n.º 5
0
 /**
  * _writeConfirmCorporateEmail
  * @return JSON
  */
 function _writeConfirmCorporateEmail($mailcontent, $fullname, $company, $payment, $disc, $total, $username, $guid, $email)
 {
     $obj = new Pandamp_Crypt_Password();
     $mailcontent = str_replace('$fullname', $fullname, $mailcontent);
     $mailcontent = str_replace('$company', $company, $mailcontent);
     $mailcontent = str_replace('$timeline', $payment, $mailcontent);
     $mailcontent = str_replace('$disc', $disc, $mailcontent);
     $mailcontent = str_replace('$price', number_format($total), $mailcontent);
     $mailcontent = str_replace('$username1', $username, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     // table User
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $where = $tblUser->getAdapter()->quoteInto('company=?', $company);
     $rowUser = $tblUser->fetchAll($where, 'username ASC');
     $tag = '<table>';
     $tag .= '<tr><td><b>Username</b></td><td>&nbsp;</td><td><b>Password</b></td></tr>';
     foreach ($rowUser as $rowsetUser) {
         $tag .= '<tr><td>' . $rowsetUser->username . '</td><td>&nbsp;</td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>';
     }
     $tag .= '</table>';
     $mailcontent = str_replace('$tag', $tag, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail');
     $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $this->send_mail();
         if ($sendAttempt) {
             $response['success'] = true;
             $response['message'] = "Please check your email at {$email}!";
             // update user
             $rowUser = $tblUser->find($obj->decryptPassword($guid))->current();
             if ($rowUser) {
                 $rowUser->isEmailSent = 'Y';
                 $rowUser->save();
             }
         } else {
             $response['failure'] = false;
             $response['message'] = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $response['failure'] = true;
         $response['message'] = "Error saving mail!";
     }
     echo Zend_Json::encode($response);
 }
Exemplo n.º 6
0
 /**	
  * TODO
  * admin setActive
  * @param id, uid, action
  */
 function setActiveAction()
 {
     $guid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $act = $this->_getParam('act') ? $this->_getParam('act') : '';
     //$formater = new Kutu_Lib_Formater();
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $rowUser = $tblUser->find($guid)->current();
     if ($act == 'down') {
         if ($rowUser->packageId == 26 or $rowUser->packageId == 27) {
             // set period = trial
             $rowUser->periodeId = 2;
             // -- write invoice
             // Get disc promo
             // $disc = $formater->checkPromoValidation('Disc',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
             // Get total promo
             // $total = $formater->checkPromoValidation('Total',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
             // $formater->_writeInvoice($rowset->guid,$total,$disc,$rowset->paymentId,'admin');
         } else {
             $rowUser->periodeId = 3;
         }
         $rowUser->isActive = 1;
     } elseif ($act == 'up') {
         $rowUser->periodeId = 1;
         $rowUser->isActive = 0;
     }
     $rowUser->activationDate = date("Y-m-d H:i:s");
     $result = $rowUser->save();
     if ($result) {
         $this->view->success = true;
     } else {
         $this->view->success = false;
     }
 }
Exemplo n.º 7
0
 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;
     }
 }
Exemplo n.º 8
0
 function pictureAction()
 {
     $this->_helper->layout->setLayout('layout-hukumonlineid-ps');
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_forward('restricted', 'error', 'identity', array('type' => 'identity', 'num' => 101));
     } else {
         $guid = $auth->getIdentity()->guid;
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUser = $tblUser->find($guid)->current();
         $this->view->row = $rowUser;
         $g = $this->getRequest();
         if ($g->isPost()) {
             $aData = $g->getParams();
             $arraypictureformat = array("jpg", "jpeg", "gif");
             $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'photo';
             if ($g->getParam('txt_erase') == 'on') {
                 foreach ($arraypictureformat as $key => $val) {
                     if (is_file($sDir . "/" . $guid . "." . $val)) {
                         unlink($sDir . "/" . $guid . "." . $val);
                         break;
                     }
                 }
             }
             $registry = Zend_Registry::getInstance();
             $files = $registry->get('files');
             if (isset($files['file_picture'])) {
                 $file = $files['file_picture'];
             }
             if ($files['file_picture']['error'] == 0 && $files['file_picture']['size'] > 0) {
                 $file = $files['file_picture']['name'];
                 $ext = explode(".", $file);
                 $ext = strtolower(array_pop($ext));
                 if (in_array($ext, $arraypictureformat)) {
                     $image_size = getimagesize($files['file_picture']['tmp_name']);
                     if ($image_size[0] > 200 || $image_size[1] > 250) {
                         $this->view->message = 'Ukuran gambar melebihi batas maksimal. Proses pengunggahan batal!';
                     } else {
                         foreach ($arraypictureformat as $key => $val) {
                             if (is_file($sDir . "/" . $guid . "." . $val)) {
                                 unlink($sDir . "/" . $guid . "." . $val);
                                 break;
                             }
                         }
                         if (is_uploaded_file($files['file_picture']['tmp_name'])) {
                             @move_uploaded_file($files['file_picture']['tmp_name'], $sDir . "/" . $guid . "." . $ext);
                             @chmod($files['file_picture']['tmp_name'], $sDir . "/" . $guid . "." . $ext, 0755);
                         }
                         $this->view->message = "Data has been successfully saved.";
                     }
                 }
             }
         }
     }
 }