function activateAction() { $this->_helper->layout()->disableLayout(); $guid = $this->_getParam('uid') ? $this->_getParam('uid') : ''; //$aclMan = new Kutu_Acl_Adapter_Local(); $obj = new Pandamp_Crypt_Password(); $formater = new Pandamp_Core_Hol_User(); $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowset = $tblUser->find(base64_decode($guid))->current(); if ($rowset) { if ($rowset->periodeId == 2) { $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 106)); } elseif ($rowset->periodeId == 3) { $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 102)); } elseif ($rowset->periodeId == 4) { $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 'downgrade')); } else { // set activation date $rowset->activationDate = date("Y-m-d h:i:s"); $rowset->isActive = 1; // check package if ($rowset->packageId == 26 or $rowset->packageId == 27) { // set period = trial $rowset->periodeId = 2; // add user to gacl // $aclMan->addUser($rowset->username,'member_gratis'); // -- 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->kopel, $total, $disc, $rowset->paymentId); } else { $rowset->periodeId = 3; } // update // $result = $rowset->save(); // if ($result) // { if ($rowset->packageId == 26 or $rowset->packageId == 27) { $this->_forward('redirect-subscription-url', 'manager', 'membership', array('guid' => base64_decode($guid))); } else { $this->_forward('redirect-url', 'manager', 'membership', array('username' => $rowset->username)); } // } // else // { // $this->_forward('restricted','manager','membership',array('type' => 'user','num' => 101)); // } } } else { $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 105)); } }
function processAction() { $formater = new Pandamp_Core_Hol_User(); $orderId = $this->_request->getParam('orderId'); $packageId = $this->_request->getParam('packageId'); $paymentSubscription = $this->_request->getParam('paymentSubscription'); $this->_orderIdNumber = $orderId; if (empty($orderId)) { echo "kosong"; die; } include_once ROOT_DIR . '/app/models/Store.php'; $modelAppStore = new App_Model_Store(); if ($modelAppStore->isOrderPaid($orderId)) { //forward to error page $this->_helper->redirector->gotoSimple('error', 'store', 'hol-site', array('view' => 'orderalreadypaid')); die; } //$tblOrder = new App_Model_Db_Table_Order(); $items = App_Model_Show_Order::show()->getOrderDetail($orderId); $tmpMethod = $this->_request->getParam('method'); if (!empty($tmpMethod)) { $items[0]['paymentMethod'] = $tmpMethod; } $tblUser = new App_Model_Db_Table_User(); $rowUser = $tblUser->find($items[0]['userId'])->current(); $total = $formater->checkPromoValidation('Total', $packageId, $rowUser->promotionId, $paymentSubscription); switch ($items[0]['paymentMethod']) { case 'nsiapay': require_once 'PaymentGateway/Nsiapay.php'; // include the class file $paymentObject = new Nsiapay(); // initiate an instance of the class if ($this->_testMode) { $paymentObject->enableTestMode(); } $paymentObject->addField('TYPE', "IMMEDIATE"); $subTotal = 0; for ($iCart = 0; $iCart < count($items); $iCart++) { $i = $iCart + 1; $basket[] = $items[$iCart]['documentName'] . "," . $items[$iCart]['price'] . ".00" . "," . $items[$iCart]['qty'] . "," . $items[$iCart]['finalPrice'] . ".00"; $subTotal += $items[$iCart]['price'] * $items[$iCart]['qty']; } $ca = implode(";", $basket); $merchantId = "000100090000028"; $paymentObject->addField("BASKET", $ca); $paymentObject->addField("MERCHANTID", $merchantId); $paymentObject->addField("CHAINNUM", "NA"); $paymentObject->addField("TRANSIDMERCHANT", $items[0]['invoiceNumber']); $paymentObject->addField("AMOUNT", $subTotal); $paymentObject->addField("CURRENCY", "360"); $paymentObject->addField("PurchaseCurrency", "360"); $paymentObject->addField("acquirerBIN", "360"); $paymentObject->addField("password", "123456"); $paymentObject->addField("URL", "http://hukumonline.pl"); $paymentObject->addField("MALLID", "199"); $paymentObject->addField("SESSIONID", Zend_Session::getId()); $sha1 = sha1($subTotal . ".00" . $merchantId . "08iIWbWvO16w" . $items[0]['invoiceNumber']); // echo $subTotal.".00".$merchantId."08iIWbWvO16w".$items[0]['invoiceNumber']."<br>"; // echo $sha1;die; $paymentObject->addField("WORDS", $sha1); //$paymentObject->dumpFields(); $this->_helper->layout->disableLayout(); $paymentObject->submitPayment(); break; case 'manual': case 'bank': /* 1. update order status 2. redirect to instruction page */ //setting payment and status as pending (1), notify = 0, notes = 'paid with...' $this->updateInvoiceMethod($orderId, 'bank', 1, 0, 'paid with manual method'); // HAP: i think we should send this notification when user were on page "Complete Order" and after confirmation made by user is approved; //$this->Mailer($orderId, 'admin-order', 'admin'); //$this->Mailer($orderId, 'user-order', 'user'); $this->_helper->redirector('instruction', 'payment', 'membership', array('orderId' => $orderId)); break; } }
/** * Set Invoice * @param guid */ function setInvoiceAction() { $this->_helper->getHelper('layout')->disableLayout(); $this->_helper->getHelper('viewRenderer')->setNoRender(); $request = $this->getRequest(); $result = 'RESULT_ERROR'; if (Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) { if ($request->isPost()) { $id = $request->getPost('id'); $modelUser = new App_Model_Db_Table_User(); $rowset = $modelUser->fetchRow("kopel='" . $id . "'"); $modelPackage = new App_Model_Db_Table_Package(); $rowPackage = $modelPackage->fetchRow("packageId=" . $rowset->packageId); //if ((in_array($rowset->packageId,array(14,15,16,17,18))) && ($rowset->paymentId <> 0) && ($rowset->isActive == 1)) if ($rowPackage && $rowset->paymentId != 0 && $rowset->isActive == 1) { $formater = new Pandamp_Core_Hol_User(); /** * @modifiedDate: Dec 07, 2012 */ // 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); $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->paymentId); $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->paymentId); // WRITE invoice //$r = $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId,'admin'); $r = $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId, 'admin'); $result = $r; } else { $result = "check your payment/status"; } } } $this->getResponse()->setBody($result); }
/** * Set Invoice * @param guid */ function setInvoiceAction() { $kopel = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowset = $tblUser->fetchRow("kopel='" . $kopel . "'"); if (($rowset->packageId == 26 || $rowset->packageId == 27) && $rowset->paymentId != 0) { $formater = new Pandamp_Core_Hol_User(); // 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); // WRITE invoice $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId, 'admin'); } else { $response = array(); $response['success'] = false; $response['message'] = "check your payment, make sure not 0"; echo Zend_Json::encode($response); } }
function newAction() { if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) { $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted'); } $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $formater = new Pandamp_Core_Hol_User(); $r = $this->getRequest(); $kopel = $r->getParam('id'); $tblInvoice = new App_Model_Db_Table_Invoice(); $rowInvoice = $tblInvoice->fetchRow("uid='" . $kopel . "'"); // add invoice but only if empty if (!$rowInvoice) { $modelUser = new App_Model_Db_Table_User(); $rowset = $modelUser->find($kopel)->current(); if (in_array($rowset->packageId, array(14, 15, 16, 17, 18))) { if (isset($rowset->paymentId) && $rowset->paymentId != 0) { $periodeId = 2; /** * @modifiedDate: Dec 07, 2012 */ // 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); $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->paymentId); $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->paymentId); $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId); } else { die('Lamanya berlangganan kosong'); } } else { $periodeId = 3; } $data = array('periodeId' => $periodeId, 'modifiedDate' => date("Y-m-d h:i:s"), 'isActive' => 1); $modelUser->update($data, "kopel='" . $kopel . "'"); } $zl = Zend_Registry::get("Zend_Locale"); $this->_redirect(ROOT_URL . "/" . $zl->getLanguage() . '/customer/user/invoicelist/id/' . $kopel); }
function registerAction() { if ($this->getRequest()->getPost()) { $value = $this->getRequest()->getPost(); $this->view->value = $value; /* list($ret, $body) = Pandamp_Lib_Remote::serverCmd('register', $value); switch ($ret) { case 200: $this->view->message = "User : <abbr>".$value['username']."</abbr> data has been successfully saved."; break; default: $this->view->error_message = "failure"; } */ $data = $this->transformRegister($value); $modelUser = new App_Model_Db_Table_User(); $id = $modelUser->insert($data); $this->updateKopel(); /** * SELECT id, parent_id, value, name, lft, rgt * eg. $aReturn = $acl->getGroupData(15) * print_r($aReturn); * output: Array ( [0] => 15 [1] => 10 [2] => Super Administrator [3] => super_admin [4] => 10 [5] => 11 ) */ $acl = Pandamp_Acl::manager(); //$aReturn = $acl->getGroupData($value['aro_groups']); $aReturn = App_Model_Show_AroGroup::show()->getUserGroup($value['aro_groups']); //echo '<pre>'; //print_r($aReturn); //echo '</pre>'; //$acl->addUser($value['username'],$aReturn[3]); $acl->addUserToGroup($value['username'], $aReturn['name']); $formater = new Pandamp_Core_Hol_User(); // Do you want Email Confirmation send? if (isset($value['ec']) == 1) { //echo 'y'; $payment = $value['payment'] ? $value['payment'] : 0; $promotionCode = $value['promotioncode'] ? $value['promotioncode'] : ''; switch ($value['aro_groups']) { /** * @modifiedDate: December 07, 2012 * @modifiedDate-2: January 29, 2013 */ case 14: // individual $mailcontent = $formater->getMailContent('konfirmasi-email-individual'); //$disc = $formater->checkPromoValidation('Disc',$value['aro_groups'],$promotionCode,$payment); //$total = $formater->checkPromoValidation('Total',$value['aro_groups'],$promotionCode,$payment); $total = $formater->checkPromoValidation('Total', $value['aro_groups'], $payment); $disc = $formater->checkPromoValidation('Disc', $value['aro_groups'], $payment); //$m = $formater->_writeConfirmIndividualEmail($mailcontent,$value['fullname'],$value['username'],$value['password'],$payment,$disc,$total,base64_encode($id),$value['email']); $m = $formater->_writeConfirmIndividualEmail($mailcontent, $value['aro_groups'], $value['fullname'], $value['username'], $value['password'], $payment, $disc, $total, base64_encode($id), $value['email']); break; case 15: // corporate/basic // corporate/basic case 16: // standard // standard case 18: // professional $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi'); //$disc = $formater->checkPromoValidation('Disc',$value['aro_groups'],$promotionCode,$payment); //$total = $formater->checkPromoValidation('Total',$value['aro_groups'],$promotionCode,$payment); $total = $formater->checkPromoValidation('Total', $value['aro_groups'], $payment); $disc = $formater->checkPromoValidation('Disc', $value['aro_groups'], $payment); //$m = $formater->_writeConfirmCorporateEmail($mailcontent,$value['fullname'],$value['company'],$payment,$disc,$total,$value['username'],base64_encode($id),$value['email']); $m = $formater->_writeConfirmCorporateEmail($mailcontent, $value['aro_groups'], $value['fullname'], $value['company'], $payment, $disc, $total, $value['username'], base64_encode($id), $value['email']); break; default: $mailcontent = $formater->getMailContent('konfirmasi email gratis'); $m = $formater->_writeConfirmFreeEmail($mailcontent, $value['fullname'], $value['username'], $value['password'], base64_encode($id), $value['email'], $aReturn['name']); break; } $this->view->message = $m; } else { //echo 't'; } } }
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 signupAction() { $this->_helper->layout->setLayout('layout-hukumonlineid-daftar'); $r = $this->getRequest(); if ($r->isPost()) { $id = $r->getParam('id') ? $r->getParam('id') : ''; $promotionCode = $r->getParam('promotionCode') ? $r->getParam('promotionCode') : ''; $package = $r->getParam('paket') ? $r->getParam('paket') : ''; $fullName = $r->getParam('fullName') ? $r->getParam('fullName') : ''; $gender = $r->getParam('chkGender') ? $r->getParam('chkGender') : ''; $month = $r->getParam('month') ? $r->getParam('month') : ''; $day = $r->getParam('day') ? $r->getParam('day') : ''; $year = $r->getParam('year') ? $r->getParam('year') : ''; $education = $r->getParam('education') ? $r->getParam('education') : ''; $expense = $r->getParam('expense') ? $r->getParam('expense') : ''; $company = $r->getParam('company') ? $r->getParam('company') : ''; $businessType = $r->getParam('businessType') ? $r->getParam('businessType') : ''; $phone = $r->getParam('phone') ? $r->getParam('phone') : ''; $fax = $r->getParam('fax') ? $r->getParam('fax') : ''; $payment = $r->getParam('payment') ? $r->getParam('payment') : ''; $email = $r->getParam('email') ? $r->getParam('email') : ''; $newArtikel = $r->getParam('newArtikel') ? $r->getParam('newArtikel') : ''; $newRegulation = $r->getParam('newRegulation') ? $r->getParam('newRegulation') : ''; $newWRegulation = $r->getParam('newWeeklyRegulation') ? $r->getParam('newWeeklyRegulation') : ''; $iscontact = $r->getParam('iscontact') ? $r->getParam('iscontact') : ''; $obj = new Pandamp_Crypt_Password(); $formater = new Pandamp_Core_Hol_User(); $aclMan = Pandamp_Acl::manager(); try { for ($x = 1; $x <= $id; $x++) { $username = $r->getParam('username' . $x) ? $r->getParam('username' . $x) : ''; $password = $r->getParam('password' . $x) ? $r->getParam('password' . $x) : ''; $tblUser = new Pandamp_Modules_Identity_User_Model_User(); Zend_Db_Table::getDefaultAdapter()->beginTransaction(); $rowUser = $tblUser->fetchNew(); $rowUser->username = $username; $rowUser->password = $obj->encryptPassword($password); $rowUser->fullName = $fullName; $rowUser->gender = $gender == 1 ? 'L' : 'P'; $rowUser->birthday = $year . '-' . $month . '-' . $day; $rowUser->indexCol = $x; $rowUser->phone = $phone; $rowUser->fax = $fax; $rowUser->email = $email; $rowUser->company = $company; $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N'; $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N'; $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N'; $rowUser->isContact = $iscontact == $x ? 'Y' : 'N'; $rowUser->packageId = $package; $rowUser->promotionId = $promotionCode; $rowUser->educationId = $education; $rowUser->expenseId = $expense; $rowUser->paymentId = $payment; $rowUser->businessTypeId = $businessType; $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber(); $rowset = $tblNumber->fetchRow(); $num = $rowset->user; $totdigit = 5; $num = strval($num); $jumdigit = strlen($num); $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num; $rowset->user = $rowset->user += 1; $tblNumber->update(array('user' => $rowset->user)); $rowUser->kopel = $noinvoice; $rowUser->save(); Zend_Db_Table::getDefaultAdapter()->commit(); $aclMan->addUser($username, 'member_gratis'); } switch ($package) { case 25: $mailcontent = $formater->getMailContent('konfirmasi email gratis'); $m = $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email, 'gratis'); break; case 26: $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment); $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment); $mailcontent = $formater->getMailContent('konfirmasi-email-individual'); $m = $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email); break; case 27: $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment); $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment); $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi'); $m = $formater->_writeConfirmCorporateEmail($mailcontent, $fullName, $company, $payment, $disc, $total, $r->getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email); break; } $this->view->message = $m; } catch (Zend_Exception $e) { Zend_Db_Table::getDefaultAdapter()->rollBack(); $this->view->message = $e->getMessage(); } } }