当前位置: 首页>>代码示例>>PHP>>正文


PHP VirtueMartModelOrders::updateStatusForOneOrder方法代码示例

本文整理汇总了PHP中VirtueMartModelOrders::updateStatusForOneOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelOrders::updateStatusForOneOrder方法的具体用法?PHP VirtueMartModelOrders::updateStatusForOneOrder怎么用?PHP VirtueMartModelOrders::updateStatusForOneOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VirtueMartModelOrders的用法示例。


在下文中一共展示了VirtueMartModelOrders::updateStatusForOneOrder方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plgVmOnPaymentResponseReceived

 function plgVmOnPaymentResponseReceived(&$html)
 {
     // the payment itself should send the parameter needed.
     $virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
     $vendorId = 0;
     if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
         return null;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     if (!class_exists('VirtueMartCart')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $payment_data = JRequest::get('post');
     $payment_name = $this->renderPluginName($method);
     $html = $this->_getPaymentResponseHtml($payment_data, $payment_name);
     if (!empty($payment_data)) {
         vmdebug('plgVmOnPaymentResponseReceived', $payment_data);
         $order_number = $payment_data['invoice'];
         $return_context = $payment_data['custom'];
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
         $payment_name = $this->renderPluginName($method);
         $html = $this->_getPaymentResponseHtml($payment_data, $payment_name);
         if ($virtuemart_order_id) {
             // send the email ONLY if payment has been accepted
             if (!class_exists('VirtueMartModelOrders')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
             }
             $modelOrder = new VirtueMartModelOrders();
             $orderitems = $modelOrder->getOrder($virtuemart_order_id);
             $nb_history = count($orderitems['history']);
             //vmdebug('history', $orderitems);
             if (!class_exists('shopFunctionsF')) {
                 require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             if ($nb_history == 1) {
                 if (!class_exists('shopFunctionsF')) {
                     require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 shopFunctionsF::sentOrderConfirmedEmail($orderitems);
                 $this->logInfo('plgVmOnPaymentResponseReceived, sentOrderConfirmedEmail ' . $order_number, 'message');
                 $order['order_status'] = $orderitems['items'][$nb_history - 1]->order_status;
                 $order['virtuemart_order_id'] = $virtuemart_order_id;
                 $order['customer_notified'] = 0;
                 $order['comments'] = JText::sprintf('VMPAYMENT_PAYPAL_EMAIL_SENT');
                 $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
             }
         }
     }
     //We delete the old stuff
     // get the correct cart / session
     $cart = VirtueMartCart::getCart();
     $cart->emptyCart();
     return true;
 }
开发者ID:rurikhero,项目名称:PagSeguro-VirtueMart-3,代码行数:60,代码来源:pagseguro_virtuemartbrasil.php

示例2: managePaymentResponse

	function managePaymentResponse ($virtuemart_order_id, $resp, $new_status, $return_context = NULL) {
		// Save platform response data
		$this->savePaymentData ($virtuemart_order_id, $resp);

		if (!class_exists ('VirtueMartModelOrders')) {
			require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
		}
		// save order data
		$modelOrder = new VirtueMartModelOrders();
		$order['order_status'] = $new_status;
		$order['virtuemart_order_id'] = $virtuemart_order_id;
		$order['customer_notified'] = 1;
		$date = JFactory::getDate ();
		$order['comments'] = JText::sprintf ('VMPAYMENT_' . $this->_name . '_NOTIFICATION_RECEVEIVED', $date->toFormat ('%Y-%m-%d %H:%M:%S'));
		//vmdebug($this->_name . ' - managePaymentResponse', $order);

		// la fonction updateStatusForOneOrder fait l'envoie de l'email à partir de VM2.0.2
		$modelOrder->updateStatusForOneOrder ($virtuemart_order_id, $order, TRUE);

		if (!class_exists ('VirtueMartCart')) {
			require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
		}

		if ($resp->isAcceptedPayment ()) {
			// Empty cart in session
			$this->emptyCart ($return_context);
		}
	}
开发者ID:xenten,项目名称:swift-kanban,代码行数:28,代码来源:payzen.php

示例3: VirtueMartModelOrders

 function update_status($status, $order_id, $text = 'VMPAYMENT_SEB_PAYMENT_CANCELED')
 {
     if ($order_id) {
         // send the email only if payment has been accepted
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $modelOrder = new VirtueMartModelOrders();
         $order['order_status'] = $status;
         $order['virtuemart_order_id'] = $order_id;
         $order['customer_notified'] = 1;
         $order['comments'] = JTExt::sprintf($text, $order_id);
         $modelOrder->updateStatusForOneOrder($order_id, $order, true);
     }
 }
开发者ID:jflash,项目名称:moodulid25,代码行数:15,代码来源:seb.php

示例4: plgVmOnPaymentResponseReceived

 function plgVmOnPaymentResponseReceived(&$html = "")
 {
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $payment_data = $_GET;
     // the payment itself should send the parameter needed.
     $virtuemart_paymentmethod_id = $payment_data["pm"];
     $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($payment_data["orderid"]);
     $vendorId = 0;
     if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
         return null;
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     $db =& JFactory::getDBO();
     $query = "SELECT * FROM #__virtuemart_orders WHERE virtuemart_order_id =" . $virtuemart_order_id;
     $db->setQuery($query);
     $payment = $db->loadObject();
     //if(!$payment = $this->getDataByOrderId($virtuemart_order_id))
     //{
     //	return;
     //}
     if (@$payment_data["callback"] == 1) {
         $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id  found ' . $virtuemart_order_id, 'message');
         $vendorId = 0;
         $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
         $this->logInfo('epay_data ' . implode('   ', $_GET), 'message');
         // get all know columns of the table
         $response_fields = $payment_data;
         unset($response_fields["option"]);
         unset($response_fields["view"]);
         unset($response_fields["task"]);
         unset($response_fields["tmpl"]);
         $response_fields["payment_name"] = $this->renderPluginName($method);
         $response_fields["order_number"] = $payment_data["orderid"];
         $response_fields["virtuemart_order_id"] = $virtuemart_order_id;
         $response_fields["epay_response"] = addslashes(serialize($response_fields));
         $response_fields["virtuemart_paymentmethod_id"] = $payment->virtuemart_paymentmethod_id;
         //$this->storePSPluginInternalData($response_fields);
         $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', TRUE);
         if (strlen($method->epay_md5key) > 0) {
             $params = $payment_data;
             $var = "";
             foreach ($params as $key => $value) {
                 if ($key != "hash") {
                     $var .= $value;
                 }
             }
             if ($payment_data["hash"] != md5($var . $method->epay_md5key)) {
                 echo "MD5 ERROR";
                 $this->logInfo('MD5 Error: exit ', 'ERROR');
                 return null;
             }
         }
         if ((int) $payment_data["txnfee"] > 0) {
             $fee = (int) $payment_data["txnfee"] / 100;
             $db = JFactory::getDBO();
             $q = "UPDATE #__virtuemart_orders SET order_payment = " . (double) $fee . ", order_total = order_total+{$fee} WHERE virtuemart_order_id=" . $virtuemart_order_id;
             $db->setQuery($q);
             $db->query();
         }
         $new_status = $method->status_success;
         if ($virtuemart_order_id) {
             // send the email only if payment has been accepted
             if (!class_exists('VirtueMartModelOrders')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
             }
             $modelOrder = new VirtueMartModelOrders();
             $order["order_status"] = $new_status;
             $order["virtuemart_order_id"] = $virtuemart_order_id;
             $order["customer_notified"] = 1;
             $order['comments'] = JText::sprintf('VMPAYMENT_EPAY_PAYMENT_STATUS_CONFIRMED', $payment_data["orderid"]);
             $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
         }
         echo "OK";
     } else {
         $session = JFactory::getSession();
         vmdebug('plgVmOnPaymentResponseReceived', $payment_data);
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($payment_data["orderid"]);
         $payment_name = $this->renderPluginName($method);
         $payment_name = $this->renderPluginName($method);
         $html = $this->_getPaymentResponseHtml($payment_data, $payment_name);
         $this->emptyCart($session->getId());
     }
     return true;
 }
开发者ID:ePay,项目名称:virtuemart3,代码行数:91,代码来源:epay.php

示例5: plgVmOnPaymentNotification

 function plgVmOnPaymentNotification()
 {
     $virtuemart_paymentmethod_id = JRequest::getInt('pm', 0);
     $order_number = JRequest::getInt('on', 0);
     if (!($method = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
         return null;
         // Another method was selected, do nothing
     }
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
     $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id  found ' . $virtuemart_order_id, 'message');
     if (!$virtuemart_order_id) {
         $this->_debug = true;
         // force debug here
         $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id not found ', 'ERROR');
         // send an email to admin, and ofc not update the order status: exit  is fine
         //$this->sendEmailToVendorAndAdmins(JText::_('VMPAYMENT_PAYMILL_ERROR_EMAIL_SUBJECT'), JText::_('VMPAYMENT_PAYMILL_UNKNOW_ORDER_ID'));
         exit;
     }
     $vendorId = 0;
     $payment = $this->getDataByOrderId($virtuemart_order_id);
     $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     $this->_debug = $method->debug;
     if (!$payment) {
         $this->logInfo('getDataByOrderId payment not found: exit ', 'ERROR');
         return null;
     }
     $new_status = 'C';
     $new_comment = 'Paymill - Geld ist eingegangen.';
     $this->logInfo('plgVmOnPaymentNotification return new_status:' . $new_status, 'message');
     if ($virtuemart_order_id) {
         // send the email only if payment has been accepted
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $modelOrder = new VirtueMartModelOrders();
         $order['order_status'] = $new_status;
         $order['comments'] = $new_comment;
         $order['virtuemart_order_id'] = $virtuemart_order_id;
         $order['customer_notified'] = 0;
         // TOKEN FROM SESSION
         $session = JFactory::getSession();
         $pm_token = $session->get('pm_token');
         //define NEW PM_VARS
         define('API_HOST', 'https://api.paymill.com/v2/');
         define('API_KEY', $method->private_key);
         if ($pm_token) {
             require "components/com_paymillapi/lib/Services/Paymill/Transactions.php";
             $transactionsObject = new Services_Paymill_Transactions(API_KEY, API_HOST);
             $params = array('amount' => $totalInPaymentCurrency * 100, 'currency' => 'eur', 'token' => $pm_token, 'description' => $address->email);
             $transaction = $transactionsObject->create($params);
             $pm_status = $transaction['status'];
             $q = "UPDATE #__paymill SET status = '" . $pm_status . "', email = '" . $address->email . "' WHERE token = '" . $pm_token . "'";
             $db->setQuery($q);
             $db->query();
             $new_status = 'C';
             $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
         } else {
             echo "Ihre Kreditkartenzahlung war leider fehlerhaft. Bitte überprüfen Sie Ihre Eingabe.<br /><br /><a href='" . JURI::root() . "/component/virtuemart/cart/editpayment?Itemid=0'>Zurück zur Bezahlung</a>";
         }
         // END NEW PM_VARS
         //$modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
     }
     return true;
 }
开发者ID:stAn47,项目名称:paymill-virtuemart-2,代码行数:73,代码来源:paymill.php

示例6: plgVmOnPaymentNotification

 function plgVmOnPaymentNotification()
 {
     if (empty($_POST)) {
         $fap = json_decode(file_get_contents("php://input"));
         $_POST = array();
         foreach ($fap as $key => $val) {
             $_POST[$key] = $val;
         }
     }
     $_SERVER['REQUEST_URI'] = '';
     $_SERVER['SCRIPT_NAME'] = '';
     $_SERVER['QUERY_STRING'] = '';
     define('_JEXEC', 1);
     define('DS', DIRECTORY_SEPARATOR);
     $option = 'com_virtuemart';
     $my_path = dirname(__FILE__);
     $my_path = explode(DS . 'plugins', $my_path);
     $my_path = $my_path[0];
     if (file_exists($my_path . '/defines.php')) {
         include_once $my_path . '/defines.php';
     }
     if (!defined('_JDEFINES')) {
         define('JPATH_BASE', $my_path);
         require_once JPATH_BASE . '/includes/defines.php';
     }
     define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option);
     define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option);
     define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option);
     require_once JPATH_BASE . '/includes/framework.php';
     $app = JFactory::getApplication('site');
     $app->initialise();
     if (!class_exists('VmConfig')) {
         require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
     }
     VmConfig::loadConfig();
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.fphp';
     }
     if (!class_exists('plgVmPaymentFondy')) {
         require dirname(__FILE__) . DS . 'fondy.php';
     }
     require dirname(__FILE__) . DS . 'Fondy.cls.php';
     //print_r ($_POST);die;
     list($order_id, ) = explode(Fondy::ORDER_SEPARATOR, $_POST['order_id']);
     $order = new VirtueMartModelOrders();
     $method = new plgVmPaymentFondy();
     $order_s_id = $order->getOrderIdByOrderNumber($order_id);
     $orderitems = $order->getOrder($order_s_id);
     $methoditems = $method->__getVmPluginMethod($orderitems['details']['BT']->virtuemart_paymentmethod_id);
     $option = array('merchant_id' => $methoditems->FONDY_MERCHANT, 'secret_key' => $methoditems->FONDY_SECRET_KEY);
     $response = Fondy::isPaymentValid($option, $_POST);
     if ($response === true) {
         $red = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginresponsereceived&pm=' . $paymentMethodID);
         header('Location:' . $red);
         $datetime = date("YmdHis");
         echo "OK";
     } else {
         echo "<!-- {$response} -->";
     }
     $orderitems['order_status'] = $methoditems->status_success;
     $orderitems['customer_notified'] = 0;
     $orderitems['virtuemart_order_id'] = $order_s_id;
     $orderitems['comments'] = 'Fondy ID: ' . $order_id . " Ref ID : " . $_POST['payment_id'];
     $order->updateStatusForOneOrder($order_s_id, $orderitems, true);
 }
