コード例 #1
0
 function verifyPayment(&$pPaymentParameters, &$pOrder)
 {
     global $gCommerceSystem;
     unset($_SESSION[$this->code . '_error']);
     if (!empty($pPaymentParameters['cc_ref_id'])) {
         // reference transation
         $this->cc_ref_id = $pPaymentParameters['cc_ref_id'];
     } elseif (empty($pPaymentParameters['cc_number'])) {
         $this->mErrors['number'] = tra('Please enter a credit card number.');
     } elseif ($this->verifyCreditCard($pPaymentParameters['cc_number'], $pPaymentParameters['cc_expires_month'], $pPaymentParameters['cc_expires_year'], $pPaymentParameters['cc_cvv'])) {
         if (empty($pPaymentParameters['cc_owner'])) {
             $this->mErrors['owner'] = tra('Please enter the name card holders name as it is written on the card.');
         } else {
             $this->cc_owner = $pPaymentParameters['cc_owner'];
         }
         if (preg_match('/^37/', $pPaymentParameters['cc_number']) && BitBase::getParameter($pOrder->info, 'currency', $gCommerceSystem->getConfig('DEFAULT_CURRENCY')) != 'USD') {
             $this->mErrors['number'] = tra('American Express cannot process transactions in currencies other than USD. Change the currency in your cart, or use a different card.');
         }
     }
     $this->saveSessionDetails();
     if ($this->mErrors) {
         $_SESSION[$this->code . '_error'] = $this->mErrors;
     }
     return count($this->mErrors) === 0;
 }
コード例 #2
0
ファイル: localization.php プロジェクト: bitweaver/commerce
function currency_yahoo_quote($code, $base = DEFAULT_CURRENCY)
{
    global $gYahooCurrencies;
    $ret = FALSE;
    if (empty($gYahooCurrencies)) {
        currency_yahoo_load($base);
    }
    return BitBase::getParameter($gYahooCurrencies, strtoupper($base . $code));
}
コード例 #3
0
 function getCustomerActivity(&$pParamHash, $pRetained = TRUE)
 {
     $sortMode = '';
     if (!empty($pParamHash['sort_mode'])) {
         switch ($pParamHash['sort_mode']) {
             case 'orders_asc':
                 $sortMode = 'COUNT(`orders_id`) ASC, ';
                 break;
             case 'orders_desc':
                 $sortMode = 'COUNT(`orders_id`) DESC, ';
                 break;
             case 'first_purchase_asc':
                 $sortMode = 'MIN(co.`date_purchased`) ASC, ';
                 break;
             case 'first_purchase_desc':
                 $sortMode = 'MIN(co.`date_purchased`) DESC, ';
                 break;
             case 'age_asc':
                 $sortMode = 'MAX(co.`date_purchased`) - MIN(co.`date_purchased`) ASC, ';
                 break;
             case 'age_desc':
                 $sortMode = 'MAX(co.`date_purchased`) - MIN(co.`date_purchased`) DESC, ';
                 break;
             case 'last_purchase_asc':
                 $sortMode = 'MAX(co.`date_purchased`) ASC, ';
                 break;
             case 'last_purchase_desc':
                 $sortMode = 'MAX(co.`date_purchased`) DESC, ';
                 break;
             case 'revenue_asc':
                 $sortMode = 'SUM(co.`order_total`) DESC, ';
                 break;
         }
     } else {
         $pParamHash['sort_mode'] = 'revenue_desc';
     }
     $interval = BitBase::getParameter($pParamHash, 'interval', '2 years');
     $bindVars[] = $interval;
     $bindVars[] = $interval;
     $bindVars[] = $interval;
     $comparison = $pRetained ? '<' : '>';
     $sortMode .= 'SUM(co.`order_total`) DESC';
     BitBase::prepGetList($pParamHash);
     $sql = "SELECT uu.`user_id`,uu.`real_name`, uu.`login`,SUM(order_total) AS `revenue`, COUNT(orders_id) AS `orders`, MIN(`date_purchased`) AS `first_purchase`, MIN(`orders_id`) AS `first_orders_id`, MAX(date_purchased) AS `last_purchase`, MAX(`orders_id`) AS `last_orders_id`, MAX(date_purchased) - MIN(date_purchased) AS `age`\n\t\t\t\tFROM com_orders co \n\t\t\t\t\tINNER JOIN users_users uu ON(co.customers_id=uu.user_id) \n\t\t\t\tWHERE NOW() - uu.registration_date::int::abstime::timestamptz > ? \n\t\t\t\tGROUP BY  uu.`user_id`,uu.`real_name`, uu.`login`\n\t\t\t\tHAVING NOW() - MIN(co.date_purchased) > ? AND NOW() - MAX(co.date_purchased) " . $comparison . " ? ORDER BY {$sortMode}";
     if ($rs = $this->mDb->query($sql, $bindVars)) {
         while ($row = $rs->fetchRow()) {
             $ret['customers'][$row['user_id']] = $row;
             @($ret['totals']['orders'] += $row['orders']);
             @($ret['totals']['revenue'] += $row['revenue']);
             @$ret['totals']['customers']++;
         }
     }
     return $ret;
 }
