/**
  * Implements all 3 steps of the Direct Post Method for demonstration
  * purposes.
  */
 public static function directPostDemo($url, $api_login_id, $transaction_key, $amount = "0.00", $md5_setting = "")
 {
     // Step 1: Show checkout form to customer.
     if (!count($_POST) && !count($_GET)) {
         $fp_sequence = time();
         // Any sequential number like an invoice number.
         echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $url, $api_login_id, $transaction_key);
     } elseif (count($_POST)) {
         $response = new AuthorizeNetSIM($api_login_id, $md5_setting);
         if ($response->isAuthorizeNet()) {
             if ($response->approved) {
                 // Do your processing here.
                 $redirect_url = $url . '?response_code=1&transaction_id=' . $response->transaction_id;
             } else {
                 // Redirect to error page.
                 $redirect_url = $url . '?response_code=' . $response->response_code . '&response_reason_text=' . $response->response_reason_text;
             }
             // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
             echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
         } else {
             echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
         }
     } elseif (!count($_POST) && count($_GET)) {
         if ($_GET['response_code'] == 1) {
             echo "Thank you for your purchase! Transaction id: " . htmlentities($_GET['transaction_id']);
         } else {
             echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
         }
     }
 }
Ejemplo n.º 2
0
 function gdlr_get_authorize_form($option)
 {
     global $hotel_option;
     $test_mode = empty($hotel_option['authorize-live-mode']) || $hotel_option['authorize-live-mode'] == 'disable' ? true : false;
     $relay_response_url = plugin_dir_url(__FILE__) . 'authorize-payment.php?response=1&invoice=' . $option['invoice'];
     return AuthorizeNetDPM::getCreditCardForm($option['price'], $option['invoice'], $relay_response_url, $hotel_option['authorize-api-id'], $hotel_option['authorize-transaction-key'], $test_mode, $test_mode);
 }
Ejemplo n.º 3
0
 /**
  * Implements all 3 steps of the Direct Post Method for demonstration
  * purposes.
  */
 public static function directPostDemo($url, $api_login_id, $transaction_key, $amount = "0.00", $md5_setting = "", $test_mode = true)
 {
     
     // Step 1: Show checkout form to customer.
     if (JRequest::getVar('task') == 'submit_order')
     {
         $fp_sequence = time(); // Any sequential number like an invoice number.
         echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $url, $api_login_id, $transaction_key, $test_mode, $test_mode);
     }
     // Step 2: Handle AuthorizeNet Transaction Result & return snippet.
     elseif (count($_POST)) 
     {
         $response = new AuthorizeNetSIM($api_login_id, $md5_setting);
         if ($response->isAuthorizeNet()) 
         {
             if ($response->approved) 
             {
                 // Do your processing here.
                 //$mainframe->redirect('index.php?option=com_docmanpaypal&task=ipn&merchant=authorize.net&response_code=1&transaction_id=' . $response->transaction_id); 
                 $redirect_url = JURI::base() . substr($_SERVER['REQUEST_URI'], 0) . '&response_code=1&transaction_id=' . $response->transaction_id;
             }
             else
             {
                 // Redirect to error page.
                 //$mainframe->redirect('index.php?option=com_docmanpaypal&task=ipn&merchant=authorize.net&response_code=' . $response->response_code . '&transaction_id=' . $response->transaction_id. '&response_reason_text=' . $response->response_reason_text);
                 $redirect_url = JURI::base() . substr($_SERVER['REQUEST_URI'], 0) . '&response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text;
             	//$redirect_url = $url . '?response_code='.$response->response_code . '&response_reason_text=' . $response->response_reason_text;
             }
             // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
             echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
         }
         else
         {
             echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
         }
     }
     // Step 3: Show receipt page to customer.
     elseif (!count($_POST) && count($_GET))
     {
         if ($_GET['response_code'] == 1)
         {
             echo "Thank you for your purchase! Transaction id: " . htmlentities($_GET['transaction_id']);
         }
         else
         {
           echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
         }
     }
 }
Ejemplo n.º 4
0
 public static function receivePost($url, $api, $hash)
 {
     // Step 2: Handle AuthorizeNet Transaction Result & return snippet.
     if (count($_POST)) {
         $url = remove_query_arg('mcsipn', 'true');
         $response = new AuthorizeNetSIM($api, $hash);
         if ($response->isAuthorizeNet()) {
             if ($response->approved) {
                 // Do your processing here.
                 $redirect_url = add_query_arg(array('response_code' => 1, 'transaction_id' => $response->transaction_id), $url);
             } else {
                 // Redirect to error page.
                 $redirect_url = add_query_arg(array('response_code' => $response->response_code, 'response_reason_text' => $response->response_reason_text, $url));
             }
             // Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
             echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
         } else {
             echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
         }
     }
 }
