Exemple #1
0
 /**
  * oAuth2 authorization. If the acess_token needs to be refreshed pass $refresh_token as first parameter,
  * if this is the first time getting access_token from user, then set the first parameter to false, pass the auth code
  * in the second.
  * @param bool $refresh_token
  * @param bool $auth_code
  * @return array $tokens
  */
 function authorize($refresh_token = FALSE, $auth_code = FALSE)
 {
     $auth = new Authorize($this->conn, $this->api_key, $this->api_secret);
     $tokens = $refresh_token ? $auth->refreshAccessToken($refresh_token) : $auth->getAccessToken($auth_code);
     !$tokens ? $auth->getAuthorizationCode() : $this->conn->setAccessData($tokens['access_token'], $tokens['refresh_token']);
     return $tokens;
 }
function eStore_auth_net_ipn_processor_listener()
{
    if (isset($_REQUEST['x_invoice_num']) && isset($_REQUEST['x_trans_id']) && isset($_REQUEST['x_amount'])) {
        if (get_option('eStore_use_authorize_gateway')) {
            //Auth.net is enabled
            //Process the IPN
        } else {
            eStore_payment_debug("Authorize.net payment gateway is not enabled in eStore settings. This IPN will not be processed", false);
        }
    } else {
        return;
    }
    status_header(200);
    include_once 'lib/gateway/Authorize.php';
    include_once 'eStore_process_payment_data.php';
    // Create an instance of the authorize.net library
    $myAuthorize = new Authorize();
    // Log the IPN results
    $debug_on = get_option('eStore_cart_enable_debug');
    if ($debug_on) {
        $myAuthorize->ipnLog = TRUE;
    }
    // Specify your authorize api and transaction id
    $authorize_login_id = get_option('eStore_authorize_login');
    $authorize_tx_key = get_option('eStore_authorize_tx_key');
    $myAuthorize->setUserInfo($authorize_login_id, $authorize_tx_key);
    // Enable test mode if needed
    if (get_option('eStore_cart_enable_sandbox')) {
        $myAuthorize->enableTestMode();
    }
    // Check validity and process
    if ($myAuthorize->validateIpn()) {
        handle_payment_data($myAuthorize->ipnData, "authorize");
    } else {
        $_SESSION['eStore_tx_result'] = $myAuthorize->lastError;
        //Ipn validation failed... redirect to the cancel URL
        $return = get_option('cart_cancel_from_paypal_url');
        if (empty($return)) {
            $return = get_bloginfo('wpurl');
        }
        $redirection_parameter = 'Location: ' . $return;
        header($redirection_parameter);
        exit;
    }
}
Exemple #3
0
 /**
  * makes all routes
  */
 static function start()
 {
     $routes = explode('/', $_SERVER['REQUEST_URI']);
     if (!Authorize::checkAuth() && ($routes[1] != 'register' || $routes[1] == 'langchange')) {
         // pre-check authorisation
         if ($routes[1] == 'langchange') {
             include Module::CONTROLLER_PATH . 'ControllerMain.php';
             $controller = new ControllerMain();
             $controller->actionlangchange();
         } else {
             include Module::CONTROLLER_PATH . 'ControllerAuth.php';
             $controller = new ControllerAuth();
             $controller->actionlogin();
         }
     } else {
         $routeNames = Module::getRoutes();
         $controllerName = 'Main';
         $actionName = 'index';
         // generate controller name
         if (!empty($routes[1])) {
             if (isset($routeNames[$routes[1]])) {
                 $controllerName = $routeNames[$routes[1]]['controller'];
                 // get action
                 if (!empty($routes[2])) {
                     $actionName = $routes[2];
                 } else {
                     $actionName = $routeNames[$routes[1]]['action'];
                 }
             } else {
                 Route::ErrorPage404();
             }
         }
         // need for get names with prefixes
         $modelName = 'Model' . $controllerName;
         $controllerName = 'Controller' . $controllerName;
         $actionName = 'action' . ucfirst($actionName);
         $modelFile = $modelName . Module::DEFAULT_EXT;
         $modelPath = Module::MODEL_PATH . $modelFile;
         if (file_exists($modelPath)) {
             include $modelPath;
         }
         $controllerFile = $controllerName . Module::DEFAULT_EXT;
         $controllerPath = Module::CONTROLLER_PATH . $controllerFile;
         if (file_exists($controllerPath)) {
             include $controllerPath;
         } else {
             Route::ErrorPage404();
         }
         $controller = new $controllerName();
         $action = $actionName;
         if (method_exists($controller, $action)) {
             $controller->{$action}();
         } else {
             Route::ErrorPage404();
         }
     }
 }