开发者ID:cloudipsp,项目名称:virtuemart,代码行数:65,代码来源:fondy.php

示例7: plgVmOnUserPaymentCancel

 function plgVmOnUserPaymentCancel()
 {
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     $tp_cart = json_decode($_SESSION['__vm']['vmcart']);
     $vm_order = VirtueMartModelOrders::getOrderIdByOrderNumber($tp_cart->order_number);
     $orderModel = VmModel::getModel('orders');
     $order = $orderModel->getOrder($vm_order);
     if ($this->_vmpCtable->virtuemart_paymentmethod_id != $order['details']['BT']->virtuemart_paymentmethod_id) {
         return NULL;
     }
     echo '<script>alert("Pago Cancelado: Por favor intente nuevamente")</script>';
     $modelOrder = new VirtueMartModelOrders();
     $order['order_status'] = 'X';
     $order['virtuemart_order_id'] = $vm_order;
     $order['customer_notified'] = 1;
     $order['comments'] = JTExt::sprintf("Pago Rechazado", $vm_order);
     $modelOrder->updateStatusForOneOrder($vm_order, $order, false);
     return true;
 }
开发者ID:guillermoluced,项目名称:Plugin-VirtueMart,代码行数:21,代码来源:todopago.php

示例8: plgVmOnPaymentNotification

 public function plgVmOnPaymentNotification()
 {
     if (JRequest::getVar('pelement') != 'kaznachey') {
         return null;
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $order_id = JRequest::getVar('order_number');
     $order = VirtueMartModelOrders::getOrder($order_id);
     $error = false;
     $method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id);
     if ($method) {
         $request_json = file_get_contents('php://input');
         $request = json_decode($request_json, true);
         $request_sign = md5($request["ErrorCode"] . $request["OrderId"] . $request["MerchantInternalPaymentId"] . $request["MerchantInternalUserId"] . number_format($request["OrderSum"], 2, ".", "") . number_format($request["Sum"], 2, ".", "") . strtoupper($request["Currency"]) . $request["CustomMerchantInfo"] . strtoupper($method->secret_key));
         if ($request['SignatureEx'] == $request_sign) {
             $order['order_status'] = $method->status_success;
             $order['virtuemart_order_id'] = "{$order_id}";
             $order['customer_notified'] = 0;
             $order['comments'] = JTExt::sprintf('VMPAYMENT_kaznachey_PAYMENT_CONFIRMED', $order_id);
             if (!class_exists('VirtueMartModelOrders')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
             }
             $modelOrder = new VirtueMartModelOrders();
             ob_start();
             $modelOrder->updateStatusForOneOrder($order_id, $order, true);
             ob_end_clean();
         } else {
             $error = "WRONG_SIGNATURE";
         }
         if ($error) {
             $order['order_status'] = $method->status_canceled;
             $order['virtuemart_order_id'] = "{$order_id}";
             $order['customer_notified'] = 0;
             $order['comments'] = JTExt::sprintf("VMPAYMENT_kaznachey_PAYMENT_ERROR: {$error}", $order_id);
             if (!class_exists('VirtueMartModelOrders')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
             }
             $modelOrder = new VirtueMartModelOrders();
             ob_start();
             $modelOrder->updateStatusForOneOrder($order_id, $order, true);
             ob_end_clean();
         }
     }
     exit;
     return null;
 }
