本文整理汇总了PHP中tep_get_zone_code函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_get_zone_code函数的具体用法?PHP tep_get_zone_code怎么用?PHP tep_get_zone_code使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_get_zone_code函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
protected function index()
{
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
if (!$this->config->get('paypal_express_test')) {
$this->data['action'] = 'https://www.paypal_express.com/cgi-bin/webscr';
} else {
$this->data['action'] = 'https://www.sandbox.paypal_express.com/cgi-bin/webscr';
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
$order->info['comments'] = $comments;
}
}
if (MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER == 'Live') {
$api_url = 'https://api-3t.paypal.com/nvp';
} else {
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
$params = array('USER' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME, 'PWD' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD, 'VERSION' => '3.2', 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE, 'METHOD' => 'DoExpressCheckoutPayment', 'TOKEN' => $ppe_token, 'PAYMENTACTION' => MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale' ? 'Sale' : 'Authorization', 'PAYERID' => $ppe_payerid, 'AMT' => $this->format_raw($order->info['total']), 'CURRENCYCODE' => $order->info['currency'], 'BUTTONSOURCE' => 'osCommerce22_Default_EC');
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '=' . urlencode(trim($value)) . '&';
}
$post_string = substr($post_string, 0, -1);
$response = $this->sendTransactionToGateway($api_url, $post_string);
$response_array = array();
parse_str($response, $response_array);
if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
$this->data['back'] = $this->url->https('checkout/payment');
$this->id = 'payment';
$this->template = $this->config->get('config_template') . 'payment/paypal_express.tpl';
$this->render();
}
示例2: index
protected function index()
{
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
if (!$this->config->get('pp_express_test')) {
$this->data['action'] = 'https://www.pp_express.com/cgi-bin/webscr';
} else {
$this->data['action'] = 'https://www.sandbox.pp_express.com/cgi-bin/webscr';
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if (!$this->config->get('pp_direct_test')) {
$api_endpoint = 'https://api-3t.pp.com/nvp';
} else {
$api_endpoint = 'https://api-3t.sandbox.pp.com/nvp';
}
$payment_data = array('USER' => $this->config->get('pp_direct_username'), 'PWD' => $this->config->get('pp_direct_password'), 'VERSION' => '3.2', 'SIGNATURE' => $this->config->get('pp_direct_signature'), 'METHOD' => 'DoExpressCheckoutPayment', 'TOKEN' => $ppe_token, 'PAYMENTACTION' => MODULE_PAYMENT_pp_EXPRESS_TRANSACTION_METHOD == 'Sale' ? 'Sale' : 'Authorization', 'PAYERID' => $ppe_payerid, 'AMT' => $this->format_raw($order->info['total']), 'CURRENCYCODE' => $order->info['currency'], 'BUTTONSOURCE' => 'osCommerce22_Default_EC');
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '=' . urlencode(trim($value)) . '&';
}
$post_string = substr($post_string, 0, -1);
$response = $this->sendTransactionToGateway($api_url, $post_string);
$response_array = array();
parse_str($response, $response_array);
if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/pp_express.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/pp_express.tpl';
} else {
$this->template = 'default/template/payment/pp_express.tpl';
}
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
示例3: get_paynet_transaction
/**
* Transform OsCommerce order to PaynetEasy order
*
* @param order $oscommerce_order OsCommerce order
* @param string $redirect_url Url for final payment processing
*
* @return PaymentTransaction PaynetEasy transaction
*/
protected function get_paynet_transaction(OsCommerceOrder $oscommerce_order, $redirect_url = null)
{
$oscommerce_customer = $oscommerce_order->customer;
$paynet_transaction = new PaymentTransaction();
$paynet_address = new BillingAddress();
$paynet_payment = new Payment();
$paynet_customer = new Customer();
$query_config = new QueryConfig();
$state_code = tep_get_zone_code($oscommerce_customer['country']['id'], $oscommerce_customer['zone_id'], $oscommerce_customer['state']);
$paynet_address->setCountry($oscommerce_customer['country']['iso_code_2'])->setState($state_code)->setCity($oscommerce_customer['city'])->setFirstLine($oscommerce_customer['street_address'])->setZipCode($oscommerce_customer['postcode'])->setPhone($oscommerce_customer['telephone']);
$paynet_customer->setEmail($oscommerce_customer['email_address'])->setFirstName($oscommerce_customer['firstname'])->setLastName($oscommerce_customer['lastname'])->setIpAddress(tep_get_ip_address());
$paynet_payment->setClientId($oscommerce_order->info['order_id'])->setDescription($this->get_paynet_order_description($oscommerce_order))->setAmount($oscommerce_order->info['total'])->setCurrency($oscommerce_order->info['currency'])->setCustomer($paynet_customer)->setBillingAddress($paynet_address);
if (isset($oscommerce_order->info['paynet_order_id'])) {
$paynet_payment->setPaynetId($oscommerce_order->info['paynet_order_id']);
}
$query_config->setEndPoint((int) MODULE_PAYMENT_PAYNETEASYFORM_END_POINT)->setLogin(MODULE_PAYMENT_PAYNETEASYFORM_LOGIN)->setSigningKey(MODULE_PAYMENT_PAYNETEASYFORM_SIGNING_KEY)->setGatewayMode(MODULE_PAYMENT_PAYNETEASYFORM_GATEWAY_MODE)->setGatewayUrlSandbox(MODULE_PAYMENT_PAYNETEASYFORM_SANDBOX_GATEWAY)->setGatewayUrlProduction(MODULE_PAYMENT_PAYNETEASYFORM_PRODUCTION_GATEWAY);
if (Validator::validateByRule($redirect_url, Validator::URL, false)) {
$query_config->setRedirectUrl($redirect_url)->setCallbackUrl($redirect_url);
}
$paynet_transaction->setPayment($paynet_payment)->setQueryConfig($query_config);
return $paynet_transaction;
}
示例4: before_process
function before_process()
{
global $order, $sendto, $ppeuk_token, $ppeuk_payerid, $HTTP_POST_VARS, $comments;
if (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
$order->info['comments'] = $comments;
}
}
if (MODULE_PAYMENT_PAYPAL_UK_EXPRESS_TRANSACTION_SERVER == 'Live') {
$api_url = 'https://payflowpro.verisign.com/transaction';
} else {
$api_url = 'https://pilot-payflowpro.verisign.com/transaction';
}
$params = array('USER' => tep_not_null(MODULE_PAYMENT_PAYPAL_UK_EXPRESS_USERNAME) ? MODULE_PAYMENT_PAYPAL_UK_EXPRESS_USERNAME : MODULE_PAYMENT_PAYPAL_UK_EXPRESS_VENDOR, 'VENDOR' => MODULE_PAYMENT_PAYPAL_UK_EXPRESS_VENDOR, 'PARTNER' => MODULE_PAYMENT_PAYPAL_UK_EXPRESS_PARTNER, 'PWD' => MODULE_PAYMENT_PAYPAL_UK_EXPRESS_PASSWORD, 'TENDER' => 'P', 'TRXTYPE' => MODULE_PAYMENT_PAYPAL_UK_EXPRESS_TRANSACTION_METHOD == 'Sale' ? 'S' : 'A', 'EMAIL' => $order->customer['email_address'], 'TOKEN' => $ppeuk_token, 'ACTION' => 'D', 'PAYERID' => $ppeuk_payerid, 'AMT' => $this->format_raw($order->info['total']), 'CURRENCY' => $order->info['currency'], 'BUTTONSOURCE' => 'osCommerce22_Default_PRO2EC');
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRY'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '[' . strlen(trim($value)) . ']=' . trim($value) . '&';
}
$post_string = substr($post_string, 0, -1);
$response = $this->sendTransactionToGateway($api_url, $post_string, array('X-VPS-REQUEST-ID: ' . md5($cartID . tep_session_id() . rand())));
$response_array = array();
parse_str($response, $response_array);
if ($response_array['RESULT'] != '0') {
switch ($response_array['RESULT']) {
case '1':
case '26':
$error_message = MODULE_PAYMENT_PAYPAL_UK_EXPRESS_ERROR_CFG_ERROR;
break;
case '7':
$error_message = MODULE_PAYMENT_PAYPAL_UK_EXPRESS_ERROR_ADDRESS;
break;
case '12':
$error_message = MODULE_PAYMENT_PAYPAL_UK_EXPRESS_ERROR_DECLINED;
break;
case '1000':
$error_message = MODULE_PAYMENT_PAYPAL_UK_EXPRESS_ERROR_EXPRESS_DISABLED;
break;
default:
$error_message = MODULE_PAYMENT_PAYPAL_UK_EXPRESS_ERROR_GENERAL;
break;
}
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . urlencode($error_message), 'SSL'));
}
}
示例5: before_process
function before_process()
{
global $HTTP_GET_VARS, $HTTP_POST_VARS, $sagepay_server_skey_code, $sagepay_server_transaction_details, $sage_pay_server_nexturl, $customer_id, $order, $currency, $order_totals, $cartID;
$sagepay_server_transaction_details = null;
$error = null;
if (isset($HTTP_GET_VARS['check']) && $HTTP_GET_VARS['check'] == 'PROCESS') {
if (isset($HTTP_GET_VARS['skcode']) && tep_session_is_registered('sagepay_server_skey_code') && $HTTP_GET_VARS['skcode'] == $sagepay_server_skey_code) {
$skcode = tep_db_prepare_input($HTTP_GET_VARS['skcode']);
$sp_query = tep_db_query('select verified, transaction_details from sagepay_server_securitykeys where code = "' . tep_db_input($skcode) . '" limit 1');
if (tep_db_num_rows($sp_query)) {
$sp = tep_db_fetch_array($sp_query);
tep_session_unregister('sagepay_server_skey_code');
tep_db_query('delete from sagepay_server_securitykeys where code = "' . tep_db_input($skcode) . '"');
if ($sp['verified'] == '1') {
$sagepay_server_transaction_details = $sp['transaction_details'];
return true;
}
}
}
} else {
if (!tep_session_is_registered('sagepay_server_skey_code')) {
tep_session_register('sagepay_server_skey_code');
$sagepay_server_skey_code = tep_create_random_value(16);
}
$params = array('VPSProtocol' => $this->api_version, 'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802', 'Vendor' => substr(MODULE_PAYMENT_SAGE_PAY_SERVER_VENDOR_LOGIN_NAME, 0, 15), 'VendorTxCode' => substr(date('YmdHis') . '-' . $customer_id . '-' . $cartID, 0, 40), 'Amount' => $this->format_raw($order->info['total']), 'Currency' => $currency, 'Description' => substr(STORE_NAME, 0, 100), 'NotificationURL' => $this->formatURL(tep_href_link('ext/modules/payment/sage_pay/server.php', 'check=SERVER&skcode=' . $sagepay_server_skey_code, 'SSL', false)), 'BillingSurname' => substr($order->billing['lastname'], 0, 20), 'BillingFirstnames' => substr($order->billing['firstname'], 0, 20), 'BillingAddress1' => substr($order->billing['street_address'], 0, 100), 'BillingCity' => substr($order->billing['city'], 0, 40), 'BillingPostCode' => substr($order->billing['postcode'], 0, 10), 'BillingCountry' => $order->billing['country']['iso_code_2'], 'BillingPhone' => substr($order->customer['telephone'], 0, 20), 'DeliverySurname' => substr($order->delivery['lastname'], 0, 20), 'DeliveryFirstnames' => substr($order->delivery['firstname'], 0, 20), 'DeliveryAddress1' => substr($order->delivery['street_address'], 0, 100), 'DeliveryCity' => substr($order->delivery['city'], 0, 40), 'DeliveryPostCode' => substr($order->delivery['postcode'], 0, 10), 'DeliveryCountry' => $order->delivery['country']['iso_code_2'], 'DeliveryPhone' => substr($order->customer['telephone'], 0, 20), 'CustomerEMail' => substr($order->customer['email_address'], 0, 255), 'Apply3DSecure' => '0');
$ip_address = tep_get_ip_address();
if (ip2long($ip_address) != -1 && ip2long($ip_address) != false) {
$params['ClientIPAddress'] = $ip_address;
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_METHOD == 'Payment') {
$params['TxType'] = 'PAYMENT';
} elseif (MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_METHOD == 'Deferred') {
$params['TxType'] = 'DEFERRED';
} else {
$params['TxType'] = 'AUTHENTICATE';
}
if ($params['BillingCountry'] == 'US') {
$params['BillingState'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], '');
}
if ($params['DeliveryCountry'] == 'US') {
$params['DeliveryState'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE != 'Normal') {
$params['Profile'] = 'LOW';
}
$contents = array();
foreach ($order->products as $product) {
$product_name = $product['name'];
if (isset($product['attributes'])) {
foreach ($product['attributes'] as $att) {
$product_name .= '; ' . $att['option'] . '=' . $att['value'];
}
}
$contents[] = str_replace(array(':', "\n", "\r", '&'), '', $product_name) . ':' . $product['qty'] . ':' . $this->format_raw($product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price'] + $product['final_price']) . ':' . $this->format_raw(($product['tax'] / 100 * $product['final_price'] + $product['final_price']) * $product['qty']);
}
foreach ($order_totals as $ot) {
$contents[] = str_replace(array(':', "\n", "\r", '&'), '', strip_tags($ot['title'])) . ':---:---:---:---:' . $this->format_raw($ot['value']);
}
$params['Basket'] = substr(sizeof($contents) . ':' . implode(':', $contents), 0, 7500);
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '=' . urlencode(trim($value)) . '&';
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_SERVER == 'Live') {
$gateway_url = 'https://live.sagepay.com/gateway/service/vspserver-register.vsp';
} else {
$gateway_url = 'https://test.sagepay.com/gateway/service/vspserver-register.vsp';
}
$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);
$string_array = explode(chr(10), $transaction_response);
$return = array();
foreach ($string_array as $string) {
if (strpos($string, '=') != false) {
$parts = explode('=', $string, 2);
$return[trim($parts[0])] = trim($parts[1]);
}
}
if ($return['Status'] == 'OK') {
$sp_query = tep_db_query('select id, securitykey from sagepay_server_securitykeys where code = "' . tep_db_input($sagepay_server_skey_code) . '" limit 1');
if (tep_db_num_rows($sp_query)) {
$sp = tep_db_fetch_array($sp_query);
if ($sp['securitykey'] != $return['SecurityKey']) {
tep_db_query('update sagepay_server_securitykeys set securitykey = "' . tep_db_input($return['SecurityKey']) . '", date_added = now() where id = "' . (int) $sp['id'] . '"');
}
} else {
tep_db_query('insert into sagepay_server_securitykeys (code, securitykey, date_added) values ("' . tep_db_input($sagepay_server_skey_code) . '", "' . tep_db_input($return['SecurityKey']) . '", now())');
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal') {
tep_redirect($return['NextURL']);
} else {
if (!tep_session_is_registered('sage_pay_server_nexturl')) {
tep_session_register('sage_pay_server_nexturl');
}
$sage_pay_server_nexturl = $return['NextURL'];
tep_redirect(tep_href_link('ext/modules/payment/sage_pay/checkout.php', '', 'SSL'));
}
} else {
$error = $this->getErrorMessageNumber($return['StatusDetail']);
$this->sendDebugEmail($return);
}
//.........这里部分代码省略.........
示例6: quote
function quote($method = '')
{
/* FedEx integration starts */
global $shipping_weight, $shipping_num_boxes, $cart, $order;
require_once DIR_FS_CATALOG . DIR_WS_INCLUDES . 'library/fedex-common.php5';
//if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER == 'test') {
//$request['Version'] = array('ServiceId' => 'crs', 'Major' => '7', 'Intermediate' => '0', 'Minor' => '0');
//$path_to_wsdl = DIR_WS_INCLUDES . "wsdl/RateService_v7_test.wsdl";
//} else {
$path_to_wsdl = DIR_FS_CATALOG . DIR_WS_INCLUDES . "wsdl/RateService_v9.wsdl";
//}
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$this->types = array();
if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_PRIORITY == 'true') {
$this->types['INTERNATIONAL_PRIORITY'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
$this->types['EUROPE_FIRST_INTERNATIONAL_PRIORITY'] = array('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('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('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('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('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('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']['id'] == STORE_COUNTRY || MODULE_SHIPPING_FEDEX_WEB_SERVICES_GROUND == 'true' && $order->delivery['country']['id'] != STORE_COUNTRY && MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
$this->types['FEDEX_GROUND'] = array('icon' => '', 'handling_fee' => $order->delivery['country']['id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
$this->types['GROUND_HOME_DELIVERY'] = array('icon' => '', 'handling_fee' => $order->delivery['country']['id'] == STORE_COUNTRY ? MODULE_SHIPPING_FEDEX_WEB_SERVICES_HOME_DELIVERY_HANDLING_FEE : MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_HANDLING_FEE);
}
if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_INTERNATIONAL_GROUND == 'true') {
$this->types['INTERNATIONAL_GROUND'] = array('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('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
}
if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_FREIGHT == 'true') {
$this->types['FEDEX_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
$this->types['FEDEX_NATIONAL_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
$this->types['FEDEX_1_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
$this->types['FEDEX_2_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
$this->types['FEDEX_3_DAY_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_EXPRESS_HANDLING_FEE);
$this->types['INTERNATIONAL_ECONOMY_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
$this->types['INTERNATIONAL_PRIORITY_FREIGHT'] = array('icon' => '', 'handling_fee' => MODULE_SHIPPING_FEDEX_WEB_SERVICES_INT_EXPRESS_HANDLING_FEE);
}
// $this->types[] = 'SMART_POST';
// customer details
$street_address = $order->delivery['street_address'];
$street_address2 = $order->delivery['suburb'];
$city = $order->delivery['city'];
$state = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
if ($state == "QC") {
$state = "PQ";
}
$postcode = str_replace(array(' ', '-'), '', $order->delivery['postcode']);
$country_id = $order->delivery['country']['iso_code_2'];
$totals = $order->info['subtotal'] || $_SESSION['cart']->show_total();
$this->_setInsuranceValue($totals);
$request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd));
$request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v9 using PHP ***');
// $request['RequestedShipment']['SmartPostDetail'] = array(
// 'Indicia' => 'MEDIA_MAIL',
// 'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE',
// 'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION',
// 'HubId' => '5254',
// 'CustomerManifestId' => 1101);
// $request['RequestedShipment']['ServiceType'] = 'SMART_POST';
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '9', 'Intermediate' => '0', 'Minor' => '0');
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = $this->_setDropOff();
// valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
// valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue'] = array('Ammount' => $this->insurance, 'Currency' => $_SESSION['currency']);
$request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->fedex_key, 'Password' => $this->fedex_pwd));
$request['ClientDetail'] = array('AccountNumber' => $this->fedex_act_num, 'MeterNumber' => $this->fedex_meter_num);
// print_r($request['WebAuthenticationDetail']);
// print_r($request['ClientDetail']);
// exit;
$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($street_address, $street_address2), 'City' => $city, 'PostalCode' => $postcode, 'CountryCode' => $country_id, 'Residential' => $order->delivery['company'] != '' ? false : true));
//customer county code
if (in_array($country_id, array('US', 'CA'))) {
$request['RequestedShipment']['Recipient']['StateOrProvinceCode'] = $state;
}
// print_r($request['RequestedShipment']['Recipient']) ;
// exit;
$request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('AccountNumber' => $this->fedex_act_num, 'CountryCode' => $this->country));
$request['RequestedShipment']['RateRequestTypes'] = 'LIST';
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
//.........这里部分代码省略.........
示例7: setShippingMethod
function setShippingMethod($method = '')
{
global $shipping_modules, $language, $order, $cart, $shipping, $onepage;
if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
$pass = false;
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
if ($order->delivery['country_id'] == STORE_COUNTRY) {
$pass = true;
}
break;
case 'international':
if ($order->delivery['country_id'] != STORE_COUNTRY) {
$pass = true;
}
break;
case 'both':
$pass = true;
break;
}
// disable free shipping for Alaska and Hawaii
$zone_code = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
if (in_array($zone_code, array('AK', 'HI'))) {
$pass = false;
}
$free_shipping = false;
if ($pass == true && $order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
$free_shipping = true;
include DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php';
}
} else {
$free_shipping = false;
}
if (!tep_session_is_registered('shipping')) {
tep_session_register('shipping');
}
$shipping = false;
$onepage['info']['shipping_method'] = false;
if (tep_count_shipping_modules() > 0 || $free_shipping == true) {
if (strpos($method, '_')) {
$shipping = $method;
list($module, $method) = explode('_', $shipping);
global ${$module};
if (is_object(${$module}) || $shipping == 'free_free') {
$quote = $shipping_modules->quote($method, $module);
if (isset($quote['error'])) {
unset($shipping);
} else {
if (isset($quote[0]['methods'][0]['title']) && isset($quote[0]['methods'][0]['cost']) || $shipping == 'free_free') {
$shipping = array('id' => $shipping, 'title' => $shipping == 'free_free' ? FREE_SHIPPING_TITLE : $quote[0]['module'], 'description' => $shipping == 'free_free' ? FREE_SHIPPING_TITLE : $quote[0]['module'] . ':<br />' . $quote[0]['methods'][0]['title'], 'cost' => $shipping == 'free_free' ? '0' : $quote[0]['methods'][0]['cost']);
$onepage['info']['shipping_method'] = $shipping;
}
}
} else {
unset($shipping);
}
}
}
return '{
"success": "true"
}';
}
示例8: before_process
function before_process()
{
global $order, $order_totals, $sendto, $response_array;
if (isset($_POST['cc_owner']) && !empty($_POST['cc_owner']) && isset($_POST['cc_type']) && $this->isCardAccepted($_POST['cc_type']) && isset($_POST['cc_number_nh-dns']) && !empty($_POST['cc_number_nh-dns'])) {
if (MODULE_PAYMENT_PAYPAL_PRO_DP_TRANSACTION_SERVER == 'Live') {
$api_url = 'https://api-3t.paypal.com/nvp';
} else {
$api_url = 'https://api-3t.sandbox.paypal.com/nvp';
}
$params = array('USER' => MODULE_PAYMENT_PAYPAL_PRO_DP_API_USERNAME, 'PWD' => MODULE_PAYMENT_PAYPAL_PRO_DP_API_PASSWORD, 'VERSION' => $this->api_version, 'SIGNATURE' => MODULE_PAYMENT_PAYPAL_PRO_DP_API_SIGNATURE, 'METHOD' => 'DoDirectPayment', 'PAYMENTACTION' => MODULE_PAYMENT_PAYPAL_PRO_DP_TRANSACTION_METHOD == 'Sale' ? 'Sale' : 'Authorization', 'IPADDRESS' => tep_get_ip_address(), 'AMT' => $this->format_raw($order->info['total']), 'CREDITCARDTYPE' => $_POST['cc_type'], 'ACCT' => $_POST['cc_number_nh-dns'], 'EXPDATE' => $_POST['cc_expires_month'] . $_POST['cc_expires_year'], 'CVV2' => $_POST['cc_cvc_nh-dns'], 'FIRSTNAME' => substr($_POST['cc_owner'], 0, strpos($_POST['cc_owner'], ' ')), 'LASTNAME' => substr($_POST['cc_owner'], strpos($_POST['cc_owner'], ' ') + 1), 'STREET' => $order->billing['street_address'], 'CITY' => $order->billing['city'], 'STATE' => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']), 'COUNTRYCODE' => $order->billing['country']['iso_code_2'], 'ZIP' => $order->billing['postcode'], 'EMAIL' => $order->customer['email_address'], 'SHIPTOPHONENUM' => $order->customer['telephone'], 'CURRENCYCODE' => $order->info['currency'], 'BUTTONSOURCE' => 'OSCOM23_DP');
if ($_POST['cc_type'] == 'MAESTRO') {
$params['STARTDATE'] = $_POST['cc_starts_month'] . $_POST['cc_starts_year'];
$params['ISSUENUMBER'] = $_POST['cc_issue_nh-dns'];
}
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$item_params = array();
$line_item_no = 0;
foreach ($order->products as $product) {
$item_params['L_NAME' . $line_item_no] = $product['name'];
$item_params['L_AMT' . $line_item_no] = $this->format_raw($product['final_price']);
$item_params['L_NUMBER' . $line_item_no] = $product['id'];
$item_params['L_QTY' . $line_item_no] = $product['qty'];
$line_item_no++;
}
$items_total = $this->format_raw($order->info['subtotal']);
foreach ($order_totals as $ot) {
if (!in_array($ot['code'], array('ot_subtotal', 'ot_shipping', 'ot_tax', 'ot_total'))) {
$item_params['L_NAME' . $line_item_no] = $ot['title'];
$item_params['L_AMT' . $line_item_no] = $this->format_raw($ot['value']);
$items_total += $this->format_raw($ot['value']);
$line_item_no++;
}
}
$item_params['ITEMAMT'] = $items_total;
$item_params['TAXAMT'] = $this->format_raw($order->info['tax']);
$item_params['SHIPPINGAMT'] = $this->format_raw($order->info['shipping_cost']);
if ($this->format_raw($item_params['ITEMAMT'] + $item_params['TAXAMT'] + $item_params['SHIPPINGAMT']) == $params['AMT']) {
$params = array_merge($params, $item_params);
}
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '=' . urlencode(utf8_encode(trim($value))) . '&';
}
$post_string = substr($post_string, 0, -1);
$response = $this->sendTransactionToGateway($api_url, $post_string);
$response_array = array();
parse_str($response, $response_array);
if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') {
$this->sendDebugEmail($response_array);
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
} else {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, 'error_message=' . MODULE_PAYMENT_PAYPAL_PRO_DP_ERROR_ALL_FIELDS_REQUIRED, 'SSL'));
}
}
示例9: before_process
//.........这里部分代码省略.........
$params['CV2'] = $sagepay_token_cvc;
}
} else {
$params['CardType'] = $cc_type;
if ($cc_type == 'PAYPAL') {
$params['PayPalCallbackURL'] = tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PAYPAL', 'SSL');
} else {
$params['CardHolder'] = $cc_owner;
$params['CardNumber'] = $cc_number;
$params['ExpiryDate'] = $cc_expires;
$params['CreateToken'] = MODULE_PAYMENT_SAGE_PAY_DIRECT_TOKENS == 'True' && isset($HTTP_POST_VARS['cc_save']) && $HTTP_POST_VARS['cc_save'] == 'true' ? '1' : '0';
if ($cc_type == 'MAESTRO' && MODULE_PAYMENT_SAGE_PAY_DIRECT_ALLOW_MAESTRO == 'True' || $cc_type == 'AMEX' && MODULE_PAYMENT_SAGE_PAY_DIRECT_ALLOW_AMEX == 'True') {
$params['StartDate'] = $cc_start;
}
if ($cc_type == 'MAESTRO' && MODULE_PAYMENT_SAGE_PAY_DIRECT_ALLOW_MAESTRO == 'True') {
$params['IssueNumber'] = $cc_issue;
}
if (MODULE_PAYMENT_SAGE_PAY_DIRECT_VERIFY_WITH_CVC == 'True') {
$params['CV2'] = $cc_cvc;
}
}
}
$ip_address = tep_get_ip_address();
if (!empty($ip_address) && ip2long($ip_address) != -1 && ip2long($ip_address) != false) {
$params['ClientIPAddress'] = $ip_address;
}
if (MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_METHOD == 'Payment') {
$params['TxType'] = 'PAYMENT';
} elseif (MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_METHOD == 'Deferred') {
$params['TxType'] = 'DEFERRED';
} else {
$params['TxType'] = 'AUTHENTICATE';
}
if ($params['BillingCountry'] == 'US') {
$params['BillingState'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], '');
}
if ($params['DeliveryCountry'] == 'US') {
$params['DeliveryState'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
}
$contents = array();
foreach ($order->products as $product) {
$product_name = $product['name'];
if (isset($product['attributes'])) {
foreach ($product['attributes'] as $att) {
$product_name .= '; ' . $att['option'] . '=' . $att['value'];
}
}
$contents[] = str_replace(array(':', "\n", "\r", '&'), '', $product_name) . ':' . $product['qty'] . ':' . $this->format_raw($product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price'] + $product['final_price']) . ':' . $this->format_raw(($product['tax'] / 100 * $product['final_price'] + $product['final_price']) * $product['qty']);
}
foreach ($order_totals as $ot) {
$contents[] = str_replace(array(':', "\n", "\r", '&'), '', strip_tags($ot['title'])) . ':---:---:---:---:' . $this->format_raw($ot['value']);
}
$params['Basket'] = substr(sizeof($contents) . ':' . implode(':', $contents), 0, 7500);
$post_string = '';
foreach ($params as $key => $value) {
$post_string .= $key . '=' . urlencode(trim($value)) . '&';
}
if (MODULE_PAYMENT_SAGE_PAY_DIRECT_TRANSACTION_SERVER == 'Live') {
$gateway_url = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp';
} else {
$gateway_url = 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp';
}
$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);
}
$string_array = explode(chr(10), $transaction_response);
$sage_pay_response = array();
foreach ($string_array as $string) {
if (strpos($string, '=') != false) {
$parts = explode('=', $string, 2);
$sage_pay_response[trim($parts[0])] = trim($parts[1]);
}
}
if (isset($params['CreateToken']) && $params['CreateToken'] == '1') {
global $sagepay_token_cc_type, $sagepay_token_cc_number, $sagepay_token_cc_expiry_date;
tep_session_register('sagepay_token_cc_type');
$sagepay_token_cc_type = $params['CardType'];
tep_session_register('sagepay_token_cc_number');
$sagepay_token_cc_number = str_repeat('X', strlen($params['CardNumber']) - 4) . substr($params['CardNumber'], -4);
tep_session_register('sagepay_token_cc_expiry_date');
$sagepay_token_cc_expiry_date = $params['ExpiryDate'];
}
if ($sage_pay_response['Status'] == '3DAUTH') {
global $sage_pay_direct_acsurl, $sage_pay_direct_pareq, $sage_pay_direct_md;
tep_session_register('sage_pay_direct_acsurl');
$sage_pay_direct_acsurl = $sage_pay_response['ACSURL'];
tep_session_register('sage_pay_direct_pareq');
$sage_pay_direct_pareq = $sage_pay_response['PAReq'];
tep_session_register('sage_pay_direct_md');
$sage_pay_direct_md = $sage_pay_response['MD'];
tep_redirect(tep_href_link('ext/modules/payment/sage_pay/checkout.php', '', 'SSL'));
}
if ($sage_pay_response['Status'] == 'PPREDIRECT') {
tep_redirect($sage_pay_response['PayPalRedirectURL']);
}
if ($sage_pay_response['Status'] != 'OK' && $sage_pay_response['Status'] != 'AUTHENTICATED' && $sage_pay_response['Status'] != 'REGISTERED') {
$this->sendDebugEmail($sage_pay_response);
$error = $this->getErrorMessageNumber($sage_pay_response['StatusDetail']);
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : ''), 'SSL'));
}
}
示例10: before_process_payflow
function before_process_payflow()
{
global $cartID, $order, $order_totals, $sendto, $response_array;
if (isset($_POST['cc_owner']) && !empty($_POST['cc_owner']) && isset($_POST['cc_type']) && $this->isCardAccepted($_POST['cc_type']) && isset($_POST['cc_number_nh-dns']) && !empty($_POST['cc_number_nh-dns'])) {
$params = array('AMT' => $this->_app->formatCurrencyRaw($order->info['total']), 'CURRENCY' => $order->info['currency'], 'BILLTOFIRSTNAME' => substr($_POST['cc_owner'], 0, strpos($_POST['cc_owner'], ' ')), 'BILLTOLASTNAME' => substr($_POST['cc_owner'], strpos($_POST['cc_owner'], ' ') + 1), 'BILLTOSTREET' => $order->billing['street_address'], 'BILLTOCITY' => $order->billing['city'], 'BILLTOSTATE' => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']), 'BILLTOCOUNTRY' => $order->billing['country']['iso_code_2'], 'BILLTOZIP' => $order->billing['postcode'], 'EMAIL' => $order->customer['email_address'], 'ACCT' => $_POST['cc_number_nh-dns'], 'EXPDATE' => $_POST['cc_expires_month'] . $_POST['cc_expires_year'], 'CVV2' => $_POST['cc_cvc_nh-dns']);
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTOFIRSTNAME'] = $order->delivery['firstname'];
$params['SHIPTOLASTNAME'] = $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRY'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$item_params = array();
$line_item_no = 0;
foreach ($order->products as $product) {
$item_params['L_NAME' . $line_item_no] = $product['name'];
$item_params['L_COST' . $line_item_no] = $this->_app->formatCurrencyRaw($product['final_price']);
$item_params['L_QTY' . $line_item_no] = $product['qty'];
$line_item_no++;
}
$items_total = $this->_app->formatCurrencyRaw($order->info['subtotal']);
foreach ($order_totals as $ot) {
if (!in_array($ot['code'], array('ot_subtotal', 'ot_shipping', 'ot_tax', 'ot_total'))) {
$item_params['L_NAME' . $line_item_no] = $ot['title'];
$item_params['L_COST' . $line_item_no] = $this->_app->formatCurrencyRaw($ot['value']);
$item_params['L_QTY' . $line_item_no] = 1;
$items_total += $this->_app->formatCurrencyRaw($ot['value']);
$line_item_no++;
}
}
$item_params['ITEMAMT'] = $items_total;
$item_params['TAXAMT'] = $this->_app->formatCurrencyRaw($order->info['tax']);
$item_params['FREIGHTAMT'] = $this->_app->formatCurrencyRaw($order->info['shipping_cost']);
if ($this->_app->formatCurrencyRaw($item_params['ITEMAMT'] + $item_params['TAXAMT'] + $item_params['FREIGHTAMT']) == $params['AMT']) {
$params = array_merge($params, $item_params);
}
$params['_headers'] = array('X-VPS-REQUEST-ID: ' . md5($cartID . tep_session_id() . $this->_app->formatCurrencyRaw($order->info['total'])), 'X-VPS-CLIENT-TIMEOUT: 45', 'X-VPS-VIT-INTEGRATION-PRODUCT: OSCOM', 'X-VPS-VIT-INTEGRATION-VERSION: 2.3');
$response_array = $this->_app->getApiResult('DP', 'PayflowPayment', $params);
if ($response_array['RESULT'] != '0') {
switch ($response_array['RESULT']) {
case '1':
case '26':
$error_message = $this->_app->getDef('module_dp_error_configuration');
break;
case '7':
$error_message = $this->_app->getDef('module_dp_error_address');
break;
case '12':
$error_message = $this->_app->getDef('module_dp_error_declined');
break;
case '23':
case '24':
$error_message = $this->_app->getDef('module_dp_error_invalid_card');
break;
default:
$error_message = $this->_app->getDef('module_dp_error_general');
break;
}
tep_redirect(tep_href_link('checkout_confirmation.php', 'error_message=' . $error_message, 'SSL'));
}
} else {
tep_redirect(tep_href_link('checkout_confirmation.php', 'error_message=' . $this->_app->getDef('module_dp_error_all_fields_required'), 'SSL'));
}
}
示例11: before_process
function before_process()
{
global $HTTP_GET_VARS, $HTTP_POST_VARS, $sage_pay_server_securitykey, $sage_pay_server_nexturl, $customer_id, $order, $currency, $order_totals, $cartID;
$error = null;
if (isset($HTTP_GET_VARS['check']) && $HTTP_GET_VARS['check'] == 'SERVER') {
$sig = $HTTP_POST_VARS['VPSTxId'] . $HTTP_POST_VARS['VendorTxCode'] . $HTTP_POST_VARS['Status'];
if ($HTTP_POST_VARS['Status'] == 'OK') {
$sig .= $HTTP_POST_VARS['TxAuthNo'];
}
$sig .= substr(MODULE_PAYMENT_SAGE_PAY_SERVER_VENDOR_LOGIN_NAME, 0, 15);
if ($HTTP_POST_VARS['Status'] != 'AUTHENTICATED' && $HTTP_POST_VARS['Status'] != 'REGISTERED') {
$sig .= $HTTP_POST_VARS['AVSCV2'];
}
$sig .= $sage_pay_server_securitykey;
if ($HTTP_POST_VARS['Status'] != 'AUTHENTICATED' && $HTTP_POST_VARS['Status'] != 'REGISTERED') {
$sig .= $HTTP_POST_VARS['AddressResult'] . $HTTP_POST_VARS['PostCodeResult'] . $HTTP_POST_VARS['CV2Result'];
}
$sig .= $HTTP_POST_VARS['GiftAid'] . $HTTP_POST_VARS['3DSecureStatus'];
if ($HTTP_POST_VARS['3DSecureStatus'] == 'OK') {
$sig .= $HTTP_POST_VARS['CAVV'];
}
if ($HTTP_POST_VARS['AddressStatus'] == 'NONE' || $HTTP_POST_VARS['AddressStatus'] == 'CONFIRMED' || $HTTP_POST_VARS['AddressStatus'] == 'UNCONFIRMED') {
$sig .= $HTTP_POST_VARS['AddressStatus'];
}
if ($HTTP_POST_VARS['PayerStatus'] == 'VERIFIED' || $HTTP_POST_VARS['PayerStatus'] == 'UNVERIFIED') {
$sig .= $HTTP_POST_VARS['PayerStatus'];
}
if (in_array($HTTP_POST_VARS['CardType'], array('VISA', 'MC', 'DELTA', 'SOLO', 'MAESTRO', 'UKE', 'AMEX', 'DC', 'JCB', 'SWITCH', 'LASER', 'PAYPAL'))) {
$sig .= $HTTP_POST_VARS['CardType'];
}
$sig .= $HTTP_POST_VARS['Last4Digits'];
if (isset($HTTP_POST_VARS['VPSSignature']) && $HTTP_POST_VARS['VPSSignature'] == strtoupper(md5($sig))) {
if ($HTTP_POST_VARS['Status'] != 'OK' && $HTTP_POST_VARS['Status'] != 'AUTHENTICATED' && $HTTP_POST_VARS['Status'] != 'REGISTERED') {
tep_session_unregister('sage_pay_server_securitykey');
tep_session_unregister('sage_pay_server_nexturl');
$error = $this->getErrorMessageNumber($HTTP_POST_VARS['StatusDetail']);
if (MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal') {
$error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
} else {
$error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
}
$result = 'Status=OK' . chr(13) . chr(10) . 'RedirectURL=' . $error_url;
} else {
$result = 'Status=OK' . chr(13) . chr(10) . 'RedirectURL=' . tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PROCESS&key=' . md5($sage_pay_server_securitykey) . '&VPSTxId=' . $HTTP_POST_VARS['VPSTxId'] . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
}
} else {
tep_session_unregister('sage_pay_server_securitykey');
tep_session_unregister('sage_pay_server_nexturl');
$error = $this->getErrorMessageNumber($HTTP_POST_VARS['StatusDetail']);
if (MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal') {
$error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
} else {
$error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
}
$result = 'Status=INVALID' . chr(13) . chr(10) . 'RedirectURL=' . $error_url;
}
echo $result;
exit;
} elseif (isset($HTTP_GET_VARS['check']) && $HTTP_GET_VARS['check'] == 'PROCESS') {
if ($HTTP_GET_VARS['key'] == md5($sage_pay_server_securitykey)) {
tep_session_unregister('sage_pay_server_securitykey');
tep_session_unregister('sage_pay_server_nexturl');
if (isset($HTTP_GET_VARS['VPSTxId'])) {
$order->info['comments'] = 'Sage Pay Reference ID: ' . $HTTP_GET_VARS['VPSTxId'] . (tep_not_null($order->info['comments']) ? "\n\n" . $order->info['comments'] : '');
}
return true;
}
} else {
$params = array('VPSProtocol' => '2.23', 'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802', 'Vendor' => substr(MODULE_PAYMENT_SAGE_PAY_SERVER_VENDOR_LOGIN_NAME, 0, 15), 'VendorTxCode' => substr(date('YmdHis') . '-' . $customer_id . '-' . $cartID, 0, 40), 'Amount' => $this->format_raw($order->info['total']), 'Currency' => $currency, 'Description' => substr(STORE_NAME, 0, 100), 'NotificationURL' => tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=SERVER&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false), 'BillingSurname' => substr($order->billing['lastname'], 0, 20), 'BillingFirstnames' => substr($order->billing['firstname'], 0, 20), 'BillingAddress1' => substr($order->billing['street_address'], 0, 100), 'BillingCity' => substr($order->billing['city'], 0, 40), 'BillingPostCode' => substr($order->billing['postcode'], 0, 10), 'BillingCountry' => $order->billing['country']['iso_code_2'], 'BillingPhone' => substr($order->customer['telephone'], 0, 20), 'DeliverySurname' => substr($order->delivery['lastname'], 0, 20), 'DeliveryFirstnames' => substr($order->delivery['firstname'], 0, 20), 'DeliveryAddress1' => substr($order->delivery['street_address'], 0, 100), 'DeliveryCity' => substr($order->delivery['city'], 0, 40), 'DeliveryPostCode' => substr($order->delivery['postcode'], 0, 10), 'DeliveryCountry' => $order->delivery['country']['iso_code_2'], 'DeliveryPhone' => substr($order->customer['telephone'], 0, 20), 'CustomerEMail' => substr($order->customer['email_address'], 0, 255), 'Apply3DSecure' => '0');
$ip_address = tep_get_ip_address();
if (ip2long($ip_address) != -1 && ip2long($ip_address) != false) {
$params['ClientIPAddress'] = $ip_address;
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_METHOD == 'Payment') {
$params['TxType'] = 'PAYMENT';
} elseif (MODULE_PAYMENT_SAGE_PAY_SERVER_TRANSACTION_METHOD == 'Deferred') {
$params['TxType'] = 'DEFERRED';
} else {
$params['TxType'] = 'AUTHENTICATE';
}
if ($params['BillingCountry'] == 'US') {
$params['BillingState'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], '');
}
if ($params['DeliveryCountry'] == 'US') {
$params['DeliveryState'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
}
if (MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE != 'Normal') {
$params['Profile'] = 'LOW';
}
$contents = array();
foreach ($order->products as $product) {
$product_name = $product['name'];
if (isset($product['attributes'])) {
foreach ($product['attributes'] as $att) {
$product_name .= '; ' . $att['option'] . '=' . $att['value'];
}
}
$contents[] = str_replace(array(':', "\n", "\r", '&'), '', $product_name) . ':' . $product['qty'] . ':' . $this->format_raw($product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price']) . ':' . $this->format_raw($product['tax'] / 100 * $product['final_price'] + $product['final_price']) . ':' . $this->format_raw(($product['tax'] / 100 * $product['final_price'] + $product['final_price']) * $product['qty']);
}
foreach ($order_totals as $ot) {
//.........这里部分代码省略.........
示例12: before_process
function before_process()
{
global $customer_id, $order, $sendto, $ppe_token, $ppe_payerid, $ppe_secret, $ppe_order_total_check, $HTTP_POST_VARS, $comments, $response_array;
if (!tep_session_is_registered('ppe_token')) {
tep_redirect(tep_href_link('ext/modules/payment/paypal/express.php', '', 'SSL'));
}
$response_array = $this->getExpressCheckoutDetails($ppe_token);
if ($response_array['ACK'] == 'Success' || $response_array['ACK'] == 'SuccessWithWarning') {
if (!tep_session_is_registered('ppe_secret') || $response_array['PAYMENTREQUEST_0_CUSTOM'] != $ppe_secret) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
} elseif ($response_array['PAYMENTREQUEST_0_AMT'] != $this->format_raw($order->info['total']) && !tep_session_is_registered('ppe_order_total_check')) {
tep_session_register('ppe_order_total_check');
$ppe_order_total_check = true;
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}
} else {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
if (tep_session_is_registered('ppe_order_total_check')) {
tep_session_unregister('ppe_order_total_check');
}
if (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
$order->info['comments'] = $comments;
}
}
$params = array('TOKEN' => $ppe_token, 'PAYERID' => $ppe_payerid, 'PAYMENTREQUEST_0_AMT' => $this->format_raw($order->info['total']), 'PAYMENTREQUEST_0_CURRENCYCODE' => $order->info['currency']);
if (is_numeric($sendto) && $sendto > 0) {
$params['PAYMENTREQUEST_0_SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['PAYMENTREQUEST_0_SHIPTOSTREET'] = $order->delivery['street_address'];
$params['PAYMENTREQUEST_0_SHIPTOCITY'] = $order->delivery['city'];
$params['PAYMENTREQUEST_0_SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['PAYMENTREQUEST_0_SHIPTOZIP'] = $order->delivery['postcode'];
}
$response_array = $this->doExpressCheckoutPayment($params);
if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') {
if ($response_array['L_ERRORCODE0'] == '10486') {
if (MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER == 'Live') {
$paypal_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout';
} else {
$paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout';
}
$paypal_url .= '&token=' . $ppe_token . '&useraction=commit';
tep_redirect($paypal_url);
}
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
}
示例13: tep_calculate_tax
$params['L_NUMBER' . $line_item_no] = $product['id'];
$params['L_QTY' . $line_item_no] = $product['qty'];
$product_tax = tep_calculate_tax($product['final_price'], $product['tax']);
$params['L_TAXAMT' . $line_item_no] = $paypal_express->format_raw($product_tax);
$tax_total += $paypal_express->format_raw($product_tax) * $product['qty'];
$items_total += $paypal_express->format_raw($product['final_price']) * $product['qty'];
$line_item_no++;
}
$params['ITEMAMT'] = $items_total;
$params['TAXAMT'] = $tax_total;
if (tep_not_null($order->delivery['firstname'])) {
$params['ADDROVERRIDE'] = '1';
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$quotes_array = array();
if ($cart->get_content_type() != 'virtual') {
$total_weight = $cart->show_weight();
$total_count = $cart->count_contents();
// load all enabled shipping modules
include DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping();
$free_shipping = false;
if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
$pass = false;
switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
case 'national':
示例14: before_process
function before_process()
{
global $customer_id, $order, $sendto, $ppeuk_token, $ppeuk_payerid, $ppeuk_secret, $ppeuk_order_total_check, $HTTP_POST_VARS, $comments, $response_array;
if (!tep_session_is_registered('ppeuk_token')) {
tep_redirect(tep_href_link('ext/modules/payment/paypal/express_payflow.php', '', 'SSL'));
}
$response_array = $this->getExpressCheckoutDetails($ppeuk_token);
if ($response_array['RESULT'] == '0') {
if (!tep_session_is_registered('ppeuk_secret') || $response_array['CUSTOM'] != $ppeuk_secret) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));
} elseif (!tep_session_is_registered('ppeuk_order_total_check')) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}
} else {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . urlencode($response_array['OSCOM_ERROR_MESSAGE']), 'SSL'));
}
if (tep_session_is_registered('ppeuk_order_total_check')) {
tep_session_unregister('ppeuk_order_total_check');
}
if (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
$order->info['comments'] = $comments;
}
}
$params = array('EMAIL' => $order->customer['email_address'], 'TOKEN' => $ppeuk_token, 'PAYERID' => $ppeuk_payerid, 'AMT' => $this->format_raw($order->info['total']), 'CURRENCY' => $order->info['currency']);
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRY'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$response_array = $this->doExpressCheckoutPayment($params);
if ($response_array['RESULT'] != '0') {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . urlencode($response_array['OSCOM_ERROR_MESSAGE']), 'SSL'));
}
}
示例15: before_process
function before_process()
{
global $customer_id, $order, $sendto, $ppe_token, $ppe_payerid, $HTTP_POST_VARS, $comments, $response_array;
if (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
$order->info['comments'] = $comments;
}
}
$params = array('TOKEN' => $ppe_token, 'PAYERID' => $ppe_payerid, 'AMT' => $this->format_raw($order->info['total']), 'CURRENCYCODE' => $order->info['currency']);
if (is_numeric($sendto) && $sendto > 0) {
$params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname'];
$params['SHIPTOSTREET'] = $order->delivery['street_address'];
$params['SHIPTOCITY'] = $order->delivery['city'];
$params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
$params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2'];
$params['SHIPTOZIP'] = $order->delivery['postcode'];
}
$response_array = $this->doExpressCheckoutPayment($params);
if ($response_array['ACK'] != 'Success' && $response_array['ACK'] != 'SuccessWithWarning') {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL'));
}
}