Ejemplo n.º 5
0
function cw_payment_authorize_sim_run_processor($params, $return)
{
    if ($params['payment_data']['processor'] == authorize_sim_addon_name) {
        global $config, $tables, $current_location, $cart, $APP_SESS_ID;
        $addon_name = str_replace("-", "_", authorize_sim_addon_name);
        $asim_api_login_id = $config[$addon_name]['asim_api_login_id'];
        $asim_transaction_key = $config[$addon_name]['asim_transaction_key'];
        $asim_md5_hash = $config[$addon_name]['asim_md5_hash'];
        $asim_mode = $config[$addon_name]['asim_test_live_mode'];
        $asim_currency = $config[$addon_name]['asim_currency'];
        $asim_prefix = intval($config[$addon_name]['asim_prefix']);
        if (empty($asim_api_login_id) || empty($asim_transaction_key)) {
            $top_message = array("content" => "Enter your merchant credentials on settings page before running the payment.", "type" => "E");
            cw_header_location($current_location . "index.php?target=cart&mode=checkout");
        }
        define("AUTHORIZENET_API_LOGIN_ID", $asim_api_login_id);
        define("AUTHORIZENET_TRANSACTION_KEY", $asim_transaction_key);
        define("AUTHORIZENET_SANDBOX", $asim_mode == "live" ? FALSE : TRUE);
        define("AUTHORIZENET_MD5_SETTING", $asim_md5_hash);
        $payment_data = $params['payment_data'];
        $userinfo = $params['userinfo'];
        $doc_ids = $params['doc_ids'];
        $cart =& cw_session_register('cart');
        $time = time();
        $asim_amount = price_format($cart['info']['total']);
        $asim_fp_sequence = $asim_prefix . $time;
        $asim_fp_hash = AuthorizeNetDPM::getFingerprint($asim_api_login_id, $asim_transaction_key, $asim_amount, $asim_fp_sequence, $time);
        $asim_fp_timestamp = $time;
        $asim_relay_url = $current_location . '/index.php?target=' . authorize_sim_addon_target;
        // save $APP_SESS_ID
        $unique_id = strtolower(md5($asim_md5_hash . $asim_api_login_id . $userinfo['email']));
        db_query("INSERT INTO {$tables['payment_data']} (ref_id, session_id) VALUES ('{$unique_id}', '{$APP_SESS_ID}')");
        $card_expire_Month = intval($_POST['card_expire_Month']);
        $card_expire_Year = intval($_POST['card_expire_Year']);
        cw_func_call('cw_payment_create_form', array('url' => AUTHORIZENET_SANDBOX ? AuthorizeNetDPM::SANDBOX_URL : AuthorizeNetDPM::LIVE_URL, 'fields' => array('x_relay_response' => "FALSE", 'x_version' => "3.1", 'x_delim_char' => ",", 'x_delim_data' => "TRUE", 'x_amount' => $asim_amount, 'x_fp_sequence' => $asim_fp_sequence, 'x_fp_hash' => $asim_fp_hash, 'x_fp_timestamp' => $time, 'x_relay_response' => "TRUE", 'x_relay_url' => $asim_relay_url, 'x_login' => $asim_api_login_id, 'x_card_num' => $_POST['card_number'], 'x_exp_date' => date("m/y", mktime(0, 0, 0, $card_expire_Month, 1, $card_expire_Year)), 'x_card_code' => $_POST['card_cvv2'], 'x_first_name' => $_POST['first_name'], 'x_last_name' => $_POST['last_name'], 'x_address' => $_POST['address'], 'x_city' => $_POST['city'], 'x_state' => $_POST['state'], 'x_zip' => $_POST['zipcode'], 'x_country' => $_POST['country'], 'x_email' => $userinfo['email']), 'name' => $payment_data['title']));
        exit;
    }
    return $return;
}
Ejemplo n.º 6
0
function mcs_payment_form()
{
    $ret = $form = '';
    if (isset($_GET['response_code'])) {
        $mcs = $_GET['response_code'];
        $provider = get_option('mcs_gateway') == 2 ? 'Authorize.net' : 'PayPal';
        switch ($mcs) {
            case 'thanks':
                $ret = "<p class='notice'>" . sprintf(__("Thank you for your purchase! You can view your purchase information at %s. You will receive an email with your payment key once your payment is finalized.", 'my-calendar-submissions'), $provider) . "</p>";
                break;
            case 'cancel':
                $ret = __("Sorry that you decided to cancel your purchase! Contact us if you have any questions!", 'my-calendar-submissions');
                break;
        }
    }
    if (mcs_payment_required()) {
        $price = mcs_get_price(is_user_logged_in());
        $currency = get_option('mcs_currency');
        $quantity = get_option('mcs_quantity');
        $discounts = mcs_check_discount();
        $discount_rate = (int) $discounts['rate'];
        $discount = $discount_rate != 0 ? true : false;
        if (isset($_GET['response_code'])) {
            $message = '';
        } else {
            $message = wpautop(jd_draw_template(array('price' => $price, 'currency' => $currency, 'discount' => $discount_rate, 'begins' => $discounts['begins'], 'ends' => $discounts['ends']), get_option('mcs_payment_message')));
        }
        $form = "<div class='mc-payments-form " . get_option('mcs_gateway') . "'>\n\t\t {$ret}\n\t\t {$message}";
        $nonce = wp_create_nonce('mcs-payments-nonce');
        if (get_option('mcs_gateway') == 'authorizenet') {
            if (get_option('mcs_quantity') != 'true' || (get_option('mcs_quantity') == 'true' && isset($_POST['mcs_quantity']) || isset($_GET['response_code']))) {
                require_once 'gateways/AuthorizeNet.php';
                // The SDK
                $url = mcs_replace_http(add_query_arg('mcsipn', 'true', get_permalink()));
                $rand = time() . rand(100000, 999999);
                $mcs_quantity = isset($_POST['mcs_quantity']) ? (int) $_POST['mcs_quantity'] : 1;
                $price = mcs_calculate_price($mcs_quantity, $price, $discount, $discount_rate);
                $form .= AuthorizeNetDPM::directPost($url, $price, $rand, $nonce);
            } else {
                $form .= mcs_set_quantity_form($price);
            }
        } else {
            $form .= mcs_paypal_form($price, $currency, $discount_rate, $discounts, $discount, $quantity);
        }
        $form .= "</div>";
    }
    return $form;
}
Ejemplo n.º 7
0
 public function testRelayResponseUrl()
 {
     $return_url = 'http://yourdomain.com';
     $this->assertContains('window.location="' . $return_url . '";', AuthorizeNetDPM::getRelayResponseSnippet($return_url));
 }
