Example #1
0
 function isOrderPaid($orderId)
 {
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $rowOrder = $tblOrder->find($orderId)->current();
     if (!empty($rowOrder)) {
         if ($rowOrder->orderStatus == 3) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Example #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);
 }
Example #3
0
 private function saveOrder($cart, $method)
 {
     $defaultCurrency = 'Rp';
     $tblPaymentSetting = new Pandamp_Modules_Payment_Setting_Model_PaymentSetting();
     $usdIdrEx = $tblPaymentSetting->fetchRow(" settingKey= 'USDIDR'");
     $currencyValue = $usdIdrEx->settingValue;
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $taxRate = $rowTaxRate->settingValue;
     $auth = Zend_Auth::getInstance();
     $userId = $auth->getIdentity()->guid;
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $row = $tblOrder->fetchNew();
     $row->userId = $userId;
     //get value from post var (store/checkout.phtml)
     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');
     //        if ($method == "nsiapay") {
     //        	$row->orderStatus=8;
     //        }
     //        else {
     //        $row->orderStatus=1; //pending
     //        }
     $row->orderStatus = 1;
     //pending
     $row->currency = $defaultCurrency;
     $row->currencyValue = $currencyValue;
     $row->orderTotal = $cart['grandTotal'];
     $row->orderTax = $cart['taxAmount'];
     $row->ipAddress = Pandamp_Lib_Formater::getRealIpAddr();
     $orderId = $row->save();
     $rowJustInserted = $tblOrder->find($orderId)->current();
     //		$rowJustInserted->invoiceNumber = date('Ymd') . '.' . $orderId;
     $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber();
     $rowset = $tblNumber->fetchRow();
     $num = $rowset->invoice;
     $totdigit = 5;
     $num = strval($num);
     $jumdigit = strlen($num);
     $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num;
     $rowset->invoice = $rowset->invoice += 1;
     $tblNumber->update(array('invoice' => $rowset->invoice));
     $rowJustInserted->invoiceNumber = $noinvoice;
     $rowJustInserted->save();
     $this->view->invoiceNumber = $rowJustInserted->invoiceNumber;
     $this->view->datePurchased = $rowJustInserted->datePurchased;
     $tblOrderDetail = new Pandamp_Modules_Payment_OrderDetail_Model_OrderDetail();
     for ($iCart = 0; $iCart < count($cart['items']); $iCart++) {
         $rowDetail = $tblOrderDetail->fetchNew();
         $itemId = $cart['items'][$iCart]['itemId'];
         $rowDetail->orderId = $orderId;
         $rowDetail->itemId = $itemId;
         $rowDetail->documentName = $cart['items'][$iCart]['item_name'];
         $rowDetail->price = $cart['items'][$iCart]['itemPrice'];
         $itemPrice = $rowDetail->price;
         @($rowDetail->tax = ($cart['grandTotal'] - $cart['subTotal']) / $cart['subTotal'] * 100);
         $rowDetail->qty = $cart['items'][$iCart]['qty'];
         $rowDetail->finalPrice = $cart['items'][$iCart]['itemTotal'];
         $rowDetail->save();
     }
     //[TODO] MUST ALSO INSERT/UPDATE KutuUserFinance
     return $orderId;
 }
Example #4
0
<?php

error_reporting(E_ALL | E_STRICT);
require_once "../baseinit.php";
Pandamp_Application::getResource('session');
Pandamp_Application::getResource('db');
$transidmerchant = $_GET['OrderNumber'];
$responseCode = $_GET['RESPONSECODE'];
$cardNumber = $_GET['CARDNUMBER'];
$bank = $_GET['BANK'];
$approvalCode = $_GET['APPROVALCODE'];
$result = strtoupper($_GET['RESULT']);
$tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
$rowOrder = $tblOrder->fetchRow("invoiceNumber='" . $transidmerchant . "' AND orderStatus=1");
$datenow = date('YmdHis');
if ($_SERVER['REMOTE_ADDR'] == "203.190.41.220") {
    if ($rowOrder > 0) {
        if ($result == "SUCCESS") {
            //$rowOrder->orderStatus = 14;
            $rowOrder->paymentDate = $datenow;
            $data = array('status' => 'notify', 'responseCode' => $responseCode, 'creditcard' => $cardNumber, 'bank' => $bank, 'approvalCode' => $approvalCode);
            $tblNsiapay = new Pandamp_Modules_Payment_Nsiapay_Model_Nsiapay();
            $tblNsiapay->update($data, "transidmerchant='" . $transidmerchant . "'");
            $tblNhis = new Pandamp_Modules_Payment_NsiapayHistory_Model_NsiapayHistory();
            $tblNhis->insert(array('orderId' => $rowOrder->orderId, 'paymentStatus' => 'notify', 'dateAdded' => date('YmdHis')));
            $response = "Continue";
        } else {
            //$rowOrder->orderStatus = 15;
            $rowOrder->paymentDate = $datenow;
            $response = "Stop";
        }
 public function trdetailAction()
 {
     $this->_checkAuth();
     $orderId = $this->_request->getParam('id');
     $userId = $this->_userInfo->userId;
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $tblOrderDetail = new Pandamp_Modules_Payment_OrderDetail_Model_OrderDetail();
     $tblOrderHistory = new Pandamp_Modules_Payment_OrderHistory_Model_OrderHistory();
     $tblOrderPaypalHistory = new Pandamp_Modules_Payment_Paypal_Model_Paypal();
     $rowset = $tblOrder->getOrderAndStatus($orderId);
     $rowsetDetail = $tblOrderDetail->fetchAll($tblOrderDetail->select()->where("orderId='" . $orderId . "'"));
     $rowsetHistory = $tblOrderHistory->getUserHistory($orderId);
     $rowsetPaypalHistory = $tblOrderPaypalHistory->fetchAll($tblOrderPaypalHistory->select()->where("orderId='" . $orderId . "'"));
     //print_r($rowsetHistory);
     $this->view->listOrder = $rowset;
     $this->view->listOrderDetail = $rowsetDetail;
     $this->view->rowsetHistory = $rowsetHistory;
     $this->view->rowsetPaypalHistory = $rowsetPaypalHistory;
 }
 protected function updateInvoiceMethod($orderId, $payMethod, $status, $notify, $note)
 {
     $tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
     $rows = $tblOrder->find($orderId)->current();
     $row = array();
     $ivnum = $rows->invoiceNumber;
     /*if(empty($ivnum)){
     			if($status==3 || $status==5 || (!empty($_SESSION['_method'])&&($_SESSION['_method'] =='paypal')))
     			$ivnum = $this->getInvoiceNumber();
     			//$row=array ('invoiceNumber'	=> $ivnum);
     		}*/
     //if( )$ivnum = $this->getInvoiceNumber();
     $row = array('orderStatus' => $status, 'paymentMethod' => $payMethod);
     //$_SESSION['_method'] = '';
     /*$this->_paymentMethod=$payMethod;//set payment method on table
     		$row->paymentMethod=$this->_paymentMethod;*/
     $tblOrder->update($row, 'orderId = ' . $orderId);
     $tblHistory = new Pandamp_Modules_Payment_OrderHistory_Model_OrderHistory();
     $rowHistory = $tblHistory->fetchNew();
     $rowHistory->orderId = $orderId;
     $rowHistory->orderStatusId = $status;
     $rowHistory->dateCreated = date('YmdHis');
     $rowHistory->userNotified = $notify;
     $rowHistory->note = $note;
     $rowHistory->save();
     return $ivnum;
 }
Example #7
0
<?php

error_reporting(E_ALL | E_STRICT);
require_once "../baseinit.php";
//set_include_path(ROOT_DIR.'/library' . PATH_SEPARATOR . get_include_path());
Pandamp_Application::getResource('session');
Pandamp_Application::getResource('db');
$transidmerchant = $_GET['TRANSIDMERCHANT'];
$currency = $_GET['CURRENCY'];
$tblOrder = new Pandamp_Modules_Payment_Order_Model_Order();
$rowOrder = $tblOrder->fetchRow("invoiceNumber='" . $transidmerchant . "'");
$datenow = date('YmdHis');
if ($_SERVER['REMOTE_ADDR'] == "203.190.41.220") {
    if ($rowOrder) {
        //$rowOrder->orderStatus = 9;
        $rowOrder->datePurchased = $datenow;
        $rowOrder->save();
        $tblNsiapay = new Pandamp_Modules_Payment_Nsiapay_Model_Nsiapay();
        $tblNsiapay->update(array('status' => 'verify', 'bin' => $currency), "transidmerchant='" . $transidmerchant . "'");
        $tblNhis = new Pandamp_Modules_Payment_NsiapayHistory_Model_NsiapayHistory();
        $tblNhis->insert(array('orderId' => $rowOrder->orderId, 'paymentStatus' => 'verify', 'dateAdded' => date('YmdHis')));
        $response = "continue";
    } else {
        $response = "stop";
    }
    echo $response;
} else {
    $rowOrder->orderStatus = 7;
    $rowOrder->datePurchased = $datenow;
    $rowOrder->save();
    echo "continue";