// *** Make sure the file isn't accessed directly defined('APPHP_EXEC') or die('Restricted Access'); //-------------------------------------------------------------------------- if (Modules::IsModuleInstalled('payments')) { $mode = ModulesSettings::Get('payments', 'mode'); if (ModulesSettings::Get('payments', 'is_active') == 'yes') { //---------------------------------------------------------------------- define('LOG_MODE', false); define('LOG_TO_FILE', false); define('LOG_ON_SCREEN', false); define('TEST_MODE', $mode == 'TEST MODE' ? true : false); $log_data = ''; $msg = ''; $nl = "\n"; // --- Get PayPal response $objPaymentIPN = new PaymentIPN($_REQUEST, 'paypal'); $status = $objPaymentIPN->GetPaymentStatus(); $order_number = $objPaymentIPN->GetParameter('custom'); $transaction_number = $objPaymentIPN->GetParameter('txn_id'); $payer_status = $objPaymentIPN->GetParameter('payer_status'); $pp_payment_type = $objPaymentIPN->GetParameter('payment_type'); $total = $objPaymentIPN->GetParameter('mc_gross'); // Payment Types : 0 - Online Order, 1 - PayPal, 2 - 2CO, 3 - Authorize.Net // Payment Methods : 0 - Payment Company Account, 1 - Credit Card, 2 - E-Check if ($status == 'Completed') { if ($payer_status == 'verified') { $payment_method = '0'; } else { $payment_method = '1'; } } else {
/** * Draw prepayment info * @param $draw */ public static function DrawPrepayment($plan_id = '', $payment_type = '', $currency = '', $draw = true) { global $objSettings, $objLogin; $plan_id = empty($plan_id) ? MicroGrid::GetParameter('plan_id', false) : $plan_id; $payment_type = empty($payment_type) ? MicroGrid::GetParameter('payment_type', false) : $payment_type; $currency = empty($currency) ? MicroGrid::GetParameter('currency', false) : $currency; $output = ''; // retrieve module parameters $paypal_email = ModulesSettings::Get('payments', 'paypal_email'); $collect_credit_card = ModulesSettings::Get('payments', 'online_collect_credit_card'); $two_checkout_vendor = ModulesSettings::Get('payments', 'two_checkout_vendor'); $authorize_login_id = ModulesSettings::Get('payments', 'authorize_login_id'); $authorize_transaction_key = ModulesSettings::Get('payments', 'authorize_transaction_key'); $mode = ModulesSettings::Get('payments', 'mode'); $vat_value = ModulesSettings::Get('payments', 'vat_value'); // retrieve credit card info $cc_type = isset($_REQUEST['cc_type']) ? prepare_input($_REQUEST['cc_type']) : ''; $cc_holder_name = isset($_POST['cc_holder_name']) ? prepare_input($_POST['cc_holder_name']) : ''; $cc_number = isset($_POST['cc_number']) ? prepare_input($_POST['cc_number']) : ""; $cc_expires_month = isset($_POST['cc_expires_month']) ? prepare_input($_POST['cc_expires_month']) : "1"; $cc_expires_year = isset($_POST['cc_expires_year']) ? prepare_input($_POST['cc_expires_year']) : date("Y"); $cc_cvv_code = isset($_POST['cc_cvv_code']) ? prepare_input($_POST['cc_cvv_code']) : ""; // prepare datetime format $field_date_format = get_datetime_format(); $currency_format = get_currency_format(); $arr_durations = self::PrepareDurationsArray(); // prepare clients info $sql = 'SELECT * FROM ' . TABLE_CUSTOMERS . ' WHERE id = ' . (int) $objLogin->GetLoggedID(); $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY); $client_info = array(); $client_info['first_name'] = isset($result[0]['first_name']) ? $result[0]['first_name'] : ''; $client_info['last_name'] = isset($result[0]['last_name']) ? $result[0]['last_name'] : ''; $client_info['address1'] = isset($result[0]['b_address']) ? $result[0]['b_address'] : ''; $client_info['address2'] = isset($result[0]['b_address2']) ? $result[0]['b_address2'] : ''; $client_info['city'] = isset($result[0]['b_city']) ? $result[0]['b_city'] : ''; $client_info['state'] = isset($result[0]['b_state']) ? $result[0]['b_state'] : ''; $client_info['zip'] = isset($result[0]['b_zipcode']) ? $result[0]['b_zipcode'] : ''; $client_info['country'] = isset($result[0]['b_country']) ? $result[0]['b_country'] : ''; $client_info['email'] = isset($result[0]['email']) ? $result[0]['email'] : ''; $client_info['company'] = isset($result[0]['company']) ? $result[0]['company'] : ''; $client_info['phone'] = isset($result[0]['phone']) ? $result[0]['phone'] : ''; $client_info['fax'] = isset($result[0]['fax']) ? $result[0]['fax'] : ''; if ($cc_holder_name == '') { if ($objLogin->IsLoggedIn()) { $cc_holder_name = $objLogin->GetLoggedFirstName() . ' ' . $objLogin->GetLoggedLastName(); } else { $cc_holder_name = $client_info['first_name'] . ' ' . $client_info['last_name']; } } // get order number $sql = 'SELECT id, order_number FROM ' . TABLE_ORDERS . ' WHERE customer_id = ' . (int) $objLogin->GetLoggedID() . ' AND status = 0 ORDER BY id DESC'; $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY); if ($result[1] > 0) { $order_number = $result[0]['order_number']; } else { $order_number = strtoupper(get_random_string(10)); } $additional_info = ''; $cart_total_wo_vat = 0; $vat_cost = 0; $cart_total = 0; $sql = 'SELECT ap.id, ap.listings_count, ap.price, ap.duration, ap.is_default, apd.name, apd.description FROM ' . TABLE_ADVERTISE_PLANS . ' ap LEFT OUTER JOIN ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . ' apd ON ap.id = apd.advertise_plan_id AND apd.language_id = \'' . Application::Get('lang') . '\' WHERE ap.id = ' . (int) $plan_id; $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY); $fisrt_part = '<table border="0" width="97%" align="center"> <tr><td colspan="3"><h4>' . _ORDER_DESCRIPTION . '</h4></td></tr> <tr><td width="20%">' . _ORDER_DATE . ' </td><td width="2%"> : </td><td> ' . format_datetime(date('Y-m-d H:i:s'), $field_date_format) . '</td></tr>'; if ($result[1] > 0) { if ($result[0]['price'] == 0) { $payment_type = 'online'; $collect_credit_card = 'no'; } $cart_total_wo_vat = $result[0]['price'] * Application::Get('currency_rate'); $vat_cost = $cart_total_wo_vat * ($vat_value / 100); $cart_total = $cart_total_wo_vat + $vat_cost; $duration = isset($arr_durations[$result[0]['duration']]) ? $arr_durations[$result[0]['duration']] : ''; $fisrt_part .= '<tr><td>' . _ADVERTISE_PLAN . ' </td><td width="2%"> : </td><td> ' . $result[0]['name'] . '</td></tr>'; $fisrt_part .= '<tr><td>' . _DURATION . ' </td><td width="2%"> : </td><td> ' . $duration . '</td></tr>'; $fisrt_part .= '<tr><td>' . _LISTINGS . ' </td><td width="2%"> : </td><td> ' . $result[0]['listings_count'] . '</td></tr>'; $fisrt_part .= '<tr><td>' . _PRICE . ' </td><td width="2%"> : </td><td> ' . Currencies::PriceFormat($cart_total_wo_vat) . '</td></tr>'; $fisrt_part .= '<tr><td>' . _DESCRIPTION . ' </td><td width="2%"> : </td><td> ' . $result[0]['description'] . '</td></tr>'; } $pp_params = array('api_login' => '', 'transaction_key' => '', 'order_number' => $order_number, 'address1' => $client_info['address1'], 'address2' => $client_info['address2'], 'city' => $client_info['city'], 'zip' => $client_info['zip'], 'country' => $client_info['country'], 'state' => $client_info['state'], 'first_name' => $client_info['first_name'], 'last_name' => $client_info['last_name'], 'email' => $client_info['email'], 'company' => $client_info['company'], 'phone' => $client_info['phone'], 'fax' => $client_info['fax'], 'notify' => '', 'return' => 'index.php?page=payment_return', 'cancel_return' => 'index.php?page=payment_cancel', 'paypal_form_type' => '', 'paypal_form_fields' => '', 'paypal_form_fields_count' => '', 'collect_credit_card' => $collect_credit_card, 'cc_type' => '', 'cc_holder_name' => '', 'cc_number' => '', 'cc_cvv_code' => '', 'cc_expires_month' => '', 'cc_expires_year' => '', 'currency_code' => Application::Get('currency_code'), 'additional_info' => $additional_info, 'discount_value' => '', 'extras_param' => '', 'extras_sub_total' => '', 'vat_cost' => $vat_cost, 'cart_total' => number_format((double) $cart_total, (int) Application::Get('currency_decimals'), '.', ','), 'is_prepayment' => false, 'pre_payment_type' => '', 'pre_payment_value' => 0); $fisrt_part .= ' <tr><td colspan="3" nowrap="nowrap" height="10px"></td></tr> <tr><td colspan="3"><h4>' . _TOTAL . '</h4></td></tr> <tr><td>' . _SUBTOTAL . ' </td><td> : </td><td> ' . Currencies::PriceFormat($cart_total_wo_vat, '', '', $currency_format) . '</td></tr>'; $fisrt_part .= '<tr><td>' . _VAT . ' (' . $vat_value . '%) </td><td> : </td><td> ' . Currencies::PriceFormat($vat_cost, '', '', $currency_format) . '</td></tr>'; $fisrt_part .= '<tr><td>' . _PAYMENT_SUM . ' </td><td> : </td><td> <b>' . Currencies::PriceFormat($cart_total, '', '', $currency_format) . '</b></td></tr>'; $fisrt_part .= '<tr><td colspan="3" nowrap="nowrap" height="0px"></td></tr>'; $fisrt_part .= '<tr><td colspan="3">'; //if($additional_info != ''){ // $fisrt_part .= '<tr><td colspan="3" nowrap height="10px"></td></tr>'; // $fisrt_part .= '<tr><td colspan="3"><h4>'._ADDITIONAL_INFO.'</h4>'.$additional_info.'</td></tr>'; //} $second_part = ' </td></tr> </table><br />'; if ($payment_type == 'online') { $output .= $fisrt_part; $pp_params['credit_card_required'] = $collect_credit_card; $pp_params['cc_type'] = $cc_type; $pp_params['cc_holder_name'] = $cc_holder_name; $pp_params['cc_number'] = $cc_number; $pp_params['cc_cvv_code'] = $cc_cvv_code; $pp_params['cc_expires_month'] = $cc_expires_month; $pp_params['cc_expires_year'] = $cc_expires_year; $output .= PaymentIPN::DrawPaymentForm('online', $pp_params, $mode == 'TEST MODE' ? 'test' : 'real', false); $output .= $second_part; } else { if ($payment_type == 'paypal') { $output .= $fisrt_part; $pp_params['api_login'] = $paypal_email; $pp_params['notify'] = 'index.php?page=payment_notify_paypal'; $pp_params['paypal_form_type'] = 'single'; $pp_params['paypal_form_fields'] = ''; $pp_params['paypal_form_fields_count'] = ''; $output .= PaymentIPN::DrawPaymentForm('paypal', $pp_params, $mode == 'TEST MODE' ? 'test' : 'real', false); $output .= $second_part; } else { if ($payment_type == '2co') { $output .= $fisrt_part; $pp_params['api_login'] = $two_checkout_vendor; $pp_params['notify'] = 'index.php?page=payment_notify_2co'; $output .= PaymentIPN::DrawPaymentForm('2co', $pp_params, $mode == 'TEST MODE' ? 'test' : 'real', false); $output .= $second_part; } else { if ($payment_type == 'authorize') { $output .= $fisrt_part; $pp_params['api_login'] = $authorize_login_id; $pp_params['transaction_key'] = $authorize_transaction_key; $pp_params['notify'] = 'index.php?page=payment_notify_autorize_net'; // authorize.net accepts only USD, so we need to convert the sum into USD $pp_params['cart_total'] = number_format($pp_params['cart_total'] * Application::Get('currency_rate'), '2', '.', ','); $output .= PaymentIPN::DrawPaymentForm('authorize.net', $pp_params, $mode == 'TEST MODE' ? 'test' : 'real', false); $output .= $second_part; } } } } if ($draw) { echo $output; } else { $output; } }
// *** Make sure the file isn't accessed directly defined('APPHP_EXEC') or die('Restricted Access'); //-------------------------------------------------------------------------- if (Modules::IsModuleInstalled('payments')) { $mode = ModulesSettings::Get('payments', 'mode'); if (ModulesSettings::Get('payments', 'is_active') == 'yes') { //---------------------------------------------------------------------- define('LOG_MODE', false); define('LOG_TO_FILE', false); define('LOG_ON_SCREEN', false); define('TEST_MODE', $mode == 'TEST MODE' ? true : false); $log_data = ''; $msg = ''; $nl = "\n"; // --- Get 2CO response $objPaymentIPN = new PaymentIPN($_REQUEST, '2co'); $status = $objPaymentIPN->GetPaymentStatus(); $payment_method = $objPaymentIPN->GetParameter('pay_method'); $total = $objPaymentIPN->GetParameter('total'); $transaction_number = $objPaymentIPN->GetParameter('order_number'); $order_number = $objPaymentIPN->GetParameter('custom'); // Payment Types : 0 - Online Order, 1 - PayPal, 2 - 2CO, 3 - Authorize.Net // Payment Methods : 0 - Payment Company Account, 1 - Credit Card, 2 - E-Check if ($payment_method != '') { $payment_method = '1'; } else { $payment_method = '0'; } if (TEST_MODE) { $status = 'approved'; }
// *** Make sure the file isn't accessed directly defined('APPHP_EXEC') or die('Restricted Access'); //-------------------------------------------------------------------------- if (Modules::IsModuleInstalled('payments')) { $mode = ModulesSettings::Get('payments', 'mode'); if (ModulesSettings::Get('payments', 'is_active') == 'yes') { //---------------------------------------------------------------------- define('LOG_MODE', false); define('LOG_TO_FILE', false); define('LOG_ON_SCREEN', false); define('TEST_MODE', $mode == 'TEST MODE' ? true : false); $log_data = ''; $msg = ''; $nl = "\n"; // --- Get Authorize.Net response $objPaymentIPN = new PaymentIPN($_REQUEST, 'authorize.net'); $status = $objPaymentIPN->GetPaymentStatus(); $order_number = $objPaymentIPN->GetParameter('custom'); $transaction_number = $objPaymentIPN->GetParameter('x_trans_id'); $x_method = $objPaymentIPN->GetParameter('x_method'); $total = $objPaymentIPN->GetParameter('x_amount'); $reason_text = $objPaymentIPN->GetParameter('x_response_reason_text'); // Payment Types : 0 - Online Order, 1 - PayPal, 2 - 2CO, 3 - Authorize.Net // Payment Methods : 0 - Payment Company Account, 1 - Credit Card, 2 - E-Check if (strtolower($x_method) == '1' || strtolower($x_method) == 'cc') { $payment_method = '1'; } else { $payment_method = '2'; } if (TEST_MODE) { $status = '1';