コード例 #1
0
 function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $http = eZHTTPTool::instance();
     eZDebug::writeNotice($parameters, "parameters");
     $orderID = $parameters['order_id'];
     $order = eZOrder::fetch($orderID);
     if (empty($orderID) || get_class($order) != 'ezorder') {
         eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
         return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
     }
     // Decrement the quantitity field
     $order = eZOrder::fetch($orderID);
     $productCollection = $order->productCollection();
     $ordereditems = $productCollection->itemList();
     foreach ($ordereditems as $item) {
         $contentObject = $item->contentObject();
         $contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
         $contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
         foreach (array_keys($contentObjectAttributes) as $key) {
             $contentObjectAttribute = $contentObjectAttributes[$key];
             $contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
             // Each attribute has an attribute identifier called 'quantity' that identifies it.
             if ($contentClassAttribute->attribute("identifier") == "quantity") {
                 $contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
                 $contentObjectAttribute->store();
             }
         }
     }
     return eZWorkflowEventType::STATUS_ACCEPTED;
 }
コード例 #2
0
 function execute($process, $event)
 {
     $ini = eZINI::instance('workflow.ini');
     $cost = $ini->variable("SimpleShippingWorkflow", "ShippingCost");
     $description = $ini->variable("SimpleShippingWorkflow", "ShippingDescription");
     $parameters = $process->attribute('parameter_list');
     if (isset($parameters['order_id'])) {
         $orderID = $parameters['order_id'];
         $order = eZOrder::fetch($orderID);
         $orderItems = $order->attribute('order_items');
         $addShipping = true;
         foreach ($orderItems as $orderItem) {
             if ($orderItem->attribute('type') == 'ezsimpleshipping') {
                 $addShipping = false;
                 break;
             }
         }
         if ($addShipping) {
             $productCollection = $order->attribute('productcollection');
             $orderCurrency = $productCollection->attribute('currency_code');
             $cost = eZShopFunctions::convertAdditionalPrice($orderCurrency, $cost);
             $orderItem = new eZOrderItem(array('order_id' => $orderID, 'description' => $description, 'price' => $cost, 'type' => 'ezsimpleshipping'));
             $orderItem->store();
         }
     }
     return eZWorkflowType::STATUS_ACCEPTED;
 }
コード例 #3
0
 public static function custom_error_handling()
 {
     $http = eZHTTPTool::instance();
     $order_id = $http->postVariable('order_id');
     $order = eZOrder::fetch($order_id);
     $response = $http->postVariable('response');
     //write error to log file
     self::write_invalid_checkcreditcard_log($order_id, $response);
     //generate the string and return it back to the template full translated
     return xrowPayoneHelper::generateCustomErrorString($order, $response);
 }
コード例 #4
0
ファイル: ezpaypalgateway.php プロジェクト: mugoweb/ezpaypal
 function createRedirectionUrl($process)
 {
     //__DEBUG__
     $this->logger->writeTimedString("createRedirectionUrl");
     //___end____
     $paypalINI = eZINI::instance('paypal.ini');
     $paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
     $requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
     $business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
     $processParams = $process->attribute('parameter_list');
     $orderID = $processParams['order_id'];
     $indexDir = eZSys::indexDir();
     $localHost = eZSys::serverURL();
     $localURI = eZSys::serverVariable('REQUEST_URI');
     $order = eZOrder::fetch($orderID);
     $amount = urlencode($order->attribute('total_inc_vat'));
     $currency = urlencode($order->currencyCode());
     //        include_once( 'lib/ezlocale/classes/ezlocale.php' );
     $locale = eZLocale::instance();
     $countryCode = urlencode($locale->countryCode());
     $maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
     $itemName = urlencode($this->createShortDescription($order, $maxDescLen));
     $accountInfo = $order->attribute('account_information');
     $first_name = urlencode($accountInfo['first_name']);
     $last_name = urlencode($accountInfo['last_name']);
     $street = urlencode($accountInfo['street2']);
     $zip = urlencode($accountInfo['zip']);
     $state = urlencode($accountInfo['state']);
     $place = urlencode($accountInfo['place']);
     $image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
     $background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
     $pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
     $noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
     $noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
     $noShipping = 1;
     $url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "&currency_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "&notify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
     //__DEBUG__
     $this->logger->writeTimedString("business       = {$business}");
     $this->logger->writeTimedString("item_name      = {$itemName}");
     $this->logger->writeTimedString("custom         = {$orderID}");
     $this->logger->writeTimedString("no_shipping    = {$noShipping}");
     $this->logger->writeTimedString("localHost      = {$localHost}");
     $this->logger->writeTimedString("amount         = {$amount}");
     $this->logger->writeTimedString("currency_code  = {$currency}");
     $this->logger->writeTimedString("notify_url     = {$localHost}" . $indexDir . "/paypal/notify_url/");
     $this->logger->writeTimedString("return         = {$localHost}" . $indexDir . "/shop/checkout/");
     $this->logger->writeTimedString("cancel_return  = {$localHost}" . $indexDir . "/shop/basket/");
     //___end____
     return $url;
 }