开发者ID:saxum2010,项目名称:kaznacheyJoomla3.0,代码行数:48,代码来源:kaznachey.php

示例9: plgVmOnPaymentNotification

 public function plgVmOnPaymentNotification()
 {
     if (JRequest::getVar('pelement') != 'kaznachey') {
         return null;
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $order_id = JRequest::getVar('order_number');
     $order = VirtueMartModelOrders::getOrder($order_id);
     $error = false;
     $method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id);
     if ($method) {
         $merchantGuid = $method->merchant_id;
         $merchnatSecretKey = $method->secret_key;
         $HTTP_RAW_POST_DATA = @$HTTP_RAW_POST_DATA ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
         $hrpd = json_decode($HTTP_RAW_POST_DATA);
         if (@$hrpd->MerchantInternalPaymentId) {
             $merchantGuid = $method->merchant_id;
             $merchnatSecretKey = $method->secret_key;
             $amount = number_format($order['details']['BT']->order_total, 2, '.', '');
             $signature_u = md5(md5($merchantGuid . $merchnatSecretKey . "{$amount}" . $order_id));
             if ($hrpd->ErrorCode == 0) {
                 if ($hrpd->CustomMerchantInfo == $signature_u) {
                     $order['order_status'] = $method->status_success;
                     $order['virtuemart_order_id'] = "{$order_id}";
                     $order['customer_notified'] = 0;
                     $order['comments'] = JTExt::sprintf('VMPAYMENT_kaznachey_PAYMENT_CONFIRMED', $order_id);
                     if (!class_exists('VirtueMartModelOrders')) {
                         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
                     }
                     $modelOrder = new VirtueMartModelOrders();
                     ob_start();
                     $modelOrder->updateStatusForOneOrder($order_id, $order, true);
                     ob_end_clean();
                 } else {
                     $error = "Wrong_SIGNATURE";
                 }
             } else {
                 $error = "Transaction_error";
             }
         }
         if ($error) {
             $order['order_status'] = $method->status_canceled;
             $order['virtuemart_order_id'] = "{$order_id}";
             $order['customer_notified'] = 0;
             $order['comments'] = JTExt::sprintf("VMPAYMENT_kaznachey_PAYMENT_ERROR: {$error}", $order_id);
             if (!class_exists('VirtueMartModelOrders')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
             }
             $modelOrder = new VirtueMartModelOrders();
             ob_start();
             $modelOrder->updateStatusForOneOrder($order_id, $order, true);
             ob_end_clean();
         }
     }
     exit;
     return null;
 }