Exemple #4
0
 /**
  * Ipn::authorize()
  *
  * Validate Authorize payments
  *
  * @access	public
  * @return	void
  */
 public function authorize()
 {
     // make sure there are no timeouts...
     echo lang('Processing...');
     flush();
     $gate = $this->db->get_where('gateways', array('name' => 'authorize'))->row();
     $gate_conf = json_decode($gate->settings);
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/Authorize.php';
     $this->_gateway = 2;
     // Create an instance of the authorize.net library
     $my_authorize = new Authorize();
     // Log the IPN results
     // $my_authorize->ipn_log = TRUE;
     // Specify your authorize login and secret
     $my_authorize->set_user_info($gate_conf['login'], $gate_conf['secret']);
     // Enable test mode if needed
     $my_authorize->enable_test_mode();
     // Check validity and write down it
     if ($my_authorize->validate_ipn()) {
         $settings = json_decode(base64_decode($my_authorize->ipn_data['x_Cust_ID']));
         if ($settings['type'] == 'reg') {
             $this->_new_user_payment($settings['user_id'], $my_authorize->ipn_data['x_Amount']);
             redirect('/user/pay_complete');
         }
         redirect('/user/pay_cancel');
     } else {
         $this->_log_error($my_authorize->ipn_data);
         redirect('/user/pay_cancel');
     }
 }
 function getModules($position, $container = false)
 {
     $modules = $this->fetchModules();
     $output = '';
     //ob_start();
     if (!empty($modules)) {
         foreach ($modules as $module) {
             if (!empty($module['Module']['position']) and $module['Module']['position'] == $position) {
                 //check if the module is enabled in the current page
                 if ($this->site != 'admin' and !in_array('0', $module['Module']['pages'], true) and !in_array(Request::data('_Route.index'), $module['Module']['pages'], true)) {
                     continue;
                 }
                 //check permissions
                 if (!empty($module['Module']['rules']['display']) and !Authorize::check_rules($module['Module']['rules']['display'])) {
                     continue;
                 }
                 $output .= \GCore\Helpers\Module::render($module['Module'], $container);
             }
         }
     }
     //$output = ob_get_clean();
     return $output;
 }
Exemple #6
0
<?php