Ejemplo n.º 8
0
 /**
  * Parse the transaction results sent from Authorize.net Direct Post
  * @param \TransactionController $controller
  */
 public static function transaction($controller)
 {
     $matches = array();
     preg_match('#page/(\\d{1,})/?#', $_POST['redirect_url'], $matches);
     if (!isset($matches[1])) {
         throw new \Jazzee\Exception("No page id match found in redirect_url: '{$_POST['redirect_url']}");
     }
     $applicationPage = $controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\ApplicationPage')->find($matches[1]);
     if (!$applicationPage) {
         throw new \Jazzee\Exception("{$matches[1]} is not a valid applicationPage id");
     }
     if (!empty($_POST['x_cust_id'])) {
         $applicant = $controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\Applicant')->find($_POST['x_cust_id']);
         if (!$applicant) {
             throw new \Jazzee\Exception("{$_POST['x_cust_id']} is not a valid applicant id.  Anet post: " . var_export($_POST, true));
         }
         $answer = new \Jazzee\Entity\Answer();
         $answer->setPage($applicationPage->getPage());
         $applicant->addAnswer($answer);
         $payment = new \Jazzee\Entity\Payment();
         $payment->setType($controller->getEntityManager()->getRepository('\\Jazzee\\Entity\\PaymentType')->find($_POST['paymentType']));
         $answer->setPayment($payment);
         $fakeInput = new \Foundation\Form\Input(array());
         if ($payment->getType()->getJazzeePaymentType($controller)->pendingPayment($payment, $fakeInput)) {
             $controller->getEntityManager()->persist($applicant);
             $controller->getEntityManager()->persist($answer);
             $controller->getEntityManager()->persist($payment);
             foreach ($payment->getVariables() as $var) {
                 $controller->getEntityManager()->persist($var);
             }
             $controller->getEntityManager()->flush();
             print \AuthorizeNetDPM::getRelayResponseSnippet($_POST['redirect_url']);
         }
     }
 }