开发者ID:saxum2010,项目名称:kaznachey_Joomla-virtuemart-2.5-2.0.x,代码行数:59,代码来源:kaznachey.php

示例10: plgVmOnPaymentNotification

 public function plgVmOnPaymentNotification()
 {
     if (!class_exists('VirtueMartModelOrders')) {
         require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
     }
     $payeer_data = vRequest::getPost();
     if (isset($payeer_data['m_operation_id']) && isset($payeer_data['m_sign'])) {
         $err = false;
         $message = '';
         $payment = $this->getDataByOrderId($payeer_data['m_orderid']);
         $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
         // запись логов
         $log_text = "--------------------------------------------------------\n" . "operation id\t\t" . $payeer_data["m_operation_id"] . "\n" . "operation ps\t\t" . $payeer_data["m_operation_ps"] . "\n" . "operation date\t\t" . $payeer_data["m_operation_date"] . "\n" . "operation pay date\t" . $payeer_data["m_operation_pay_date"] . "\n" . "shop\t\t\t\t" . $payeer_data["m_shop"] . "\n" . "order id\t\t\t" . $payeer_data["m_orderid"] . "\n" . "amount\t\t\t\t" . $payeer_data["m_amount"] . "\n" . "currency\t\t\t" . $payeer_data["m_curr"] . "\n" . "description\t\t" . base64_decode($payeer_data["m_desc"]) . "\n" . "status\t\t\t\t" . $payeer_data["m_status"] . "\n" . "sign\t\t\t\t" . $payeer_data["m_sign"] . "\n\n";
         $log_file = $method->log_file;
         if (!empty($log_file)) {
             file_put_contents($_SERVER['DOCUMENT_ROOT'] . $log_file, $log_text, FILE_APPEND);
         }
         // проверка цифровой подписи и ip
         $sign_hash = strtoupper(hash('sha256', implode(":", array($payeer_data['m_operation_id'], $payeer_data['m_operation_ps'], $payeer_data['m_operation_date'], $payeer_data['m_operation_pay_date'], $payeer_data['m_shop'], $payeer_data['m_orderid'], $payeer_data['m_amount'], $payeer_data['m_curr'], $payeer_data['m_desc'], $payeer_data['m_status'], $method->secret_key))));
         $valid_ip = true;
         $sIP = str_replace(' ', '', $method->ip_filter);
         if (!empty($sIP)) {
             $arrIP = explode('.', $_SERVER['REMOTE_ADDR']);
             if (!preg_match('/(^|,)(' . $arrIP[0] . '|\\*{1})(\\.)' . '(' . $arrIP[1] . '|\\*{1})(\\.)' . '(' . $arrIP[2] . '|\\*{1})(\\.)' . '(' . $arrIP[3] . '|\\*{1})($|,)/', $sIP)) {
                 $valid_ip = false;
             }
         }
         if (!$valid_ip) {
             $message .= " - the ip address of the server is not trusted\n" . "   trusted ip: " . $sIP . "\n" . "   ip of the current server: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $err = true;
         }
         if ($payeer_data["m_sign"] != $sign_hash) {
             $message .= " - do not match the digital signature\n";
             $err = true;
         }
         if (!$err) {
             // загрузка заказа
             $order_number = $payment->order_number;
             $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
             $order['virtuemart_order_id'] = $payment->virtuemart_order_id;
             $order['virtuemart_user_id'] = $payment->virtuemart_user_id;
             $order['order_total'] = $payeer_data['m_amount'];
             $order['customer_notified'] = 0;
             $order['virtuemart_vendor_id'] = 1;
             $order['comments'] = vmText::sprintf('VMPAYMENT_PAYEER_PAYMENT_CONFIRMED', $order_number);
             $modelOrder = new VirtueMartModelOrders();
             $order_curr = $payment->payment_currency == 'RUR' ? 'RUB' : $payment->payment_currency;
             $order_amount = number_format($payment->payment_order_total, 2, '.', '');
             // проверка суммы и валюты
             if ($payeer_data['m_amount'] != $order_amount) {
                 $message .= " - Wrong amount\n";
                 $err = true;
             }
             if ($payeer_data['m_curr'] != $order_curr) {
                 $message .= " - Wrong currency\n";
                 $err = true;
             }
             // проверка статуса
             if (!$err) {
                 switch ($payeer_data['m_status']) {
                     case 'success':
                         $order['order_status'] = $method->status_success;
                         $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
                         break;
                     default:
                         $message .= " The payment status is not success\n";
                         $order['order_status'] = $method->status_canceled;
                         $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
                         $err = true;
                         break;
                 }
             }
         }
         if ($err) {
             $to = $method->admin_email;
             if (!empty($to)) {
                 $message = "Failed to make the payment through the system Payeer for the following reasons:\n\n" . $message . "\n" . $log_text;
                 $headers = "From: no-reply@" . $_SERVER['HTTP_HOST'] . "\r\n" . "Content-type: text/plain; charset=utf-8 \r\n";
                 mail($to, "Error payment", $message, $headers);
             }
             echo $payeer_data['m_orderid'] . '|error';
         } else {
             echo $payeer_data['m_orderid'] . '|success';
         }
     }
     return true;
 }