ignore_user_abort(true);
set_time_limit(0);
include_once 'config.inc.php';
$etc = new Etc();
$auth = new Authorize();
if (!$_GET['database'] || '' == $_GET['database']) {
    die($lang['dieTableChoose']);
} else {
    include_once 'templates/style.css';
    //echo '<div class="container">';
    //echo '<div class="span1">';
    //echo '</div>';
    //echo '<div class="span10">';
    echo '<br />' . $_GET['database'] . '<i class=icon-backward></i>  <a href=dbStructure.php?database=' . $_GET['database'] . ' target="right">' . $lang['back'] . '</a><br /><br />';
    include_once 'templates/sql_query_navi.html';
    echo "<br /><br />";
    $transport = new TSocket(HOST, PORT);
    $protocol = new TBinaryProtocol($transport);
    $client = new ThriftHiveClient($protocol);
    $transport->open();
    $sql = 'use `' . $_GET['database'] . '`';
    //echo $sql.'<br /><br />';
    $client->execute($sql);
    //$client->fetchOne();
    $sql = 'desc formatted ' . $_GET['table'];
    $client->execute($sql);
    $array_desc_table = $client->fetchAll();
    $array_desc_table_1 = $etc->GetTableDetail($array_desc_table, "1");
    $array_desc_table_4 = @$etc->GetTableDetail($array_desc_table, "4");
Exemple #7
0
 /**
  * User::pay_new()
  *
  * New payment
  *
  * @access	public
  * @param	int		$id			User ID
  * @param	int		$gate_id	Gateway ID
  * @return	void
  */
 public function pay_new($id = '', $gate_id = '')
 {
     if (intval($id) == 0 or intval($gate_id) == 0) {
         show_404();
     }
     $user = $this->db->get_where('users', array('id' => $id))->row();
     if (!$user or $user->status != 0) {
         show_404();
     }
     $group = $this->db->get_where('groups', array('id' => $user->group))->row();
     if (!$group) {
         show_404();
     }
     $gate = $this->db->get_where('gateways', array('id' => $gate_id))->row();
     if (!$gate) {
         show_404();
     }
     // get payment gateway settings
     $gate_conf = unserialize($gate->settings);
     // load payment libs
     include_once APPPATH . 'libraries/payment/PaymentGateway.php';
     // which payment system to use?
     if ($gate->name == 'paypal') {
         // Include the paypal library
         include_once APPPATH . 'libraries/payment/Paypal.php';
         // Create an instance of the paypal library
         $my_paypal = new Paypal();
         // Specify your paypal email
         $my_paypal->add_field('business', $gate_conf['email']);
         // Specify the currency
         $my_paypal->add_field('currency_code', $gate_conf['currency']);
         // Specify the url where paypal will send the user on success/failure
         $my_paypal->add_field('return', site_url('user/pay_complete'));
         $my_paypal->add_field('cancel_return', site_url('user/pay_cancel'));
         // Specify the url where paypal will send the IPN
         $my_paypal->add_field('notify_url', site_url('payment/ipn/paypal'));
         // Specify the product information
         $my_paypal->add_field('item_name', $this->startup->site_config->sitename . ' ' . lang('Account Registration'));
         $my_paypal->add_field('amount', $group->price);
         $my_paypal->add_field('item_number', rand(1, 1000) . '-' . $user->id);
         // Specify any custom value
         $my_paypal->add_field('custom', base64_encode(json_encode(array('user_id' => $user->id, 'type' => 'reg'))));
         // Enable test mode if needed
         if (defined('XUDEBUG') and XUDEBUG == true) {
             $my_paypal->enable_test_mode();
         }
         // Let's start the train!
         $data['form'] = $my_paypal->submit_payment(lang('If you are not automatically redirected to payment website within 5 seconds,<br> click \'Make Payment\' below to begin the payment procedure.'));
     } else {
         if ($gate->name == 'authorize') {
             // Include the paypal library
             include_once APPPATH . 'libraries/payment/Authorize.php';
             // Create an instance of the authorize.net library
             $my_authorize = new Authorize();
             // Specify your authorize.net login and secret
             $my_authorize->set_user_info($gate_conf['login'], $gate_conf['secret']);
             // Specify the url where authorize.net will send the user on success/failure
             $my_authorize->add_field('x_Receipt_Link_URL', site_url('user/pay_complete'));
             // Specify the url where authorize.net will send the IPN
             $my_authorize->add_field('x_Relay_URL', site_url('payment/ipn/authorize'));
             // Specify the product information
             $my_authorize->add_field('x_Description', $this->startup->site_config->sitename . ' ' . lang('Account Registration'));
             $my_authorize->add_field('x_Amount', $group->price);
             $my_authorize->add_field('x_Invoice_num', rand(1, 1000) . '-' . $user->id);
             $my_authorize->add_field('x_Cust_ID', base64_encode(json_encode(array('user_id' => $user->id, 'type' => 'reg'))));
             // Enable test mode if needed
             if (defined('XUDEBUG') and XUDEBUG == true) {
                 $my_authorize->enable_test_mode();
             }
             // Let's start the train!
             $data['form'] = $my_authorize->submit_payment(lang('If you are not automatically redirected to payment website within 5 seconds,<br> click \'Make Payment\' below to begin the payment procedure.'));
         } else {
             if ($gate->name = '2co') {
                 // Include the paypal library
                 include_once APPPATH . 'libraries/payment/TwoCo.php';
                 // Create an instance of the authorize.net library
                 $my2_co = new TwoCo();
                 // Specify your 2CheckOut vendor id
                 $my2_co->add_field('sid', $gate_conf['vendor_id']);
                 // Specify the order information
                 $my2_co->add_field('cart_order_id', rand(1, 1000) . '-' . $user->id);
                 $my2_co->add_field('total', $group->price);
                 // Specify the url where authorize.net will send the IPN
                 $my2_co->add_field('x_Receipt_Link_URL', site_url('payment/ipn/two_checkout'));
                 $my2_co->add_field('tco_currency', $gate_conf['currency']);
                 $my2_co->add_field('custom', base64_encode(json_encode(array('user_id' => $user->id, 'type' => 'reg'))));
                 // Enable test mode if needed
                 if (defined('XUDEBUG') and XUDEBUG == true) {
                     $my2_co->enable_test_mode();
                 }
                 // Let's start the train!
                 $data['form'] = $my2_co->submit_payment(lang('If you are not automatically redirected to payment website within 5 seconds,<br> click \'Make Payment\' below to begin the payment procedure.'));
             }
         }
     }
     $this->load->view($this->startup->skin . '/header', array('header_title' => lang('Make Payment')));
     $this->load->view($this->startup->skin . '/user/register/pay_new', array('ammount' => $group, 'user' => $id, 'form' => $data['form']));
     $this->load->view($this->startup->skin . '/footer');
 }
function espresso_process_authnet($payment_data)
{
    // Include the authorize.net library
    include_once 'Authorize.php';
    // Create an instance of the authorize.net library
    $myAuthorize = new Authorize();
    echo '<!--Event Espresso Authorize.net SIM Gateway Version ' . $myAuthorize->gateway_version . '-->';
    // Log the IPN results
    $myAuthorize->ipnLog = TRUE;
    $authnet_settings = get_option('event_espresso_authnet_settings');
    $authnet_login_id = $authnet_settings['authnet_login_id'];
    $authnet_transaction_key = $authnet_settings['authnet_transaction_key'];
    // Enable test mode if needed
    //4007000000027  <-- test successful visa
    //4222222222222  <-- test failure card number
    if ($authnet_settings['use_sandbox']) {
        $myAuthorize->enableTestMode();
        $email_transaction_dump = true;
    }
    // Specify your authorize login and secret
    $myAuthorize->setUserInfo($authnet_login_id, $authnet_transaction_key);
    $payment_data['txn_type'] = 'authorize.net SIM';
    $payment_data['payment_status'] = "Incomplete";
    if (!empty($_REQUEST['x_trans_id'])) {
        $payment_data['txn_id'] = $_REQUEST['x_trans_id'];
    } else {
        $payment_data['txn_id'] = 0;
    }
    $payment_data['txn_details'] = serialize($_REQUEST);
    $curl_session_id = uniqid('', true);
    global $wpdb;
    $sql = "UPDATE " . EVENTS_ATTENDEE_TABLE . " SET attendee_session = '" . $curl_session_id . "' WHERE attendee_session ='" . $payment_data['attendee_session'] . "' ";
    $wpdb->query($sql);
    $payment_data['attendee_session'] = $curl_session_id;
    // Check validity and write down it
    if ($myAuthorize->validateIpn()) {
        $payment_data['txn_id'] = $myAuthorize->ipnData['x_trans_id'];
        $payment_data['txn_details'] = serialize($myAuthorize->ipnData);
        //file_put_contents('authorize.txt', 'SUCCESS' . date("m-d-Y")); //Used for debugging purposes
        //Be sure to echo something to the screen so authent knows that the ipn works
        //store the results in reusable variables
        if ($myAuthorize->ipnData['x_response_code'] == 1) {
            ?>
			<h2><?php 
            _e('Thank You!', 'event_espresso');
            ?>
</h2>
			<p><?php 
            _e('Your transaction has been processed.', 'event_espresso');
            ?>
</p>
			<?php 
            $payment_data['payment_status'] = 'Completed';
        } else {
            ?>
			<h2 style="color:#F00;"><?php 
            _e('There was an error processing your transaction!', 'event_espresso');
            ?>
</h2>
			<p><strong>Error:</strong> (Payment was declined)</p>
			<?php 
            $payment_data['payment_status'] = 'Payment Declined';
        }
        //Debugging option
        $email_transaction_dump = true;
        if ($email_transaction_dump == true) {
            // For this, we'll just email ourselves ALL the data as plain text output.
            $subject = 'Authorize.net Notification - Gateway Variable Dump';
            $body = "An authorize.net payment notification was successfully recieved\n";
            $body .= "from " . $myAuthorize->ipnData['x_email'] . " on " . date('m/d/Y');
            $body .= " at " . date('g:i A') . "\n\nDetails:\n";
            foreach ($myAuthorize->ipnData as $key => $value) {
                $body .= "\n{$key}: {$value}\n";
            }
            wp_mail($payment_data['contact'], $subject, $body);
        }
    } else {
        ?>
		<h2 style="color:#F00;"><?php 
        _e('There was an error processing your transaction!', 'event_espresso');
        ?>
</h2>
		<p><strong>Error:</strong> (IPN response did not validate) ?></p>
		<?php 
        if (is_writable('authorize.txt')) {
            file_put_contents('authorize.txt', "FAILURE\n\n" . $myAuthorize->ipnData);
        }
        //echo something to the screen so authent knows that the ipn works
        $subject = 'Instant Payment Notification - Gateway Variable Dump';
        $body = "An instant payment notification failed\n";
        $body .= "from " . $myAuthorize->ipnData['x_email'] . " on " . date('m/d/Y');
        $body .= " at " . date('g:i A') . "\n\nDetails:\n";
        foreach ($myAuthorize->ipnData as $key => $value) {
            $body .= "\n{$key}: {$value}\n";
        }
        wp_mail($payment_data['contact'], $subject, $body);
    }
    add_action('action_hook_espresso_email_after_payment', 'espresso_email_after_payment');
    return $payment_data;
}
<?php

include_once '../../../wp-load.php';
include_once 'lib/gateway/Authorize.php';
include_once 'eStore_process_payment_data.php';
status_header(200);
// Create an instance of the authorize.net library
$myAuthorize = new Authorize();
// Log the IPN results
$debug_on = get_option('eStore_cart_enable_debug');
if ($debug_on) {
    $myAuthorize->ipnLog = TRUE;
}
// Specify your authorize api and transaction id
$authorize_login_id = get_option('eStore_authorize_login');
$authorize_tx_key = get_option('eStore_authorize_tx_key');
$myAuthorize->setUserInfo($authorize_login_id, $authorize_tx_key);
// Enable test mode if needed
if (get_option('eStore_cart_enable_sandbox')) {
    $myAuthorize->enableTestMode();
}
// Check validity and process
if ($myAuthorize->validateIpn()) {
    handle_payment_data($myAuthorize->ipnData, "authorize");
} else {
    $_SESSION['eStore_tx_result'] = $myAuthorize->lastError;
    //Ipn validation failed... redirect to the cancel URL
    $return = get_option('cart_cancel_from_paypal_url');
    if (empty($return)) {
        $return = get_bloginfo('wpurl');
    }
Exemple #10
0
$dbChangesAjax = 'No';
$confFilesAjax = 'No';
/* Checking whether upgrader support curret version */
$versionSupport = false;
if ($oldVersion == '2.2.2.2' || $oldVersion == '2.3' || $oldVersion == '2.4' || $oldVersion == '2.4.0.1' || $oldVersion == '2.4.1') {
    $versionSupport = true;
}
if (!isset($_REQUEST['hdnState'])) {
    $currScreen = $screenArr['welcome'];
    $currPage = 'templates/welcome.inc';
    require_once 'templates/mainUi.php';
} else {
    $state = $_REQUEST['hdnState'];
    switch ($state) {
        case 'authAdmin':
            if (Authorize::authAdmin(trim($_POST['txtUsername']), trim($_POST['txtPassword']))) {
                if ($versionSupport) {
                    $currScreen = $screenArr['versionCheck'];
                    $currPage = 'templates/upgradeStart.inc';
                    require_once 'templates/mainUi.php';
                } else {
                    $currScreen = $screenArr['versionCheck'];
                    $currPage = 'templates/error-version.inc';
                    require_once 'templates/mainUi.php';
                }
            } else {
                $currScreen = $screenArr['welcome'];
                $currPage = 'templates/error-login.inc';
                require_once 'templates/mainUi.php';
            }
            break;
 /**
  * @api {post} /ecommerce/purchase Make Purchase
  * @apiName Make Purchase
  * @apiGroup Transaction
  * @apiHeader (Header) {String} X_Authorization Authorization value.
  * @apiParam  {String[]} items cart items in json format
  * @apiParam  {Number} amount Total amount.
  * @apiParam  {Number} card_num Credit Cart Number.
  * @apiParam  {String} exp_date Credit Cart exp date in 'm/y' format.
  *
  * @apiParam  (items) {Number} id course_sale_id
  * @apiParam  (items) {Number} course_id Course Id.
  * @apiParam  (items) {String} name Course Name.
  * @apiParam  (items) {Number} price final price.
  * @apiParam  (items) {Number} qty qty.
  * 
  * @apiError 400 Input Invalid. This will happen if the param is missing or not the valid format.
  * @apiError 404 Not found. This will happen if the role id/user id/group id is not in our system.
  * @apiError 401 Not authorized. This will happen if the header value is not attached.
  * 
  * 
  */
 public static function purchase()
 {
     $app = \Slim\Slim::getInstance();
     $data = $app->request->post();
     $idUser = self::authCheck();
     self::inputValid();
     self::cartCheck();
     $data['cust_id'] = $idUser;
     $transaction = new Authorize();
     $transaction->setCustomer($data);
     $transaction->addItem(json_decode($data['items']));
     $result = $transaction->AIM($data['amount'], $data['card_num'], $data['exp_date']);
     if (!$result->approved) {
         $app->halt(400, json_encode($result->response_reason_text));
     }
     EnrollmentController::afterPurchaseEnroll(json_decode($data['items']), $idUser);
     return json_encode($result);
 }
Exemple #12
0
<?php

// Include the paypal library
include_once 'Authorize.php';
// Create an instance of the authorize.net library
$myAuthorize = new Authorize();
// Log the IPN results
$myAuthorize->ipnLog = TRUE;
// Specify your authorize login and secret
$myAuthorize->setUserInfo('YOUR_LOGIN', 'YOUR_SECRET_KEY');
// Enable test mode if needed
$myAuthorize->enableTestMode();
// Check validity and write down it
if ($myAuthorize->validateIpn()) {
    file_put_contents('authorize.txt', 'SUCCESS');
} else {
    file_put_contents('authorize.txt', "FAILURE\n\n" . $myAuthorize->ipnData);
}
function submit_to_authorize()
{
    $eStore_default_currency = get_option('cart_payment_currency');
    $eStore_return_url = get_option('cart_return_from_paypal_url');
    $eStore_sandbox_enabled = get_option('eStore_cart_enable_sandbox');
    $myAuthorize = new Authorize();
    $authorize_login_id = get_option('eStore_authorize_login');
    $authorize_tx_key = get_option('eStore_authorize_tx_key');
    $myAuthorize->setUserInfo($authorize_login_id, $authorize_tx_key);
    if (get_option('eStore_auto_product_delivery') != '') {
        $notify = WP_ESTORE_URL . '/eStore_auth_ipn.php';
        $myAuthorize->addField('x_Relay_URL', $notify);
    }
    global $wpdb;
    $products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
    $x_Description = "Cart Checkout: ";
    $count = 1;
    foreach ($_SESSION['eStore_cart'] as $item) {
        $id = $item['item_number'];
        $ret_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$id}'", OBJECT);
        if ($count > 1) {
            $x_Description .= ", ";
        }
        $x_Description .= $item['item_number'];
        $rounded_price = round($item['price'], 2);
        $item_name = substr(htmlspecialchars($item['name']), 0, 30);
        $line_item_val = $item['item_number'] . "<|>" . $item_name . "<|><|>" . $item['quantity'] . "<|>" . $rounded_price . "<|>" . "N";
        $myAuthorize->addField('x_line_item-' . $count, $line_item_val);
        $count++;
    }
    //Specify the url where auth.net will return the customer after payment
    $total_items_in_cart = count($_SESSION['eStore_cart']);
    if ($total_items_in_cart == 1 && !empty($ret_product->return_url)) {
        //$myAuthorize->addField('x_receipt_link_URL', $ret_product->return_url);
        $eStore_return_url = $ret_product->return_url;
    }
    if (!empty($eStore_return_url)) {
        //Set the return URL
        $myAuthorize->addField('x_receipt_link_URL', $eStore_return_url);
    }
    //TODO - new auth.net redirection method
    if (WP_ESTORE_USE_AUTH_NET_ALT_REDIRECTION === '1') {
        $myAuthorize->addField('x_receipt_link_method', "GET");
        $myAuthorize->addField('x_receipt_link_text', "Click Here to Complete Transaction");
        $myAuthorize->addField('x_Relay_Response', "FALSE");
    }
    // Shipping
    $myAuthorize->addField('x_freight', $_SESSION['eStore_cart_postage_cost']);
    // Tax
    if (!empty($_SESSION['eStore_cart_total_tax'])) {
        $myAuthorize->addField('x_tax', round($_SESSION['eStore_cart_total_tax'], 2));
    } else {
        $myAuthorize->addField('x_tax', 0);
    }
    // Duty
    $myAuthorize->addField('x_duty', 0);
    // Total
    $total = round($_SESSION['eStore_cart_sub_total'] + $_SESSION['eStore_cart_postage_cost'] + $_SESSION['eStore_cart_total_tax'], 2);
    $myAuthorize->addField('x_Amount', $total);
    //If currency code is set then the "x_fp_hash" algorithm need to be updated to include this field.
    //$myAuthorize->addField('x_currency_code', $eStore_default_currency);
    // Description
    $myAuthorize->addField('x_Description', $x_Description);
    //$val = "item2<|>cricket bag<|>Wilson cricket carry bag, red<|>1<|>39.99<|>N";
    $myAuthorize->addField('x_Invoice_num', rand(1, 100));
    //Generate Customer ID
    $custId = uniqid();
    $myAuthorize->addField('x_Cust_ID', $custId);
    // Enable test mode if needed
    if ($eStore_sandbox_enabled) {
        $myAuthorize->enableTestMode();
    }
    // Save the order details
    eStore_save_order_details($custId);
    // Lets clear the cart
    reset_eStore_cart();
    // Let's start the train!
    $myAuthorize->submitPayment2(WP_ESTORE_CLICK_HERE);
}
 /**
 	Method:			getPaymentInformation
 	Creator:		Jason Spangler
 	Created:		6/17/13
 
 	Modifier:		Jason Spangler
 	Modified:		6/17/13
 
 	Description:	Gets the payment profile information
 	@return:		(OBJECT) The customer payment profile object
 */
 public function getPaymentInformation()
 {
     return Authorize::getCustomerPaymentProfile($this->authnet_customer_profile_id, $this->authnet_payment_profile_id);
 }
function espresso_display_authnet($payment_data)
{
    extract($payment_data);
    // Setup class
    include_once 'Authorize.php';
    global $org_options;
    $myAuthorize = new Authorize();
    // initiate an instance of the class
    echo '<!--Event Espresso Authorize.net Gateway Version ' . $myAuthorize->gateway_version . '-->';
    $authnet_settings = get_option('event_espresso_authnet_settings');
    $authnet_login_id = empty($authnet_settings['authnet_login_id']) ? '' : $authnet_settings['authnet_login_id'];
    $authnet_transaction_key = empty($authnet_settings['authnet_transaction_key']) ? '' : $authnet_settings['authnet_transaction_key'];
    $button_type = empty($authnet_settings['button_type']) ? '' : $authnet_settings['button_type'];
    //$button_url = $authnet_settings['button_url'];
    $image_url = empty($authnet_settings['image_url']) ? '' : $authnet_settings['image_url'];
    $use_sandbox = $authnet_settings['use_sandbox'];
    $use_testmode = $authnet_settings['test_transactions'];
    if ($use_testmode == true) {
        // Enable test mode if needed
        $myAuthorize->enableTestMode();
    }
    if ($use_sandbox) {
        // Enable test mode if needed
        $myAuthorize->useTestServer();
    }
    $quantity = !empty($quantity) ? $quantity : espresso_count_attendees_for_registration($attendee_id);
    $myAuthorize->setUserInfo($authnet_login_id, $authnet_transaction_key);
    $myAuthorize->addField('x_Relay_URL', home_url() . '/?page_id=' . $org_options['notify_url']);
    $myAuthorize->addField('x_Description', stripslashes_deep($event_name) . ' | ' . __('Reg. ID:', 'event_espresso') . ' ' . $attendee_id . ' | ' . __('Name:', 'event_espresso') . ' ' . stripslashes_deep($fname . ' ' . $lname) . ' | ' . __('Total Registrants:', 'event_espresso') . ' ' . $quantity);
    $myAuthorize->addField('x_Amount', number_format($event_cost, 2));
    $myAuthorize->addField('x_Logo_URL', $image_url);
    $myAuthorize->addField('x_Invoice_num', 'au-' . event_espresso_session_id());
    //Post variables
    $myAuthorize->addField('x_cust_id', $attendee_id);
    $myAuthorize->addField('x_first_name', $fname);
    $myAuthorize->addField('x_last_name', $lname);
    $myAuthorize->addField('x_Email', $attendee_email);
    $myAuthorize->addField('x_Address', $address);
    $myAuthorize->addField('x_City', $city);
    $myAuthorize->addField('x_State', $state);
    $myAuthorize->addField('x_Zip', $zip);
    //Enable this function if you want to send payment notification before the person has paid.
    //This function is copied on the payment processing page
    //event_espresso_send_payment_notification($attendee_id, $txn_id, $amount_pd);
    //Decide if you want to auto redirect to your payment website or display a payment button.
    if (!empty($authnet_settings['bypass_payment_page']) && $authnet_settings['bypass_payment_page'] == 'Y') {
        $myAuthorize->submitPayment();
        //Enable auto redirect to payment site
    } else {
        if (empty($authnet_settings['button_url'])) {
            //$button_url = EVENT_ESPRESSO_GATEWAY_URL . "authnet/btn_cc_vmad.gif";
            if (file_exists(EVENT_ESPRESSO_GATEWAY_DIR . "/authnet/btn_cc_vmad.gif")) {
                $button_url = EVENT_ESPRESSO_GATEWAY_DIR . "/authnet/btn_cc_vmad.gif";
            } else {
                $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/authnet/btn_cc_vmad.gif";
            }
        } elseif (file_exists($authnet_settings['button_url'])) {
            $button_url = $authnet_settings['button_url'];
        } else {
            //If no other buttons exist, then use the default location
            $button_url = EVENT_ESPRESSO_PLUGINFULLURL . "gateways/authnet/btn_cc_vmad.gif";
        }
        $myAuthorize->submitButton($button_url, 'authnet');
        //Display payment button
    }
    if ($use_sandbox) {
        echo '<p>Test credit card # 4007000000027</p>';
        echo '<h3 style="color:#ff0000;" title="Payments will not be processed">' . __('Debug Mode Is Turned On', 'event_espresso') . '</h3>';
        $myAuthorize->dump_fields();
        // for debugging, output a table of all the fields
    }
}
<?php

// Include the paypal library
include_once 'Authorize.php';
// Create an instance of the authorize.net library
$myAuthorize = new Authorize();
// Specify your authorize.net login and secret
$myAuthorize->setUserInfo('YOUR_LOGIN', 'YOUR_SECRET_KEY');
// Specify the url where authorize.net will send the user on success/failure
$myAuthorize->addField('x_Receipt_Link_URL', 'http://YOUR_HOST/payment/authorize_success.php');
// Specify the url where authorize.net will send the IPN
$myAuthorize->addField('x_Relay_URL', 'http://YOUR_HOST/payment/authorize_ipn.php');
// Specify the product information
$myAuthorize->addField('x_Description', 'T-Shirt');
$myAuthorize->addField('x_Amount', '9.99');
$myAuthorize->addField('x_Invoice_num', rand(1, 100));
$myAuthorize->addField('x_Cust_ID', 'muri-khao');
// Enable test mode if needed
$myAuthorize->enableTestMode();
// Let's start the train!
$myAuthorize->submitPayment();
Exemple #17
0
 function dispatch($content_only = false, $check_perm = true)
 {
     Event::trigger('on_before_dispatch', $this);
     $session = Base::getSession();
     reset:
     //if no action set, set it to index
     if (strlen(trim($this->action)) == 0) {
         $this->action = 'index';
     }
     //set admin path
     $site = '';
     if ($this->site == 'admin') {
         $site = '\\Admin';
     }
     //load the extension class
     $controller = !empty($this->controller) ? '\\Controllers\\' . Str::camilize($this->controller) : '\\' . Str::camilize($this->extension);
     $extension = !empty($this->extension) ? '\\Extensions\\' . Str::camilize($this->extension) : '';
     $classname = '\\GCore' . $site . $extension . $controller;
     $this->tvout = strlen(Request::data('tvout', null)) > 0 ? Request::data('tvout') : $this->tvout;
     //set referer
     if (!$content_only) {
         if (!($this->controller == 'users' and ($this->action == 'login' or $this->action == 'logout' or $this->action == 'register')) and (!empty($this->extension) or !empty($this->controller)) and $this->tvout == 'index') {
             $session->set('_referer', Url::current());
         } else {
             //$session->set('_referer', 'index.php');
         }
     }
     //check permissions
     if ($check_perm and !Authorize::authorized($classname, $this->action)) {
         if ($content_only) {
             return;
         }
         $this->redirect(r_('index.php?cont=users&act=login'));
     }
     //if the extension class not found or the action function not found then load an error
     if (!class_exists($classname) or !in_array($this->action, get_class_methods($classname)) and !in_array('__call', get_class_methods($classname)) or substr($this->action, 0, 1) == '_') {
         $this->controller = 'errors';
         $this->action = 'e404';
         //reset the controller
         $classname = '\\GCore\\Controllers\\Errors';
         \GCore\Libs\Env::e404();
         //we need the rendered content only
         if ($content_only) {
             return;
         }
     }
     //load language file
     if (!empty($extension)) {
         Lang::load($site . $extension);
     }
     //set theme
     $doc = Document::getInstance($this->site, $this->thread);
     $doc->theme = 'bootstrap3';
     //'gcoreui';//'semantic1';
     $theme = \GCore\Helpers\Theme::getInstance();
     // in gcore app, bootstrap should be always loaded first with jquery
     //load class and run the action
     ${$classname} = new $classname($this->site, $this->thread);
     ob_start();
     $continue = ${$classname}->_initialize();
     //check and read cache
     if (!empty(${$classname}->cache)) {
         if (!is_array(${$classname}->cache)) {
             ${$classname}->cache = array();
         }
         if (empty(${$classname}->cache['time'])) {
             ${$classname}->cache['time'] = Base::getConfig('app_cache_expiry', 900);
         }
         if (empty(${$classname}->cache['title'])) {
             ${$classname}->cache['title'] = File::makeSafe($classname . '_' . $this->action);
         } else {
             ${$classname}->cache['title'] = File::makeSafe(${$classname}->cache['title']);
         }
         if (empty(${$classname}->cache['key'])) {
             ${$classname}->cache['key'] = 'cached_view';
         } else {
             ${$classname}->cache['key'] = 'cached_view_' . ${$classname}->cache['key'];
         }
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cached_view = $cache->get(${$classname}->cache['key']);
         $cached = false;
         if (!empty($cached_view)) {
             $cached = true;
             $continue = false;
             echo $cached_view;
         }
     }
     if ($continue !== false) {
         ${$classname}->{$this->action}();
         if ($this->reset === true) {
             $this->reset = false;
             goto reset;
         }
         //initialize and render view
         $view = new View();
         $view->initialize(${$classname});
         $view->renderView($this->action);
     }
     //get the action output buffer
     $this->buffer = ob_get_clean();
     //check and save cache
     if (!empty(${$classname}->cache) and !$cached) {
         $cache = Cache::getInstance(${$classname}->cache['title'], array('expiration' => ${$classname}->cache['time']));
         $cache->set(${$classname}->cache['key'], $this->buffer);
     }
     //finalize
     ob_start();
     ${$classname}->_finalize();
     $this->buffer .= ob_get_clean();
     //now load the theme files
     //$theme = \GCore\Helpers\Theme::getInstance();
     if ($this->tvout != 'ajax' and $doc->theme == 'bootstrap3') {
         $this->buffer = '<div class="gbs3">' . $this->buffer . '</div>';
     }
     Event::trigger('on_after_dispatch');
 }