本文整理汇总了PHP中VirtueMartModelOrders::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP VirtueMartModelOrders::getOrder方法的具体用法?PHP VirtueMartModelOrders::getOrder怎么用?PHP VirtueMartModelOrders::getOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtueMartModelOrders
的用法示例。
在下文中一共展示了VirtueMartModelOrders::getOrder方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: plgVmOnPaymentResponseReceived
function plgVmOnPaymentResponseReceived(&$html)
{
//language
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$lang = JFactory::getLanguage();
$filename = 'com_virtuemart';
$lang->load($filename, JPATH_ADMINISTRATOR);
$vendorId = 0;
$payment_data = JRequest::get('request');
$order_id = substr($payment_data['VK_REF'], 0, -1);
$pmethod = VirtueMartModelOrders::getOrder($order_id);
$payment_method = $pmethod['details']['BT']->virtuemart_paymentmethod_id;
if (!($method = $this->getVmPluginMethod($payment_method))) {
return null;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$payment_name = $this->renderPluginName($method);
$vk_array = array();
foreach ($payment_data as $key => $value) {
if (substr($key, 0, 3) == "VK_") {
$vk_array[$key] = $value;
}
}
$sig_result = $this->signature_check($vk_array, $method->pub_key);
$html = '<table>' . "\n";
if ($sig_result == 0) {
$html .= $this->getHtmlRow(SEB_BANK_ERROR, " ");
}
$html .= '</table>' . "\n";
$config =& JFactory::getConfig();
$dbprefix = $config->getValue('dbprefix');
$order = new VirtueMartModelOrders();
$order = $order->getOrder($order_id);
$cart = VirtueMartCart::getCart();
if ($_REQUEST['VK_SERVICE'] == 1101 && $sig_result == 1) {
$html .= $this->_getPaymentResponseHtml($payment_data, $payment_name);
if (isset($cart->_dataValidated)) {
if ($order['details']['BT']->order_status != $method->status_success) {
$this->update_status($method->status_success, $order_id, "VMPAYMENT_SEB_PAYMENT_CONFIRMED");
}
echo JText::_("VMPAYMENT_SEB_SUCCESS_MESSAGE");
}
} elseif ($_REQUEST['VK_SERVICE'] == 1901 && $sig_result == 1) {
// makse on tühistatud
if ($order['details']['BT']->order_status != $method->status_canceled) {
$this->update_status($method->status_canceled, $order_id, "VMPAYMENT_SEB_PAYMENT_CANCELED");
}
echo JText::_("VMPAYMENT_SEB_FAIL_MESSAGE");
}
$cart->emptyCart();
$url = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
echo '<head><meta http-equiv="Refresh" content="5;URL=' . $url . '"></head>';
return true;
}
示例4: plgVmOnPaymentResponseReceived
function plgVmOnPaymentResponseReceived(&$html)
{
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$paymentParams = JRequest::get('request');
foreach ((array) $paymentParams as $f => $v) {
if ($f == 'json') {
$macFields = $v;
}
}
if (!$macFields) {
return NULL;
}
$paymentMessage = @json_decode($macFields, true);
if (!$paymentMessage) {
$paymentMessage = @json_decode(htmlspecialchars_decode($paymentMessage), true);
}
if (!$paymentMessage || !isset($paymentMessage['signature']) || !$paymentMessage['signature']) {
return NULL;
}
$virtuemart_order_id = $paymentMessage['paymentId'];
$order = VirtueMartModelOrders::getOrder($virtuemart_order_id);
if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) {
return null;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$this->_initConfigVariables($method);
$paymentValidationResult = $this->validateBanklinkPayment($paymentParams);
if ($paymentValidationResult['status'] == 'success') {
if ($order['details']['BT']->order_status != $method->status_success) {
$this->update_status($method->status_success, $virtuemart_order_id, "MAKSEKESKUS_PAYMENT_CONFIRMED");
}
echo JText::_("MAKSEKESKUS_SUCCESS_MESSAGE");
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
$cart = VirtueMartCart::getCart();
$cart->emptyCart();
$url = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
} else {
if ($paymentValidationResult['status'] == 'cancelled') {
if ($order['details']['BT']->order_status != $method->status_canceled) {
$this->update_status($method->status_canceled, $virtuemart_order_id, "MAKSEKESKUS_PAYMENT_CANCELED");
}
echo JText::_("MAKSEKESKUS_FAIL_MESSAGE");
$url = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=cart');
$this->handlePaymentUserCancel($virtuemart_order_id);
} else {
if ($paymentValidationResult['status'] == 'received') {
$url = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart');
} else {
//total failure
echo JText::_("MAKSEKESKUS_FAIL_MESSAGE");
$url = JROUTE::_(JURI::root() . 'index.php');
}
}
}
echo '<head><meta http-equiv="Refresh" content="5;URL=' . $url . '"></head>';
return true;
}
示例5: 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('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$order_number = JRequest::getVar('on');
if (!$order_number) {
return false;
}
$db = JFactory::getDBO();
$query = 'SELECT ' . $this->_tablename . '.`virtuemart_order_id` FROM ' . $this->_tablename . " WHERE `order_number`= '" . $order_number . "'";
$db->setQuery($query);
$virtuemart_order_id = $db->loadResult();
if (!$virtuemart_order_id) {
return null;
}
if ($virtuemart_order_id) {
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
// get the correct cart / session
$cart = VirtueMartCart::getCart();
// send the email ONLY if payment has been accepted
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$order = new VirtueMartModelOrders();
$orderitems = $order->getOrder($virtuemart_order_id);
//$cart->sentOrderConfirmedEmail($orderitems);
$cart->emptyCart();
}
return true;
}
示例6: plgVmOnShowOrderBEPayment
function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
{
$order = new VirtueMartModelOrders();
$my_order = $order->getOrder($virtuemart_order_id);
$html = '';
$htmlStatus = '';
$gettpstatus = vRequest::getString('gettpstatus', 0);
if ($gettpstatus == 1) {
$method = $this->getVmPluginMethod($payment_method_id);
require_once 'cs/TPConnector.php';
$tpconnector = new TPConnector();
$connector_data = $tpconnector->createTPConnector($method);
$connector = $connector_data['connector'];
$security_code = $connector_data['security'];
$merchant = $connector_data['merchant'];
$optionsGS = array('MERCHANT' => $merchant, 'OPERATIONID' => $my_order['details']['BT']->order_number);
$status = $connector->getStatus($optionsGS);
if (isset($status['Operations'])) {
if (is_array($status['Operations'])) {
foreach ($status['Operations'] as $index => $value) {
$htmlStatus .= '<tr>';
$htmlStatus .= '<td>';
$htmlStatus .= '' . $index . ': ';
$htmlStatus .= '</td>';
$htmlStatus .= '<td>';
$htmlStatus .= '' . $value . '';
$htmlStatus .= '</td>';
$htmlStatus .= '</tr>';
}
}
}
}
$html = '<table class="adminlist table ">' . "\n";
$html .= '<thead>' . "\n";
$html .= '<tr>' . "\n";
$html .= '<th colspan="2">' . "\n";
$html .= 'TodoPago Status' . "\n";
$html .= '</th>' . "\n";
$html .= '</tr>' . "\n";
$html .= '</thead>' . "\n";
$html .= '<tr>' . "\n";
$html .= '<td colspan="2">' . "\n";
$html .= '<input onclick="getTPStatus()" style="cursor:pointer;width: 300px; margin-left: auto; display: block; margin-right: auto; height: 50px;" id="updateTPStatus" type="button" value="Get TodoPago Status">' . "\n";
$html .= '</td>' . "\n";
$html .= '</tr>' . "\n";
$html .= $htmlStatus;
$html .= '</table>' . "\n";
$js = '<script type="text/javascript">
function getTPStatus(){
window.location.href = window.location.href+"&gettpstatus=1";
}
</script>';
$html .= $js;
return $html;
}
示例7: plgVmOnPaymentNotification
function plgVmOnPaymentNotification()
{
if (!JRequest::getInt('pro', 0)) {
return NULL;
}
$format = JRequest::getWord('format', '');
$robologin = JRequest::getVar('robologin', '');
if ($robologin && $format == 'json') {
// список доступных платежных методов на робокассе
$current = JRequest::getVar('current', '0');
$data = JFactory::getXML("http://merchant.roboxchange.com/WebService/Service.asmx/GetCurrencies?MerchantLogin=" . $robologin . "&Language=ru");
$result = $data->Result->Code;
$json = new stdClass();
if ($result != 0) {
$json->html = htmlspecialchars($data->Result->Description);
die(json_encode($json));
}
$html = '<select id="paramspaymethod" name="params[paymethod]">';
$html .= '<option value="0">' . JText::_('VMPAYMENT_STT_ROBOKASSA_PRO_PAYMETHODS_ALL') . '</option>';
foreach ($data->Groups->Group as $element) {
$html .= '<optgroup label="' . htmlspecialchars($element->getAttribute('Description')) . '">';
foreach ($element->Items->Currency as $field) {
$label = $field->getAttribute('Label');
$name = $field->getAttribute('Name');
$s = '';
if ($label == $current) {
$s = ' selected="selected"';
}
$html .= '<option value="' . htmlspecialchars($label) . '"' . $s . '>' . htmlspecialchars($name) . '</option>';
}
$html .= '</optgroup>';
}
$html .= '</select>';
$json->html = $html;
die(json_encode($json));
}
//Изменение статуса заказа на Confirmed после оплаты счета
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$robokassa_data = JRequest::get('post');
$virtuemart_order_id = $robokassa_data['InvId'];
if (!array_key_exists('InvId', $robokassa_data) || !isset($robokassa_data['InvId'])) {
return NULL;
// Another method was selected, do nothing
}
if (!$virtuemart_order_id) {
return;
}
$sum = $robokassa_data['OutSum'];
$notify_signature = $robokassa_data['SignatureValue'];
$payment = $this->getDataByOrderId($virtuemart_order_id);
$method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
if (!isset($method->payment_currency) || !$method->payment_currency) {
$this->getPaymentCurrency($method);
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'currencydisplay.php';
}
$paymentCurrency = CurrencyDisplay::getInstance($method->payment_currency);
$order_model = new VirtueMartModelOrders();
$order_info = $order_model->getOrder($virtuemart_order_id);
$totalInPaymentCurrency = round($paymentCurrency->convertCurrencyTo($method->payment_currency, $order_info['details']['BT']->order_total, false), 2);
$mrh_pass2 = $method->mrh_pass2;
$sig = strtoupper(md5("{$sum}:{$virtuemart_order_id}:{$mrh_pass2}"));
if ($sig == $notify_signature && $sum == $totalInPaymentCurrency) {
$new_status = $method->status_success;
$modelOrder = VmModel::getModel('orders');
$order = array();
$order['order_status'] = $new_status;
$order['customer_notified'] = 1;
$order['comments'] = 'robokassaPro';
$modelOrder->updateStatusForOneOrder($virtuemart_order_id, $order, true);
die('OK' . $virtuemart_order_id);
} else {
die('error signature or sum');
}
return true;
}
示例8: 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('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$order_number = JRequest::getVar('on');
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
$payment_name = $this->renderPluginName($method);
$html = '<table>' . "\n";
$html .= $this->getHtmlRow('PAYKEEPER_PAYMENT_NAME', $payment_name);
$html .= $this->getHtmlRow('PAYKEEPER_ORDER_NUMBER', $virtuemart_order_id);
$html .= $this->getHtmlRow('PAYKEEPER_STATUS', JText::_('VMPAYMENT_PAYKEEPER_STATUS_SUCCESS'));
$html .= '</table>' . "\n";
if ($virtuemart_order_id) {
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
// get the correct cart / session
$cart = VirtueMartCart::getCart();
// send the email ONLY if payment has been accepted
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$order = new VirtueMartModelOrders();
$orderitems = $order->getOrder($virtuemart_order_id);
$cart->sentOrderConfirmedEmail($orderitems);
$cart->emptyCart();
}
return true;
}
示例9: 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;
}
$payment_data = JRequest::get('post');
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) {
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
// get the correct cart / session
$cart = VirtueMartCart::getCart();
// send the email ONLY if payment has been accepted
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$order = new VirtueMartModelOrders();
$orderitems = $order->getOrder($virtuemart_order_id);
//vmdebug('PaymentResponseReceived CART', $orderitems);
$cart->sentOrderConfirmedEmail($orderitems);
//We delete the old stuff
$cart->emptyCart();
}
return true;
}
示例10: 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);
}
示例11: 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;
}
示例12: plgVmOnPaymentResponseReceived
function plgVmOnPaymentResponseReceived(&$html)
{
//language
if (!class_exists('VirtueMartCart')) {
require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('VirtueMartModelOrders')) {
require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php';
}
$lang = JFactory::getLanguage();
$filename = 'com_virtuemart';
$lang->load($filename, JPATH_ADMINISTRATOR);
$vendorId = 0;
$payment_data = JRequest::get('request');
$order_id = substr($payment_data['SOLOPMT_RETURN_REF'], 0, -1);
$pmethod = VirtueMartModelOrders::getOrder($order_id);
$payment_method = $pmethod['details']['BT']->virtuemart_paymentmethod_id;
if (!($method = $this->getVmPluginMethod($payment_method))) {
return null;
// Another method was selected, do nothing
}
if (!$this->selectedThisElement($method->payment_element)) {
return false;
}
$payment_name = $this->renderPluginName($method);
$vk_array = array();
foreach ($payment_data as $key => $value) {
if (substr($key, 0, 8) == "SOLOPMT_") {
$vk_array[$key] = $value;
}
}
$sig_result = $this->checkReturnMac($vk_array, $method->priv_key, $method->keyvar);
$config =& JFactory::getConfig();
$dbprefix = $config->getValue('dbprefix');
$order = new VirtueMartModelOrders();
$order = $order->getOrder($order_id);
$cart = VirtueMartCart::getCart();
//Currency
$db = JFactory::getDBO();
$q = 'SELECT * FROM `' . $this->_tablename . '` ' . 'WHERE `virtuemart_order_id` = ' . $order_id;
$db->setQuery($q);
if (!($paymentTable = $db->loadObject())) {
// JError::raiseWarning(500, $db->getErrorMsg());
return '';
}
$this->getPaymentCurrency($paymentTable);
$q = 'SELECT `currency_code_3` FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id`="' . $paymentTable->payment_currency . '" ';
$db =& JFactory::getDBO();
$db->setQuery($q);
$currency_code_3 = $db->loadResult();
//currency
if ($sig_result == true) {
$html .= $this->_getPaymentResponseHtml($payment_data, $payment_name, round($order['details']['BT']->order_total, 2), $currency_code_3);
if ($order['details']['BT']->order_status != $method->status_success) {
$this->update_status($method->status_success, $order_id, "VMPAYMENT_NORDEA_PAYMENT_CONFIRMED");
}
echo JText::_("VMPAYMENT_NORDEA_SUCCESS_MESSAGE");
echo $html;
} elseif ($sig_result == false) {
// makse on tühistatud
if ($order['details']['BT']->order_status != $method->status_canceled) {
$this->update_status($method->status_canceled, $order_id, "VMPAYMENT_NORDEA_PAYMENT_CANCELED");
}
echo JText::_("VMPAYMENT_NORDEA_FAIL_MESSAGE");
}
$cart->emptyCart();
$url = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=orders');
echo '<head><meta http-equiv="Refresh" content="5;URL=' . $url . '"></head>';
return true;
}
示例13: plgVmOnShowOrderBEPayment
function plgVmOnShowOrderBEPayment($virtuemart_order_id, $payment_method_id)
{
$order = new VirtueMartModelOrders();
$my_order = $order->getOrder($virtuemart_order_id);
$method = $this->getVmPluginMethod($payment_method_id);
require_once 'cs/TPConnector.php';
$tpconnector = new TPConnector();
$connector_data = $tpconnector->createTPConnector($method);
$connector = $connector_data['connector'];
$security_code = $connector_data['security'];
$merchant = $connector_data['merchant'];
$optionsGS = array('MERCHANT' => $merchant, 'OPERATIONID' => $my_order['details']['BT']->order_number);
if ($merchant == "") {
} else {
$status = $connector->getStatus($optionsGS);
include_once "views/get_status_view.php";
echo "<hr />";
include_once "views/get_devoluciones_view.php";
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query->select($db->quoteName(array('tp_security_code_prod')));
$query->from($db->quoteName('#__virtuemart_payment_plg_todopago'));
$query->where($db->quoteName("virtuemart_order_id") . "=" . $db->quote($_GET['virtuemart_order_id']));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$payment_element = $db->loadObjectList();
$_requestKey = $payment_element[0]->tp_security_code_prod;
/////devoluciones
if ($_POST["dev_params"] == "dev_params") {
if ($method->tp_ambiente == "test") {
$security = $method->tp_security_code_test;
$merchant = $method->tp_id_site_test;
$rest_end_point = "https://developers.todopago.com.ar/t/1.1/api/Authorize";
} else {
$security = $method->tp_security_code_prod;
$merchant = $method->tp_id_site_prod;
$rest_end_point = "https://api.todopago.com.ar/t/1.1/api/Authorize";
}
$data = array("RequestType" => "ReturnRequest", "Security" => $security, "RequestKey" => $_requestKey, "Merchant" => $merchant, "Amount" => $_POST["ReturnRequestAmount"]);
$data_string = json_encode($data);
$ch = curl_init($rest_end_point);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: {$method->tp_auth_http}"));
$result = curl_exec($ch);
$rta = json_decode($result);
echo "<h4>" . $rta->ReturnResponse->StatusMessage . "</h4>";
if ($rta->ReturnResponse->StatusCode == 2011) {
echo '<h4 style="color:red">' . "DEVOLUCION OK!" . '</h4>';
echo '<script>alert("Su devolucion se ha realizado con exito")</script>';
} else {
echo '<h4 style="color:red">' . "NO SE PUDO REALIZAR DEVOLUCION INTENTE MAS TARDE!" . '</h4>';
}
}
}
////devoluciones
}
示例14: plgVmOnUpdateOrderPayment
/**
* Save updated order data to the method specific table
*
* @param array $_formData Form data
* @return mixed, True on success, false on failures (the rest of the save-process will be
* skipped!), or null when this method is not actived.
* @author Oscar van Eijk
*
public function plgVmOnUpdateOrderPayment( $_formData) {
return null;
}
/**
* Save updated orderline data to the method specific table
*
* @param array $_formData Form data
* @return mixed, True on success, false on failures (the rest of the save-process will be
* skipped!), or null when this method is not actived.
* @author Oscar van Eijk
*
public function plgVmOnUpdateOrderLine( $_formData) {
return null;
}
/**
* plgVmOnEditOrderLineBE
* This method is fired when editing the order line details in the backend.
* It can be used to add line specific package codes
*
* @param integer $_orderId The order ID
* @param integer $_lineId
* @return mixed Null for method that aren't active, text (HTML) otherwise
* @author Oscar van Eijk
*
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
* @author Oscar van Eijk
*
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;
}
*/
function plgVmOnPaymentNotification()
{
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';
}
$moip = JRequest::getVar('moip');
if (!isset($moip)) {
return;
}
// trata os retorno no Virtuemart ( atualizando status )
$this->order_id = $order_number = JRequest::getVar('order_id');
$pm = JRequest::getVar('pm');
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
$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;
//.........这里部分代码省略.........