本文整理汇总了PHP中fn_get_payment_method_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_payment_method_data函数的具体用法?PHP fn_get_payment_method_data怎么用?PHP fn_get_payment_method_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_payment_method_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_payment_dependencies_checkout_select_default_payment_method
function fn_payment_dependencies_checkout_select_default_payment_method(&$cart, &$payment_methods, &$completed_steps)
{
$available_payment_ids = array();
foreach ($payment_methods as $group) {
foreach ($group as $method) {
$available_payment_ids[] = $method['payment_id'];
}
}
// Change default payment if it doesn't exists
if (floatval($cart['total']) != 0 && !in_array($cart['payment_id'], $available_payment_ids)) {
$cart['payment_id'] = reset($available_payment_ids);
$cart['payment_method_data'] = fn_get_payment_method_data($cart['payment_id']);
}
}
示例2: index
public function index($id = 0, $params = array())
{
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if (!empty($id)) {
$data = fn_get_payment_method_data($id, $lang_code);
if (empty($data)) {
$status = Response::STATUS_NOT_FOUND;
} else {
$status = Response::STATUS_OK;
}
} else {
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_elements_per_page'));
$page = $this->safeGet($params, 'page', 1);
$data = fn_get_payments($lang_code);
if ($items_per_page) {
$data = array_slice($data, ($page - 1) * $items_per_page, $items_per_page);
}
$data = array('payments' => $data, 'params' => array('items_per_page' => $items_per_page, 'page' => $page, 'total_items' => count($data)));
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
示例3: die
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Http;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION')) {
if ($mode == 'notify') {
$order_id = strpos($_REQUEST['MerchantReference'], '_') ? substr($_REQUEST['MerchantReference'], 0, strpos($_REQUEST['MerchantReference'], '_')) : $_REQUEST['MerchantReference'];
$order_info = fn_get_order_info($order_id);
$processor_data = fn_get_payment_method_data($order_info['payment_id']);
$pp_response = array();
$pp_response['transaction_id'] = $_REQUEST['TransactionId'];
$pp_response['transaction_datetime'] = $_REQUEST['TransactionDateTime'];
$pp_response['reason_text'] = $_REQUEST['ResponseDescription'];
if ($_REQUEST['ResultCode'] == 0) {
if ($_REQUEST['StatusFlag'] == 'Success' && in_array($_REQUEST['ResponseCode'], array('00', '08', '10', '11', '16'))) {
$tran_ticket = db_get_field("SELECT data FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id);
$cart_hashkey_str = $tran_ticket . $processor_data['processor_params']['posid'] . $processor_data['processor_params']['acquirerid'] . $_REQUEST['MerchantReference'] . $_REQUEST['ApprovalCode'] . $_REQUEST['Parameters'] . $_REQUEST['ResponseCode'] . $_REQUEST['SupportReferenceID'] . $_REQUEST['AuthStatus'] . $_REQUEST['PackageNo'] . $_REQUEST['StatusFlag'];
$cart_hashkey = strtoupper(hash('sha256', $cart_hashkey_str));
if ($cart_hashkey == $_REQUEST['HashKey']) {
$pp_response['order_status'] = 'P';
db_query("DELETE FROM ?:order_data WHERE type = 'E' AND order_id = ?i", $order_id);
if (!empty($_REQUEST['SupportReferenceID'])) {
$pp_response['reason_text'] .= '; SupportReferenceID: ' . $_REQUEST['SupportReferenceID'];
}
示例4: fn_paypal_set_express_checkout
function fn_paypal_set_express_checkout($payment_id, $order_id = 0, $order_info = array(), $cart = array(), $area = AREA)
{
$processor_data = fn_get_payment_method_data($payment_id);
if (!empty($order_id)) {
$return_url = fn_url("payment_notification.notify?payment=paypal_express&order_id={$order_id}", $area, 'current');
$cancel_url = fn_url("payment_notification.cancel?payment=paypal_express&order_id={$order_id}", $area, 'current');
} else {
$return_url = fn_payment_url('current', "paypal_express.php?mode=express_return&payment_id={$payment_id}");
$cancel_url = fn_url("checkout.cart", $area, 'current');
}
$request = array('PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_CURRENCYCODE' => $processor_data['processor_params']['currency'], 'LOCALECODE' => CART_LANGUAGE, 'RETURNURL' => $return_url, 'CANCELURL' => $cancel_url, 'METHOD' => 'SetExpressCheckout', 'SOLUTIONTYPE' => 'Sole');
if (isset($_SESSION['paypal_token'])) {
$request['IDENTITYACCESSTOKEN'] = $_SESSION['paypal_token'];
}
$paypal_settings = fn_get_paypal_settings();
if (!empty($paypal_settings) && !empty($paypal_settings['main_pair']['detailed'])) {
$request['LOGOIMG'] = !empty($paypal_settings['main_pair']['detailed']['http_image_path']) ? $paypal_settings['main_pair']['detailed']['http_image_path'] : $paypal_settings['main_pair']['detailed']['image_path'];
$exploded_logo = explode('?', $request['LOGOIMG']);
$request['LOGOIMG'] = $exploded_logo[0];
}
fn_paypal_build_request($processor_data, $request, $post_url, $cert_file);
$order_details = !empty($order_info) ? fn_paypal_build_details($order_info, $processor_data, false) : fn_paypal_build_details($cart, $processor_data);
$request = array_merge($request, $order_details);
if (!empty($order_info)) {
//We need to minus taxes when it based on unit price because product subtotal already include this tax.
if (Registry::get('settings.General.tax_calculation') == 'unit_price') {
$sum_taxes = fn_paypal_sum_taxes($order_info);
$request['PAYMENTREQUEST_0_ITEMAMT'] -= $sum_taxes['P'];
$request['PAYMENTREQUEST_0_SHIPPINGAMT'] -= $sum_taxes['S'];
}
}
$result = fn_paypal_request($request, $post_url, $cert_file);
return $result;
}
示例5: processPaymentCertificates
public static function processPaymentCertificates($store_data)
{
$payment_methods = db_get_array('SELECT p.payment_id, pp.* FROM ?:payments p, ?:payment_processors pp WHERE pp.processor_id = p.processor_id AND p.processor_id != 0');
$certificates_dir = Registry::get('config.dir.certificates');
foreach ($payment_methods as $payment_method) {
if (in_array($payment_method['processor_script'], array('paypal_express.php', 'paypal_pro.php', 'qbms.php'))) {
$payment_data = fn_get_payment_method_data($payment_method['payment_id']);
$certificate_filename = '';
if (isset($payment_data['processor_params']['certificate_filename'])) {
$certificate_filename = $payment_data['processor_params']['certificate_filename'];
} elseif (isset($payment_data['processor_params']['certificate'])) {
$certificate_filename = $payment_data['processor_params']['certificate'];
}
if ($certificate_filename) {
$filename = $payment_method['payment_id'] . '/' . $certificate_filename;
$old_certificate_file = $store_data['path'] . '/payments/certificates/' . $certificate_filename;
if (file_exists($old_certificate_file)) {
fn_mkdir($certificates_dir . $payment_method['payment_id']);
fn_copy($old_certificate_file, $certificates_dir . $filename);
} else {
$filename = '';
}
$payment_data['processor_params']['certificate_filename'] = $filename;
fn_update_payment($payment_data, $payment_method['payment_id']);
}
}
}
}
示例6: fn_checkout_place_order
/**
* Place order handler
*
* @param array $cart Cart
* @param array $auth Auth
* @param array $params Params
* @return str
*/
function fn_checkout_place_order(&$cart, &$auth, $params)
{
// Prevent unauthorized access
if (empty($cart['user_data']['email'])) {
return PLACE_ORDER_STATUS_DENIED;
}
// Prevent using disabled payment method by challenging HTTP data
if (!empty($params['payment_id'])) {
$cart['payment_id'] = $params['payment_id'];
}
if (isset($cart['payment_id'])) {
$payment_method_data = fn_get_payment_method_data($cart['payment_id']);
if (!empty($payment_method_data['status']) && $payment_method_data['status'] != 'A') {
return PLACE_ORDER_STATUS_DENIED;
}
}
// Remove previous failed order
if (!empty($cart['failed_order_id']) || !empty($cart['processed_order_id'])) {
$_order_ids = !empty($cart['failed_order_id']) ? $cart['failed_order_id'] : $cart['processed_order_id'];
foreach ($_order_ids as $_order_id) {
fn_delete_order($_order_id);
}
$cart['rewrite_order_id'] = $_order_ids;
unset($cart['failed_order_id'], $cart['processed_order_id']);
}
if (!empty($params['payment_info'])) {
$cart['payment_info'] = $params['payment_info'];
} else {
$cart['payment_info'] = array();
}
if (empty($params['payment_info']) && !empty($cart['extra_payment_info'])) {
$cart['payment_info'] = empty($cart['payment_info']) ? array() : $cart['payment_info'];
$cart['payment_info'] = array_merge($cart['extra_payment_info'], $cart['payment_info']);
}
unset($cart['payment_info']['secure_card_number']);
if (!empty($cart['products'])) {
foreach ($cart['products'] as $cart_id => $product) {
$_is_edp = db_get_field("SELECT is_edp FROM ?:products WHERE product_id = ?i", $product['product_id']);
if (fn_check_amount_in_stock($product['product_id'], $product['amount'], empty($product['product_options']) ? array() : $product['product_options'], $cart_id, $_is_edp, 0, $cart) == false) {
fn_delete_cart_product($cart, $cart_id);
return PLACE_ORDER_STATUS_TO_CART;
}
if (!fn_allowed_for('ULTIMATE:FREE')) {
$exceptions = fn_get_product_exceptions($product['product_id'], true);
if (!isset($product['options_type']) || !isset($product['exceptions_type'])) {
$product = array_merge($product, db_get_row('SELECT options_type, exceptions_type FROM ?:products WHERE product_id = ?i', $product['product_id']));
}
if (!fn_is_allowed_options_exceptions($exceptions, $product['product_options'], $product['options_type'], $product['exceptions_type'])) {
fn_set_notification('E', __('notice'), __('product_options_forbidden_combination', array('[product]' => $product['product'])));
fn_delete_cart_product($cart, $cart_id);
return PLACE_ORDER_STATUS_TO_CART;
}
if (!fn_is_allowed_options($product)) {
fn_set_notification('E', __('notice'), __('product_disabled_options', array('[product]' => $product['product'])));
fn_delete_cart_product($cart, $cart_id);
return PLACE_ORDER_STATUS_TO_CART;
}
}
}
}
list($order_id, $process_payment) = fn_place_order($cart, $auth);
// Clean up saved shipping rates
unset($_SESSION['product_groups']);
if (!empty($order_id)) {
if (empty($params['skip_payment']) && $process_payment == true || !empty($params['skip_payment']) && empty($auth['act_as_user'])) {
// administrator, logged in as customer can skip payment
$payment_info = !empty($cart['payment_info']) ? $cart['payment_info'] : array();
fn_start_payment($order_id, array(), $payment_info);
}
fn_order_placement_routines('route', $order_id);
return PLACE_ORDER_STATUS_OK;
} else {
return PLACE_ORDER_STATUS_TO_CART;
}
}
示例7: fn_prepare_repay_data
function fn_prepare_repay_data($payment_id, $order_info, $auth)
{
if (empty($payment_id)) {
$payment_id = $order_info['payment_id'];
}
//Get payment methods
$payment_methods = fn_get_payments(array('usergroup_ids' => $auth['usergroup_ids']));
fn_set_hook('prepare_repay_data', $payment_id, $order_info, $auth, $payment_methods);
if (!empty($payment_methods)) {
// Get payment method info
$payment_groups = fn_prepare_checkout_payment_methods($order_info, $auth);
if (!empty($payment_id)) {
$order_payment_id = $payment_id;
} else {
$first = reset($payment_methods);
$order_payment_id = $first['payment_id'];
}
$payment_data = fn_get_payment_method_data($order_payment_id);
$payment_data['surcharge_value'] = 0;
if (floatval($payment_data['a_surcharge'])) {
$payment_data['surcharge_value'] += $payment_data['a_surcharge'];
}
if (floatval($payment_data['p_surcharge'])) {
if (fn_allowed_for('MULTIVENDOR') && fn_take_payment_surcharge_from_vendor($order_info['products'])) {
$payment_data['surcharge_value'] += fn_format_price($order_info['total']);
} else {
$payment_data['surcharge_value'] += fn_format_price(($order_info['total'] - $order_info['payment_surcharge']) * $payment_data['p_surcharge'] / 100);
}
}
Registry::get('view')->assign('payment_methods', $payment_groups);
Registry::get('view')->assign('order_payment_id', $order_payment_id);
Registry::get('view')->assign('payment_method', $payment_data);
}
}
示例8: fn_prepare_repay_data
function fn_prepare_repay_data($payment_id, $order_info, $auth, &$templater)
{
//Get payment methods
$payment_methods = fn_get_payment_methods($auth);
if (!empty($payment_methods)) {
// Get payment method info
if (!empty($payment_id)) {
$order_payment_id = $payment_id;
} else {
$first = reset($payment_methods);
$order_payment_id = $first['payment_id'];
}
$payment_data = fn_get_payment_method_data($order_payment_id);
$payment_data['surcharge_value'] = 0;
if (floatval($payment_data['a_surcharge'])) {
$payment_data['surcharge_value'] += $payment_data['a_surcharge'];
}
if (floatval($payment_data['p_surcharge'])) {
$payment_data['surcharge_value'] += fn_format_price(($order_info['total'] - $order_info['payment_surcharge']) * $payment_data['p_surcharge'] / 100);
}
$templater->assign('payment_methods', $payment_methods);
$templater->assign('credit_cards', fn_get_static_data_section('C', true));
$templater->assign('order_payment_id', $order_payment_id);
$templater->assign('payment_method', $payment_data);
}
}
示例9: foreach
$addons = Registry::get('addons');
foreach ($addons as $addon_id => $addon) {
if ($view->templateExists('addons/' . $addon_id . '/views/payments/components/cc_processors/' . $processor_template)) {
$view->assign('processor_template', 'addons/' . $addon_id . '/views/payments/components/cc_processors/' . $processor_template);
break;
}
}
}
$view->assign('processor_params', $processor_data['processor_params']);
$view->assign('processor_name', $processor_data['processor']);
$view->assign('callback', $processor_data['callback']);
$view->assign('payment_id', $_REQUEST['payment_id']);
// Show methods list
} elseif ($mode == 'manage') {
$payments = fn_get_payments(DESCR_SL);
Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => array('A', 'H')), DESCR_SL));
Tygh::$app['view']->assign('payments', $payments);
Tygh::$app['view']->assign('templates', fn_get_payment_templates());
Tygh::$app['view']->assign('payment_processors', fn_get_payment_processors());
} elseif ($mode == 'update') {
$payment = fn_get_payment_method_data($_REQUEST['payment_id'], DESCR_SL);
$payment['icon'] = fn_get_image_pairs($payment['payment_id'], 'payment', 'M', true, true, DESCR_SL);
Tygh::$app['view']->assign('usergroups', fn_get_usergroups(array('type' => 'C', 'status' => array('A', 'H')), DESCR_SL));
Tygh::$app['view']->assign('payment', $payment);
Tygh::$app['view']->assign('templates', fn_get_payment_templates($payment));
Tygh::$app['view']->assign('payment_processors', fn_get_payment_processors());
Tygh::$app['view']->assign('taxes', fn_get_taxes());
if (Registry::get('runtime.company_id') && Registry::get('runtime.company_id') != $payment['company_id']) {
Tygh::$app['view']->assign('hide_for_vendor', true);
}
}
示例10: fn_rus_edost_calculate_cart_taxes_pre
function fn_rus_edost_calculate_cart_taxes_pre(&$cart, $cart_products, &$product_groups)
{
if (!empty($cart['shippings_extra'])) {
if (!empty($cart['select_office'])) {
$select_office = $cart['select_office'];
} elseif (!empty($_REQUEST['select_office'])) {
$select_office = $cart['select_office'] = $_REQUEST['select_office'];
}
if (!empty($select_office)) {
foreach ($product_groups as $group_key => $group) {
if (!empty($group['chosen_shippings'])) {
foreach ($group['chosen_shippings'] as $shipping_key => $shipping) {
$shipping_id = $shipping['shipping_id'];
if ($shipping['module'] != 'edost') {
continue;
}
if (!empty($cart['shippings_extra']['data'][$group_key][$shipping_id])) {
$shippings_extra = $cart['shippings_extra']['data'][$group_key][$shipping_id];
$product_groups[$group_key]['chosen_shippings'][$shipping_key]['data'] = $shippings_extra;
if (!empty($select_office[$group_key][$shipping_id])) {
$office_id = $select_office[$group_key][$shipping_id];
$product_groups[$group_key]['chosen_shippings'][$shipping_key]['office_id'] = $office_id;
if (!empty($shippings_extra['office'][$office_id])) {
$office_data = $shippings_extra['office'][$office_id];
$product_groups[$group_key]['chosen_shippings'][$shipping_key]['office_data'] = $office_data;
}
}
}
}
}
}
}
if (!empty($cart['shippings_extra']['data'])) {
foreach ($cart['shippings_extra']['data'] as $group_key => $shippings) {
foreach ($shippings as $shipping_id => $shipping_data) {
if (!empty($product_groups[$group_key]['shippings'][$shipping_id]['module'])) {
$module = $product_groups[$group_key]['shippings'][$shipping_id]['module'];
if (!empty($shipping_data) && $module == 'edost') {
$product_groups[$group_key]['shippings'][$shipping_id]['data'] = $shipping_data;
}
}
}
}
}
if (!empty($cart['shippings_extra']['rates'])) {
foreach ($cart['shippings_extra']['rates'] as $group_key => $shippings) {
foreach ($shippings as $shipping_id => $shipping) {
if (!empty($shipping['day']) && !empty($product_groups[$group_key]['shippings'][$shipping_id])) {
$product_groups[$group_key]['shippings'][$shipping_id]['delivery_time'] = $shipping['day'];
}
}
}
}
}
if (!empty($cart['payment_id'])) {
$payment_info = fn_get_payment_method_data($cart['payment_id']);
if (strpos($payment_info['template'], 'edost_cod.tpl')) {
$cart['shippings_extra']['sum'] = array('pricediff' => 0, 'transfer' => 0, 'total' => 0);
foreach ($product_groups as $group_key => $group) {
foreach ($group['shippings'] as $shipping_id => $shipping) {
if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'])) {
$cart['product_groups'][$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
$product_groups[$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
}
if (!empty($cart['shipping'][$shipping_id])) {
$cart['shipping'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
$cart['shipping'][$shipping_id]['rates'] = 1;
}
}
if (!empty($group['chosen_shippings'])) {
foreach ($group['chosen_shippings'] as $shipping_key => $shipping) {
$shipping_id = $shipping['shipping_id'];
if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'])) {
$cart['product_groups'][$group_key]['shippings'][$shipping_id]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricecash'];
$cart['shippings_extra']['sum']['pricediff'] += $cart['shippings_extra']['rates'][$group_key][$shipping_id]['pricediff'];
}
$cart['shippings_extra']['sum']['transfer'] += $cart['shippings_extra']['rates'][$group_key][$shipping_id]['transfer'];
if (!empty($cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'])) {
$product_groups[$group_key]['chosen_shippings'][$shipping_key]['rate'] = $cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'];
$cart['shipping_cost'] = $cart['shippings_extra']['rates'][$group_key][$shipping['shipping_id']]['pricecash'];
$cart['display_shipping_cost'] = $cart['shipping_cost'];
}
}
$cart['shippings_extra']['sum']['total'] = $cart['shippings_extra']['sum']['transfer'] + $cart['shippings_extra']['sum']['pricediff'];
}
}
}
$_SESSION['shipping_hash'] = fn_get_shipping_hash($cart['product_groups']);
}
}
示例11: die
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
// rus_build_pack dbazhenov
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION')) {
if ($mode == 'notify') {
if (isset($_REQUEST['hash']) && isset($_REQUEST['type'])) {
$processor_data = fn_get_processor_data_by_name('vsevcredit.php');
$payment_data = fn_get_payment_by_processor($processor_data['processor_id']);
$payment_data = reset($payment_data);
$payment_params = fn_get_payment_method_data($payment_data['payment_id']);
$secret_word = $payment_params['processor_params']['vvc_secret'];
if ($_REQUEST['type'] == 'user') {
if (md5($_REQUEST['user_code'] . $_REQUEST['email'] . $secret_word) === $_REQUEST['hash']) {
//For the anonymous checkout
die(0);
}
} elseif ($_REQUEST['type'] == 'order_status') {
if (isset($_REQUEST['order_id']) && isset($_REQUEST['type']) && $_REQUEST['type'] != 'user') {
$order_id = (int) $_REQUEST['order_id'];
$order_info = fn_get_order_info($order_id);
} else {
die('Access denied');
}
if (md5($_REQUEST['user_id'] . $order_id . $_REQUEST['vvc_order_id'] . $_REQUEST['vvc_status'] . $secret_word) === $_REQUEST['hash'] && $order_info['payment_info']['awaiting_callback'] == true) {
if ($_REQUEST['vvc_status'] == 'OK') {
示例12: fn_associate_order_id
function fn_associate_order_id($order_id, $transaction_id, $schema_url)
{
$payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $order_id);
$processor_data = fn_get_payment_method_data($payment_id);
$base_url = 'https://' . ($processor_data['params']['test'] == 'N' ? 'checkout.google.com' : 'sandbox.google.com/checkout') . '/cws/v2/Merchant/' . $processor_data['params']['merchant_id'];
$request_url = $base_url . '/request';
$post = array();
$post[] = "<add-merchant-order-number xmlns='" . $schema_url . "' google-order-number='" . $transaction_id . "'>";
$post[] = "<merchant-order-number>" . $order_id . "</merchant-order-number>";
$post[] = "</add-merchant-order-number>";
$_id = base64_encode($processor_data['params']['merchant_id'] . ":" . $processor_data['params']['merchant_key']);
$headers[] = "Authorization: Basic {$_id}";
$headers[] = "Accept: application/xml ";
list($a, $return) = fn_https_request("POST", $request_url, $post, '', '', 'application/xml', '', '', '', $headers);
return true;
}
示例13: DEFINE
//
// $Id: proxypay3_validation.php 7502 2009-05-19 14:54:59Z zeke $
//
DEFINE('AREA', 'C');
DEFINE('AREA_NAME', 'customer');
require './../prepare.php';
require './../init.php';
#$Ref=88;
#$Amount=4.50;
#$Shop=500;
#$Currency=978;
$totals_100 = array('EUR', 'USD', 'GBP', 'CHF', 'NLG', 'DEM', 'FRF', 'ATS');
if (!empty($_REQUEST['Ref'])) {
$order_id = strpos($_REQUEST['Ref'], '_') ? substr($_REQUEST['Ref'], 0, strpos($_REQUEST['Ref'], '_')) : $_REQUEST['Ref'];
$result = db_get_row("SELECT * FROM ?:orders WHERE order_id = ?i", $order_id);
$processor_data = fn_get_payment_method_data($result['payment_id']);
if (!in_array($processor_data['params']['currency'], $_REQUEST['totals_100'])) {
$total_cost = $result['total'];
} else {
$total_cost = $result['total'] * 100;
}
$amount = !empty($_REQUEST['Amount']) ? $_REQUEST['Amount'] + 0 : 0;
// what is zero for?
$currency = !empty($_REQUEST['Currency']) ? $_REQUEST['Currency'] + 0 : 0;
if (0 + $result['total'] == $amount && $processor_data['params']['merchantid'] == $_REQUEST['Shop'] && 0 + $processor_data['params']['currency'] == $currency && !empty($order_id) && !empty($amount) && !empty($currency)) {
fn_change_order_status($order_id, 'O');
print "[OK]";
} else {
fn_change_order_status($order_id, 'D', '', true);
print "[ERROR]";
}
示例14: fn_check_processor_script
/**
*
* @param int $payment_id payment ID
* @param string $action action
* @return array (boolean, string)
*/
function fn_check_processor_script($payment_id, $action, $additional_params = false)
{
if ($additional_params) {
if ($action == 'save' || !empty($_REQUEST['skip_payment']) && AREA == 'C') {
return array(false, '');
}
}
$payment = fn_get_payment_method_data((int) $payment_id);
if (!empty($payment['processor_id'])) {
$processor_data = fn_get_processor_data($payment['payment_id']);
if (!empty($processor_data['processor_script']) && file_exists(DIR_PAYMENT_FILES . $processor_data['processor_script'])) {
return array(true, $processor_data);
}
}
return array(false, '');
}
示例15: fn_paypal_set_bml_checkout
function fn_paypal_set_bml_checkout($payment_id, $order_id = 0, $order_info = array(), $cart = array(), $area = AREA)
{
$processor_data = fn_get_payment_method_data($payment_id);
if (!empty($order_id)) {
$return_url = fn_url("payment_notification.notify?payment=paypal_bml&order_id={$order_id}", $area, 'current');
$cancel_url = fn_url("payment_notification.cancel?payment=paypal_bml&order_id={$order_id}", $area, 'current');
} else {
$return_url = fn_payment_url('current', "paypal_bml.php?mode=express_return&payment_id={$payment_id}");
$cancel_url = fn_url("checkout.cart", $area, 'current');
}
$request = array('PAYMENTREQUEST_0_PAYMENTACTION' => 'SALE', 'PAYMENTREQUEST_0_SOLUTIONTYPE' => 'SOLE', 'PAYMENTREQUEST_0_CURRENCYCODE' => $processor_data['processor_params']['currency'], 'LOCALECODE' => CART_LANGUAGE, 'RETURNURL' => $return_url, 'CANCELURL' => $cancel_url, 'METHOD' => 'SetExpressCheckout', 'LANDINGPAGE' => 'Billing', 'UserSelectedFundingSource' => 'BML');
fn_paypal_build_request($processor_data, $request, $post_url, $cert_file);
$order_details = !empty($order_info) ? fn_paypal_build_details($order_info, $processor_data, false) : fn_paypal_build_details($cart, $processor_data);
$request = array_merge($request, $order_details);
return fn_paypal_request($request, $post_url, $cert_file);
}