开发者ID:dldemoks,项目名称:Joomla-3.4.8---Virtuemart-3.0.9,代码行数:87,代码来源:payeer.php

示例11: plgVmOnUpdateOrderPayment


//.........这里部分代码省略.........
     $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id  found ' . $virtuemart_order_id, 'message');
     if (!$virtuemart_order_id) {
         return;
     }
     $vendorId = 0;
     $payment = $this->getDataByOrderId($virtuemart_order_id);
     if ($payment->payment_name == '') {
         return false;
     }
     // recupera as informações do método de pagamento
     $method = $this->getVmPluginMethod($pm);
     if (!$this->selectedThisElement($method->payment_element)) {
         return false;
     }
     if (!$payment) {
         $this->logInfo('getDataByOrderId payment not found: exit ', 'ERROR');
         return null;
     }
     $status_pagamento = JRequest::getVar('StatusPagamento');
     $mensagem = JRequest::getVar('Mensagem');
     $status = JRequest::getVar('Status');
     $total_pago = JRequest::getVar('TotalPago');
     $forma_pagamento = JRequest::getVar('FormaPagamento');
     $tipo_pagamento = JRequest::getVar('TipoPagamento');
     $url_redirecionar = JRequest::getVar('Url');
     $timestamp = date('Y-m-d') . 'T' . date('H:i:s');
     // recupera as informações do pagamento
     $db = JFactory::getDBO();
     $query = 'SELECT payment_name, payment_order_total, payment_currency, virtuemart_paymentmethod_id
    FROM `' . $this->_tablename . '`
    WHERE order_number = "' . $this->order_id . '"';
     $db->setQuery($query);
     $pagamento = $db->loadObjectList();
     //if ($status_pagamento=='Sucesso') {
     $this->codigo_moip = $codigo_moip = JRequest::getVar('CodigoMoIP', 0);
     if ($codigo_moip == 'undefined') {
         $this->codigo_moip = $codigo_moip = '';
     }
     $log = $timestamp . '|' . $this->codigo_moip . '|' . $mensagem . '|' . $tipo_pagamento . '|' . $forma_pagamento . '|' . $pagamento[0]->payment_order_total;
     if ($status == 'Autorizado') {
         $novo_status = '1';
     } else {
         $novo_status = '0';
     }
     $arr_status = array("EmAnalise" => "Pagamento em análise de risco", "Autorizado" => "Pagamento autorizado.", "Iniciado" => "Pagamento foi iniciado, porem sem confirmação de finalização até o momento", "Cancelado" => "Pagamento foi cancelado");
     $response_fields['payment_currency'] = $pagamento[0]->payment_currency;
     $response_fields['payment_order_total'] = $pagamento[0]->payment_order_total;
     //$response_fields['virtuemart_paymentmethod_id']     = $pagamento[0]->virtuemart_paymentmethod_id;
     $response_fields['status'] = $novo_status;
     $response_fields['msg_status'] = $arr_status[$status];
     $response_fields['virtuemart_paymentmethod_id'] = $pm;
     $response_fields['payment_name'] = $payment->payment_name;
     $response_fields['order_number'] = $order_number;
     $response_fields['virtuemart_order_id'] = $virtuemart_order_id;
     $response_fields['type_transaction'] = $forma_pagamento . ' - ' . $tipo_pagamento;
     $response_fields['log'] = $log;
     if (!empty($codigo_moip)) {
         $response_fields['codigo_moip'] = $codigo_moip;
     }
     if (!empty($url_redirecionar)) {
         $response_fields['url_redirecionar'] = $url_redirecionar;
     }
     $this->storePSPluginInternalData($response_fields, 'virtuemart_order_id', true);
     // notificação do pagamento realizado
     $notificacao = "<b>" . JText::_('VMPAYMENT_MOIP_NOTIFY_TRANSACTION') . " - " . $forma_pagamento . "</b>\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_CODIGO_MOIP') . " " . $codigo_moip . "\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_PEDIDO') . " " . $order_number . "\n";
     $notificacao .= "<hr />";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_STATUS') . " <b>" . ($status == 1 ? JText::_('VMPAYMENT_MOIP_NOTIFY_PAID') : JText::_('VMPAYMENT_MOIP_NOTIFY_NOTPAID')) . "</b>\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_TYPE_TRANSACTION') . " <b>" . $response_fields['type_transaction'] . "</b>\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_TYPE_MESSAGE') . " <b>" . $mensagem . " </b>\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_ORDER_TOTAL') . " <b>R\$ " . number_format($this->valor, 2, ',', '.') . "</b> \n";
     $notificacao .= "\n\n";
     $notificacao .= JText::_('VMPAYMENT_MOIP_NOTIFY_AUTHENTICATE') . "<a href='http://www.moip.com.br'>Moip</a>";
     if ($virtuemart_order_id) {
         // send the email only if payment has been accepted
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $modelOrder = new VirtueMartModelOrders();
         $orderitems = $modelOrder->getOrder($virtuemart_order_id);
         $nb_history = count($orderitems['history']);
         $order = array();
         $order['order_status'] = $this->_getPaymentStatus($method, $status);
         $order['virtuemart_order_id'] = $virtuemart_order_id;
         $order['comments'] = $notificacao;
         $order['customer_notified'] = 1;
         $modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
         if ($nb_history == 1) {
             if (!class_exists('shopFunctionsF')) {
                 require JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
             }
             $this->logInfo('Notification, sentOrderConfirmedEmail ' . $order_number . ' ' . $order['order_status'], 'message');
         }
     }
     $cart = VirtueMartCart::getCart();
     $cart->emptyCart();
     //}
     return true;
 }
