本文整理汇总了PHP中VirtueMartModelOrders::getOrderIdByOrderNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelOrders::getOrderIdByOrderNumber方法的具体用法?PHP VirtueMartModelOrders::getOrderIdByOrderNumber怎么用?PHP VirtueMartModelOrders::getOrderIdByOrderNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtueMartModelOrders
的用法示例。
在下文中一共展示了VirtueMartModelOrders::getOrderIdByOrderNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plgVmOnPaymentNotification
/**
* Check PayZen response, save order and empty cart (if payment success) when server notification is received from payment platform.
*
* @param string $return_context session id
* @param int $virtuemart_order_id virtuemart order primary key concerned by payment
* @param string $new_status new order status
* @return
*/
function plgVmOnPaymentNotification () {
// platform params and payment data
$data = JRequest::get ('post');
$this->logInfo ('plgVmOnPaymentNotification START ', 'error');
if (!array_key_exists ('vads_order_id', $data) || !isset($data['vads_order_id'])) {
$this->logInfo ('plgVmOnPaymentNotification -- Another method was selected, do nothing : ', 'error');
return NULL; // Another method was selected, do nothing
}
// Retrieve order info from database
if (!class_exists ('VirtueMartModelOrders')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
}
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber ($data['vads_order_id']);
// Order not found
/*
if (!$virtuemart_order_id) {
$this->logInfo('plgVmOnPaymentNotification -- payment check attempted on non existing order : ' . $resp->get('order_id'), 'error');
$response .= '<span style="display:none">OK-';
$response .= $data['vads_hash'];
$response .= "=Impossible de retrouver la commande\n";
$response .= '</span>';
die($response);
}
*/
// Payment params
$payment_data = $this->getDataByOrderId ($virtuemart_order_id);
/*
if (!$payment_data || !($payment = $this->getPaymentMethod($payment_data->payment_method_id))) {
$this->logInfo('plgVmOnPaymentNotification -- payment data not found: exit ', 'ERROR');
$response .= '<span style="display:none">OK-';
$response .= $data['vads_hash'];
$response .= "=Méthode de paiement introuvable\n";
$response .= '</span>';
die($response);
}
*/
$method = $this->getVmPluginMethod ($payment_data->virtuemart_paymentmethod_id);
if (!$this->selectedThisElement ($method->payment_element)) {
return FALSE;
}
$this->_debug = $method->debug;
$custom = $this->_name . '_custom';
$return_context = $payment_data->$custom;
// Load API
if (!class_exists ('VadsApi')) {
require(JPATH_VMPAYMENTPLUGIN . DS . 'payzen' . DS . 'payzen_api.php');
}
$api = new VadsApi();
$resp = $api->getResponse (
$data, $method->ctx_mode, $method->key_test, $method->key_prod
);
if (!$resp->isAuthentified ()) {
$this->logInfo ('plgVmOnPaymentNotification -- suspect request sent to plgVmOnPaymentNotification, IP : ' . $_SERVER['REMOTE_ADDR'], 'error');
die($resp->getOutputForGateway ('auth_fail'));
}
$order = VirtueMartModelOrders::getOrder ($virtuemart_order_id);
$order_status_code = $order['items'][0]->order_status;
// Order not processed yet
if ($order_status_code == 'P') {
if ($resp->isAcceptedPayment ()) {
$currency = $api->findCurrencyByNumCode ($resp->get ('currency'))->alpha3;
$amount = ($resp->get ('amount') / 100) . ' ' . $currency;
$new_status = $method->order_success_status;
$this->logInfo ('plgVmOnPaymentNotification -- payment process OK, ' . $amount . ' paid for order ' . $resp->get ('order_id') . ', new status ' . $new_status, 'message');
echo ($resp->getOutputForGateway ('payment_ok'));
}
else {
$new_status = $method->order_failure_status;
$this->logInfo ('plgVmOnPaymentNotification -- payment process error ' . $resp->message . ', new status ' . $new_status, 'ERROR');
echo ($resp->getOutputForGateway ('payment_ko'));
}
// Save platform response
//.........这里部分代码省略.........
示例2: plgVmConfirmedOrder
function plgVmConfirmedOrder($cart, $order)
{
if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
return null;
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$this->_initConfigVariables($method);
$orderPaymentValues = array('payment_name' => $this->renderPluginName($method), 'order_number' => $order['details']['BT']->order_number, 'payment_currency' => $this->_currency);
$this->storePSPluginInternalData($orderPaymentValues);
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
$currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
$html = '<table>' . "\n";
$html .= $this->getHtmlRow('MAKSEKESKUS_PAYMENT_INFO', $orderPaymentValues['payment_name']);
$html .= $this->getHtmlRow('MAKSEKESKUS_ORDER_NUMBER', $order['details']['BT']->order_number);
$html .= $this->getHtmlRow('MAKSEKESKUS_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total));
$html .= '</table>' . "\n";
$bank_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order['details']['BT']->order_number);
$paymentMessage = array('shopId' => $this->_shop_id, 'paymentId' => $bank_order_id, 'amount' => number_format($this->_toTargetAmount($order['details']['BT']->order_total, CurrencyDisplay::getInstance($order['order_currency'])), 2, '.', ''));
$paymentMessage['signature'] = $this->_getStartSignature($paymentMessage, $this->_api_secret);
$macFields = array('json' => json_encode($paymentMessage), 'locale' => $this->_getPreferredLocale());
$html .= '<form method="post" action="' . htmlspecialchars($this->_destination_url) . '">';
foreach ($macFields as $key => $value) {
$html .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
}
$html .= "</br>";
$html .= '<input type="submit" value="' . JText::_("MAKSEKESKUS_SUBMIT") . '"/>';
$html .= '</form>';
JRequest::setVar('html', $html);
}
示例3: getOrderDetails
public function getOrderDetails()
{
$orderModel = VmModel::getModel('orders');
$orderDetails = 0;
// If the user is not logged in, we will check the order number and order pass
if ($orderPass = JRequest::getString('order_pass', false) and $orderNumber = JRequest::getString('order_number', false)) {
$orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass);
if (empty($orderId)) {
vmDebug('Invalid order_number/password ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'));
return 0;
}
$orderDetails = $orderModel->getOrder($orderId);
}
if ($orderDetails == 0) {
$_currentUser = JFactory::getUser();
$cuid = $_currentUser->get('id');
// If the user is logged in, we will check if the order belongs to him
$virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0);
if (!$virtuemart_order_id) {
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number'));
}
$orderDetails = $orderModel->getOrder($virtuemart_order_id);
JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php');
if (!Permissions::getInstance()->check("admin")) {
if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) {
if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
echo 'view ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return;
}
}
}
}
return $orderDetails;
}
示例4: plgVmOnPaymentNotification
/**
* @return bool|null
*/
function plgVmOnPaymentNotification()
{
//$this->_debug = true;
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$paypal_data = JRequest::get('post');
if (!isset($paypal_data['invoice'])) {
return FALSE;
}
$order_number = $paypal_data['invoice'];
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($paypal_data['invoice']))) {
return FALSE;
}
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
return FALSE;
}
$method = $this->getVmPluginMethod($payments[0]->virtuemart_paymentmethod_id);
if (!$this->selectedThisElement($method->payment_element)) {
return FALSE;
}
$this->_debug = $method->debug;
$this->logInfo('paypal_data ' . implode(' ', $paypal_data), 'message');
// _processIPN checks that $res== "VERIFIED"
if (!$this->_processIPN($paypal_data, $method)) {
$this->logInfo('paypal_data _processIPN FALSE', 'message');
return FALSE;
}
//$this->_storePaypalInternalData ($method, $paypal_data, $virtuemart_order_id, $payment->virtuemart_paymentmethod_id);
$modelOrder = VmModel::getModel('orders');
$order = array();
/*
* https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
* The status of the payment:
* Canceled_Reversal: A reversal has been canceled. For example, you won a dispute with the customer, and the funds for the transaction that was reversed have been returned to you.
* Completed: The payment has been completed, and the funds have been added successfully to your account balance.
* Created: A German ELV payment is made using Express Checkout.
* Denied: You denied the payment. This happens only if the payment was previously pending because of possible reasons described for the pending_reason variable or the Fraud_Management_Filters_x variable.
* Expired: This authorization has expired and cannot be captured.
* Failed: The payment has failed. This happens only if the payment was made from your customer’s bank account.
* Pending: The payment is pending. See pending_reason for more information.
* Refunded: You refunded the payment.
* Reversed: A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from your account balance and returned to the buyer. The reason for the reversal is specified in the ReasonCode element.
* Processed: A payment has been accepted.
* Voided: This authorization has been voided.
*
*/
$lang = JFactory::getLanguage();
$order['customer_notified'] = 1;
// 1. check the payment_status is Completed
if (strcmp($paypal_data['payment_status'], 'Completed') == 0) {
// 2. check that txn_id has not been previously processed
if ($this->_check_txn_id_already_processed($payments, $paypal_data['txn_id'], $method)) {
return FALSE;
}
// 3. check email and amount currency is correct
if (!$this->_check_email_amount_currency($payments, $this->_getMerchantEmail($method), $paypal_data)) {
return FALSE;
}
// now we can process the payment
$order['order_status'] = $method->status_success;
$order['comments'] = JText::sprintf('VMPAYMENT_PAYPAL_PAYMENT_STATUS_CONFIRMED', $order_number);
} elseif (strcmp($paypal_data['payment_status'], 'Pending') == 0) {
$key = 'VMPAYMENT_PAYPAL_PENDING_REASON_FE_' . strtoupper($paypal_data['pending_reason']);
if (!$lang->hasKey($key)) {
$key = 'VMPAYMENT_PAYPAL_PENDING_REASON_FE_DEFAULT';
}
$order['comments'] = JText::sprintf('VMPAYMENT_PAYPAL_PAYMENT_STATUS_PENDING', $order_number) . JText::_($key);
$order['order_status'] = $method->status_pending;
} elseif (strcmp($paypal_data['payment_status'], 'Refunded') == 0 and isset($method->status_refunded)) {
if ($this->_is_full_refund($payments, $paypal_data)) {
$order['comments'] = JText::sprintf('VMPAYMENT_PAYPAL_PAYMENT_STATUS_REFUNDED', $order_number);
$order['order_status'] = $method->status_refunded;
} else {
$order['comments'] = JText::sprintf('VMPAYMENT_PAYPAL_PAYMENT_STATUS_PARTIAL_REFUNDED', $order_number);
$order['order_status'] = isset($method->status_partial_refunded) ? $method->status_partial_refunded : 'R';
}
} elseif (isset($paypal_data['payment_status'])) {
$order['order_status'] = $method->status_canceled;
} else {
/*
* a notification was received that concerns one of the payment (since $paypal_data['invoice'] is found in our table),
* but the IPN notification has no $paypal_data['payment_status']
* We just log the info in the order, and do not change the status, do not notify the customer
*/
$order['comments'] = JText::_('VMPAYMENT_PAYPAL_IPN_NOTIFICATION_RECEIVED');
$order['customer_notified'] = 0;
}
$this->_storePaypalInternalData($method, $paypal_data, $virtuemart_order_id, $payments[0]->virtuemart_paymentmethod_id);
$this->logInfo('plgVmOnPaymentNotification return new_status:' . $order['order_status'], 'message');
$modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
//// remove vmcart
if (isset($paypal_data['custom'])) {
$this->emptyCart($paypal_data['custom'], $order_number);
}
//die();
}
示例5: plgVmOnPaymentNotification
function plgVmOnPaymentNotification() {
//https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNandPDTVariables/
if (!class_exists('VirtueMartModelOrders')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
}
$paypal_data = JRequest::get('post');
//Recuring payment return rp_invoice_id instead of invoice
if (array_key_exists('rp_invoice_id', $paypal_data)) {
$paypal_data['invoice'] = $paypal_data['rp_invoice_id'];
}
if (!isset($paypal_data['invoice'])) {
return FALSE;
}
$order_number = $paypal_data['invoice'];
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($paypal_data['invoice']))) {
return FALSE;
}
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
return FALSE;
}
$this->_currentMethod = $this->getVmPluginMethod($payments[0]->virtuemart_paymentmethod_id);
if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
return FALSE;
}
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($virtuemart_order_id);
$paypalInterface = $this->_loadPayPalInterface();
$paypalInterface->setOrder($order);
$paypalInterface->debugLog($paypal_data, 'PaymentNotification, paypal_data:', 'debug');
$paypalInterface->debugLog($order_number, 'PaymentNotification, order_number:', 'debug');
$paypalInterface->debugLog($payments[0]->virtuemart_paymentmethod_id, 'PaymentNotification, virtuemart_paymentmethod_id:', 'debug');
$order_history = $paypalInterface->processIPN($paypal_data, $payments);
if (!$order_history) {
return false;
} else {
$this->_storePaypalInternalData( $paypal_data, $virtuemart_order_id, $payments[0]->virtuemart_paymentmethod_id);
$paypalInterface->debugLog('order_number:'.$order_number.' new_status:' . $order_history['order_status'], 'plgVmOnPaymentNotification', 'debug');
$orderModel->updateStatusForOneOrder($virtuemart_order_id, $order_history, TRUE);
//// remove vmcart
if (isset($paypal_data['custom'])) {
$this->emptyCart( $paypal_data['custom'], $order_number );
}
}
}
示例6: plgVmOnPaymentNotification
/**
* @return bool|null
*/
function plgVmOnPaymentNotification () {
if (!class_exists ('VirtueMartModelOrders')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
}
$paypal_data = JRequest::get ('post');
if (!isset($paypal_data['invoice'])) {
return NULL;
}
$order_number = $paypal_data['invoice'];
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber ($paypal_data['invoice']))) {
return NULL;
}
$vendorId = 0;
if (!($payment = $this->getDataByOrderId ($virtuemart_order_id))) {
return NULL;
}
$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;
}
$this->logInfo ('paypal_data ' . implode (' ', $paypal_data), 'message');
$this->_storePaypalInternalData ($method, $paypal_data, $virtuemart_order_id, $payment->virtuemart_paymentmethod_id);
$modelOrder = VmModel::getModel ('orders');
$order = array();
$error_msg = $this->_processIPN ($paypal_data, $method, $virtuemart_order_id);
$this->logInfo ('process IPN ' . $error_msg, 'message');
if (!(empty($error_msg))) {
$order['customer_notified'] = 0;
$order['order_status'] = $method->status_canceled;
$order['comments'] = 'process IPN ' . $error_msg;
/** @var $modelOrder array() */
$modelOrder->updateStatusForOneOrder ($virtuemart_order_id, $order, TRUE);
$this->logInfo ('process IPN ' . $error_msg . ' ' . $order['order_status'] , 'ERROR');
return NULL;
}
else {
$this->logInfo ('process IPN OK', 'message');
}
/*
* https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
* The status of the payment:
* Canceled_Reversal: A reversal has been canceled. For example, you won a dispute with the customer, and the funds for the transaction that was reversed have been returned to you.
* Completed: The payment has been completed, and the funds have been added successfully to your account balance.
* Created: A German ELV payment is made using Express Checkout.
* Denied: You denied the payment. This happens only if the payment was previously pending because of possible reasons described for the pending_reason variable or the Fraud_Management_Filters_x variable.
* Expired: This authorization has expired and cannot be captured.
* Failed: The payment has failed. This happens only if the payment was made from your customer’s bank account.
* Pending: The payment is pending. See pending_reason for more information.
* Refunded: You refunded the payment.
* Reversed: A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from your account balance and returned to the buyer. The reason for the reversal is specified in the ReasonCode element.
* Processed: A payment has been accepted.
* Voided: This authorization has been voided.
*
*/
if (empty($paypal_data['payment_status']) || ($paypal_data['payment_status'] != 'Completed' && $paypal_data['payment_status'] != 'Pending')) {
//return false;
}
$lang = JFactory::getLanguage ();
$order['customer_notified'] = 1;
if (strcmp ($paypal_data['payment_status'], 'Completed') == 0) {
$order['order_status'] = $method->status_success;
$order['comments'] = JText::sprintf ('VMPAYMENT_PAYPAL_PAYMENT_STATUS_CONFIRMED', $order_number);
}
elseif (strcmp ($paypal_data['payment_status'], 'Pending') == 0) {
$key = 'VMPAYMENT_PAYPAL_PENDING_REASON_FE_' . strtoupper ($paypal_data['pending_reason']);
if (!$lang->hasKey ($key)) {
$key = 'VMPAYMENT_PAYPAL_PENDING_REASON_FE_DEFAULT';
}
$order['comments'] = JText::sprintf ('VMPAYMENT_PAYPAL_PAYMENT_STATUS_PENDING', $order_number) . JText::_ ($key);
$order['order_status'] = $method->status_pending;
}
else {
$order['order_status'] = $method->status_canceled;
}
$this->logInfo ('plgVmOnPaymentNotification return new_status:' . $order['order_status'], 'message');
$modelOrder->updateStatusForOneOrder ($virtuemart_order_id, $order, TRUE);
//// remove vmcart
$this->emptyCart ($paypal_data['custom'], $order_number);
//die();
}
示例7: plgVmOnPaymentNotification
/**
* @return bool|null
*/
function plgVmOnPaymentNotification()
{
//$this->_debug = true;
if (!class_exists('VirtueMartModelOrders')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'orders.php';
}
$virtuemart_paymentmethod_id = vRequest::getInt('pm', 0);
//$this->_debug=true;
if (!($this->_currentMethod = $this->getVmPluginMethod($virtuemart_paymentmethod_id))) {
return NULL;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($this->_currentMethod->payment_element)) {
return FALSE;
}
$order_number = vRequest::getString('on', '');
if (empty($order_number)) {
return FALSE;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return FALSE;
}
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
return FALSE;
}
$this->debugLog('OK', 'plgVmOnPaymentNotification', 'debug');
if (!class_exists('SofortLib')) {
require VMPATH_ROOT . DS . 'plugins' . DS . 'vmpayment' . DS . 'sofort' . DS . 'sofort' . DS . 'library' . DS . 'sofortLib.php';
}
$sofortLib_Notification = new SofortLib_Notification();
$this->sofortLog($sofortLib_Notification);
$transactionId = $sofortLib_Notification->getNotification();
if ($sofortLib_Notification->isError()) {
$this->debugLog('SOFORT notification return Error ' . $sofortLib_Notification->getError(), 'plgVmOnPaymentNotification', 'error');
}
//no valid parameters/xml
if (empty($transactionId)) {
$this->debugLog('no transaction ID for order number ' . $order_number, 'plgVmOnPaymentNotification', 'error');
}
if (empty($transactionId) || $sofortLib_Notification->isError()) {
return FALSE;
}
$this->debugLog($transactionId, 'plgVmOnPaymentNotification Transaction ID ', 'debug');
$sofortLib_TransactionData = new SofortLib_TransactionData(trim($this->_currentMethod->configuration_key));
$this->sofortLog($sofortLib_TransactionData);
$sofortLib_TransactionData->setTransaction($transactionId)->sendRequest();
// check that secret , and order are identical
$security = vRequest::getString('security', '');
if ($security != $payments[0]->security) {
$this->debugLog("security token received: " . $security . " security token expected: " . $payments[0]->security, 'plgVmOnPaymentNotification', 'error');
return false;
}
$paymentMethod = $sofortLib_TransactionData->getPaymentMethod();
if ($paymentMethod != self::SU_SOFORTBANKING) {
$this->debugLog("Payment method is " . $paymentMethod . " Should be SU" . 'plgVmOnPaymentNotification', 'error');
return false;
}
$sofort_data['sofort_response_amount'] = $sofortLib_TransactionData->getAmount();
$sofort_data['sofort_response_currency'] = $sofortLib_TransactionData->getCurrency();
// check that the amount is the same
if (!$this->_checkAmountAndCurrency($sofort_data, $payments)) {
return false;
}
$modelOrder = VmModel::getModel('orders');
$order_history = array();
$status = 'status_' . $sofortLib_TransactionData->getStatus();
//$this->debugLog('plgVmOnPaymentNotification getStatus:' .$status. ' '.var_export($method, true) , 'message');
$order_history['customer_notified'] = true;
$order_history['order_status'] = $this->_currentMethod->{$status};
$order_history['comments'] = vmText::_('VMPAYMENT_SOFORT_RESPONSE_STATUS_REASON_' . $sofortLib_TransactionData->getStatusReason());
$sofort_data['sofort_response_status_reason'] = $sofortLib_TransactionData->getStatusReason();
$sofort_data['sofort_response_transaction'] = $sofortLib_TransactionData->getTransaction();
$sofort_data['payment_name'] = str_replace(array('\\t', '\\n'), '', $this->renderPluginName($this->_currentMethod));
$sofort_data['virtuemart_order_id'] = $payments[0]->virtuemart_order_id;
$sofort_data['order_number'] = $payments[0]->order_number;
$sofort_data['virtuemart_paymentmethod_id'] = $payments[0]->virtuemart_paymentmethod_id;
$sofort_data['sofort_response_status'] = $sofortLib_TransactionData->getStatus();
$sofort_data['sofort_response_status_reason'] = $sofortLib_TransactionData->getStatusReason();
$this->debugLog(var_export($sofort_data, true), 'plgVmOnPaymentNotification storePSPluginInternalData ', 'debug');
$this->storePSPluginInternalData($sofort_data);
$modelOrder->updateStatusForOneOrder($payments[0]->virtuemart_order_id, $order_history, false);
}
示例8: plgVmOnPaymentNotification
function plgVmOnPaymentNotification()
{
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
outToLog('#plgVmOnPaymentNotification: started');
$merchant_key = $this->getMerchantKeyForOos();
if (!$merchant_key) {
$msg = "No OOS secret key found in configuration";
outToLog($msg);
throw new Exception($msg);
}
$encrypted_request = file_get_contents('php://input');
//$encrypted_request = $_POST['encrypted_request'];
outToLog('#plgVmOnPaymentNotification: encrypted_request base64 = ' . base64_encode($encrypted_request));
//$encrypted_request = base64_decode($encrypted_request);
$decrypted_request = $this->decrypt_aes128_ecb_pkcs5($encrypted_request, $merchant_key);
outToLog("#plgVmOnPaymentNotification: using secret key {$merchant_key}");
outToLog("#plgVmOnPaymentNotification: decrypted_request: [{$decrypted_request}]");
$json_request = json_decode($decrypted_request, true);
if (!$json_request) {
$msg = 'Failed decrypting secret text or decoding JSON';
outToLog("#plgVmOnPaymentNotification: {$msg}");
throw new Exception($msg);
}
$ordersArray = $json_request['payments'];
outToLog('#plgVmOnPaymentNotification: num orders = ' . count($ordersArray));
if (!$ordersArray) {
return false;
}
$jsonResponsePayments = array();
for ($i = 0; $i < count($ordersArray); $i++) {
$orderRecord = $ordersArray[$i];
outToLog('RESPONSE: order ' . ($i + 1) . ' = ' . $orderRecord["orderId"]);
$oosPayment = array("pay_for" => $orderRecord["orderId"], "order_amount" => $orderRecord["amount"], "order_currency" => "RUB", "paymentDateTime" => date('l jS \\of F Y h:i:s A'), "state" => $orderRecord['state']);
$order_amount = $this->to_float($oosPayment['order_amount']);
$orderId = $oosPayment['pay_for'];
if (!$orderId) {
continue;
}
$vmOrderId = VirtueMartModelOrders::getOrderIdByOrderNumber($orderId);
if (!$vmOrderId) {
array_push($jsonResponsePayments, array("orderId" => $orderId, "action" => RESPONSE_ACTION_REJECT));
continue;
}
$vmPayments = $this->getDatasByOrderId($vmOrderId);
if (!$vmPayments) {
continue;
}
$vmPM = $this->getVmPluginMethod($vmPayments[0]->virtuemart_paymentmethod_id);
if (!$this->selectedThisElement($vmPM->payment_element)) {
continue;
}
$this->logInfo('oos_data ' . implode(' ', $oosPayment), 'message');
$error = '';
//$pay_for = $order_number;
$order_currency = $oosPayment['order_currency'];
//проверяем pay запрос
$localOrder = array('customer_notified' => 1, 'order_status' => $vmPM->status_pending);
//получаем данные
outToLog('RESPONSE: virtuemart_order_id = ' . $vmOrderId . ' order_number = ' . $orderId . '$order_amount = ' . $order_amount);
if ($merchant_key != $this->_getSecretWord($vmPM)) {
$error .= JText::_('PLG_OOS_VM2_ERROR_3') . '<br>';
}
if (empty($order_amount)) {
$error .= JText::_('PLG_OOS_VM2_ERROR_5') . '<br>';
} else {
if (!is_numeric($order_amount)) {
$error .= JText::_('PLG_OOS_VM2_ERROR_4') . '<br>';
}
}
if (empty($order_currency)) {
$error .= JText::_('PLG_OOS_VM2_ERROR_6') . '<br>';
} else {
if (strlen($order_currency) > 4) {
$error .= JText::_('PLG_OOS_VM2_ERROR_7') . '<br>';
}
}
//если нет ошибок
if (!$error) {
if ($orderId) {
//сверяем строчки хеша (присланную и созданную нами)
$state = $oosPayment['state'];
$responseAction = null;
if ($state == 'err') {
$jtext = JText::_('PLG_OOS_VM2_ERROR_11');
$localOrder['order_status'] = $vmPM->status_canceled;
outToLog('RESPONSE: order[order_status] = ' . $localOrder['order_status'] . ', comment = ' . $jtext);
$localOrder['comments'] = sprintf($jtext, $orderId);
$responseAction = RESPONSE_ACTION_CONFIRM;
} else {
if ($state == 'rej') {
$jtext = JText::_('PLG_OOS_VM2_ERROR_12');
$localOrder['order_status'] = $vmPM->status_canceled;
outToLog('RESPONSE: order[order_status] = ' . $localOrder['order_status'] . ', comment = ' . $jtext);
$localOrder['comments'] = sprintf($jtext, $orderId);
$responseAction = RESPONSE_ACTION_CONFIRM;
} else {
if ($state == 'ref') {
$jtext = JText::_('PLG_OOS_VM2_ERROR_13');
//.........这里部分代码省略.........
示例9: display
public function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$task = JRequest::getWord('task', 'list');
$layoutName = JRequest::getWord('layout', 'list');
$this->setLayout($layoutName);
$_currentUser = JFactory::getUser();
$document = JFactory::getDocument();
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = JRequest::getWord('format', 'html');
}
$this->assignRef('format', $format);
if ($format == 'pdf') {
$document->setTitle(JText::_('COM_VIRTUEMART_INVOICE'));
//PDF needs more RAM than usual
$memory_limit = ini_get('memory_limit');
if ($memory_limit < 40) {
@ini_set('memory_limit', '40M');
}
} else {
if ($layoutName == 'details') {
$document->setTitle(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
$pathway->additem(JText::_('COM_VIRTUEMART_ACC_ORDER_INFO'));
} else {
$document->setTitle(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
$pathway->additem(JText::_('COM_VIRTUEMART_ORDERS_VIEW_DEFAULT_TITLE'));
}
}
$orderModel = VmModel::getModel('orders');
if ($layoutName == 'details') {
$order_list_link = FALSE;
$cuid = $_currentUser->get('id');
// if(!empty($cuid)){
$order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list');
// } else {
// $order_list_link = false;
// $order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders');;
// }
$this->assignRef('order_list_link', $order_list_link);
if (empty($cuid)) {
// If the user is not logged in, we will check the order number and order pass
if ($orderPass = JRequest::getString('order_pass', false)) {
$orderNumber = JRequest::getString('order_number', false);
$orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass);
if (empty($orderId)) {
echo JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return;
}
$orderDetails = $orderModel->getOrder($orderId);
}
} else {
// If the user is logged in, we will check if the order belongs to him
$virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0);
if (!$virtuemart_order_id) {
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number'));
}
$orderDetails = $orderModel->getOrder($virtuemart_order_id);
if (!class_exists('Permissions')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
}
if (!Permissions::getInstance()->check("admin")) {
if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) {
if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
echo JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return;
}
}
}
}
if (empty($orderDetails['details'])) {
echo JText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
return;
}
$userFieldsModel = VmModel::getModel('userfields');
$_userFields = $userFieldsModel->getUserFields('account', array('captcha' => true, 'delimiters' => true), array('delimiter_userinfo', 'user_is_vendor', 'username', 'password', 'password2', 'agreed', 'address_type'));
$orderbt = $orderDetails['details']['BT'];
$orderst = array_key_exists('ST', $orderDetails['details']) ? $orderDetails['details']['ST'] : $orderbt;
$userfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderbt);
$_userFields = $userFieldsModel->getUserFields('shipment', array(), array('delimiter_userinfo', 'username', 'email', 'password', 'password2', 'agreed', 'address_type'));
$shipmentfields = $userFieldsModel->getUserFieldsFilled($_userFields, $orderst);
$shipment_name = '';
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
JPluginHelper::importPlugin('vmshipment');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmOnShowOrderFEShipment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_shipmentmethod_id, &$shipment_name));
$payment_name = '';
if (!class_exists('vmPSPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmpsplugin.php';
}
JPluginHelper::importPlugin('vmpayment');
$dispatcher = JDispatcher::getInstance();
$returnValues = $dispatcher->trigger('plgVmOnShowOrderFEPayment', array($orderDetails['details']['BT']->virtuemart_order_id, $orderDetails['details']['BT']->virtuemart_paymentmethod_id, &$payment_name));
if ($format == 'pdf') {
$invoiceNumberDate = array();
$return = $orderModel->createInvoiceNumber($orderDetails['details']['BT'], $invoiceNumberDate);
//.........这里部分代码省略.........
示例10: plgVmConfirmedOrder
function plgVmConfirmedOrder($cart, $order)
{
if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
return null;
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$cart->_dataValidated = "1";
$lang = JFactory::getLanguage();
$filename = 'com_virtuemart';
$lang->load($filename, JPATH_ADMINISTRATOR);
$vendorId = 0;
$html = "";
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$this->getPaymentCurrency($method);
$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();
$paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
$totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
$cd = CurrencyDisplay::getInstance($cart->pricesCurrency);
$this->_virtuemart_paymentmethod_id = $order['details']['BT']->virtuemart_paymentmethod_id;
$dbValues['payment_name'] = $this->renderPluginName($method);
$dbValues['order_number'] = $order['details']['BT']->order_number;
$dbValues['VK_SND_ID'] = $method->VK_SND_ID;
$dbValues['payment_currency'] = $method->payment_currency;
$dbValues['pub_key'] = $method->pub_key;
$dbValues['priv_key'] = $method->priv_key;
$dbValues['cancel'] = $method->cancel;
$dbValues['url'] = $method->url;
$dbValues['return'] = $method->return;
$this->storePSPluginInternalData($dbValues);
$html = '<table>' . "\n";
$html .= $this->getHtmlRow('SEB_PAYMENT_INFO', $dbValues['payment_name']);
if (!empty($payment_info)) {
$lang =& JFactory::getLanguage();
if ($lang->hasKey($method->payment_info)) {
$payment_info = JTExt::_($method->payment_info);
} else {
$payment_info = $method->payment_info;
}
$html .= $this->getHtmlRow($bank_UPPER . _PAYMENTINFO, $payment_info);
}
if (!class_exists('VirtueMartModelCurrency')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php';
}
$currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
$html .= $this->getHtmlRow('SEB_ORDER_NUMBER', $order['details']['BT']->order_number);
$html .= $this->getHtmlRow('SEB_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total));
$html .= '</table>' . "\n";
$paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
$totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order['details']['BT']->order_total, false), 2);
$bank_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order['details']['BT']->order_number);
$VK_a['VK_SERVICE'] = '1002';
$VK_a['VK_VERSION'] = '008';
$VK_a['VK_SND_ID'] = $dbValues['VK_SND_ID'];
$VK_a['VK_STAMP'] = hexdec($bank_order_id);
$VK_a['VK_AMOUNT'] = $totalInPaymentCurrency;
$VK_a['VK_CURR'] = 'EUR';
$VK_a['VK_REF'] = $this->generateRefNum($bank_order_id);
$VK_a['VK_MSG'] = "Arve " . $bank_order_id . " tasumine";
$VK_a['VK_MAC'] = $this->createSignature($VK_a, $dbValues['priv_key'], $dbValues['priv_pass']);
$VK_a['VK_RETURN'] = JROUTE::_(JURI::root() . 'plugins/vmpayment/seb/bank.php');
$VK_a['VK_CANCEL'] = $VK_a['VK_RETURN'];
$html .= '<form method="post" action="' . $dbValues['url'] . '">';
foreach ($VK_a as $VK_name => $VK_value) {
$html .= '<input type="hidden" name="' . htmlspecialchars($VK_name) . '" value="' . htmlspecialchars($VK_value) . '"/>' . "\n" . "\t";
}
$html .= "</br>";
$html .= '<input type="submit" value="' . JText::_("VMPAYMENT_SEB_SUBMIT") . '"/>';
$html .= '</form>';
JRequest::setVar('html', $html);
// return $this->processConfirmedOrderPaymentResponse(true, $cart, $order, $html, , $method->status_canceled);
}
示例11: ipn
/**
* IPN_Handler
*
* This trigger is invoked whenever a new notification needs to be processed,
* and will call the IPN API
*
*
*/
private function ipn () {
// ERP mode turns off all automated authorization and capture functionality
// as well as IPN reception and / or polling, and disables any admin UI functionality that may trigger
//If the authorization is done by ERP then the IPN URL set in amazon should not be this one.
// we keep it anyway, for testing purposes
if ($this->isERPModeEnabled() and $this->isAuthorizationDoneByErp()) {
return;
}
// Fetch all HTTP request headers
$headers = getallheaders();
$body = file_get_contents('php://input');
$this->debugLog($headers, 'AMAZON IPN HEADERS debug', 'debug');
$this->debugLog($body, 'AMAZON IPN BODY debug', 'debug');
$this->loadAmazonClass('OffAmazonPaymentsNotifications_Client');
$this->loadVmClass('VirtueMartModelOrders', JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
try {
$client = new OffAmazonPaymentsNotifications_Client();
$notification = $client->parseRawMessage($headers, $body);
} catch (OffAmazonPaymentsNotifications_InvalidMessageException $e) {
$this->debugLog($e->getMessage() . __FUNCTION__ . ' $body', 'error');
header("HTTP/1.1 503 Service Unavailable");
exit(0);
}
$notificationType = $notification->getNotificationType();
$this->debugLog($notificationType, 'ipn', 'debug');
if (!$this->isValidNotificationtype($notificationType)) {
$this->debugLog($notificationType, 'ipn NOT isValidNotificationtype', 'error');
return;
}
$notificationClass = 'amazonHelper' . $notificationType;
$notificationFile = JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'amazon' . DS . 'helpers' . DS . strtolower($notificationType . '.php');
if (!file_exists($notificationFile)) {
$this->debugLog("Unknown notification Type: " . $notificationType, __FUNCTION__, 'error');
return false;
}
if (!class_exists($notificationClass)) {
require(JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'amazon' . DS . 'helpers' . DS . 'helper.php');
require($notificationFile);
}
$this->debugLog($notificationType, 'ipn', 'debug');
$notificationResponse = new $notificationClass($notification, $this->_currentMethod);
$this->debugLog("<pre>" . var_export($notificationResponse->amazonData, true) . "</pre>", __FUNCTION__, 'debug');
if (!($order_number = $notificationResponse->getReferenceId())) {
$this->debugLog('no ReferenceId IPN received', $notificationClass, 'error');
return true;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
$this->debugLog('Received a ' . $notificationClass . ' with order number ' . $order_number . ' but no order in DB with that number', $notificationClass, 'error');
return true;
}
$orderModel = VmModel::getModel('orders');
$order = $orderModel->getOrder($virtuemart_order_id);
if (!($payments = $this->getDatasByOrderId($virtuemart_order_id))) {
// we ignore it because we receive also notification when refund/capture is done in the Amazon BE, and there is no valid reference
//$this->debugLog('Received a ' . $newClass . ' with order number ' . $order_number . 'but no order in DB with that number in AMAZON payment table', $newClass, 'error');
return true;
}
$amazonState = $notificationResponse->onNotificationUpdateOrderHistory($order, $payments);
$this->storeAmazonInternalData($order, NULL, NULL, $notification, NULL, $notificationResponse->getStoreInternalData());
$nextOperation = $notificationResponse->onNotificationNextOperation($order, $payments, $amazonState);
if ($nextOperation === false) {
return;
}
if (!function_exists($nextOperation)) {
//$this->debugLog('Trying to call ' . $nextOperation . ' but the function does not exists: Programming error', $notificationClass, 'error');
}
$this->$nextOperation($payments, $order);
}
示例12: plgVmOnPaymentResponseReceived
function plgVmOnPaymentResponseReceived (&$html) {
if (!class_exists ('VirtueMartCart')) {
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
}
if (!class_exists ('shopFunctionsF')) {
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php');
}
if (!class_exists ('VirtueMartModelOrders')) {
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php');
}
$virtuemart_paymentmethod_id = JRequest::getInt ('pm', 0);
$order_number = JRequest::getString ('on', 0);
if (!($method = $this->getVmPluginMethod ($virtuemart_paymentmethod_id))) {
return NULL; // Another method was selected, do nothing
}
if (!$this->selectedThisElement ($method->payment_element)) {
return NULL;
}
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber ($order_number))) {
return NULL;
}
$db = JFactory::getDBO ();
$_q = 'SELECT * FROM `' . $this->_tablename . '` '
. 'WHERE `virtuemart_order_id` = ' . $virtuemart_order_id;
$db->setQuery ($_q);
if (!($paymentData = $db->loadObject ())) {
// JError::raiseWarning(500, $db->getErrorMsg());
}
vmdebug ('HEIDELPAY paymentdata', $paymentData);
$cart = VirtueMartCart::getCart ();
$cart->emptyCart ();
if ($paymentData->processing_result == "NOK") {
vmError ('VMPAYMENT_HEIDELPAY_PAYMENT_FAILED','VMPAYMENT_HEIDELPAY_PAYMENT_FAILED');
vmError (" - " . $paymentData->comment," - " . $paymentData->comment);
} else {
vmInfo ('VMPAYMENT_HEIDELPAY_PAYMENT_SUCESS');
$html = "<h3>".JText::sprintf ('VMPAYMENT_HEIDELPAY_ORDER_NR') . ': ' . $order_number . " </h3>" ;
$tmpkom = preg_replace("/\(-/", '<a href="', $paymentData->comment);
$tmpkom = preg_replace('/-\)/', '" target="_blank">Barcode runterladen</a>', $tmpkom );
$html .= $tmpkom;
}
// if payment is in test mode
if ($paymentData->transaction_mode != "LIVE") {
vmInfo('VMPAYMENT_HEIDELPAY_PAYMENT_TESTMODE');
}
$orgSecret = $this->createSecretHash ($order_number, $method->HEIDELPAY_SECRET);
$order['comments']="";
if ($virtuemart_order_id) {
$order['customer_notified'] = 0;
$order['order_status'] = $this->getStatus ($method, $paymentData->processing_result);
$modelOrder = VmModel::getModel ('orders');
$orderitems = $modelOrder->getOrder ($virtuemart_order_id);
$nb_history = count ($orderitems['history']);
if ($orderitems['history'][$nb_history - 1]->order_status_code != $order['order_status']) {
if ($method->HEIDELPAY_CONFIRM_EMAIL == 1 or ($method->HEIDELPAY_CONFIRM_EMAIL == 2 and $paymentData->processing_result == "ACK")) {
$order['customer_notified'] = 1;
$order['comments'] = JText::sprintf ('VMPAYMENT_HEIDELPAY_EMAIL_SENT') . "<br />";
}
$order['comments'] .= $paymentData->comment;
/*
* Verify Payment response
*/
if ($orgSecret != $paymentData->secret_hash) {
$order['customer_notified'] = 0;
$order['comments'] = "Hash verification error, suspecting manipulation. IP: " . $paymentData->response_ip;
$order['order_status'] = '';
}
$modelOrder->updateStatusForOneOrder ($virtuemart_order_id, $order, TRUE);
}
}
return TRUE;
}
示例13: plgVmOnUpdateOrderPayment
//.........这里部分代码省略.........
* @param integer $_orderId The order ID
* @param integer $_lineId
* @return mixed Null for method that aren't active, text (HTML) otherwise
*
public function plgVmOnEditOrderLineBEPayment( $_orderId, $_lineId) {
return null;
}
/**
* This method is fired when showing the order details in the frontend, for every orderline.
* It can be used to display line specific package codes, e.g. with a link to external tracking and
* tracing systems
*
* @param integer $_orderId The order ID
* @param integer $_lineId
* @return mixed Null for method that aren't active, text (HTML) otherwise
*
public function plgVmOnShowOrderLineFE( $_orderId, $_lineId) {
return null;
}
/**
* This event is fired when the method notifies you when an event occurs that affects the order.
* Typically, the events represents for payment authorizations, Fraud Management Filter actions and other actions,
* such as refunds, disputes, and chargebacks.
*
* NOTE for Plugin developers:
* If the plugin is NOT actually executed (not the selected payment method), this method must return NULL
*
* @param $return_context: it was given and sent in the payment form. The notification should return it back.
* Used to know which cart should be emptied, in case it is still in the session.
* @param int $virtuemart_order_id : payment order id
* @param char $new_status : new_status for this order id.
* @return mixed Null when this method was not selected, otherwise the true or false
*
* @author Valerie Isaksen
*
*
public function plgVmOnPaymentNotification() {
return null;
}
/**
* plgVmOnPaymentResponseReceived
* This event is fired when the method returns to the shop after the transaction
*
* the method itself should send in the URL the parameters needed
* NOTE for Plugin developers:
* If the plugin is NOT actually executed (not the selected payment method), this method must return NULL
*
* @param int $virtuemart_order_id : should return the virtuemart_order_id
* @param text $html: the html to display
* @return mixed Null when this method was not selected, otherwise the true or false
*
* @author Valerie Isaksen
*
*
function plgVmOnPaymentResponseReceived(, &$virtuemart_order_id, &$html) {
return null;
}
*/
function plgVmOnPaymentNotification()
{
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$virtuemart_paymentmethod_id = JRequest::getInt('virtuemart_paymentmethod_id', '');
$order_number = JRequest::getString('mer_txn', '');
$status = JRequest::getString('f_code', '');
if (!isset($order_number)) {
return;
}
$method = $this->getVmPluginMethod($virtuemart_paymentmethod_id);
if (!($virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number))) {
return;
}
$modelOrder = VmModel::getModel('orders');
$vmorder = $modelOrder->getOrder($virtuemart_order_id);
$order = array();
$order['customer_notified'] = 1;
if (strtolower($status) == "ok") {
$order['order_status'] = "C";
$order['comments'] = JText::sprintf('VMPAYMENT_PAYNETZ_PAYMENT_STATUS_CONFIRMED', $virtuemart_order_id);
} else {
$order['comments'] = JText::sprintf('VMPAYMENT_PAYNETZ_PAYMENT_STATUS_FAILED', $virtuemart_order_id);
$order['order_status'] = "X";
$this->_handlePaymentCancel($virtuemart_order_id, $html);
return;
}
$this->logInfo('plgVmOnPaymentNotification return new_status:' . $order['order_status'], 'message');
$modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, TRUE);
//// remove vmcart
$this->emptyCart($payment->user_session, $mb_data['transaction_id']);
$html = 'Thank you for order. Your transaction ID is ' . $virtuemart_order_id . "\n";
JRequest::setVar('html', $html);
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage($html);
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task=confirm', FALSE));
return;
}
示例14: getMyOrderDetails
/**
* This is a proxy function to return an order safely, we may set the getOrder function to private
* Maybe the right place would be the controller, cause there are JRequests in it. But for a fast solution,
* still better than to have it 3-4 times in the view.html.php of the views.
* @author Max Milbers
*
* @return array
*/
public function getMyOrderDetails($orderID = 0, $orderNumber = false, $orderPass = false)
{
$_currentUser = JFactory::getUser();
$cuid = $_currentUser->get('id');
$orderDetails = false;
// If the user is not logged in, we will check the order number and order pass
if (empty($cuid)) {
$sess = JFactory::getSession();
$orderNumber = vRequest::getString('order_number', $orderNumber);
$tries = $sess->get('getOrderDetails.' . $orderNumber, 0);
if ($tries > 5) {
vmDebug('Too many tries, Invalid order_number/password ' . vmText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'));
return false;
}
// If the user is not logged in, we will check the order number and order pass
if ($orderPass = vRequest::getString('order_pass', $orderPass)) {
$orderId = $this->getOrderIdByOrderPass($orderNumber, $orderPass);
if (empty($orderId)) {
echo vmText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
vmdebug('getMyOrderDetails COM_VIRTUEMART_RESTRICTED_ACCESS', $orderNumber, $orderPass, $tries);
$tries++;
$sess->set('getOrderDetails.' . $orderNumber, $tries);
return false;
}
$orderDetails = $this->getOrder($orderId);
}
} else {
// If the user is logged in, we will check if the order belongs to him
$virtuemart_order_id = vRequest::getInt('virtuemart_order_id', $orderID);
if (!$virtuemart_order_id) {
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(vRequest::getString('order_number'));
}
$orderDetails = $this->getOrder($virtuemart_order_id);
$user = JFactory::getUser();
if (!vmAccess::manager('orders')) {
if (!isset($orderDetails['details']['BT']->virtuemart_user_id)) {
$orderDetails['details']['BT']->virtuemart_user_id = 0;
}
if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
echo vmText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return false;
}
}
}
return $orderDetails;
}
示例15: getMyOrderDetails
/**
* This is a proxy function to return an order safely, we may set the getOrder function to private
* Maybe the right place would be the controller, cause there are JRequests in it. But for a fast solution,
* still better than to have it 3-4 times in the view.html.php of the views.
* @author Max Milbers
*
* @return array
*/
public function getMyOrderDetails($orderID = 0, $orderNumber = false, $orderPass = false){
$_currentUser = JFactory::getUser();
$cuid = $_currentUser->get('id');
$orderDetails = false;
// If the user is not logged in, we will check the order number and order pass
if(empty($orderID) and empty($cuid)){
// If the user is not logged in, we will check the order number and order pass
if ($orderPass = vRequest::getString('order_pass',$orderPass)){
$orderNumber = vRequest::getString('order_number',$orderNumber);
$orderId = $this->getOrderIdByOrderPass($orderNumber,$orderPass);
if(empty($orderId)){
echo vmText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
vmdebug('getMyOrderDetails COM_VIRTUEMART_RESTRICTED_ACCESS',$orderPass,$orderNumber);
return false;
}
$orderDetails = $this->getOrder($orderId);
}
}
else {
// If the user is logged in, we will check if the order belongs to him
$virtuemart_order_id = vRequest::getInt('virtuemart_order_id',$orderID) ;
if (!$virtuemart_order_id) {
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(vRequest::getString('order_number'));
}
$orderDetails = $this->getOrder($virtuemart_order_id);
$user = JFactory::getUser();
if(!$user->authorise('core.admin','com_virtuemart')){
if(!isset($orderDetails['details']['BT']->virtuemart_user_id)){
$orderDetails['details']['BT']->virtuemart_user_id = 0;
}
//if(!empty($orderDetails['details']['BT']->virtuemart_user_id)){
vmdebug('getMyOrderDetails',$cuid,$orderDetails['details']['BT']->virtuemart_user_id);
if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
echo vmText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
return false;
}
//}
}
}
return $orderDetails;
}