Ejemplo n.º 9
0
        <form method="post" action="process_sale.php" id="checkout_form">
        <input type="hidden" name="size" value="<?php 
    echo $size;
    ?>
">
        <?php 
} else {
    ?>
        <form method="post" action="<?php 
    echo AUTHORIZENET_SANDBOX ? AuthorizeNetDPM::SANDBOX_URL : AuthorizeNetDPM::LIVE_URL;
    ?>
" id="checkout_form">
        <?php 
    $time = time();
    $fp_sequence = $time;
    $fp = AuthorizeNetDPM::getFingerprint(AUTHORIZENET_API_LOGIN_ID, AUTHORIZENET_TRANSACTION_KEY, $amount, $fp_sequence, $time);
    $sim = new AuthorizeNetSIM_Form(array('x_amount' => $amount, 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fp, 'x_fp_timestamp' => $time, 'x_relay_response' => "TRUE", 'x_relay_url' => $coffee_store_relay_url, 'x_login' => AUTHORIZENET_API_LOGIN_ID, 'x_test_request' => TEST_REQUEST));
    echo $sim->getHiddenFieldString();
}
?>
      <fieldset>
        <div>
          <label>Credit Card Number</label>
          <input type="text" class="text required creditcard" size="15" name="x_card_num" value="6011000000000012"></input>
        </div>
        <div>
          <label>Exp.</label>
          <input type="text" class="text required" size="4" name="x_exp_date" value="04/15"></input>
        </div>
        <div>
          <label>CCV</label>
Ejemplo n.º 10
0
<?php 
require_once JPATH_COMPONENT . DS . 'anet_php_sdk' . DS . 'AuthorizeNet.php'; // The SDK
$url = JURI::base() . substr($_SERVER['REQUEST_URI'],1) . '&format=raw&post=1' . '&order_id=' . $order_id . '&key=' . $key . '&myid=' . $my->id;
//echo $url;
//error_reporting(E_ALL);
if (JRequest::getVar('post') == 0) {
$api_login_id = $dm->cfg['authorizenet_login_id'];
$transaction_key = $dm->cfg['authorizenet_transaction_key'];
$md5_setting = $dm->cfg['authorizenet_md5_setting']; // Your MD5 Setting
$amount = $dm->getPrice(JRequest::getInt('id'));
error_reporting(0);
echo $dm->cfg['authorizenet_processing_page'];
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting, $dm->cfg['authorizenet_test_mode']);