开发者ID:edrdesigner,项目名称:MoIP-VirtueMart-3,代码行数:101,代码来源:moip.php

示例12: plgVmOnPaymentNotification

 public function plgVmOnPaymentNotification()
 {
     if (JRequest::getVar('pelement') != 'paykeeper') {
         return null;
     }
     if (!class_exists('VirtueMartModelOrders')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
     }
     $orderid = JRequest::getInt('WMI_PAYMENT_NO', 0);
     $postprice = floatval(JRequest::getVar('WMI_PAYMENT_AMOUNT'));
     $payment = $this->getDataByOrderId($orderid);
     $method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
     $order_model = new VirtueMartModelOrders();
     $order_info = $order_model->getOrder($orderid);
     $order_number = $order_info['details']['BT']->order_number;
     if (!$method->payment_currency) {
         $this->getPaymentCurrency($method);
     }
     // END printing out HTML Form code (Payment Extra Info)
     $q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $method->payment_currency . '" ';
     $db =& JFactory::getDBO();
     $db->setQuery($q);
     $currency_code_3 = $db->loadResult();
     if (!class_exists('CurrencyDisplay')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     $paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
     $totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order_info['details']['BT']->order_total, false), 2);
     $sig = JRequest::getVar('WMI_SIGNATURE');
     $params = JRequest::get('post');
     unset($params["WMI_SIGNATURE"]);
     uksort($params, "strcasecmp");
     $values = implode('', $params);
     $signature = base64_encode(pack("H*", md5($values . $method->paykeeper_secret)));
     if ($totalInPaymentCurrency == $postprice && $sig == $signature) {
         switch (JRequest::getVar('WMI_ORDER_STATE')) {
             case 'Accepted':
                 $status = $method->status_success;
                 $msg = 'оплачен';
                 break;
             case 'Rejected':
             default:
                 $status = $method->status_canceled;
                 $msg = 'отменён';
                 break;
         }
         $order['order_status'] = $status;
         $order['virtuemart_order_id'] = $orderid;
         $order['customer_notified'] = 0;
         $order['comments'] = JTExt::sprintf('VMPAYMENT_PAYKEEPER_PAYMENT_CONFIRMED', $order_number);
         if (!class_exists('VirtueMartModelOrders')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
         }
         $modelOrder = new VirtueMartModelOrders();
         ob_start();
         $modelOrder->updateStatusForOneOrder($orderid, $order, true);
         ob_end_clean();
         echo 'WMI_RESULT=OK';
         exit;
     }
     echo 'WMI_RESULT=RETRY&WMI_DESCRIPTION=' . urlencode('Неверная подпись заказа');
     return null;
 }
开发者ID:arkane0906,项目名称:lasercut-bootstrap,代码行数:63,代码来源:paykeeper.php


注:本文中的VirtueMartModelOrders::updateStatusForOneOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。