コード例 #4
0
ファイル: currencies.php プロジェクト: bitweaver/commerce
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
//  $Id$
//
require 'includes/application_top.php';
require_once DIR_WS_FUNCTIONS . 'localization.php';
global $currencies;
$activeCurrency = FALSE;
if ($activeCode = BitBase::getParameter($_REQUEST, 'code')) {
    $activeCurrency = BitBase::getParameter($currencies->currencies, $activeCode);
}
if ($action = BitBase::getParameter($_GET, 'action')) {
    if (zen_not_null($action)) {
        switch ($action) {
            case 'insert':
            case 'save':
                $currencies->store($_REQUEST);
                if (isset($_POST['default']) && $_POST['default'] == 'on') {
                    $gCommerceSystem->storeConfig('DEFAULT_CURRENCY', $code);
                }
                zen_redirect(zen_href_link_admin(FILENAME_CURRENCIES, 'action=edit&code=' . $activeCode));
                break;
            case 'deleteconfirm':
                if (!$currencies->expungeCurrency($activeCode)) {
                    $messageStack->add(ERROR_REMOVE_DEFAULT_CURRENCY, 'error');
                }
                zen_redirect(zen_href_link_admin(FILENAME_CURRENCIES, 'page=' . $_GET['page']));
コード例 #5
0
ファイル: cc.php プロジェクト: bitweaver/commerce
 function verifyPayment(&$pPaymentParameters, &$pOrder)
 {
     if (empty($pPaymentParameters['cc_number'])) {
         $error = tra('Please enter a credit card number.');
     } elseif ($this->verifyCreditCard($pPaymentParameters['cc_number'], $pPaymentParameters['cc_expires_month'], $pPaymentParameters['cc_expires_year'], $pPaymentParameters['cc_cvv'])) {
         $ret = TRUE;
     } else {
         foreach (array('cc_owner', 'cc_number', 'cc_expires_month', 'cc_expires_year', 'cc_cvv') as $key) {
             $_SESSION[$key] = BitBase::getParameter($pPaymentParameters, $key);
         }
         $_SESSION['pfp_error'] = $this->mErrors;
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, NULL, 'SSL', true, false));
     }
     return $ret;
 }
コード例 #6
0
ファイル: LibertyMime.php プロジェクト: bitweaver/liberty
 function liberty_mime_get_source_file($pParamHash)
 {
     $fileName = BitBase::getParameter($pParamHash, 'file_name');
     if (empty($pParamHash['package'])) {
         $pParamHash['package'] = liberty_mime_get_storage_sub_dir_name(array('mime_type' => BitBase::getParameter($pParamHash, 'mime_type'), 'name' => $fileName));
     }
     if (empty($pParamHash['sub_dir'])) {
         $pParamHash['sub_dir'] = BitBase::getParameter($pParamHash, 'attachment_id');
     }
     $defaultFileName = liberty_mime_get_default_file_name($fileName, $pParamHash['mime_type']);
     $ret = STORAGE_PKG_PATH . liberty_mime_get_storage_branch($pParamHash) . $defaultFileName;
     if (!file_exists($ret)) {
         $ret = STORAGE_PKG_PATH . liberty_mime_get_storage_branch($pParamHash) . basename(BitBase::getParameter($pParamHash, 'file_name'));
     }
     return $ret;
 }
コード例 #7
0
ファイル: states.php プロジェクト: bitweaver/commerce
<?php

require_once '../../../kernel/setup_inc.php';
require_once BITCOMMERCE_PKG_PATH . 'includes/bitcommerce_start_inc.php';
require_once BITCOMMERCE_PKG_PATH . 'includes/functions/html_output.php';
if (empty($entry)) {
    $entry = $_REQUEST;
}
if (empty($entry['country_id'])) {
    $entry['country_id'] = defined('STORE_COUNTRY') ? STORE_COUNTRY : NULL;
}
if (!empty($entry['country_id'])) {
    if (!($stateInput = zen_get_country_zone_list('state', $entry['country_id'], !empty($entry['entry_zone_id']) ? $entry['entry_zone_id'] : ''))) {
        $stateInput = zen_draw_input_field('state', zen_get_zone_name($entry['country_id'], BitBase::getParameter($entry, 'entry_zone_id'), BitBase::getParameter($entry, 'entry_state')));
    }
} else {
    $stateInput = zen_draw_input_field('state');
}
print $stateInput;
コード例 #8
0
 function liberty_mime_get_source_file($pParamHash)
 {
     if (empty($pParamHash['package'])) {
         $pParamHash['package'] = liberty_mime_get_storage_sub_dir_name(array('type' => BitBase::getParameter($pParamHash, 'mime_type'), 'name' => BitBase::getParameter($pParamHash, 'file_name')));
     }
     if (empty($pParamHash['sub_dir'])) {
         $pParamHash['sub_dir'] = BitBase::getParameter($pParamHash, 'attachment_id');
     }
     return STORAGE_PKG_PATH . liberty_mime_get_storage_branch($pParamHash) . basename(BitBase::getParameter($pParamHash, 'file_name'));
 }
コード例 #9
0
ファイル: orders.php プロジェクト: bitweaver/commerce
     $saveAddress[$addressType . '_street_address'] = $_REQUEST['street_address'];
     $saveAddress[$addressType . '_suburb'] = $_REQUEST['suburb'];
     $saveAddress[$addressType . '_city'] = $_REQUEST['city'];
     $saveAddress[$addressType . '_state'] = $_REQUEST['state'];
     $saveAddress[$addressType . '_postcode'] = $_REQUEST['postcode'];
     $saveAddress[$addressType . '_country'] = zen_get_country_name($_REQUEST['country_id']);
     $saveAddress[$addressType . '_telephone'] = $_REQUEST['telephone'];
     $gBitDb->StartTrans();
     $gBitDb->associateUpdate(TABLE_ORDERS, $saveAddress, array('orders_id' => $_REQUEST['oID']));
     $gBitDb->CompleteTrans();
     bit_redirect($_SERVER['SCRIPT_NAME'] . '?oID=' . $_REQUEST['oID']);
     exit;
     break;
 case 'update_order':
     if (!empty($_REQUEST['charge_amount']) && !empty($_REQUEST['charge_amount'])) {
         $formatCharge = $currencies->format($_REQUEST['charge_amount'], FALSE, BitBase::getParameter($_REQUEST, 'charge_currency'));
         $_REQUEST['cc_ref_id'] = $order->info['cc_ref_id'];
         if ($paymentModule = $order->getPaymentModule()) {
             if ($paymentModule->processPayment($_REQUEST, $order)) {
                 $statusMsg = tra('A payment adjustment has been made to this order for the following amount:') . "\n" . $formatCharge . ' ' . tra('Transaction ID:') . "\n" . $paymentModule->getTransactionReference();
                 $_REQUEST['comments'] = (!empty($_REQUEST['comments']) ? $_REQUEST['comments'] . "\n\n" : '') . $statusMsg;
             } else {
                 $statusMsg = tra('Additional charge could not be made:') . ' ' . $formatCharge . '<br/>' . implode($paymentModule->mErrors, '<br/>');
                 $hasError = TRUE;
                 $messageStack->add_session($statusMsg, 'error');
                 $order->updateStatus(array('comments' => $statusMsg));
             }
         }
     }
     if (empty($hasError)) {
         if ($order->updateStatus($_REQUEST)) {
コード例 #10
0
ファイル: payflowpro.php プロジェクト: bitweaver/commerce
 function processPayment(&$pPaymentParameters, &$pOrder)
 {
     global $gCommerceSystem, $messageStack, $response, $gBitDb, $gBitUser, $currencies;
     $postFields = array();
     $responseHash = array();
     $this->result = NULL;
     if (!self::verifyPayment($pPaymentParameters, $pOrder)) {
         // verify basics failed
     } elseif (!empty($pPaymentParameters['cc_ref_id']) && empty($pPaymentParameters['charge_amount'])) {
         $this->mErrors['charge_amount'] = 'Invalid amount';
     } elseif (!($orderTotal = number_format($pOrder->info['total'], 2, '.', ''))) {
         $this->mErrors['charge_amount'] = 'Invalid amount';
     } else {
         if (!empty($pPaymentParameters['cc_ref_id'])) {
             // reference transaction
             $this->paymentOrderId = $pOrder->mOrdersId;
             $paymentCurrency = BitBase::getParameter($pPaymentParameters, 'charge_currency', DEFAULT_CURRENCY);
             $paymentLocalized = $pPaymentParameters['charge_amount'];
             $paymentNative = $paymentCurrency != DEFAULT_CURRENCY ? $paymentLocalized / $pPaymentParameters['charge_currency_value'] : $paymentLocalized;
             // completed orders have a single joined 'name' field
             $pOrder->billing['firstname'] = substr($pOrder->billing['name'], 0, strpos($pOrder->billing['name'], ' '));
             $pOrder->billing['lastname'] = substr($pOrder->billing['name'], strpos($pOrder->billing['name'], ' ') + 1);
             $pOrder->delivery['firstname'] = substr($pOrder->billing['name'], 0, strpos($pOrder->billing['name'], ' '));
             $pOrder->delivery['lastname'] = substr($pOrder->billing['name'], strpos($pOrder->billing['name'], ' ') + 1);
         } else {
             $pOrder->info['cc_number'] = $this->cc_number;
             $pOrder->info['cc_expires'] = $this->cc_expires;
             $pOrder->info['cc_type'] = $this->cc_type;
             $pOrder->info['cc_owner'] = $this->cc_owner;
             $pOrder->info['cc_cvv'] = $this->cc_cvv;
             // Calculate the next expected order id
             $this->paymentOrderId = $pOrder->getNextOrderId();
             // orderTotal is in the system DEFAULT_CURRENCY. orderTotal * currency_value = localizedPayment
             $paymentCurrency = BitBase::getParameter($pOrder->info, 'currency', DEFAULT_CURRENCY);
             $paymentNative = $orderTotal;
             $paymentLocalized = $paymentCurrency != DEFAULT_CURRENCY ? $paymentNative * $pOrder->getField('currency_value') : $paymentNative;
         }
         $paymentEmail = BitBase::getParameter($pOrder->customer, 'email_address', $gBitUser->getField('email'));
         $paymentUserId = BitBase::getParameter($pOrder->customer, 'user_id', $gBitUser->getField('user_id'));
         $paymentDecimal = $currencies->get_decimal_places($paymentCurrency);
         /* === Core Credit Card Parameters ===
         
         			All credit card processors accept the basic parameters described in the following table* with one exception: the PayPal processor does not support SWIPE*.
         
         			TENDER	(Required) The method of payment. Values are:
         			- A = Automated clearinghouse (ACH)
         			- C = Credit card
         			- D = Pinless debit
         			- K = Telecheck
         			- P = PayPal
         			Note: If your processor accepts non-decimal currencies, such as, Japanese Yen, include a decimal in the amount you pass to Payflow (use 100.00 not 100). Payflow removes the decimal portion before sending the value to the processor.
         
         			// Not implemented
         
         			RECURRING	(Optional) Identifies the transaction as recurring. It is one of the following values: - Y - Identifies the transaction as recurring. - N - Does not identify the transaction as recurring (default).
         			SWIPE		(Required for card-present transactions only) Used to pass the Track 1 or Track 2 data (card's magnetic stripe information) for card-present transactions. Include either Track 1 or Track 2 data, not both. If Track 1 is physically damaged, the point-of-sale (POS) application can send Track 2 data instead.
         			ORDERID		(Optional) Checks for a duplicate order. If you pass ORDERID in a request and pass it again in the future, the response returns DUPLICATE=2 along with the ORDERID.  Note: Do not use ORDERID to catch duplicate orders processed within seconds of each other. Use ORDERID with Request ID to prevent duplicates as a result of processing or communication errors. * bitcommerce note - this cannot be paymentOrderId as a failed process will block any future transactions
         			*/
         $postFields = array('PWD' => MODULE_PAYMENT_PAYFLOWPRO_PWD, 'USER' => MODULE_PAYMENT_PAYFLOWPRO_LOGIN, 'VENDOR' => MODULE_PAYMENT_PAYFLOWPRO_VENDOR, 'PARTNER' => MODULE_PAYMENT_PAYFLOWPRO_PARTNER, 'VERBOSITY' => 'HIGH', 'TENDER' => 'C', 'REQUEST_ID' => time(), 'STREET' => $pOrder->billing['street_address'], 'ZIP' => $pOrder->billing['postcode'], 'COMMENT1' => 'OrderID: ' . $this->paymentOrderId . ' ' . $paymentEmail . ' (' . $paymentUserId . ')', 'EMAIL' => $paymentEmail, 'NAME' => BitBase::getParameter($pOrder->info, 'cc_owner'), 'BILLTOFIRSTNAME' => $pOrder->billing['firstname'], 'BILLTOLASTNAME' => $pOrder->billing['lastname'], 'BILLTOSTREET' => $pOrder->billing['street_address'], 'BILLTOSTREET2' => $pOrder->billing['suburb'], 'BILLTOCITY' => $pOrder->billing['city'], 'BILLTOSTATE' => $pOrder->billing['state'], 'BILLTOZIP' => $pOrder->billing['postcode'], 'BILLTOCOUNTRY' => $pOrder->billing['country']['countries_iso_code_2'], 'BILLTOPHONENUM' => $pOrder->billing['telephone'], 'SHIPTOFIRSTNAME' => $pOrder->delivery['firstname'], 'SHIPTOLASTNAME' => $pOrder->delivery['lastname'], 'SHIPTOSTREET' => $pOrder->delivery['street_address'], 'SHIPTOCITY' => $pOrder->delivery['city'], 'SHIPTOSTATE' => $pOrder->delivery['state'], 'SHIPTOZIP' => $pOrder->delivery['postcode'], 'SHIPTOCOUNTRY' => $pOrder->delivery['country']['countries_iso_code_2']);
         if ($paymentUserId != $gBitUser->mUserId) {
             $postFields['COMMENT1'] .= ' / ' . $gBitUser->getField('login') . ' (' . $gBitUser->mUserId . ')';
         }
         if (!empty($pPaymentParameters['cc_ref_id'])) {
             $postFields['ORIGID'] = $pPaymentParameters['cc_ref_id'];
             $postFields['COMMENT2'] = 'Reference Trans for ' . $postFields['ORIGID'];
             //	(Optional) Merchant-defined value for reporting and auditing purposes.  Limitations: 128 alphanumeric characters
         } else {
             $postFields['ACCT'] = $pOrder->info['cc_number'];
             // (Required for credit cards) Credit card or purchase card number. For example, ACCT=5555555555554444. For the pinless debit TENDER type, ACCT can be the bank account number.
             $postFields['CVV2'] = $pOrder->getField('cc_cvv');
             // (Optional) A code printed (not imprinted) on the back of a credit card. Used as partial assurance that the card is in the buyer's possession.  Limitations: 3 or 4 digits
             $postFields['EXPDATE'] = $pOrder->info['cc_expires'];
             // (Required) Expiration date of the credit card. For example, 1215 represents December 2015.
             $postFields['INVNUM'] = $this->paymentOrderId;
             // (Optional) Your own unique invoice or tracking number.
             $postFields['FREIGHTAMT'] = $pOrder->info['shipping_cost'];
             // 	(Optional) Total shipping costs for this order.  Nine numeric characters plus decimal.
         }
         /*
         TRXTYPE	(Required) Indicates the type of transaction to perform. Values are:
         - A = Authorization
         - B = Balance Inquiry
         - C = Credit (Refund)
         - D = Delayed Capture
         - F = Voice Authorization
         - I = Inquiry
         - K = Rate Lookup
         - L = Data Upload
         - N = Duplicate Transaction Note: A type N transaction represents a duplicate transaction (version 4 SDK or HTTPS interface only) with a PNREF that is the same as the original. It appears only in the PayPal Manager user interface and never settles.
         - S = Sale 
         - V = Void
         */
         // Assume we are charging the native amount in the default currency. Some gateways support multiple currencies, check for that shortly
         if (DEFAULT_CURRENCY != $this->getProcessorCurrency() && $paymentCurrency == DEFAULT_CURRENCY) {
             global $currencies;
             // weird situtation where payflow currency default is different from the site. Need to convert site native to processor native
             $paymentNative = $currencies->convert($paymentNative, $this->getProcessorCurrency(), $paymentCurrency);
             bit_error_email('PAYMENT WARNING on ' . php_uname('n') . ': mismatch Payflow currency ' . $this->getProcessorCurrency() . ' != Default Currency ' . DEFAULT_CURRENCY, bit_error_string(), array());
         }
         $paymentAmount = $paymentNative;
         $postFields['CURRENCY'] = $this->getProcessorCurrency();
         if ($this->cc_type == 'American Express') {
             // TODO American Express Additional Credit Card Parameters
         }
         $processors = static::getProcessors();
         switch ($gCommerceSystem->getConfig('MODULE_PAYMENT_PAYFLOWPRO_PROCESSOR')) {
             case 'Cielo Payments':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'Elavon':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'First Data Merchant Services Nashville':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'First Data Merchant Services North':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'Heartland':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'Litle':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'Paymentech Salem New Hampshire':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'PayPal':
                 if ($gCommerceSystem->isConfigActive('MODULE_PAYMENT_PAYFLOWPRO_MULTI_CURRENCY')) {
                     switch ($paymentCurrency) {
                         // PayPal supports charging natively in these 5 currencies
                         case 'AUD':
                             // Australian dollar
                         // Australian dollar
                         case 'CAD':
                             // Canadian dollar
                         // Canadian dollar
                         case 'EUR':
                             // Euro
                         // Euro
                         case 'GBP':
                             // British pound
                         // British pound
                         case 'JPY':
                             // Japanese Yen
                         // Japanese Yen
                         case 'USD':
                             // US dollar
                             if ($paymentCurrency != $postFields['CURRENCY']) {
                                 $paymentAmount = number_format($paymentLocalized, $paymentDecimal, '.', '');
                                 $postFields['CURRENCY'] = strtoupper($paymentCurrency);
                             }
                             break;
                         default:
                             // all other currencies to gateway default
                             break;
                     }
                 }
                 $postFields['CUSTIP'] = $_SERVER['REMOTE_ADDR'];
                 // (Optional) IP address of payer's browser as recorded in its HTTP request to your website. This value is optional but recommended.  Note: PayPal records this IP address as a means to detect possible fraud.  Limitations: 15-character string in dotted quad format: xxx.xxx.xxx.xxx
                 //$postFields['MERCHDESCR'] = ''; //	(Optional) Information that is usually displayed in the account holder's statement, for example, <Your-Not-For-Profit> <State>, <Your-Not-For-Profit> <Branch-Name>, <Your-Website> dues or <Your-Website> list fee.  Character length and limitations: 23 alphanumeric characters, can include the special characters dash (-) and dot (.) only. Asterisks (*) are NOT permitted. If it includes a space character (), enclose the "<Soft-Descriptor>" value in double quotes.
                 $postFields['MERCHANTCITY'] = substr($_SERVER['SERVER_NAME'], 0, 21);
                 //	(Optional) A unique phone number, email address or URL, which is displayed on the account holder's statement. PayPal recommends passing a toll-free phone number because, typically, this is the easiest way for a buyer to contact the seller in the case of an inquiry.
                 /* === PayPal Specific Parameters
                 
                 					Note: You must set CURRENCY to one of the three-character currency codes for any of the supported PayPal currencies. See CURRENCY in this table for details.
                 					Limitations: Nine numeric characters plus decimal (.) character. No currency symbol. Specify the exact amount to the cent using a decimal point; use 34.00, not 34. Do not include comma separators; use 1199.95 not 1,199.95. Nine numeric characters plus decimal.
                 
                 					* BUTTONSOURCE	(Optional) Identification code for use by third-party applications to identify transactions.  Limitations: 32 alphanumeric characters.
                 					* CAPTURECOMPLETE	(Optional) Indicates if this Delayed Capture transaction is the last capture you intend to make. The values are: - Y (default) - N
                 					Note: If CAPTURECOMPLETE is Y, any remaining amount of the original reauthorized transaction is automatically voided.
                 					Limitations: 12-character alphanumeric string.
                 					* CUSTOM	(Optional) A free-form field for your own use.  Limitations: 256-character alphanumeric string.
                 					Limitations: 127 alphanumeric characters.
                 					* ITEMAMT	(Required if L_COSTn is specified). Sum of cost of all items in this order. 
                 					* ITEMAMT = L_QTY0 * LCOST0 + L_QTY1 * LCOST1 + L_QTYn * L_COSTn 
                 					Limitations: Nine numeric characters plus decimal.
                 					* TAXAMT	(Required if L_TAXAMTn is specified) Sum of tax for all items in this order.
                 					Limitations: Nine numeric characters plus decimal.
                 					* TAXAMT = L_QTY0 * L_TAXAMT0 + L_QTY1 * L_TAXAMT1 + L_QTYn * L_TAXAMTn
                 					* HANDLINGAMT	(Optional) Total handling costs for this order.
                 					Nine numeric characters plus decimal.
                 					* DISCOUNT	(Optional) Shipping discount for this order. Specify the discount as a positive amount.  Limitations: Nine numeric characters plus decimal (.) character. No currency symbol. Specify the exact amount to the cent using a decimal point; use 34.00, not 34. Do not include comma separators; use 1199.95 not 1,199.95.
                 					* INSURANCEAMT	(Optional) Total shipping insurance cost for this order.  Limitations: Nine numeric characters plus decimal (.) character. No currency symbol. Specify the exact amount to the cent using a decimal point; use 34.00, not 34. Do not include comma separators; use 1199.95 not 1,199.95.
                 					* L_NAMEn	(Optional) Line-item name.
                 					Character length and limitations: 36 alphanumeric characters.
                 					* L_DESCn	(Optional) Line-item description of the item purchased such as hiking boots or cooking utensils.
                 					* L_COSTn	(Required if L_QTYn is supplied) Cost of the line item. The line-item unit price must be a positive number and be greater than zero.
                 					Note: You must set CURRENCY to one of the three-character currency codes for any of the supported PayPal currencies. See CURRENCY in this table for details.
                 					Limitations: Nine numeric characters plus decimal (.) character. No currency symbol. Specify the exact amount to the cent using a decimal point; use 34.00, not 34. Do not include comma separators; use 1199.95 not 1,199.95. Nine numeric characters plus decimal.
                 					* L_QTYn	(Required if L_COSTn is supplied) Line-item quantity.
                 					Limitations: 10-character integer.
                 					* L_SKUn	(Optional) Product number. 
                 					Limitations: 18-characters.
                 					* L_TAXAMTn	(Optional) Line-item tax amount.
                 					Limitations: Nine numeric characters plus decimal (.) character. No currency symbol. Specify the exact amount to the cent using a decimal point; use 34.00, not 34. Do not include comma separators; use 1199.95 not 1,199.95.
                 					* MERCHANTSESSIONID	(Optional) Your customer Direct Payment session identification token. PayPal records this session token as an additional means to detect possible fraud.  Limitations: 64 characters.
                 					Character length and limitations: 13 characters including special characters, such as, space, !, ", #, $, %, &, ', (, ), +, -,*, /, :, ;, <, =, >, ?, @, comma and period.
                 
                 					If it includes the space character (), enclose the "<Soft-Descriptor-City>" value in double quotes.
                 
                 					Note: Underscore (_) is an illegal character for this field. If it is passed, then it will be removed leaving the remaining characters in the same order. For example, New_York changes to NewYork.
                 					Added in version 115 of the API.
                 
                 					* NOTIFYURL	(Optional) Your URL for receiving Instant Payment Notification (IPN) about this transaction. If you do not specify NOTIFYURL in the request, the notification URL from your Merchant Profile is used, if one exists.
                 					Limitations: 2048 alphanumeric characters.
                 					* ORDERDESC	(Optional) Description of items the customer is purchasing.
                 					Limitations: 127 alphanumeric characters.
                 					* RECURRINGTYPE	(Optional) Type of transaction occurrence. The values are: - F = First occurrence - S = Subsequent occurrence (default) Limitations: One alpha character.
                 					*/
                 break;
             case 'SecureNet':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'Vantiv':
                 // TODO Additional Credit Card Parameters
                 break;
             case 'WorldPay':
                 // TODO Additional Credit Card Parameters
                 break;
         }
         if (MODULE_PAYMENT_PAYFLOWPRO_TYPE == 'Authorization') {
             $postFields['TRXTYPE'] = 'A';
         } elseif ($paymentAmount > 0) {
             $postFields['TRXTYPE'] = 'S';
         } elseif ($paymentAmount < 0) {
             $postFields['TRXTYPE'] = 'C';
             $paymentAmount = -1.0 * $paymentAmount;
         }
         $postFields['AMT'] = number_format($paymentAmount, $paymentDecimal, '.', '');
         // (Required) Amount (Default: U.S. based currency). Nnumeric characters and a decimal only. The maximum length varies depending on your processor. Specify the exact amount to the cent using a decimal point (use 34.00 not 34). Do not include comma separators (use 1199.95 not 1,199.95). Your processor or Internet Merchant Account provider may stipulate a maximum amount.
         if (MODULE_PAYMENT_PAYFLOWPRO_MODE == 'Test') {
             $url = 'https://pilot-payflowpro.paypal.com';
         } else {
             $url = 'https://payflowpro.paypal.com';
         }
         // request-id must be unique within 30 days
         $requestId = md5(uniqid(mt_rand()));
         $headers[] = 'Content-Type: text/namevalue';
         $headers[] = 'X-VPS-Timeout: 45';
         $headers[] = 'X-VPS-VIT-Client-Type: PHP/cURL';
         $headers[] = 'X-VPS-VIT-Integration-Product: PHP::bitcommerce - Payflow Pro';
         $headers[] = 'X-VPS-VIT-Integration-Version: 1.0';
         $this->lastHeaders = $headers;
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $this->_buildNameValueList($postFields));
         $_curlOptions = array(CURLOPT_HEADER => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 60, CURLOPT_FOLLOWLOCATION => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_FORBID_REUSE => true, CURLOPT_POST => 1);
         foreach ($_curlOptions as $name => $value) {
             curl_setopt($ch, $name, $value);
         }
         $response = curl_exec($ch);
         if ($commError = curl_error($ch)) {
             $this->mErrors['curl_errno'] = curl_errno($ch);
             $this->mErrors['curl_info'] = @curl_getinfo($ch);
             $this->mErrors['process_payment'] = 'CURL ERROR ' . $this->mErrors['curl_errno'];
         }
         curl_close($ch);
         if ($response) {
             $responseHash = $this->_parseNameValueList($response);
             $this->result = NULL;
             $this->pnref = '';
             # Check result
             if (isset($responseHash['PNREF'])) {
                 $this->pnref = $responseHash['PNREF'];
             }
             if (isset($responseHash['RESULT'])) {
                 $this->result = (int) $responseHash['RESULT'];
                 if (BitBase::getParameter($responseHash, 'DUPLICATE') == 2) {
                     $duplicateError = 'Duplicate Order ( ' . $responseHash['ORDERID'] . ' )';
                     $this->mErrors['process_payment'] = $duplicateError;
                     $_SESSION[$this->code . '_error']['number'] = $duplicateError;
                 } elseif ($this->result) {
                     $this->mErrors['process_payment'] = $responseHash['RESPMSG'] . ' (' . $this->result . ')';
                     $_SESSION[$this->code . '_error']['number'] = $responseHash['RESPMSG'];
                 } else {
                     $this->clearSessionDetails();
                 }
             } else {
                 $this->clearSessionDetails();
                 $this->result = 'X';
             }
             $this->response = $response;
         }
     }
     if (count($this->mErrors) == 0 && $this->result === 0) {
         $ret = TRUE;
         $pOrder->info['cc_ref_id'] = $this->getTransactionReference();
         if (!empty($postFields['ACCT']) && MODULE_PAYMENT_PAYFLOWPRO_CARD_PRIVACY == 'True') {
             //replace middle CC num with XXXX
             $pOrder->info['cc_number'] = substr($postFields['ACCT'], 0, 6) . str_repeat('X', strlen($postFields['ACCT']) - 6) . substr($postFields['ACCT'], -4);
         }
     } else {
         foreach (array('PWD', 'USER', 'VENDOR', 'PARTNER', 'CVV2') as $field) {
             if (isset($postFields[$field])) {
                 unset($postFields[$field]);
             }
         }
         if (isset($postFields['ACCT'])) {
             $postFields['ACCT'] = $this->privatizeCard($postFields['ACCT']);
         }
         bit_error_email('PAYMENT ERROR on ' . php_uname('n') . ': ' . BitBase::getParameter($this->mErrors, 'process_payment'), bit_error_string(), array('mErrors' => $this->mErrors, 'CURL' => $postFields, 'RESPONSE' => $responseHash));
         $this->mDb->RollbackTrans();
         $messageStack->add_session('checkout_payment', tra('There has been an error processing your payment, please try again.') . '<br/>' . BitBase::getParameter($responseHash, 'RESPMSG'), 'error');
         $ret = FALSE;
     }
     $this->logTransaction($responseHash, $pOrder);
     return $ret;
 }
コード例 #11
0
ファイル: referrers.php プロジェクト: bitweaver/stats
                if (!empty($adUrl['query'])) {
                    $adParams = array();
                    parse_str($adUrl['query'], $adParams);
                    foreach ($adParams as $key => $value) {
                        computeStats($aggregateStats, $k, $key, $value, $revenue, $referers[$k][$r]);
                    }
                } else {
                    $key = 'Paid';
                    $value = $adUrl['path'];
                    computeStats($aggregateStats, $k, $key, $value, $revenue, $referers[$k][$r]);
                }
            } else {
                // bing paid query
                foreach (array('pq' => 'Paid', 'q' => 'Organic', 'p' => 'Organic', 'unknown' => 'Unknown') as $key => $title) {
                    if ($key == 'unknown' || isset($urlParams[$key])) {
                        $value = BitBase::getParameter($urlParams, $key, 'unknown');
                        computeStats($aggregateStats, $k, $title, $value, $revenue, $referers[$k][$r]);
                        break;
                    }
                }
            }
        }
        if (!empty($revenue['total_orders'])) {
            @($aggregateStats[$k]['revenue'] += $revenue['total_revenue']);
            @($aggregateStats[$k]['orders'] += $revenue['total_orders']);
        }
    }
}
function computeStats(&$aggregateStats, $k, $key, $value, $revenue, $userHash)
{
    if (!empty($revenue['total_orders'])) {
コード例 #12
0
ファイル: CommerceOrder.php プロジェクト: bitweaver/commerce
 function getFormattedAddress($pAddressHash, $pBreak = '<br>')
 {
     $ret = '';
     if ($this->isValid()) {
         $ret = zen_address_format(BitBase::getParameter($this->{$pAddressHash}, 'format_id', 2), $this->{$pAddressHash}, 1, '', $pBreak);
     }
     return $ret;
 }
コード例 #13
0
                    $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
                    break;
                case 'PRODUCT_LIST_QUANTITY':
                    $lc_align = 'right';
                    $lc_text = '&nbsp;' . $listing->fields['products_quantity'] . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_WEIGHT':
                    $lc_align = 'right';
                    $lc_text = '&nbsp;' . $listing->fields['products_weight'] . '&nbsp;';
                    break;
                case 'PRODUCT_LIST_IMAGE':
                    $lc_align = 'center';
                    if (isset($_GET['manufacturers_id'])) {
                        $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(CommerceProduct::getImageUrlFromHash($listing->fields['products_id'], 'avatar'), $listing->fields['products_name']) . '</a>';
                    } else {
                        $typeClass = BitBase::getParameter($listing->fields, 'type_class', 'CommerceProduct');
                        if (!empty($listing->fields['type_class_file']) && file_exists(BIT_ROOT_PATH . $listing->fields['type_class_file'])) {
                            require_once BIT_ROOT_PATH . $listing->fields['type_class_file'];
                        }
                        if ($thumbnail = $typeClass::getImageUrlFromHash($listing->fields['products_id'], 'avatar')) {
                            $lc_text = '<a href="' . CommerceProduct::getDisplayUrlFromId($listing->fields['products_id']) . '">' . zen_image($thumbnail, $listing->fields['products_name']) . '</a>';
                        }
                    }
                    break;
            }
            $list_box_contents[$rows][$col] = array('align' => $lc_align, 'params' => 'class="data"', 'text' => $lc_text);
        }
        $listing->MoveNext();
    }
    $error_categories = false;
} else {
コード例 #14
0
ファイル: FisheyeImage.php プロジェクト: bitweaver/fisheye
 function getStoragePath($pParamHash, $pRootDir = NULL)
 {
     $pParamHash['sub_dir'] = liberty_mime_get_storage_sub_dir_name(array('type' => BitBase::getParameter($pParamHash, 'mime_type', $this->getField('mime_type')), 'name' => BitBase::getParameter($pParamHash, 'file_name', $this->getField('file_name'))));
     $pParamHash['user_id'] = $this->getParameter($pParamHash, 'user_id', $this->getField('user_id'));
     return parent::getStoragePath($pParamHash) . $this->getParameter($pParamHash, 'attachment_id', $this->getField('attachment_id')) . '/';
 }
コード例 #15
0
ファイル: revenue.php プロジェクト: bitweaver/commerce
    $statsByOption = $stats->getRevenueByOption($_REQUEST);
    foreach ($statsByOption as $stat) {
        @($statsByOptionTotalUnits[$stat['products_options_id']] += $stat['total_units']);
    }
    $gBitSmarty->assign('statsByOption', $statsByOption);
    $gBitSmarty->assign('statsByOptionTotalUnits', $statsByOptionTotalUnits);
    $gBitSmarty->assign('statsCustomers', $stats->getCustomerConversions($_REQUEST));
    $gBitSmarty->assign('valuableInterests', $stats->getMostValuableInterests($_REQUEST));
    $gBitSmarty->assign('valuableCustomers', $stats->getMostValuableCustomers($_REQUEST));
    $gBitSystem->display('bitpackage:bitcommerce/admin_revenue_timeframe.tpl', 'Revenue By Timeframe', array('display_mode' => 'admin'));
} else {
    $listHash['max_records'] = -1;
    $revStats = $stats->getAggregateRevenue($listHash);
    $gBitSmarty->assign('stats', $revStats);
    if (BitBase::getParameter($_REQUEST, 'display') == 'matrix') {
        switch (BitBase::getParameter($_REQUEST, 'period')) {
            case 'Y-':
                $headers = array('');
                break;
            case 'Y-\\QQ':
                $headers = array('Q1', 'Q2', 'Q3', 'Q4');
                break;
            case 'Y-m':
                $headers = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
                break;
            case 'Y-\\WeekW':
            default:
                for ($i = 1; $i <= 53; $i++) {
                    $headers[] = 'Week' . str_pad($i, 2, '0', STR_PAD_LEFT);
                }
                break;
コード例 #16
0
ファイル: address_book.php プロジェクト: bitweaver/commerce
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
if (!$gBitUser->isRegistered()) {
    $_SESSION['navigation']->set_snapshot();
    zen_redirect(FILENAME_LOGIN);
}
require_once DIR_FS_MODULES . 'require_languages.php';
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
if ($addresses = CommerceCustomer::getAddressesFromId($_SESSION['customer_id'])) {
    $gBitSmarty->assign('addresses', $addresses);
}
$redirectPage = BitBase::getParameter($_REQUEST, 'return_page', FILENAME_ADDRESS_BOOK);
// error checking when updating or adding an entry
if (isset($_POST['action']) && ($_POST['action'] == 'process' || $_POST['action'] == 'update') || isset($_POST['save_address'])) {
    if ($gBitCustomer->storeAddress($_REQUEST)) {
        $messageStack->add_session('addressbook', 'Your address book has been successfully updated.', 'success');
        zen_redirect(zen_href_link($redirectPage, '', 'SSL'));
    } else {
        $gBitSmarty->assign('addressErrors', $gBitCustomer->mErrors);
    }
} elseif (isset($_REQUEST['delete']) && is_numeric($_REQUEST['delete'])) {
    if (isset($_REQUEST["confirm"])) {
        $gBitCustomer->expungeAddress($_REQUEST['delete']);
        $messageStack->add_session('addressbook', 'The selected address has been successfully removed from your address book.', 'success');
        zen_redirect(zen_href_link($redirectPage, '', 'SSL'));
    } else {
        $formHash['main_page'] = 'address_book';
コード例 #17
0
ファイル: orders_status.php プロジェクト: bitweaver/commerce
switch ($action) {
    case 'new':
        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_ORDERS_STATUS . '</b>');
        $contents = array('form' => zen_draw_form_admin('status', FILENAME_ORDERS_STATUS, 'page=' . $_GET['page'] . '&action=insert'));
        $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
        $orders_status_inputs_string = '';
        $languages = zen_get_languages();
        for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
            $orders_status_inputs_string .= '
			<div class="input-group">
				' . zen_draw_input_field('orders_status_name[' . $languages[$i]['id'] . ']') . '
				<span class="input-group-addon">' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '</span>
			</div>';
        }
        $contents[] = array('text' => '<label>' . tra(TEXT_INFO_ORDERS_STATUS_NAME) . '</label>' . $orders_status_inputs_string);
        $contents[] = array('text' => '<label>' . tra('Status ID') . '</label>' . zen_draw_input_field('orders_status_id', (int) BitBase::getParameter($_REQUEST, 'orders_status_id'), NULL, 'number'));
        $contents[] = array('text' => zen_draw_selection_field(array('type' => 'checkbox', 'name' => 'default', 'label' => TEXT_SET_DEFAULT)));
        $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . ' <a href="' . zen_href_link_admin(FILENAME_ORDERS_STATUS, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
        break;
    case 'edit':
        $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_ORDERS_STATUS . '</b>');
        $contents = array('form' => zen_draw_form_admin('status', FILENAME_ORDERS_STATUS, 'page=' . $_GET['page'] . '&orders_status_id=' . $oInfo->orders_status_id . '&action=save'));
        $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
        $orders_status_inputs_string = '';
        $languages = zen_get_languages();
        for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
            $orders_status_inputs_string .= '<div class="input-group">
					' . zen_draw_input_field('orders_status_name[' . $languages[$i]['id'] . ']', zen_get_orders_status_name($oInfo->orders_status_id, $languages[$i]['id'])) . '
					<span class="input-group-addon">' . zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '</span>
				</div>';
        }
コード例 #18
0
ファイル: BitBase.php プロジェクト: bitweaver/kernel
 public static function getCacheUuidFromKey($pCacheUuid = '', $pContentTypeGuid = NULL)
 {
     global $gBitDbName, $gBitDbHost;
     $ret = BitBase::getParameter($_SERVER, 'HTTP_HOST', 'unknown') . ':' . $gBitDbName . '@' . $gBitDbHost . ':' . ($pContentTypeGuid ? $pContentTypeGuid : static::getCacheClass()) . '#' . $pCacheUuid;
     return $ret;
 }
コード例 #19
0
 function quote($pShipHash = array())
 {
     /* FedEx integration starts */
     global $gBitCustomer, $order;
     require_once dirname(__FILE__) . '/fedex-common.php5';
     ini_set("soap.wsdl_cache_enabled", "0");
     $shippingWeight = !empty($pShipHash['shipping_weight']) && $pShipHash['shipping_weight'] > 1 ? $pShipHash['shipping_weight'] : 1;
     $shippingNumBoxes = !empty($pShipHash['shipping_num_boxes']) ? $pShipHash['shipping_num_boxes'] : 1;
     $client = new SoapClient(dirname(__FILE__) . "/RateService_v10.wsdl", array('trace' => 1));
     $this->types = array();
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY == 'true') {
         $this->types['INTERNATIONAL_PRIORITY'] = array('code' => 'FEDEX_INTERNATIONAL_PRIORITY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
         $this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('code' => 'FEDEX_EUROPE_FIRST_INTERNATIONAL_PRIORITY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_ECONOMY == 'true') {
         $this->types['INTERNATIONAL_ECONOMY'] = array('code' => 'FEDEX_INTERNATIONAL_ECONOMY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_STANDARD_OVERNIGHT == 'true') {
         $this->types['STANDARD_OVERNIGHT'] = array('code' => 'FEDEX_STANDARD_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FIRST_OVERNIGHT == 'true') {
         $this->types['FIRST_OVERNIGHT'] = array('code' => 'FEDEX_FIRST_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_PRIORITY_OVERNIGHT == 'true') {
         $this->types['PRIORITY_OVERNIGHT'] = array('code' => 'FEDEX_PRIORITY_OVERNIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_2DAY == 'true') {
         $this->types['FEDEX_2_DAY'] = array('code' => 'FEDEX_2_DAY', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     // because FEDEX_GROUND also is returned for Canadian Addresses, we need to check if the country matches the store country and whether international ground is enabled
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND == 'true' && $order->delivery['country']['countries_id'] == STORE_COUNTRY || MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND == 'true' && $order->delivery['country']['countries_id'] != STORE_COUNTRY && MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
         $this->types['FEDEX_GROUND'] = array('code' => 'FEDEX_GROUND', 'icon' => '', 'handling_fee' => $order->delivery['country']['countries_id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
         $this->types['GROUND_HOME_DELIVERY'] = array('code' => 'FEDEX_GROUND_HOME_DELIVERY', 'icon' => '', 'handling_fee' => $order->delivery['country']['countries_id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
         $this->types['INTERNATIONAL_GROUND'] = array('code' => 'FEDEX_INTERNATIONAL_GROUND', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_SAVER == 'true') {
         $this->types['FEDEX_EXPRESS_SAVER'] = array('code' => 'FEDEX_EXPRESS_SAVER', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT == 'true') {
         $this->types['FEDEX_FREIGHT'] = array('code' => 'FEDEX_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_NATIONAL_FREIGHT'] = array('code' => 'FEDEX_NATIONAL_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_1_DAY_FREIGHT'] = array('code' => 'FEDEX_1_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_2_DAY_FREIGHT'] = array('code' => 'FEDEX_2_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['FEDEX_3_DAY_FREIGHT'] = array('code' => 'FEDEX_3_DAY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
         $this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('code' => 'FEDEX_INTERNATIONAL_ECONOMY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
         $this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('code' => 'FEDEX_INTERNATIONAL_PRIORITY_FREIGHT', 'icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
     }
     // customer details
     $street_address = !empty($order->delivery['street_address']) ? $order->delivery['street_address'] : '';
     $street_address2 = !empty($order->delivery['suburb']) ? $order->delivery['suburb'] : '';
     $city = !empty($order->delivery['city']) ? $order->delivery['city'] : '';
     if ($stateLookup = BitBase::getParameter($order->delivery, 'zone_id', BitBase::getParameter($order->delivery, 'state'))) {
         $stateCode = zen_get_zone_code($order->delivery['country']['countries_id'], $stateLookup, '');
         if ($stateCode == "QC") {
             $stateCode = "PQ";
             // is this needed? been here forever
         }
     }
     $postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']);
     $country_id = $order->delivery['country']['countries_iso_code_2'];
     if (is_object($order)) {
         $totals = $order->subtotal;
     } elseif (is_object($gBitCustomer->mCart)) {
         $totals = $gBitCustomer->mCart->show_total();
     }
     $this->_setInsuranceValue($totals);
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY, 'Password' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD));
     $request['ClientDetail'] = array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'MeterNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM);
     $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v10 using PHP ***');
     $request['Version'] = array('ServiceId' => 'crs', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0');
     $request['ReturnTransitAndCommit'] = true;
     $request['RequestedShipment']['DropoffType'] = $this->_setDropOff();
     // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
     $request['RequestedShipment']['ShipTimestamp'] = date('c');
     //if (zen_not_null($method) && in_array($method, $this->types)) {
     //$request['RequestedShipment']['ServiceType'] = $method; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
     //}
     $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
     // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
     $request['RequestedShipment']['TotalInsuredValue'] = array('Amount' => $this->insurance, 'Currency' => DEFAULT_CURRENCY);
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_KEY, 'Password' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_PWD));
     $request['ClientDetail'] = array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'MeterNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_METER_NUM);
     $request['RequestedShipment']['Shipper'] = array('Address' => array('StreetLines' => array(MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_1, MODULE_SHIPPING_FEDEX_WEB_SERVICES_ADDRESS_2), 'City' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_CITY, 'StateOrProvinceCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_STATE, 'PostalCode' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_POSTAL, 'CountryCode' => $this->country));
     $request['RequestedShipment']['Recipient'] = array('Address' => array('StreetLines' => array(utf8_encode($street_address), utf8_encode($street_address2)), 'City' => utf8_encode($city), 'PostalCode' => $postcode, 'CountryCode' => $country_id, 'Residential' => empty($order->delivery['company'])));
     //customer county code
     if (!empty($stateCode) && in_array($country_id, array('US', 'CA'))) {
         $request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $stateCode;
     }
     $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_ACT_NUM, 'CountryCode' => $this->country));
     $request['RequestedShipment']['RateRequestTypes'] = 'LIST';
     $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
     $request['RequestedShipment']['RequestedPackageLineItems'] = array();
     $dimensions_failed = false;
     // check for ready to ship field
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_READY_TO_SHIP == 'true') {
         // Not fixed for bitcommerce
         $products = $gBitCustomer->mCart->get_products();
         $packages = array('default' => 0);
         $new_shipping_num_boxes = 0;
         foreach ($products as $product) {
             $dimensions_query = "SELECT products_length, products_width, products_height, products_ready_to_ship, products_dim_type FROM " . TABLE_PRODUCTS . " \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE products_id = " . (int) $product['id'] . " \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t AND products_length > 0 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t AND products_width > 0\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t AND products_height > 0 \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t LIMIT 1;";
             $dimensions = $this->mDb->query($dimensions_query);
             if ($dimensions->RecordCount() > 0 && $dimensions->fields['products_ready_to_ship'] == 1) {
                 for ($i = 1; $i <= $product['quantity']; $i++) {
                     $packages[] = array('weight' => $product['weight'], 'length' => $dimensions->fields['products_length'], 'width' => $dimensions->fields['products_width'], 'height' => $dimensions->fields['products_height'], 'units' => strtoupper($dimensions->fields['products_dim_type']));
                 }
             } else {
                 $packages['default'] += $product['weight'] * $product['quantity'];
             }
         }
         if (count($packages) > 1) {
             $za_tare_array = preg_split("/[:,]/", SHIPPING_BOX_WEIGHT);
             $zc_tare_percent = $za_tare_array[0];
             $zc_tare_weight = $za_tare_array[1];
             $za_large_array = preg_split("/[:,]/", SHIPPING_BOX_PADDING);
             $zc_large_percent = $za_large_array[0];
             $zc_large_weight = $za_large_array[1];
         }
         foreach ($packages as $id => $values) {
             if ($id === 'default') {
                 // divide the weight by the max amount to be shipped (can be done inside loop as this occurance should only ever happen once
                 // note $values is not an array
                 if ($values == 0) {
                     continue;
                 }
                 $shippingNumBoxes = ceil((double) $values / (double) SHIPPING_MAX_WEIGHT);
                 if ($shippingNumBoxes < 1) {
                     $shippingNumBoxes = 1;
                 }
                 $shippingWeight = round((double) $values / $shippingNumBoxes, 2);
                 // 2 decimal places max
                 for ($i = 0; $i < $shippingNumBoxes; $i++) {
                     $new_shipping_num_boxes++;
                     if (SHIPPING_MAX_WEIGHT <= $shippingWeight) {
                         $shippingWeight = $shippingWeight + $shippingWeight * ($zc_large_percent / 100) + $zc_large_weight;
                     } else {
                         $shippingWeight = $shippingWeight + $shippingWeight * ($zc_tare_percent / 100) + $zc_tare_weight;
                     }
                     if ($shippingWeight <= 0) {
                         $shippingWeight = 0.1;
                     }
                     $new_shipping_weight += $shippingWeight;
                     $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shippingWeight, 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT), 'GroupPackageCount' => 1);
                 }
             } else {
                 // note $values is an array
                 $new_shipping_num_boxes++;
                 if ($values['weight'] <= 0) {
                     $values['weight'] = 0.1;
                 }
                 $new_shipping_weight += $values['weight'];
                 $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $values['weight'], 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT), 'Dimensions' => array('Length' => $values['length'], 'Width' => $values['width'], 'Height' => $values['height'], 'Units' => $values['units']), 'GroupPackageCount' => 1);
             }
         }
         $shippingNumBoxes = $new_shipping_num_boxes;
         $shippingWeight = round($new_shipping_weight / $shippingNumBoxes, 2);
     } else {
         if ($shippingWeight == 0) {
             $shippingWeight = 0.1;
         }
         for ($i = 0; $i < $shippingNumBoxes; $i++) {
             $request['RequestedShipment']['RequestedPackageLineItems'][] = array('Weight' => array('Value' => $shippingWeight, 'Units' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_WEIGHT), 'GroupPackageCount' => 1);
         }
     }
     $request['RequestedShipment']['PackageCount'] = $shippingNumBoxes;
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SATURDAY == 'true') {
         $request['RequestedShipment']['ServiceOptionType'] = 'SATURDAY_DELIVERY';
     }
     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION >= 0 && $totals >= MODULE_SHIPPING_FEDEX_WEB_SERVICES_SIGNATURE_OPTION) {
         $request['RequestedShipment']['SpecialServicesRequested'] = 'SIGNATURE_OPTION';
     }
     try {
         $response = $client->getRates($request);
         if (!empty($response) && ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR' && !empty($response->RateReplyDetails))) {
             if (is_object($response->RateReplyDetails)) {
                 $response->RateReplyDetails = get_object_vars($response->RateReplyDetails);
             }
             //echo '<pre>';
             //print_r($response->RateReplyDetails);
             //echo '</pre>';
             switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
                 case 0:
                     $show_box_weight = '';
                     break;
                 case 1:
                     $show_box_weight = ' (' . $shippingNumBoxes . ' ' . TEXT_SHIPPING_BOXES . ')';
                     break;
                 case 2:
                     $show_box_weight = ' (' . number_format($shippingWeight * $shippingNumBoxes, 2) . tra('lbs') . ')';
                     break;
                 default:
                     $show_box_weight = ' (' . $shippingNumBoxes . ' x ' . number_format($shippingWeight, 2) . tra('lbs') . ')';
                     break;
             }
             $this->quotes = array('id' => $this->code, 'module' => $this->title, 'info' => $this->info(), 'weight' => $show_box_weight);
             $methods = array();
             foreach ($response->RateReplyDetails as $rateReply) {
                 if (array_key_exists($rateReply->ServiceType, $this->types) && (empty($pShipHash['method']) || str_replace('_', '', $rateReply->ServiceType) == $pShipHash['method'])) {
                     $cost = NULL;
                     if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_RATES == 'LIST') {
                         foreach ($rateReply->RatedShipmentDetails as $ShipmentRateDetail) {
                             if ($ShipmentRateDetail->ShipmentRateDetail->RateType == 'PAYOR_LIST_PACKAGE') {
                                 $cost = $ShipmentRateDetail->ShipmentRateDetail->TotalNetCharge->Amount;
                                 $cost = (double) round(preg_replace('/[^0-9.]/', '', $cost), 2);
                             }
                         }
                     } else {
                         $cost = $rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
                         $cost = (double) round(preg_replace('/[^0-9.]/', '', $cost), 2);
                     }
                     $methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType), 'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType))), 'cost' => $cost + (strpos($this->types[$rateReply->ServiceType]['handling_fee'], '%') ? $cost * (double) $this->types[$rateReply->ServiceType]['handling_fee'] / 100 : (double) $this->types[$rateReply->ServiceType]['handling_fee']), 'code' => $this->types[$rateReply->ServiceType]['code']);
                 }
             }
             $this->quotes['methods'] = $methods;
             if ($this->tax_class > 0) {
                 $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['countries_id'], $order->delivery['zone_id']);
             }
         } else {
             $message = '';
             if (is_array($response->Notifications)) {
                 foreach ($response->Notifications as $notification) {
                     $message .= tra($notification->Severity) . ': ' . tra($notification->Message);
                 }
             } elseif (is_object($response->Notifications)) {
                 $message .= tra($response->Notifications->Severity) . ': ' . tra($response->Notifications->Message);
             }
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
     }
     if (!empty($message)) {
         $this->quotes = array('module' => $this->title, 'error' => $message);
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = $this->icon;
     }
     return $this->quotes;
 }
コード例 #20
0
ファイル: configuration.php プロジェクト: bitweaver/commerce
// +----------------------------------------------------------------------+
//	$Id$
//
$pageTitle = 'Configuration Settings';
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (!empty($action)) {
    switch ($action) {
        case 'save':
            $cID = zen_db_prepare_input($_GET['cID']);
            $gCommerceSystem->storeConfigId($cID, $_POST['configuration_value']);
            zen_redirect(zen_href_link_admin(FILENAME_CONFIGURATION, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
            break;
    }
}
$gID = BitBase::getParameter($_GET, 'gID', 1);
$_GET['gID'] = $gID;
if ($cfgGroupTitle = $gBitDb->getOne("SELECT `configuration_group_title` FROM " . TABLE_CONFIGURATION_GROUP . " WHERE `configuration_group_id` = ?", (int) $gID)) {
    $pageTitle .= ': ' . tra($cfgGroupTitle);
}
define('HEADING_TITLE', $pageTitle);
if ($gID == 7) {
    $shipping_errors = '';
    if (zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == 'NONE' or zen_get_configuration_key_value('SHIPPING_ORIGIN_ZIP') == '') {
        $shipping_errors .= '<br />' . ERROR_SHIPPING_ORIGIN_ZIP;
    }
    if (zen_get_configuration_key_value('ORDER_WEIGHT_ZERO_STATUS') == '1' and !defined('MODULE_SHIPPING_FREESHIPPER_STATUS')) {
        $shipping_errors .= '<br />' . ERROR_ORDER_WEIGHT_ZERO_STATUS;
    }
    if (defined('MODULE_SHIPPING_USPS_STATUS') and (MODULE_SHIPPING_USPS_USERID == 'NONE' or MODULE_SHIPPING_USPS_PASSWORD == 'NONE' or MODULE_SHIPPING_USPS_SERVER == 'test')) {
        $shipping_errors .= '<br />' . ERROR_USPS_STATUS;
コード例 #21
0
ファイル: mod_currencies.php プロジェクト: bitweaver/commerce
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id$
//
global $gBitDb, $gCommerceSystem, $gBitProduct, $currencies;
if (empty($gCommerceSystem)) {
    require_once BITCOMMERCE_PKG_PATH . 'includes/bitcommerce_start_inc.php';
}
// test if box should display
$show_currencies = false;
if (substr(basename($_SERVER['SCRIPT_NAME']), 0, 8) != 'checkout') {
    $show_currencies = true;
}
if ($show_currencies == true) {
    if (isset($currencies) && is_object($currencies)) {
        reset($currencies->currencies);
        $currenciesHash = array();
        while (list($key, $value) = each($currencies->currencies)) {
            $currenciesHash[$key] = $value['title'];
        }
        $_template->tpl_vars['modCurrencies'] = new Smarty_variable($currenciesHash);
        $_template->tpl_vars['modSelectedCurrency'] = new Smarty_variable(BitBase::getParameter($_SESSION, 'currency', DEFAULT_CURRENCY));
        if (empty($moduleTitle)) {
            $_template->tpl_vars['moduleTitle'] = new Smarty_variable('Currencies');
        }
    }
}
コード例 #22
0
ファイル: customers.php プロジェクト: bitweaver/commerce
// | http://www.zen-cart.com/license/2_0.txt.														 |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to			 |
// | license@zen-cart.com so we can mail you a copy immediately.					|
// +----------------------------------------------------------------------+
//	$Id$
//
require 'includes/application_top.php';
require BITCOMMERCE_PKG_PATH . 'classes/CommerceStatistics.php';
if (empty($_GET['list_order'])) {
    $_GET['list_order'] = '';
}
$currencies = new currencies();
$error = false;
$processed = false;
if (BitBase::getParameter($_GET, 'user_id')) {
    switch ($action) {
        case 'status':
            if ($_GET['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) {
                $sql = "update " . TABLE_CUSTOMERS . " set `customers_authorization`=0 where `customers_id`='" . $_GET['user_id'] . "'";
            } else {
                $sql = "update " . TABLE_CUSTOMERS . " set `customers_authorization`='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where `customers_id`='" . $_GET['user_id'] . "'";
            }
            $gBitDb->Execute($sql);
            $action = '';
            zen_redirect(zen_href_link_admin(FILENAME_CUSTOMERS, 'user_id=' . $_GET['user_id'] . '&page=' . $_GET['page'], 'NONSSL'));
            break;
        case 'update':
            $customers_id = zen_db_prepare_input($_GET['user_id']);
            $customers_firstname = zen_db_prepare_input($_POST['customers_firstname']);
            $customers_lastname = zen_db_prepare_input($_POST['customers_lastname']);