?>
* NOTE: To receive the file via email you must be logged in as a registered user.
<?php 
} else if (JRequest::getVar('post') == 1) {
	if (JRequest::getVar('x_response_code') == 1) {
		 $order_id = JRequest::getVar('order_id');
		 $key = JRequest::getVar('key');		
		 $myid = JRequest::getVar('myid');
		 
		 $user =& JFactory::getUser($myid);
		 
	     $dm->completeOrder($order_id);
/*         $dm->updateOrder($order_id,array(
			'first_name' =>  $p->ipn_data['first_name'],
			'last_name' => $p->ipn_data['last_name'],
			'organization' => $p->ipn_data['payer_business_name'],
			'address' => $p->ipn_data['address_street'],
Ejemplo n.º 11
0
<?php

require_once 'coffee_store_settings.php';
if ($METHOD_TO_USE == "AIM") {
    $transaction = new AuthorizeNetAIM();
    $transaction->setSandbox(AUTHORIZENET_SANDBOX);
    $transaction->setFields(array('amount' => $amount, 'card_num' => $_POST['x_card_num'], 'exp_date' => $_POST['x_exp_date'], 'first_name' => $_POST['x_first_name'], 'last_name' => $_POST['x_last_name'], 'address' => $_POST['x_address'], 'city' => $_POST['x_city'], 'state' => $_POST['x_state'], 'country' => $_POST['x_country'], 'zip' => $_POST['x_zip'], 'email' => $_POST['x_email'], 'card_code' => $_POST['x_card_code']));
    $response = $transaction->authorizeAndCapture();
    if ($response->approved) {
        // Transaction approved! Do your logic here.
        header('Location: thank_you_page.php?transaction_id=' . $response->transaction_id);
    } else {
        header('Location: error_page.php?response_reason_code=' . $response->response_reason_code . '&response_code=' . $response->response_code . '&response_reason_text=' . $response->response_reason_text);
    }
} elseif (count($_POST)) {
    $response = new AuthorizeNetSIM();
    if ($response->isAuthorizeNet()) {
        if ($response->approved) {
            // Transaction approved! Do your logic here.
            // Redirect the user back to your site.
            $return_url = $site_root . 'thank_you_page.php?transaction_id=' . $response->transaction_id;
        } else {
            // There was a problem. Do your logic here.
            // Redirect the user back to your site.
            $return_url = $site_root . 'error_page.php?response_reason_code=' . $response->response_reason_code . '&response_code=' . $response->response_code . '&response_reason_text=' . $response->response_reason_text;
        }
        echo AuthorizeNetDPM::getRelayResponseSnippet($return_url);
    } else {
        echo "MD5 Hash failed. Check to make sure your MD5 Setting matches the one in config.php";
    }
}
 function gdlrs_get_authorize_form($option)
 {
     global $hostel_option;
     $relay_response_url = plugin_dir_url(__FILE__) . '/gdlrs-authorize-payment.php?response=1&invoice=' . $option['invoice'];
     return AuthorizeNetDPM::getCreditCardForm($option['price'], $option['invoice'], $relay_response_url, $hostel_option['authorize-api-id'], $hostel_option['authorize-transaction-key']);
 }
Ejemplo n.º 13
0
 /**
  *show signup details
  * @author vovich, Alex
  * @param int $signupId
  */
 function signupDetails($signupId = null, $activeTab = 'tab-payment')
 {
     $userSession = $this->Session->read('loggedUser');
     $signupDetails = $this->_getSignupDetails($signupId);
     $isFreeSignup = 0;
     if ($signupDetails['Signup']['status'] == 'paid' && $signupDetails['Signup']['total'] + $signupDetails['Signup']['discount'] + $signupDetails['Signup']['2pay'] == 0) {
         $isFreeSignup = 1;
     }
     $userID = $this->getUserID();
     $signupUsers = $this->SignupsUser->find('all', array('conditions' => array('signup_id' => $signupId), 'contain' => 'User'));
     $signupUserIDs = Set::combine($signupUsers, '{n}.SignupsUser.user_id', '{n}.SignupsUser.user_id');
     $signupUsers = Set::combine($signupUsers, '{n}.SignupsUser.user_id', '{n}');
     $this->Access->checkAccess('Signup', 'u', $signupDetails['Signup']['user_id']);
     //pr($signupDetails);
     //Getting packages
     if (!empty($signupDetails['Packagedetails']['package_id'])) {
         $this->Package->recursive = -1;
         $packageInformation = $this->Package->find('first', array('conditions' => array('Package.id' => $signupDetails['Packagedetails']['package_id'])));
         $signupDetails['Package'] = $packageInformation['Package'];
     }
     //get the number of people in team
     if ($signupDetails['Signup']['model'] == 'Event') {
         $Event = ClassRegistry::init('Event');
         $Event->recursive = -1;
         $event = $Event->find('first', array('conditions' => array('id' => $signupDetails['Signup']['model_id'])));
         $peopleinteam = $event['Event']['people_team'];
     } else {
         $peopleinteam = 2;
     }
     //        return $this->returnJSONResult($event);
     // PAYMENT BLOCK
     //Getting payments
     $this->Payment->recursive = 1;
     $payments = $this->Payment->find('all', array('conditions' => array('Payment.user_id' => $signupDetails['Signup']['user_id'], 'Payment.model' => 'Signup', 'Payment.model_id' => $signupDetails['Signup']['id'])));
     if (intval($signupDetails['Signup']['2pay']) > 0) {
         // Authorize.net DPM installation ===========================================================================================
         include_once '../vendors/anet_php_sdk/AuthorizeNet.php';
         $amount = $signupDetails['Signup']['2pay'];
         $time = time();
         $fp_sequence = $time;
         $authorizeNetProperties = array('x_amount' => $amount, 'x_fp_sequence' => $fp_sequence, 'x_fp_timestamp' => $time, 'x_relay_response' => "TRUE", 'x_merchant_email' => ADMIN_EMAIL, 'x_relay_url' => SECURE_SERVER . '/signups/payment_callback', 'x_delim_data' => "TRUE", 'x_delim_char' => ",");
         if (SIGNUP_AUTH_NET_TEST_MODE) {
             $authLogin = SIGNUP_AUTH_NET_TEST_LOGIN_ID;
             $authKey = SIGNUP_AUTH_NET_TEST_TRAN_KEY;
             $authorizeNetProperties['x_test_request'] = 'TRUE';
             $authorizeNetURL = AuthorizeNetDPM::SANDBOX_URL;
         } else {
             $authLogin = SIGNUP_AUTH_NET_LOGIN_ID;
             $authKey = SIGNUP_AUTH_NET_TRAN_KEY;
             $authorizeNetProperties['x_test_request'] = 'FALSE';
             $authorizeNetURL = AuthorizeNetDPM::LIVE_URL;
         }
         $authorizeNetProperties['x_freight'] = '0';
         $authorizeNetProperties['x_po_numz'] = $signupId;
         //additional customer data
         $authorizeNetProperties['x_cust_id'] = $this->getUserID();
         $authorizeNetProperties['x_customer_ip'] = $_SERVER['REMOTE_ADDR'];
         $authorizeNetProperties['x_merchant_email'] = '*****@*****.**';
         $authorizeNetProperties['x_invoice_num'] = $signupId;
         $authorizeNetProperties['x_description'] = $signupDetails[$signupDetails['Signup']['model']]['name'];
         $authorizeNetProperties['x_login'] = $authLogin;
         $authorizeNetProperties['x_email'] = $signupDetails['User']['email'];
         $fp = AuthorizeNetDPM::getFingerprint($authLogin, $authKey, $amount, $fp_sequence, $time);
         $authorizeNetProperties['x_fp_hash'] = $fp;
         foreach ($authorizeNetProperties as $key => $value) {
             $authorizeNetProperties[$key] = addslashes($value);
         }
         $sim = new AuthorizeNetSIM_Form($authorizeNetProperties);
         $authorizeNetHiddens = $sim->getHiddenFieldString();
         // EOF Authorize Net configuration
         if ($this->Session->check('signup_payment_error')) {
             $payment_error = $this->Session->read('signup_payment_error');
             $this->Session->delete('signup_payment_error');
         } else {
             $payment_error = '';
         }
         if ($this->Session->check('last_payment_id')) {
             $last_payment_id = $this->Session->read('last_payment_id');
             $payment = $this->Payment->find('first', array('conditions' => array('Payment.id' => $last_payment_id)));
             $addressID = $payment['Payment']['address_id'];
             $phone = $this->Phone->field('phone', array('id' => $payment['Payment']['phone_id']));
         } else {
             $addressID = 0;
             $phone = '';
         }
         $this->set('authorizeNetHiddens', $authorizeNetHiddens);
         $this->set('authorizeNetURL', $authorizeNetURL);
         $this->set('payment_error', $payment_error);
         // EOF Authorize.net DPM installation ==========================================================================
     }
     // EOF PAYMENT BLOCK
     //Checking Team and Teammates
     $isteamAssigned = false;
     $roomIsCompleted = false;
     $Team = ClassRegistry::init('Team');
     $assigned = array();
     //Changed by Skinny. We need to include the Pending teams, otherwise it's confusing. If the user selects this team,
     //it automatically accepts their participation on the team
     $teams = $Team->getAllUserTeamsIncludingPending($signupDetails['Signup']['user_id'], " Team.* ", $signupDetails[$signupDetails['Signup']['model']]['people_team']);
     if (empty($teams)) {
     } else {
         //Getting assigned teams
         $assigned = $Team->getUserAssignedTeams($signupDetails['Signup']['user_id'], $signupDetails['Signup']['model'], $signupDetails['Signup']['model_id']);
         if (!empty($assigned)) {
             $isteamAssigned = true;
         }
     }
     $teamInfoForSignup = array();
     $teammates = array();
     if (!empty($assigned[0]['Team']['id'])) {
         $teamInfoForSignup = $Team->teamInfoForSignup($assigned[0]['Team']['id'], $signupDetails['Signup']['model'], $signupDetails['Signup']['model_id'], $signupDetails);
         $teammates = $Team->Teammate->find('all', array('conditions' => array('team_id' => $assigned[0]['Team']['id'], 'status' => array('Accepted', 'Creator', 'Pending')), 'contain' => array('User')));
     }
     //Added by Skinny: If this user is Pending on a team that is assigned to the event, we need to give him the opportunity here
     //to accept this.
     $userIsPendingOnTeam = false;
     if ($isteamAssigned) {
         if (empty($teamInfoForSignup['waiting_for_signup']) && empty($teamInfoForSignup['waiting_for_accept'])) {
             $teamIsCompleted = true;
         } else {
             $teamIsCompleted = false;
             foreach ($teamInfoForSignup['waiting_for_accept'] as $userWaitingForAccept) {
                 if ($userWaitingForAccept['id'] == $userID) {
                     $userIsPendingOnTeam = $userWaitingForAccept;
                 }
             }
         }
     } else {
         $teamIsCompleted = false;
     }
     $new_created_team_id = 0;
     if ($this->Session->check('new_created_team_id')) {
         $new_created_team_id = $this->Session->read('new_created_team_id');
         $this->Session->delete('new_created_team_id');
     }
     //EOF checking
     // ROOMS BLOCK
     $roomsCnt = 0;
     if ($signupDetails[$signupDetails['Signup']['model']]['is_room'] == 0 || !$signupDetails['Package']['people_in_room']) {
         $roomIsCompleted = true;
     } else {
         $roomsCnt = $this->SignupRoommate->getCountRooms($signupDetails['Signup']['model'], $signupDetails['Signup']['model_id'], $signupDetails['Signup']['user_id']);
         $roomsStatus = 'incompleted';
         if ($signupDetails['Signup']['for_team']) {
             $neededRooms = $signupDetails[$signupDetails['Signup']['model']]['people_team'] / $signupDetails['Package']['people_in_room'];
         } else {
             $neededRooms = 1;
         }
         $rooms = $this->SignupRoom->getSignupRooms($signupUserIDs, $signupDetails['Signup']['model'], $signupDetails['Signup']['model_id']);
         $roomInfo = array();
         $roomIsCompleted = false;
         $roomIsPending = false;
         // CREATE ROOM BLOCK
         $showCreateRoomBlock = true;
         if ($neededRooms <= count($rooms)) {
             $roomIsCompleted = true;
             $showCreateRoomBlock = false;
         }
         $showFindInviters = false;
         foreach ($rooms as $room) {
             if (isset($room['users'][$signupDetails['Signup']['user_id']])) {
                 $showCreateRoomBlock = false;
                 if ($room['status'] == 'Pending') {
                     $roomIsCompleted = false;
                     $roomIsPending = true;
                 }
             }
             if ($room['people_in_room'] > count($room['roommates'])) {
                 $showFindInviters = true;
                 $roomIsCompleted = false;
             }
         }
         if ($signupDetails['Signup']['for_team'] && !$showCreateRoomBlock && !$roomIsCompleted) {
             $waitingForTemmatesRoom = true;
         } else {
             $waitingForTemmatesRoom = false;
         }
         if ($showCreateRoomBlock) {
             //working with questions
             $questions = $this->Question->find('all', array('conditions' => array('model' => 'Room_for_' . strtolower($signupDetails['Signup']['model']), 'model_id' => $signupDetails['Signup']['model_id'])));
             $this->set('questions', $questions);
         }
         $this->set('showFindInviters', $showFindInviters);
         $this->set('waitingForTemmatesRoom', $waitingForTemmatesRoom);
         $this->set('showCreateRoomBlock', $showCreateRoomBlock);
         // EOF CREATE ROOM BLOCK
         $this->set('rooms', $rooms);
     }
     // EOF ROOMS BLOCK
     if (!empty($signupDetails[$signupDetails['Signup']['model']]['signup_required'])) {
         $this->set('cheepestPackage', $this->Package->getCheepesPackage($signupDetails['Signup']['model'], $signupDetails['Signup']['model_id']));
     }
     if ($signupDetails['Signup']['status'] != 'paid') {
         /*pass to the view countries and states*/
         $countries_states = $this->Address->setCountryStates();
         $this->set('countries', $countries_states['countries']);
         $this->set('states', $countries_states['states']);
         //Getting  address
         $this->Address->recursive = -1;
         $addresses = $this->Address->find('list', array('fields' => array('id', 'address'), 'conditions' => array('model' => 'User', 'model_id' => $userSession['id'], 'is_deleted <>' => 1), 'order' => 'id DESC'));
         $addresses = array('0' => "Custom address") + $addresses;
         $this->set('addressesIds', $addresses);
     }
     if ($userID == 2) {
         //Configure::write('debug', '1');
         //echo $neededRooms;
         //pr($signupDetails);
     }
     $this->set('peopleinteam', $peopleinteam);
     $teams = Set::combine($teams, '{n}.Team.id', '{n}.Team.name');
     $this->set('cardtypes', array('Visa' => 'Visa', 'MasterCard' => 'MasterCard'));
     $this->set('team', $assigned);
     $this->set('userIsPendingOnTeam', $userIsPendingOnTeam);
     //Checking accession for the changing packages
     $this->set('canChangePackage', $this->Access->getAccess('SignupChangePackage', 'r', $signupDetails['Signup']['user_id']));
     $this->set('canUpgradePackage', $this->Access->getAccess('SignupUpgradePackage', 'r', $signupDetails['Signup']['user_id']));
     $this->set('userRole', 'creator');
     $this->set('roomsCnt', $roomsCnt);
     $this->set('isFreeSignup', $isFreeSignup);
     $this->set('new_created_team_id', $new_created_team_id);
     $this->set(compact('roomsCnt', 'roomIsCompleted', 'roomIsPending', 'activeTab', 'teamIsCompleted', 'isteamAssigned', 'teamInfoForSignup', 'signupUsers', 'userID', 'payments', 'signupDetails', 'signupId', 'teams', 'signupDetails', 'phone', 'addressID', 'teammates'));
 }
Ejemplo n.º 14
0
<?php

require_once 'anet_php_sdk/AuthorizeNet.php';
// The SDK
$url = "http://queencitytech.com/sustainbrand/transaction.php";
$api_login_id = '9bdY4HtEh2P';
$transaction_key = '4FX5Fzp4vv37X6CX';
$md5_setting = 'b33a46f5ee81f6f0790f3ea9f02468e1';
// Your MD5 Setting
$amount = $_POST['billing_amount'];
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);
Ejemplo n.º 15
0
			<?php 
if (!empty($_GET['response']) && $_GET['response'] == 2) {
    echo '<div class="gdlr-lms-error" style="margin-bottom: 0px;">';
    echo $_GET['response_code'] . ' : ' . $_GET['response_reason_text'];
    echo '</div>';
} else {
    if (!empty($_GET['invoice'])) {
        global $gdlr_lms_option, $wpdb;
        $relay_response_url = plugin_dir_url(__FILE__) . 'single-authorize.php?response=1&invoice=' . $_GET['invoice'];
        $api_login_id = $gdlr_lms_option['authorize-api-id'];
        $transaction_key = $gdlr_lms_option['authorize-transaction-key'];
        $temp_sql = "SELECT * FROM " . $wpdb->prefix . "gdlrpayment ";
        $temp_sql .= "WHERE id = " . $_GET['invoice'];
        $result = $wpdb->get_row($temp_sql);
        $fp_sequence = $_GET['invoice'];
        $amount = $result->price;
        echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $relay_response_url, $api_login_id, $transaction_key);
    }
}
?>
			</div>
		</div>
	</div>
