/** * callbackAction * This method isn't called from the project * but it is called from a bank gateway service * in order to set as payed the order processed * * IMPORTANT: * This method was within the /default/orders controller and it has been moved here * because the access to the /default/orders is denied without an authentication process * /default/common controller is accessible without login process. */ public function callbackAction() { $request = $this->getRequest(); $response = $request->getParams(); if (!empty($response['custom']) && is_numeric(trim($response['custom']))) { // Getting the md5 value in order to match with the class name. $classrequest = $request->gateway; // Orderid back from the bank $order_id = trim($response['custom']); // Get the bank selected using the MD5 code $bank = Banks::findbyMD5($classrequest); if (!empty($bank[0]['classname'])) { if (!empty($bank[0]['classname']) && class_exists($bank[0]['classname'])) { $class = $bank[0]['classname']; $payment = new $class($response['custom']); // Check if the method "Response" exists in the Payment class and send all the bank information to the payment module if (method_exists($class, "Response")) { Shineisp_Commons_Utilities::logs("Callback called: {$class}\nParameters: " . json_encode($response), "payments.log"); $payment->Callback($response); } } } } die; }
/** * Response * Create the Order, Invoice and send an email to the customer * @param $response from the Gateway Server * @return order_id or false */ public function Response($response) { $bank = self::getModule(); if (!empty($response['payment_status']) && $response['payment_status'] == "Completed") { if (!empty($response['item_number'])) { $product = array('id' => $response['item_number'], 'name' => $response['item_name']); // Get the indexes of the order and bankid $indexes = trim($response['custom']); list($orderid, $bankid) = explode(",", $indexes); if (is_numeric($orderid) && is_numeric($bankid)) { $bank = Banks::find($bankid, null, true); // Replacing the comma with the dot in the amount value. $amount = str_replace(",", ".", $response['amount']); $GatewayResponse['id'] = $response['thx_id']; $GatewayResponse['item'] = $response['item_name']; $GatewayResponse['amount'] = $amount; $GatewayResponse['bank_id'] = $bankid; $GatewayResponse['status'] = $response['payment_status'] == "Completed" ? 1 : 0; } // Complete the order with the payment details if (Orders::Complete($orderid)) { return $orderid; } else { return false; } } } return false; }
/** * CreateForm * @return string */ public function CreateForm() { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $bank = Banks::findbyClassname(__CLASS__); try { $form = "<h4>" . $bank['name'] . "</h4><p>" . $bank['description'] . "</p>"; return array('name' => $bank['name'], 'description' => $bank['description'], 'html' => $form); } catch (Exception $e) { die($e->getMessage()); } }
/** * Create the payment module * @param $id */ public function getPaymentsForm($orderid = NULL) { $payments = array(); $banks = Banks::findAllActive("classname", true); $translator = Shineisp_Registry::get('Zend_Translate'); if (!empty($banks)) { foreach ($banks as $bank) { if (!empty($bank['classname']) && class_exists($bank['classname'])) { if (class_exists($bank['classname'])) { $class = $bank['classname']; $payment = new $class($orderid); $payments[] = $payment->setUrlOk($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($bank['classname']))->setUrlKo($_SERVER['HTTP_HOST'] . "/orders/response/" . md5($bank['classname']))->setUrlCallback($_SERVER['HTTP_HOST'] . "/common/callback/gateway/" . md5($bank['classname']))->setRedirect(false)->setFormHidden(false)->CreateForm(); } } } } $this->view->payments = $payments; // Path of the template return $this->view->render('partials/payments.phtml'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Payment date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'reference', array('filters' => array('StringTrim'), 'label' => $translate->_('Transaction Reference'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'income', array('filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'outcome', array('filters' => array('StringTrim'), 'label' => $translate->_('Expense'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'confirmed', array('filters' => array('StringTrim'), 'label' => $translate->_('Does the Transaction has been confirmed?'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('confirmed')->setAllowEmpty(false)->setMultiOptions(array('0' => "No, it has been not", '1' => "Yes, it has been")); $this->addElement('select', 'bank_id', array('decorators' => array('Bootstrap'), 'label' => 'Method of Payments', 'class' => 'form-control')); $this->getElement('bank_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Banks::getList()); $this->addElement('select', 'order_id', array('decorators' => array('Bootstrap'), 'label' => 'Order', 'class' => 'form-control')); $this->getElement('order_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Orders::getList()); $this->addElement('select', 'customer_id', array('decorators' => array('Bootstrap'), 'label' => 'Customer', 'class' => 'form-control')); $this->getElement('customer_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Customers::getList()); $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'rows' => '3', 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control')); $this->addElement('hidden', 'payment_id'); }
public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'customer_id', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Customer'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "lastname firstname ( company )", 'url-search' => "/admin/customers/search", 'class' => 'select2')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'customer_parent_id', array('label' => $translate->_('Invoice destination'), 'decorators' => array('Bootstrap'), 'field-id' => "customer_id", 'fields-data' => "firstname lastname", 'url-search' => "/admin/customers/search", 'class' => 'select2', 'disable' => 'true')); $this->addElement('select', 'isp_id', array('required' => true, 'label' => $translate->_('ISP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('isp_id')->setAllowEmpty(false)->setMultiOptions(Isp::getList()); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'categories', array('label' => $translate->_('Filter by categories'), 'decorators' => array('Bootstrap'), 'id' => 'productcategories', 'field-id' => "category_id", 'fields-data' => "name", 'url-search' => "/admin/productscategories/search", 'class' => 'select2', 'rel' => 'tree_select')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'referdomain', array('filters' => array('StringTrim'), 'label' => $translate->_('Reference Domain'), 'description' => $translate->_('Assign a domain in order to identify the service/product'), 'decorators' => array('Bootstrap'), 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'products', array('id' => "products", 'required' => false, 'label' => $translate->_('Products'), 'field-id' => "product_id", 'fields-data' => "name", 'url-search' => "/admin/products/search", 'class' => 'select2')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'billingcycle_id', array('id' => 'billingid', 'label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'field-id' => "billing_cycle_id", 'fields-data' => "name ( price / setupfee )", 'url-search' => "/admin/orders/getbillingcycles", 'class' => 'select2')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'domains_selected', array('filters' => array('StringTrim'), 'label' => $translate->_('Add Domains'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('If you do not find a domain name from this list, you have to create it by the domain admministration page.'), 'multiple' => true, 'field-id' => "domain_id", 'fields-data' => "domain", 'url-search' => "/admin/domains/search", 'class' => 'select2')); $this->addElement('checkbox', 'is_renewal', array('label' => $translate->_('Is a Renewal?'), 'description' => "If this order is a renewal, it will be checked by ShineISP and it cannot be deleted by the customer in the customer order frontend panel.", 'decorators' => array('Bootstrap'), 'class' => 'form-control')); /* * This hidden form field will be converted in a advanced select object * the JQuery Select2 object is loaded automatically by the css class select2 */ $this->addElement('hidden', 'invoice_id', array('label' => $translate->_('Invoice No.'), 'decorators' => array('Bootstrap'), 'field-id' => "invoice_id", 'fields-data' => "formatted_number ( number )", 'url-search' => "/admin/invoices/search", 'class' => 'select2')); $this->addElement('text', 'order_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Order Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'expiring_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'description' => $translate->_('If this date is set ShineISP will suspend the order at the specified date.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Date Start'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'value' => '1', 'class' => 'form-control')); $this->addElement('text', 'profit', array('filters' => array('StringTrim'), 'label' => $translate->_('Profit'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'rows' => '3', 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control')); $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'price', array('filters' => array('StringTrim'), 'label' => $translate->_('Price'), 'id' => 'price', 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'vat', array('filters' => array('StringTrim'), 'label' => $translate->_('VAT'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'total', array('filters' => array('StringTrim'), 'label' => $translate->_('Total'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'grandtotal', array('filters' => array('StringTrim'), 'label' => $translate->_('Grand Total'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Save again in order to update the totals.'), 'class' => 'form-control bold')); $this->addElement('text', 'received_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'missing_income', array('readonly' => 1, 'filters' => array('StringTrim'), 'label' => $translate->_('Missing income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'fastlink', array('filters' => array('StringTrim'), 'id' => 'fastlink', 'label' => $translate->_('Fastlink Code'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read a unique code for redirect a user in the order page using the fastlink.'), 'class' => 'form-control readonly')); $this->addElement('text', 'visits', array('filters' => array('StringTrim'), 'label' => $translate->_('Visits'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('Here you can read how many times the order has been viewed by the customer.'), 'class' => 'form-control readonly')); // If the browser client is an Apple client hide the file upload html object if (false == Shineisp_Commons_Utilities::isAppleClient()) { $MBlimit = Settings::findbyParam('adminuploadlimit'); $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit); $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin'); $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle')); if (!empty($filetypes)) { $file->addValidator('Extension', false, $filetypes); } $file->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1); $this->addElement($file); $this->addElement('select', 'filecategory', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('filecategory')->setAllowEmpty(false)->setMultiOptions(FilesCategories::getList())->setRegisterInArrayValidator(false)->setRequired(false); } $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'label' => $translate->_('Private Notes'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control wysiwyg')); $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'label' => $translate->_('Post a comment'), 'decorators' => array('Bootstrap'), 'class' => 'form-control wysiwyg')); $this->addElement('select', 'status_id', array('label' => 'Status', 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders')); $this->addElement('text', 'paymentdate', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date')); $this->addElement('text', 'reference', array('filters' => array('StringTrim'), 'label' => $translate->_('Payment Reference'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'bank_id', array('id' => 'paymentmethods', 'label' => $translate->_('Bank name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('bank_id')->setAllowEmpty(false)->setMultiOptions(Banks::getList(true)); $this->addElement('text', 'income', array('filters' => array('StringTrim'), 'label' => $translate->_('Income'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('text', 'payment_description', array('filters' => array('StringTrim'), 'label' => $translate->_('Notes'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('select', 'confirmed', array('filters' => array('StringTrim'), 'label' => $translate->_('Has the Transaction been confirmed?'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('confirmed')->setAllowEmpty(false)->setMultiOptions(array('0' => "No, not yet", '1' => "Yes, it has been")); $this->addElement('hidden', 'order_id'); }
public function create($params) { $this->authenticate(); $uuid = $params['uuid']; $customers = Customers::find($uuid); if (empty($customers)) { throw new Shineisp_Api_Exceptions(400006, ":: 'uuid' not valid"); exit; } $trancheid = intval($params['trancheid']); $tranche = ProductsTranches::getTranchebyId($trancheid); if (empty($tranche)) { throw new Shineisp_Api_Exceptions(400006, ":: 'trancheid' not valid"); exit; } #Check Products if (empty($params['products']) && !is_array($params['products'])) { throw new Shineisp_Api_Exceptions(400006, ":: not 'products' choose"); exit; } foreach ($params['products'] as $product) { $productid = intval($product['productid']); $billingid = intval($product['billingid']); $ttry = ProductsTranches::getTranchesBy_ProductId_BillingId($productid, $billingid); if (empty($ttry)) { throw new Shineisp_Api_Exceptions(400006, ":: 'productid' or 'bilingid' not valid"); exit; } $ttry = array_shift($ttry); if ($ttry['tranche_id'] != $trancheid) { throw new Shineisp_Api_Exceptions(400006, ":: 'bilingid' not valid"); exit; } } $id = $customers['customer_id']; $isVATFree = Customers::isVATFree($id); if ($params['status'] == "complete") { $status = Statuses::id('complete', 'orders'); } else { $status = Statuses::id('tobepaid', 'orders'); } $theOrder = Orders::create($customers['customer_id'], $status, $params['note']); foreach ($params['products'] as $product) { $productid = intval($product['productid']); $billingid = intval($product['billingid']); $quantity = intval($product['quantity']); $p = Products::getAllInfo($productid); Orders::addItem($productid, $quantity, $billingid, $trancheid, $p['ProductsData'][0]['name'], array()); } $orderID = $theOrder['order_id']; if ($params['sendemail'] == 1) { Orders::sendOrder($orderID); } $banks = Banks::find($params['payment'], "*", true); if (!empty($banks[0]['classname'])) { $class = $banks[0]['classname']; if (class_exists($class)) { // Get the payment form object $banks = Banks::findbyClassname($class); $gateway = new $class($orderID); $gateway->setFormHidden(true); $gateway->setRedirect(true); $gateway->setUrlOk($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($banks['classname'])); $gateway->setUrlKo($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($banks['classname'])); $gateway->setUrlCallback($_SERVER['HTTP_HOST'] . "/common/callback/gateway/" . md5($banks['classname'])); return $gateway->CreateForm(); } } throw new Shineisp_Api_Exceptions(400006, ":: bad request"); exit; }
public static function sendOrder($orderid, $customURL = null) { $bank = ""; if (is_numeric($orderid)) { $order = self::getAllInfo($orderid, null, true); //if customer comes from reseller if ($order[0]['Customers']['parent_id']) { $customer_email = Contacts::getEmails($order[0]['Customers']['parent_id']); $invoice_dest = Customers::getAllInfo($order[0]['Customers']['parent_id']); $customer = $invoice_dest['firstname'] . " " . $invoice_dest['lastname']; $customer .= !empty($invoice_dest['company']) ? " - " . $invoice_dest['company'] : ""; $fastlink = Fastlinks::findlinks($orderid, $order[0]['Customers']['parent_id'], 'orders'); $language_id = $invoice_dest['language_id']; } else { $customer_email = Contacts::getEmails($order[0]['Customers']['customer_id']); $customer = $order[0]['Customers']['firstname'] . " " . $order[0]['Customers']['lastname']; $customer .= !empty($order[0]['Customers']['company']) ? " - " . $order[0]['Customers']['company'] : ""; $fastlink = Fastlinks::findlinks($orderid, $order[0]['Customers']['customer_id'], 'orders'); $language_id = $order[0]['Customers']['language_id']; } $email = $order[0]['Isp']['email']; $bankInfo = Banks::getBankInfo(); if (!empty($bankInfo['description'])) { $bank = $bankInfo['description']; } if (!empty($customURL)) { $url = $customURL; } else { if (!empty($fastlink[0]['code'])) { $url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $fastlink[0]['code']; } else { $url = "http://" . $_SERVER['HTTP_HOST']; } } $date = explode("-", $order[0]['order_date']); Shineisp_Commons_Utilities::sendEmailTemplate($customer_email, 'order_new', array('orderid' => $order[0]['order_number'], 'fullname' => $customer, 'email' => $email, 'bank' => $bank, 'url' => $url, ':shineisp:' => $order[0]['Customers'], 'conditions' => strip_tags(Settings::findbyParam('conditions'))), null, null, null, null, $language_id); return true; } return false; }
return $response; } public static function info($cardNum) { // $result = file_get_contents("https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo={$cardNum}&cardBinCheck=true"); $url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo={$cardNum}&cardBinCheck=true"; $result = self::curl_get($url); $result = json_decode($result); if (!$result->validated) { $bankInfo = array('validated' => $result->validated); } else { $bankInfo = array('validated' => $result->validated, 'bank' => $result->bank, 'bankName' => self::$bankInfo[$result->bank], 'bankImg' => self::getBankImg($result->bank), 'cardType' => $result->cardType, 'cardTypeName' => self::$cardType[$result->cardType]); } return $bankInfo; } } //$params = $_POST; //$params = $_GET; $params = $_REQUEST; if (!empty($params)) { if (is_numeric($params['card'])) { $res = Banks::info($params['card']); } else { $res = '参数 card 有误'; } } else { $res = '参数为空'; } //$res=Banks::info('6222021001133269958'); //$res=Banks::info('6225768758286593'); var_dump($res);
/** * setModule * Set the module configuration * @param string $classname */ public function setModule($classname) { $this->module = Banks::findbyClassname($classname); return $this; }
<?php $p = G("p", 1); $banksAdmin = Banks::getInstance()->getAllAdmin(); $transList = Trans::getInstance()->getDepositList($p); $transCnt = Trans::getInstance()->getDepositCnt(); ?> <h3>ฝากเงิน</h3> <br> <div class="row marginCenter"> <form class="setting deposit" method="get"> <div class="row dv-bank-deposit-list"> <div class="col-md-12"> <h4> ยอดเงิน ปัจจุบัน : <?php echo number_format(Trans::getInstance()->getBalance()); ?> บาท</h4> </div> </div> </form> <br> <form id="frmBDeposit" class="setting deposit" method="post" action="/setting/deposit"> <div class="row dv-bank-deposit-list"> <div class="col-md-12">
/** * Render the method of payment gateway form */ public function redirectAction() { $session = new Zend_Session_Namespace('Default'); if (empty($session->cart) || $session->cart->isEmpty()) { $this->_helper->redirector('index', 'index', 'default', array('mex' => "Cart is empty")); } // get the payment method selected $payment = $this->getRequest()->getParam('payment'); // get the payment gateway information if (!empty($payment)) { $gateway = Banks::getAllInfo($payment, "*", true); // check if the payment gateway exists if (!empty($gateway[0]['classname']) && class_exists($gateway[0]['classname'])) { // update the cart $session->cart->update(); // create the order $order = $session->cart->createOrder(); if ($order) { if ($this->getRequest()->getParam('note')) { Messages::addMessage($this->getRequest()->getParam('note'), $session->cart->getCustomerId(), null, $session->cart->getOrderid()); } // clear the cart $session->cart->clearAll(); $class = $gateway[0]['classname']; $payment = new $class($order->order_id); // create the form payment gateway $form = $payment->setUrlOk($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($gateway[0]['classname']))->setUrlKo($_SERVER['HTTP_HOST'] . "/orders/response/" . md5($gateway[0]['classname']))->setUrlCallback($_SERVER['HTTP_HOST'] . "/common/callback/gateway/" . md5($gateway[0]['classname']))->setRedirect(true)->setFormHidden(true)->CreateForm(); // push the payment gateway html form in the view $this->view->name = $form['name']; $this->view->html = $form['html']; } else { $this->_helper->redirector('index', 'index', 'default', array('mex' => "The order has been not created, please contact the administrator")); } } } }
/** * searchProcessAction * Search the record * @return unknown_type */ public function searchprocessAction() { $this->_helper->ajaxgrid->setConfig(Banks::grid())->search(); }
array_push($errmsg, "คุณไม่มีสิทธ์จัดการบัญชีนี้"); } } elseif ($submit == "frmBank") { $bankNo = P("frmBankManagerNo"); $bankName = P("frmBankManagerName"); $bankType = P("frmBankManagerType"); if (empty($bankNo) || strlen($bankNo) < 10) { array_push($errmsg, "กรุณากรอกเลขที่บัญชี"); } if (empty($bankName)) { array_push($errmsg, "กรุณากรอกชื่อบัญชี"); } if (empty($bankType)) { array_push($errmsg, "กรุณาเลือกธนาคาร"); } $banks = Banks::getInstance(); $banks->bcode = $bankType; $banks->bno = $bankNo; $banks->bname = $bankName; $banks->uid = S("user")["uid"]; if (count($errmsg) == 0) { $ret = $banks->Create(); if ($ret == -2) { array_push($errmsg, "บัญชีนี้มีอยู่แล้ว"); } elseif ($ret == 1) { array_push($sucmsg, "เพิ่มบัญชีเสร็จสมบูรณ์"); } } } elseif ($submit == "frmBDeposit") { $bank = P("bank"); $txtDeposit = P("txtDeposit");
<?php $p = G("p", 1); $sort = G("sort", "bcode"); $order = G("order", "asc"); $orderx = $order == "asc" ? "desc" : "asc"; $banktypes = BanksType::getInstance()->getAll(); $banksUser = Banks::getInstance()->getAll($sort, $order, $p); $banksUserCnt = Banks::getInstance()->getCnt(); ?> <h3>บัญชีธนาคาร</h3> <h5>ใช้สำหรับ เป็นบัญชีในการถอนเงินจากระบบ</h5> <br> <div class="row marginCenter"> <form id="frmBankManager" class="setting bank-manager" method="post" action="/setting/bank"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="frmBankManagerNo">เลขที่บัญชีธนาคาร</label> <input type="number" class="form-control" id="frmBankManagerNo" name="frmBankManagerNo" placeholder="เลขที่บัญชีธนาคาร" value="<?php echo $bankNo; ?> "> </div> </div> <div class="col-md-6"> <div class="form-group">
/** * Process the response of the banks gateways * * @return void */ public function responseAction() { $request = $this->getRequest(); $response = $request->getParams(); if (!empty($response['custom']) && is_numeric(trim($response['custom']))) { $isp = Shineisp_Registry::get('ISP'); // Orderid back from the bank $order_id = trim($response['custom']); // Getting the md5 value in order to match with the class name. $classrequest = $request->gateway; // Get the bank selected using the MD5 code $bank = Banks::findbyMD5($classrequest); if (!empty($bank[0]['classname'])) { if (!empty($bank[0]['classname']) && class_exists($bank[0]['classname'])) { $class = $bank[0]['classname']; $payment = new $class($order_id); // Check if the method "Response" exists in the Payment class and send all the bank information to the payment module if (method_exists($class, "Response")) { $OrderID = $payment->Response($response); } else { $OrderID = false; } } } // Check if the OrderID is a number because it // means that the order has been executed correctly if (is_numeric($OrderID)) { // Sending an email to the customer and the administrator with the order details. $order = Orders::getAllInfo($OrderID, null, true); Shineisp_Commons_Utilities::sendEmailTemplate($order[0]['Customers']['email'], 'order_confirm', array('fullname' => $order[0]['Customers']['fullname'], 'orderid' => $OrderID, 'order' => $order), null, null, null, null, $order[0]['Customers']['language_id']); // Redirect the user in the The task requested has been executed successfully. page $this->_helper->redirector('list', 'orders', 'default', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success')); } } $this->_helper->redirector('list', 'orders', 'default', array('mex' => 'There was a problem during the payment process.', 'status' => 'danger')); }
<?php $p = G("p", 1); $banksAdmin = Banks::getInstance()->getAllAdmin(); $banksUser = Banks::getInstance()->getMyBank(); $transList = Trans::getInstance()->getDepositList($p, 'W'); $transCnt = Trans::getInstance()->getDepositCnt('W'); Trans::getInstance()->getDepositSum(); ?> <h3>ถอนเงิน</h3> <br> <div class="row marginCenter"> <form class="setting deposit" method="get"> <div class="row dv-bank-deposit-list"> <div class="col-md-12"> <h4> ยอดเงิน ปัจจุบัน : <?php echo number_format(Trans::getInstance()->getBalance()); ?> บาท</h4> </div> </div> </form> <br> <form id="frmBWithdraw" class="setting deposit" method="post" action="/setting/withdraw"> <div class="row dv-bank-deposit-list">
<?php $p = G("p", 1); $sort = G("sort", "bcode"); $order = G("order", "asc"); $orderx = $order == "asc" ? "desc" : "asc"; $banktypes = BanksType::getInstance()->getAll(); $banksAdmin = Banks::getInstance()->getAllAdmin($sort, $order, $p); $banksAdminCnt = Banks::getInstance()->getAdminCnt(); ?> <h3>บัญชีธนาคารหลัก ของระบบ</h3> <br> <div class="row marginCenter"> <?php if (S("user")['rank'] > 2) { // if for super admin ?> <form id="frmBankManager" class="setting bank-manager" method="post" action="/setting/bank-manager"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="frmBankManagerNo">เลขที่บัญชีธนาคาร</label> <input type="number" class="form-control" id="frmBankManagerNo" name="frmBankManagerNo" placeholder="เลขที่บัญชีธนาคาร" value="<?php echo $bankNo; ?> "> </div>
public function get($uuid, $order_uuid = null, $service_uuid = null) { $this->authenticate(); $customers = Customers::findWithUuid($uuid); if (empty($customers)) { throw new Shineisp_Api_Exceptions(400006, ":: 'uuid' not valid"); exit; } $id = $customers['customer_id']; if ($order_uuid == null && $service_uuid == null) { throw new Shineisp_Api_Exceptions(400006, ":: 'order_uuid' not valid and 'service_uuid' not valid"); } #TODO get order from $order_uuid if ($service_uuid != null) { $objService = OrdersItems::findByUUID($service_uuid); if ($objService == false) { return false; } $service = $objService->toArray(); $orderid = $service['order_id']; $fields = "o.order_id, \n \t\t o.order_number,\n DATE_FORMAT(o.order_date, '%d/%m/%Y') as Starting, \n DATE_FORMAT(o.expiring_date, '%d/%m/%Y') as Valid_Up, \n in.invoice_id as invoice_id, \n in.number as Invoice, \n CONCAT(d.domain, '.', w.tld) as Domain, \n c.company as company, \n o.status_id, \n s.status as Status, \n o.vat as VAT, \n o.total as Total, \n o.grandtotal as Grandtotal\n so.code as servStatus"; $rs = Orders::getAllInfo($orderid, "*", true, $id); if (empty($rs)) { throw new Shineisp_Api_Exceptions(404001, ":: Orders not found"); } return $rs; $currency = Shineisp_Registry::getInstance()->Zend_Currency; $result = array(); $order = array_shift($rs); // Check the status of the order. // If the order has to be paid we have update it to the last prices and taxes if ($order['status_id'] == Statuses::id('tobepaid', 'orders')) { // Update the total order Orders::updateTotalsOrder($orderid); // Reload the data $rs = Orders::getAllInfo($orderid, $fields, true, $id); $order = array_shift($rs); $order['Total'] = $currency->toCurrency($order['Total'], array('currency' => Settings::findbyParam('currency'))); $order['VAT'] = $currency->toCurrency($order['VAT'], array('currency' => Settings::findbyParam('currency'))); $order['Grandtotal'] = $currency->toCurrency($order['Grandtotal'], array('currency' => Settings::findbyParam('currency'))); $order['price'] = $order['Grandtotal']; $result['tobepaid'] = true; } $result['order'] = $order; $records = OrdersItems::getAllDetails($orderid, "oi.detail_id, oi.description as description, DATE_FORMAT(oi.date_end, '%d/%m/%Y') as expiration_date, oi.quantity as quantity, oi.price as price, bc.name as billingcycle, oi.setupfee as setupfee,p.autosetup as autosetup, s.code as statuscode", true); $allactive = false; for ($i = 0; $i < count($records); $i++) { $records[$i]['itemactiveonorder'] = false; if ($records[$i]['autosetup'] == 1) { $records[$i]['itemactiveonorder'] = true; $allactive = true; } else { $allactive = false; } $records[$i]['price'] = $currency->toCurrency($records[$i]['price'], array('currency' => Settings::findbyParam('currency'))); $records[$i]['setupfee'] = $currency->toCurrency($records[$i]['setupfee'], array('currency' => Settings::findbyParam('currency'))); } $result['activeonorder'] = $allactive; $result['orderitems'] = $records; $result['invoidid'] = $order['status_id'] == Statuses::id("complete", "orders") && $order['Invoice'] > 0 ? true : false; $result['invoidnumber'] = $order['Invoice']; $result['invoidid'] = $order['invoice_id']; $result['payments'] = ""; if ($result['tobepaid'] == true) { $result['payments'] = array(); $banks = Banks::findAllActive("classname", true); if (!empty($banks)) { foreach ($banks as $bank) { if (!empty($bank['classname']) && class_exists($bank['classname'])) { if (class_exists($bank['classname'])) { $class = $bank['classname']; $payment = new $class($id); $payment->setUrlOk($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($bank['classname'])); $payment->setUrlKo($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($bank['classname'])); $payment->setUrlCallback($_SERVER['HTTP_HOST'] . "/common/callback/gateway/" . md5($bank['classname'])); $result['payments'][] = $payment->CreateForm(); } } } } } return $result; } }