コード例 #5
0
 function setupOrderAndPaymentObject($orderID)
 {
     if (isset($orderID) && $orderID > 0) {
         $this->paymentObject = eZPaymentObject::fetchByOrderID($orderID);
         if (isset($this->paymentObject)) {
             $this->order = eZOrder::fetch($orderID);
             if (isset($this->order)) {
                 return true;
             }
             $this->logger->writeTimedString("Unable to fetch order object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
             return false;
         }
         $this->logger->writeTimedString("Unable to fetch payment object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
         return false;
     }
     $this->logger->writeTimedString("Invalid orderID={$orderID}", 'setupOrderAndPaymentObject failed');
     return false;
 }
コード例 #6
0
ファイル: confirmorder.php プロジェクト: nfrp/ezpublish
        return;
    }
    if ($http->hasPostVariable("CancelButton")) {
        $order->purge(false);
        $module->redirectTo('/shop/basket/');
        return;
    }
    $tpl->setVariable("order", $order);
}
$basket = eZBasket::currentBasket();
$basket->updatePrices();
$operationResult = eZOperationHandler::execute('shop', 'confirmorder', array('order_id' => $order->attribute('id')));
switch ($operationResult['status']) {
    case eZModuleOperationInfo::STATUS_CONTINUE:
        if ($operationResult != null && !isset($operationResult['result']) && (!isset($operationResult['redirect_url']) || $operationResult['redirect_url'] == null)) {
            $order = eZOrder::fetch($order->attribute('id'));
            $tpl->setVariable("order", $order);
            $Result = array();
            $Result['content'] = $tpl->fetch("design:shop/confirmorder.tpl");
            $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/shop', 'Confirm order')));
        }
        break;
    case eZModuleOperationInfo::STATUS_HALTED:
    case eZModuleOperationInfo::STATUS_REPEAT:
        if (isset($operationResult['redirect_url'])) {
            $module->redirectTo($operationResult['redirect_url']);
            return;
        } else {
            if (isset($operationResult['result'])) {
                $result = $operationResult['result'];
                $resultContent = false;
コード例 #7
0
<?php

/**
 * @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2012.8
 * @package kernel
 */
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$user = eZUser::currentUser();
$order = eZOrder::fetch($OrderID);
if (!$order) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($http->hasPostVariable("OrderID") && $http->hasPostVariable("StatusID") && $http->hasPostVariable("SetOrderStatusButton")) {
    $access = $order->canModifyStatus($StatusID);
    if ($access) {
        if ($order->attribute('status_id') != $StatusID) {
            $order->modifyStatus($StatusID);
        }
        if ($http->hasPostVariable('RedirectURI')) {
            $uri = $http->postVariable('RedirectURI');
            $module->redirectTo($uri);
            return;
        } else {
            $module->redirectTo('/shop/orderview/' . $orderID);
            return;
        }
    } else {
        return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
コード例 #8
0
 function fetchOrder( $orderID )
 {
     $order = eZOrder::fetch( $orderID );
     return array( 'result' => $order );
 }
コード例 #9
0
ファイル: ezpaypalchecker.php プロジェクト: mugoweb/ezpaypal
 function updateStatus()
 {
     //refetch the $this->order - it's an old object, just the order ID is good
     //Changing the status with an old version for $this->order will write old
     //values to the order
     $this->logger->writeTimedString('ReFetch Order ID: ' . $this->order->ID);
     $order = eZOrder::fetch($this->order->ID);
     $this->order = $order;
     $this->order->modifyStatus(1000);
 }
コード例 #10
0
ファイル: ezorder.php プロジェクト: CG77/ezpublish-legacy
 static function customerList($offset, $limit)
 {
     $db = eZDB::instance();
     $db_params = array();
     $db_params["offset"] = (int) $offset;
     $db_params["limit"] = (int) $limit;
     $customEmailResult = $db->arrayQuery("SELECT DISTINCT email FROM ezorder WHERE is_temporary='0' ORDER BY email", $db_params);
     $customEmailArray = array();
     foreach ($customEmailResult as $customEmailRow) {
         $customEmail = $customEmailRow['email'];
         $customEmailArray[] = "'" . $customEmail . "'";
     }
     $emailString = implode(", ", $customEmailArray);
     if (!strlen($emailString)) {
         $emailString = "''";
     }
     $productItemArray = $db->arrayQuery("SELECT ezorder.id as order_id, user_id, email, ignore_vat, currency_code, ezproductcollection_item.*\n                                                 FROM ezorder, ezproductcollection_item, ezproductcollection\n                                                WHERE ezproductcollection_item.productcollection_id=ezorder.productcollection_id\n                                                  AND is_temporary='0'\n                                                  AND ezproductcollection_item.productcollection_id=ezproductcollection.id\n                                                  AND email in ( {$emailString} )\n                                             ORDER BY user_id, email, order_id");
     $siteIni = eZINI::instance();
     $anonymousUserID = $siteIni->variable('UserSettings', 'AnonymousUserID');
     $currentUserID = 0;
     $currentOrderID = 0;
     $currentUserEmail = "";
     $customArray = array();
     $accountName = null;
     $itemCount = 0;
     $hash = 0;
     $currencyCode = '';
     $ordersInfo = array();
     foreach ($productItemArray as $productItem) {
         $itemCount++;
         $currencyCode = $productItem['currency_code'];
         if ($currencyCode == '') {
             $currencyCode = eZOrder::fetchLocaleCurrencyCode();
         }
         $userID = $productItem['user_id'];
         $orderID = $productItem['order_id'];
         $order = eZOrder::fetch($orderID);
         if ($currentUserID != $userID && $itemCount != 1) {
             $customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
             $ordersInfo = array();
             $accountName = $order->attribute('account_name');
             $accountEmail = $order->attribute('account_email');
         }
         $currentUserID = $userID;
         // If the custom is anoymous user
         if ($currentUserID == $anonymousUserID) {
             $accountEmail = $order->attribute('email');
             if ($currentUserEmail == "") {
                 $accountName = $order->attribute('account_name');
                 $currentUserEmail = $accountEmail;
             }
             if ($currentUserEmail != $accountEmail) {
                 $customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
                 $ordersInfo = array();
                 $accountName = $order->attribute('account_name');
                 $accountEmail = $order->attribute('account_email');
                 $currentUserEmail = $accountEmail;
             }
             $currentUserEmail = $accountEmail;
         } else {
             $currentUserEmail = 0;
         }
         $accountName = $order->attribute('account_name');
         if (!isset($ordersInfo[$currencyCode])) {
             $ordersInfo[$currencyCode] = array('order_count' => 0, 'sum_ex_vat' => 0, 'sum_inc_vat' => 0);
         }
         if ($currentOrderID != $orderID) {
             $ordersInfo[$currencyCode]['order_count']++;
         }
         $currentOrderID = $orderID;
         if ($productItem['ignore_vat'] == true) {
             $vatValue = 0;
         } else {
             $vatValue = $productItem['vat_value'];
         }
         $price = $productItem['price'];
         if ($productItem['is_vat_inc']) {
             $priceExVAT = $price / (100 + $vatValue) * 100;
             $priceIncVAT = $price;
         } else {
             $priceExVAT = $price;
             $priceIncVAT = $price * (100 + $vatValue) / 100;
         }
         $count = $productItem['item_count'];
         $realPricePercent = (100 - $productItem['discount']) / 100;
         $ordersInfo[$currencyCode]['sum_ex_vat'] += round($count * $priceExVAT * $realPricePercent, 2);
         $ordersInfo[$currencyCode]['sum_inc_vat'] += round($count * $priceIncVAT * $realPricePercent, 2);
     }
     if (count($productItemArray) != 0) {
         $customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
     }
     return $customArray;
 }
コード例 #11
0
 function execute($process, $event)
 {
     $http = eZHTTPTool::instance();
     $siteINI = eZINI::instance('site.ini');
     $shopINI = eZINI::instance('shop.ini');
     $payoneINI = eZINI::instance('xrowpayone.ini');
     $processParams = $process->attribute('parameter_list');
     $errors = array();
     $process_id = $process->ID;
     //get the current order
     $order_id = $processParams['order_id'];
     $order = eZOrder::fetch($order_id);
     //checking if its only a redirect and so the preauthorisation is already finished
     $paymentObj = xrowPaymentObject::fetchByOrderID($order_id);
     if (is_object($paymentObj) && $paymentObj->approved()) {
         //now disapprove again because its 3d CC payment and its only paid when capture is successful
         $paymentObj->reject();
         xrowPayoneCreditCardGateway::setPaymentMethod($order);
         eZLog::write("SUCCESS in step 2 ('preauthorisation') ::3D Secure Card detected - FINISHED :: for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
         return eZWorkflowType::STATUS_ACCEPTED;
     }
     //STEP 2: preauthorisation
     if ($http->hasPostVariable('pseudocardpan')) {
         //fetching settings
         $pseudocardpan = $http->postVariable('pseudocardpan');
         $site_url = $siteINI->variable('SiteSettings', 'SiteURL');
         $aid = $payoneINI->variable('GeneralSettings', 'AID');
         $mid = $payoneINI->variable('GeneralSettings', 'MID');
         $portal_id = $payoneINI->variable('GeneralSettings', 'PortalID');
         $mode = $payoneINI->variable('GeneralSettings', 'Mode');
         $key = $payoneINI->variable('GeneralSettings', 'Key');
         $algorithm = $payoneINI->variable('GeneralSettings', 'Algorithm');
         $api_version = $payoneINI->variable('GeneralSettings', 'APIVersion');
         $response_type = $payoneINI->variable('GeneralSettings', 'ResponseType');
         $cc_3d_secure_enabled = $payoneINI->variable('CC3DSecure', 'Enabled');
         $error_url = $payoneINI->variable('CC3DSecure', 'ErrorURL');
         $success_url = $payoneINI->variable('CC3DSecure', 'SuccessURL');
         $siteaccess = $GLOBALS['eZCurrentAccess'];
         $siteaccess = $siteaccess["name"];
         //prepare some parameter values
         $error_url = "https://" . $site_url . "/" . $siteaccess . "/" . $error_url . "/orderID/" . $order_id;
         $success_url = "https://" . $site_url . "/" . $siteaccess . "/" . $success_url . "/orderID/" . $order_id;
         $order_total_in_cent = (string) $order->totalIncVAT() * 100;
         $currency_code = $order->currencyCode();
         $order_xml = simplexml_load_string($order->DataText1);
         $country_alpha3 = (string) $order_xml->country;
         $country = eZCountryType::fetchCountry($country_alpha3, "Alpha3");
         $country_alpha2 = $country["Alpha2"];
         $last_name = (string) $order_xml->last_name;
         //create hash array
         $hash_array["aid"] = $aid;
         $hash_array["mid"] = $mid;
         $hash_array["portalid"] = $portal_id;
         $hash_array["api_version"] = $api_version;
         $hash_array["mode"] = $mode;
         $hash_array["request"] = "preauthorization";
         $hash_array["responsetype"] = $response_type;
         $hash_array["clearingtype"] = "cc";
         $hash_array["reference"] = $order_id;
         $hash_array["amount"] = $order_total_in_cent;
         $hash_array["currency"] = $currency_code;
         if ($cc_3d_secure_enabled == "true") {
             $hash_array["successurl"] = $success_url;
             $hash_array["errorurl"] = $error_url;
         }
         //please note: country, lastname and pseudocardpan are not needed to be added to the hash because they are not allwoed (p.25 client doc)
         //create param array
         $param_array["aid"] = $aid;
         $param_array["mid"] = $mid;
         $param_array["portalid"] = $portal_id;
         $param_array["api_version"] = $api_version;
         $param_array["mode"] = $mode;
         $param_array["request"] = "preauthorization";
         $param_array["responsetype"] = $response_type;
         $param_array["hash"] = xrowPayoneHelper::generate_hash($algorithm, $hash_array, $key);
         $param_array["clearingtype"] = "cc";
         $param_array["reference"] = $order_id;
         $param_array["amount"] = $order_total_in_cent;
         $param_array["currency"] = $currency_code;
         $param_array["lastname"] = urlencode($last_name);
         $param_array["country"] = $country_alpha2;
         $param_array["pseudocardpan"] = $pseudocardpan;
         if ($cc_3d_secure_enabled == "true") {
             $param_array["successurl"] = $success_url;
             $param_array["errorurl"] = $error_url;
         }
         //sort params in alphabetic order
         ksort($param_array);
         $parameter_string = "?";
         foreach ($param_array as $key => $parameter) {
             $parameter_string .= $key . "=" . $parameter . "&";
         }
         $url = "https://secure.pay1.de/client-api" . $parameter_string;
         if ($siteINI->hasVariable('ProxySettings', 'ProxyServer') && $siteINI->variable('ProxySettings', 'ProxyServer') != "") {
             $proxyserver = $siteINI->variable('ProxySettings', 'ProxyServer');
             //now get the proxy url
             if (strpos($proxyserver, "://") !== false) {
                 $proxy_parts = explode("://", $proxyserver);
                 $proxyserver = $proxy_parts[1];
             }
             $context_array = array('http' => array('method' => 'GET', 'proxy' => $proxyserver));
             $context = stream_context_create($context_array);
             $json_response = file_get_contents($url, false, $context);
         } else {
             $json_response = file_get_contents($url);
         }
         if ($json_response) {
             $json_response = json_decode($json_response);
             if ($json_response->status != "ERROR" and isset($json_response->txid)) {
                 //get 'txid' from response and keep it
                 $txid = $json_response->txid;
                 //get 'userid' from response and keep it
                 $userid = $json_response->userid;
                 //now store it into the order
                 $db = eZDB::instance();
                 $db->begin();
                 $doc = new DOMDocument('1.0', 'utf-8');
                 $doc->loadXML($order->DataText1);
                 $shop_account_element = $doc->getElementsByTagName('shop_account');
                 $shop_account_element = $shop_account_element->item(0);
                 //handle and store the TXID
                 //remove first if exists
                 $txid_elements = $doc->getElementsByTagName('txid');
                 if ($txid_elements->length >= 1) {
                     $txid_element = $txid_elements->item(0);
                     $txid_element->parentNode->removeChild($txid_element);
                 }
                 //then create
                 $txidNode = $doc->createElement("txid", $txid);
                 $shop_account_element->appendChild($txidNode);
                 //handle and store the userid
                 //remove first if exists
                 $userid_elements = $doc->getElementsByTagName('userid');
                 if ($userid_elements->length >= 1) {
                     $userid_element = $userid_elements->item(0);
                     $userid_element->parentNode->removeChild($userid_element);
                 }
                 //then create
                 $useridNode = $doc->createElement("userid", $userid);
                 $shop_account_element->appendChild($useridNode);
                 //handle and store the pseudocardpan
                 if ($http->hasPostVariable('truncatedcardpan')) {
                     //remove first if exists
                     $tpan_elements = $doc->getElementsByTagName('truncatedcardpan');
                     if ($tpan_elements->length >= 1) {
                         $tpan_element = $tpan_elements->item(0);
                         $tpan_element->parentNode->removeChild($tpan_element);
                     }
                     //then create
                     $truncatedcardpan_node = $doc->createElement("truncatedcardpan", $http->postVariable('truncatedcardpan'));
                     $shop_account_element->appendChild($truncatedcardpan_node);
                 }
                 if ($json_response->status === "REDIRECT") {
                     //remove first if exists
                     $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
                     if ($cc3d_sec_elements->length >= 1) {
                         $cc3d_sec_element = $cc3d_sec_elements->item(0);
                         $cc3d_sec_element->parentNode->removeChild($cc3d_sec_element);
                     }
                     //save reserved flag false for now
                     $reservedFlag = $doc->createElement("cc3d_reserved", "false");
                     $shop_account_element->appendChild($reservedFlag);
                 } else {
                     //remove cc3d_reserved if exists. this case could occure if someone changed from 3d CC to normal CC.
                     $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
                     if ($cc3d_sec_elements->length >= 1) {
                         $cc3d_sec_element = $cc3d_sec_elements->item(0);
                         $cc3d_sec_element->parentNode->removeChild($cc3d_sec_element);
                     }
                 }
                 //i must store here redundant otherwise the order will not be stored since its stuck in a transaction
                 $db->commit();
                 //store it
                 $order->setAttribute('data_text_1', $doc->saveXML());
                 $order->store();
                 $db->commit();
                 if ($json_response->status === "REDIRECT") {
                     eZLog::write("PENDING in step 2 ('preauthorisation') ::3D Secure Card detected - REDIRECTING to creditcard institute check :: for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
                     //do redirect to 3d secure password confirm page
                     http_redirect($json_response->redirecturl);
                     exit;
                 } else {
                     xrowPayoneCreditCardGateway::setPaymentMethod($order);
                     eZLog::write("SUCCESS in step 2 ('preauthorisation') for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
                     return eZWorkflowType::STATUS_ACCEPTED;
                 }
             } else {
                 eZLog::write("FAILED in step 2 ('preauthorisation') for order ID " . $order_id . " with ERRORCODE " . $json_response->errorcode . " Message: " . $json_response->errormessage, $logName = 'xrowpayone.log', $dir = 'var/log');
                 if ($payoneINI->variable('GeneralSettings', 'CustomErrorNode') === "disabled") {
                     //use default error of payone
                     $errors = array($json_response->customermessage);
                 } else {
                     //use customized errors
                     $response["errorcode"] = $json_response->errorcode;
                     $response["errormessage"] = $json_response->errormessage;
                     $errors = array(xrowPayoneHelper::generateCustomErrorString($order, $response));
                 }
             }
         } else {
             eZLog::write("ERROR: Remote content not found in file " . __FILE__ . " on line " . __LINE__, $logName = 'xrowpayone.log', $dir = 'var/log');
         }
     } else {
         if (is_object($paymentObj)) {
             //that means, that we have a paymentobject which is not approved. its not approved because the payment has failed so we return a array
             $errors = array(ezpI18n::tr('extension/xrowpayone', 'Error occured during payment process. Please choose your payment option again.'));
             $paymentObj->remove();
         }
     }
     $process->Template = array();
     $process->Template['templateName'] = xrowPayoneCreditCardGateway::TEMPLATE;
     $process->Template['path'] = array(array('url' => false, 'text' => ezpI18n::tr('extension/xrowpayone', 'Payment Information')));
     $process->Template['templateVars'] = array('errors' => $errors, 'order' => $order, 'event' => $event);
     // return eZWorkflowType::STATUS_REJECTED;
     return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
 }
コード例 #12
0
 function checkCurrency($orderID)
 {
     $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
     $order = eZOrder::fetch($orderID);
     $productCollection = $order->attribute('productcollection');
     $currencyCode = $productCollection->attribute('currency_code');
     $currencyCode = trim($currencyCode);
     if ($currencyCode == '') {
         $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
     }
     $locale = eZLocale::instance();
     $localeCurrencyCode = $locale->currencyShortName();
     // Reverse logic to avoid calling eZCurrencyData::currencyExists() if the first expression is true.
     if (!($currencyCode == $localeCurrencyCode or eZCurrencyData::currencyExists($currencyCode))) {
         $returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
     }
     return $returnStatus;
 }
コード例 #13
0
 public function execute($process, $event)
 {
     $parameters = $process->attribute('parameter_list');
     $order = eZOrder::fetch($parameters['order_id']);
     $filter = self::filterOrderPayment($order);
     $process->Template = array();
     $process->Template['templateName'] = 'design:workflow/ezpaymentselect.tpl';
     $process->Template['templateVars'] = array('order' => $order, 'filter' => $filter);
     if (!$this->checkPayment()) {
         return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
     } else {
         eZPaymentSelectType::storeOrderData($order, $_POST['payment'], serialize($_POST));
         return eZWorkflowType::STATUS_ACCEPTED;
     }
 }
コード例 #14
0
ファイル: statuscheck.php プロジェクト: xrowgmbh/xrowpayone
<?php

$Module =& $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
if ($http->hasPostVariable('txid')) {
    $txid = $http->PostVariable('txid');
    $txaction = $http->PostVariable('txaction');
    if ($txaction === "appointed") {
        eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " :::::status:::: " . $txaction, $logName = 'xrowpayone.log', $dir = 'var/log');
        $db = eZDB::instance();
        $relevant_order = $db->arrayQuery("SELECT * FROM ezorder where data_text_1 LIKE '%<txid>{$txid}</txid>%';");
        if (count($relevant_order) == 1) {
            $order = eZOrder::fetch($relevant_order[0]["id"]);
            $doc = new DOMDocument('1.0', 'utf-8');
            $doc->loadXML($order->DataText1);
            $shop_account_element = $doc->getElementsByTagName('shop_account');
            $cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
            //detecting if its a 3d secure CC so we need to do something if its normal CC transaction then we just do nothing
            if ($cc3d_sec_elements->length >= 1) {
                $db->begin();
                $cc3d_sec_element = $cc3d_sec_elements->item(0);
                //change value
                $cc3d_sec_element->nodeValue = "true";
                $order->setAttribute('data_text_1', $doc->saveXML());
                $order->store();
                $db->commit();
            }
        } else {
            eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " specific order could not be determined (this is normal if the action was caused by a normal credit card without 3d secure protection!)", $logName = 'xrowpayone.log', $dir = 'var/log');
        }