</div>
</div>
<?php 
if (!empty($gdlr_lms_option['show-sidebar']) && $gdlr_lms_option['show-sidebar'] == 'enable') {
    get_sidebar('content');
    get_sidebar();
}
get_footer();
            $bill_output['code'] = 1;
            $bill_output['billmes'] = "";
        } else {
            // There was a problem.
            $status = array(1 => "Approved", 2 => "Declined", 3 => "Error", 4 => "Held for Review");
            $bill_output['code'] = 2;
            $bill_output['billmes'] = "The overall status of the transaction: " . $status[$response->response_code];
            $bill_output['billmes'] .= "<br />Reason: " . $response->response_reason_text;
        }
    } else {
        $bill_output['code'] = 2;
        $bill_output['billmes'] = "MD5 Hash failed. Check to make sure your MD5 Setting matches the one in config";
    }
} else {
    $bill_output["billmes"] = "Wrong request method or empty data.";
    $bill_output['code'] = 2;
}
$return = cw_call('cw_payment_check_results', array($bill_output));
$cart =& cw_session_register('cart', array());
$top_message =& cw_session_register('top_message');
if ($return['bill_error']) {
    $top_message = array('type' => 'E', 'content' => $return['bill_error'] . ' ' . $return['reason']);
    $request = $app_catalogs['customer'] . '/index.php?target=cart&mode=checkout';
} else {
    $_doc_ids = cw_get_urlencoded_doc_ids($return['doc_ids']);
    $request = $current_location . "/index.php?target=order-message&doc_ids=" . $_doc_ids;
    $cart = array();
    cw_session_save();
}
echo AuthorizeNetDPM::getRelayResponseSnippet($request);
exit;