public function _process($params)
 {
     $fp_sequence = $params['reference'];
     $time = time();
     $fingerprint = AuthorizeNetSIM_Form::getFingerprint($this->settings['api_login_id'], $this->settings['transaction_key'], $params['amount'], $fp_sequence, $time);
     $data = array('x_amount' => $params['amount'], 'x_delim_data' => 'FALSE', 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fingerprint, 'x_fp_timestamp' => $time, 'x_relay_response' => 'TRUE', 'x_relay_url' => $params['return_url'], 'x_login' => $this->settings['api_login_id'], 'x_show_form' => 'PAYMENT_FORM');
     $sim = new AuthorizeNetSIM_Form($data);
     $post_url = $this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL;
     Merchant::redirect_post($post_url, $sim->getHiddenFieldString());
 }
예제 #2
0
 /**
  * Display a form which posts to authorize.net's server
  */
 public function paymentForm(\Jazzee\Entity\Applicant $applicant, $amount)
 {
     if (\is_a($this->_controller, 'ApplyPageController')) {
         $time = time();
         $fpSequence = $applicant->getId() . $time;
         $form = new \Foundation\Form();
         $form->newHiddenElement('x_show_form', 'PAYMENT_FORM');
         $form->newHiddenElement('x_amount', $amount);
         $form->newHiddenElement('x_test_request', $this->_controller->getConfig()->getStatus() == 'PRODUCTION' ? 0 : 1);
         $form->newHiddenElement('x_fp_sequence', $fpSequence);
         $form->newHiddenElement('x_fp_hash', \AuthorizeNetSIM_Form::getFingerprint($this->_paymentType->getVar('gatewayId'), $this->_paymentType->getVar('gatewayKey'), $amount, $fpSequence, $time));
         $form->newHiddenElement('x_fp_timestamp', $time);
         $form->newHiddenElement('x_relay_response', "TRUE");
         $form->newHiddenElement('x_relay_url', $this->_controller->getServerPath() . $this->_controller->getActionPath() . '/../../../../../transaction/' . \urlencode(get_class($this)));
         $form->newHiddenElement('x_cancel_url', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('redirect_url', $this->_controller->getServerPath() . $this->_controller->getActionPath());
         $form->newHiddenElement('x_login', $this->_paymentType->getVar('gatewayId'));
         $form->newHiddenElement('x_cust_id', $applicant->getId());
         $form->newHiddenElement('x_customer_ip', $_SERVER['REMOTE_ADDR']);
         $form->newHiddenElement('x_email', $applicant->getEmail());
         $form->newHiddenElement('x_email_customer', 0);
         $form->newHiddenElement('x_description', $this->_paymentType->getVar('description'));
         $form->setAction($this->_paymentType->getVar('testAccount') ? \AuthorizeNetDPM::SANDBOX_URL : \AuthorizeNetDPM::LIVE_URL);
         $field = $form->newField();
         $field->setLegend($this->_paymentType->getName());
         $field->setInstructions("<p>Clicking the 'Pay with Credit Card' button will redirect you to a secure payment page.  Once you have completed your transaction you will be returned to the application.<strong>Application Fee:</strong> &#36;{$amount}</p>");
         $form->newButton('submit', 'Pay with Credit Card');
     } else {
         $form = parent::paymentForm($applicant, $amount);
     }
     return $form;
 }
예제 #3
0
    function authorizenetPayment()
    {
        $payconfig = $this->payconfig;
        $authTestmode = $payconfig->authTestmode;
        $authAPILogin = $payconfig->authAPILogin;
        $authTransKey = $payconfig->authTransKey;
        $details = $this->details;
        $amount = $details['amount'];
        $taxrate = $details['taxrate'];
        $totamt = (double) ($amount + $amount * ($taxrate / 100));
        //the total amount is calculated as authorize.net does not support tax parameter.
        $orderid = $details['orderid'];
        $itemname = $details['itemname'];
        $item_num = $details['item_num'];
        $invoiceNo = $details['invoiceNo'];
        $user = JFactory::getUser($details['user_id']);
        $link_status = JRoute::_(JURI::base() . 'index.php?option=com_jblance&task=membership.returnafterpayment&gateway=authorizenet');
        $this->authorizenet_url = $authTestmode ? 'https://test.authorize.net/gateway/transact.dll' : 'https://secure.authorize.net/gateway/transact.dll';
        require_once JPATH_SITE . '/components/com_jblance/gateways/includes/authorizenet/AuthorizeNetSIM.php';
        $fp_timestamp = time();
        $fp_sequence = $invoiceNo;
        // Enter an invoice or other unique number.
        $fingerprint = AuthorizeNetSIM_Form::getFingerprint($authAPILogin, $authTransKey, $totamt, $fp_sequence, $fp_timestamp);
        $this->add_field('x_login', $authAPILogin);
        $this->add_field('x_fp_hash', $fingerprint);
        $this->add_field('x_description', $itemname);
        //this is where the user is returned after payment.
        $this->add_field('x_cust_id', $user->username);
        $this->add_field('x_first_name', $user->name);
        $this->add_field('x_email', $user->email);
        // this is were POST data is sent
        $this->add_field('x_email_customer', true);
        $this->add_field('x_amount', $totamt);
        $this->add_field('x_invoice_num', $invoiceNo);
        $this->add_field('x_tax', $taxrate);
        $this->add_field('x_fp_timestamp', $fp_timestamp);
        $this->add_field('x_fp_sequence', $fp_sequence);
        $this->add_field('x_version', '3.1');
        $this->add_field('x_show_form', 'payment_form');
        $this->add_field('x_test_request', false);
        $this->add_field('x_method', 'cc');
        $this->add_field('x_receipt_link_method', 'POST');
        $this->add_field('x_receipt_link_text', 'Return to Merchant Site');
        $this->add_field('x_receipt_link_url', $link_status);
        $this->submit_authorizenet_post();
        // auto submit the fields to authorizenet
        ?>
	<script>
		document.authorizenet_form.submit();
	</script>
	<?php 
    }
 public function _process($params)
 {
     $fp_sequence = $params['reference'];
     $time = time();
     $fingerprint = AuthorizeNetSIM_Form::getFingerprint($this->settings['api_login_id'], $this->settings['transaction_key'], $params['amount'], $fp_sequence, $time);
     $data = array('x_amount' => $params['amount'], 'x_delim_data' => 'FALSE', 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fingerprint, 'x_fp_timestamp' => $time, 'x_invoice_num' => $params['reference'], 'x_relay_response' => 'TRUE', 'x_relay_url' => $params['return_url'], 'x_login' => $this->settings['api_login_id'], 'x_show_form' => 'PAYMENT_FORM', 'x_customer_ip' => $this->CI->input->ip_address());
     // set extra billing details if we have them
     if (isset($params['card_name'])) {
         $names = explode(' ', $params['card_name'], 2);
         $data['x_first_name'] = $names[0];
         $data['x_last_name'] = isset($names[1]) ? $names[1] : '';
     }
     if (isset($params['address']) and isset($params['address2'])) {
         $params['address'] = trim($params['address'] . " \n" . $params['address2']);
     }
     foreach (array('x_company' => 'company', 'x_address' => 'address', 'x_city' => 'city', 'x_state' => 'region', 'x_zip' => 'postcode', 'x_country' => 'country', 'x_phone' => 'phone', 'x_email' => 'email') as $key => $field) {
         if (isset($params[$field])) {
             $data[$key] = $params[$field];
         }
     }
     $sim = new AuthorizeNetSIM_Form($data);
     $post_url = $this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL;
     Merchant::redirect_post($post_url, $sim->getHiddenFieldString());
 }
 public function __construct($init)
 {
     $auth = parse_ini_file("auth.ini");
     $this->login = $auth["API_LOGIN_ID"];
     $this->key = $auth["TRANSACTION_KEY"];
     $this->timestamp = time();
     $this->sequence = rand(10, 1000) * $this->timestamp;
     self::_initializeGateway($init["CUSTOMERID"], $init["AMOUNT"], $init["METHOD"], $init["TEXT"], $init["URL"]);
     $this->fingerprint = parent::getFingerPrint($this->login, $this->key, $this->amount, $this->sequence, $this->timestamp);
     $this->_defaultParams["x_login"] = $this->login;
     $this->_defaultParams["x_fp_hash"] = $this->fingerprint;
     $this->_defaultParams["x_amount"] = $this->amount;
     $this->_defaultParams["x_fp_timestamp"] = $this->timestamp;
     $this->_defaultParams["x_fp_sequence"] = $this->sequence;
     $this->_defaultParams["x_version"] = "3.1";
     $this->_defaultParams["x_show_form"] = "payment_form";
     $this->_defaultParams["x_test_request"] = "false";
     $this->_defaultParams["x_method"] = "cc";
 }
    /**
     * Generate a sample form for use in a demo Direct Post implementation.
     *
     * @param string $amount                   Amount of the transaction.
     * @param string $fp_sequence              Sequential number(ie. Invoice #)
     * @param string $relay_response_url       The Relay Response URL
     * @param string $api_login_id             Your API Login ID
     * @param string $transaction_key          Your API Tran Key.
     * @param bool   $test_mode                Use the sandbox?
     * @param bool   $prefill                  Prefill sample values(for test purposes).
     *
     * @return string
     */
    public static function getCreditCardForm($amount, $fp_sequence, $relay_response_url, $api_login_id, $transaction_key, $test_mode = true, $prefill = true)
    {
        $time = time();
        $fp = self::getFingerprint($api_login_id, $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' => $relay_response_url, 'x_login' => $api_login_id));
        $hidden_fields = $sim->getHiddenFieldString();
        $post_url = $test_mode ? self::SANDBOX_URL : self::LIVE_URL;
        $form = '
        <style>
        fieldset {
            overflow: auto;
            border: 0;
            margin: 0;
            padding: 0; }

        fieldset div {
            float: left; }

        fieldset.centered div {
            text-align: center; }

        label {
            color: #183b55;
            display: block;
            margin-bottom: 5px; }

        label img {
            display: block;
            margin-bottom: 5px; }

        input.text {
            border: 1px solid #bfbab4;
            margin: 0 4px 8px 0;
            padding: 6px;
            color: #1e1e1e;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            -webkit-box-shadow: inset 0px 5px 5px #eee;
            -moz-box-shadow: inset 0px 5px 5px #eee;
            box-shadow: inset 0px 5px 5px #eee; }
        .submit {
            display: block;
            background-color: #76b2d7;
            border: 1px solid #766056;
            color: #3a2014;
            margin: 13px 0;
            padding: 8px 16px;
            -webkit-border-radius: 12px;
            -moz-border-radius: 12px;
            border-radius: 12px;
            font-size: 14px;
            -webkit-box-shadow: inset 3px -3px 3px rgba(0,0,0,.5), inset 0 3px 3px rgba(255,255,255,.5), inset -3px 0 3px rgba(255,255,255,.75);
            -moz-box-shadow: inset 3px -3px 3px rgba(0,0,0,.5), inset 0 3px 3px rgba(255,255,255,.5), inset -3px 0 3px rgba(255,255,255,.75);
            box-shadow: inset 3px -3px 3px rgba(0,0,0,.5), inset 0 3px 3px rgba(255,255,255,.5), inset -3px 0 3px rgba(255,255,255,.75); }
        </style>
        <form method="post" action="' . $post_url . '">
                ' . $hidden_fields . '
            <fieldset>
                <div>
                    <label>Credit Card Number</label>
                    <input type="text" class="text" size="15" name="x_card_num" value="' . ($prefill ? '6011000000000012' : '') . '"></input>
                </div>
                <div>
                    <label>Exp.</label>
                    <input type="text" class="text" size="4" name="x_exp_date" value="' . ($prefill ? '04/17' : '') . '"></input>
                </div>
                <div>
                    <label>CCV</label>
                    <input type="text" class="text" size="4" name="x_card_code" value="' . ($prefill ? '782' : '') . '"></input>
                </div>
            </fieldset>
            <fieldset>
                <div>
                    <label>First Name</label>
                    <input type="text" class="text" size="15" name="x_first_name" value="' . ($prefill ? 'John' : '') . '"></input>
                </div>
                <div>
                    <label>Last Name</label>
                    <input type="text" class="text" size="14" name="x_last_name" value="' . ($prefill ? 'Doe' : '') . '"></input>
                </div>
            </fieldset>
            <fieldset>
                <div>
                    <label>Address</label>
                    <input type="text" class="text" size="26" name="x_address" value="' . ($prefill ? '123 Main Street' : '') . '"></input>
                </div>
                <div>
                    <label>City</label>
                    <input type="text" class="text" size="15" name="x_city" value="' . ($prefill ? 'Boston' : '') . '"></input>
                </div>
            </fieldset>
            <fieldset>
                <div>
                    <label>State</label>
                    <input type="text" class="text" size="4" name="x_state" value="' . ($prefill ? 'MA' : '') . '"></input>
                </div>
                <div>
                    <label>Zip Code</label>
                    <input type="text" class="text" size="9" name="x_zip" value="' . ($prefill ? '02142' : '') . '"></input>
                </div>
                <div>
                    <label>Country</label>
                    <input type="text" class="text" size="22" name="x_country" value="' . ($prefill ? 'US' : '') . '"></input>
                </div>
            </fieldset>
            <input type="submit" value="BUY" class="submit buy">
        </form>';
        return $form;
    }
예제 #7
0
    /**
     * Generate a sample form for use in a demo Direct Post implementation.
     *
     * @param string $amount                   Amount of the transaction.
     * @param string $fp_sequence              Sequential number(ie. Invoice #)
     * @param string $relay_response_url       The Relay Response URL
     * @param string $api_login_id             Your API Login ID
     * @param string $transaction_key          Your API Tran Key.
     *
     * @return string
     */
    public static function getCreditCardForm($price, $fp_sequence, $relay_response_url, $api, $key, $nonce)
    {
        $test_mode = get_option('mcs_use_sandbox') == 'true' ? true : false;
        $prefill = $test_mode ? true : false;
        $time = time();
        $fp = self::getFingerprint($api, $key, $price, $fp_sequence, $time);
        $sim = new AuthorizeNetSIM_Form(array('x_amount' => $price, 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fp, 'x_fp_timestamp' => $time, 'x_relay_response' => "TRUE", 'x_relay_url' => $relay_response_url, 'x_login' => $api));
        $hidden_fields = $sim->getHiddenFieldString();
        global $wp;
        $hidden_fields .= "<input type='hidden' name='x_referer_url' value='" . mcs_replace_http(home_url(add_query_arg(array(), $wp->request))) . "' />";
        $post_url = $test_mode ? self::SANDBOX_URL : self::LIVE_URL;
        $button = get_option('mcs_button');
        $quantity = isset($_POST['mcs_quantity']) ? (int) $_POST['mcs_quantity'] : 1;
        if ($quantity == 1) {
            $purchasing = '<p>' . sprintf(__('You\'re purchasing a payment key to submit %1$s event for $%2$s.', 'my-calendar-submissions'), "<strong>{$quantity}</strong>", "<strong>{$price}</strong>") . '</p>';
        } else {
            $purchasing = '	<p>' . sprintf(__('You\'re purchasing a payment key for %1$s events. Total: $%2$s.', 'my-calendar-submissions'), "<strong>{$quantity}</strong>", "<strong>{$price}</strong>") . '</p>';
        }
        $form = $purchasing . '
        <form method="post" action="' . $post_url . '">
				<div>
                ' . $hidden_fields . '
				<input type="hidden" name="x_amount_base" value="' . $price . '" />
				</div>
                <div>
                    <label for="x_card_num">' . __('Credit Card Number', 'my-calendar-submissions') . '</label>
                    <input type="text" required aria-required="true" size="17" id="x_card_num" name="x_card_num" value="' . ($prefill ? '6011000000000012' : '') . '" />
                </div>
                <div>
                    <label for="x_exp_date">' . __('Expiration', 'my-calendar-submissions') . '</label>
                    <input type="text" required aria-required="true" size="4" id="x_exp_date" name="x_exp_date" placeholder="05/' . date('y', strtotime('+ 2 years')) . '" value="' . ($prefill ? '04/17' : '') . '" />
                </div>
                <div>
                    <label for="x_card_code">' . __('Security Code', 'my-calendar-submissions') . '</label>
                    <input type="text" required aria-required="true" size="4" id="x_card_code" name="x_card_code" placeholder="123" value="' . ($prefill ? '782' : '') . '" />
                </div>
                <div>
                    <label for="x_first_name">' . __('First Name', 'my-calendar-submissions') . '</label>
                    <input type="text" required aria-required="true" size="17" id="x_first_name" name="x_first_name" value="' . ($prefill ? 'John' : '') . '" />
                </div>
                <div>
                    <label for="x_last_name">' . __('Last Name', 'my-calendar-submissions') . '</label>
                    <input type="text" required aria-required="true" size="17" id="x_last_name" name="x_last_name" value="' . ($prefill ? 'Doe' : '') . '" />
                </div>
                <div>
                    <label for="x_payer_email">' . __('Email', 'my-calendar-submissions') . '</label>
                    <input type="email" required aria-required="true" size="17" id="x_payer_email" name="x_payer_email" value="' . ($prefill ? '*****@*****.**' : '') . '" />
                </div>				
                <div>
                    <label for="x_address">' . __('Address', 'my-calendar-submissions') . '</label>
                    <input type="text" size="26" id="x_address" name="x_address" value="' . ($prefill ? '123 Main Street' : '') . '" />
                </div>
                <div>
                    <label for="x_city">' . __('City', 'my-calendar-submissions') . '</label>
                    <input type="text" size="17" id="x_city" name="x_city" value="' . ($prefill ? 'Boston' : '') . '" />
                </div>
                <div>
                    <label for="x_state">' . __('State', 'my-calendar-submissions') . '</label>
                    <input type="text" size="4" id="x_state" name="x_state" value="' . ($prefill ? 'MA' : '') . '" />
                </div>
                <div>
                    <label for="x_zip">' . __('Zip Code', 'my-calendar-submissions') . '</label>
                    <input type="text" size="9" id="x_zip" name="x_zip" value="' . ($prefill ? '02142' : '') . '" />
                </div>
                <div>
                    <label for="x_country">' . __('Country', 'my-calendar-submissions') . '</label>
                    <input type="text" size="22" id="x_country" name="x_country" value="' . ($prefill ? 'US' : '') . '" />
                </div>';
        if ($button != '' && mc_is_url($button)) {
            $form .= "<input type='image' src='{$button}' name='submit' class='button' alt='" . __('Buy a payment key', 'my-calendar-submissions') . "' />";
        } else {
            $form .= "<input type='submit' name='submit' class='button' value='" . __('Buy a payment key', 'my-calendar-submissions') . "' />";
        }
        $form .= apply_filters('mcs_authorizenet_form', '', $price);
        $form .= '</form>';
        return $form;
    }
예제 #8
0
<?php

require_once 'anet_php_sdk/AuthorizeNet.php';
// Include the SDK you downloaded in Step 2
$api_login_id = '37nUJ4v3tWp';
$transaction_key = '22fC8P6d2s7VJmf6';
$amount = "5.99";
$fp_timestamp = time();
$fp_sequence = "123" . time();
// Enter an invoice or other unique number.
$fingerprint = AuthorizeNetSIM_Form::getFingerprint($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp);
?>

<form method='post' action="https://test.authorize.net/gateway/transact.dll">
<input type='hidden' name="x_login" value="<?php 
echo $api_login_id;
?>
" />
<input type='hidden' name="x_fp_hash" value="<?php 
echo $fingerprint;
?>
" />
<input type='hidden' name="x_amount" value="<?php 
echo $amount;
?>
" />
<input type='hidden' name="x_fp_timestamp" value="<?php 
echo $fp_timestamp;
?>
" />
<input type='hidden' name="x_fp_sequence" value="<?php 
    function setup_authnet_sim_form()
    {
        global $event_details;
        $event_id = $event_details['ID'];
        if (is_null($event_id)) {
            return false;
        }
        $regis_id = $this->erm->get_regis_id();
        $post_ID = $this->erm->get_regis_post_id();
        $this->ecm->setup_event_details($event_id);
        $_totals = $this->erm->calculate_cart_totals();
        $gateway_info = $this->erm->get_gateway_info();
        $gateway_id = $this->erm->get_payment_profile_id();
        $this->epl->load_file('libraries/gateways/authnet/AuthorizeNet.php');
        $api_login_id = $gateway_info['_epl_user'];
        $transaction_key = $gateway_info['_epl_pwd'];
        //$amount = number_format( $_totals['money_totals']['grand_total'], 2, '.', '' );
        $amount = number_format(epl_get_balance_due(), 2, '.', '');
        $description = $event_details['post_title'] . ', Qty: ' . $_totals['_att_quantity']['total'][$event_details['ID']];
        $fp_timestamp = time();
        $fp_sequence = $regis_id . time();
        // Enter an invoice or other unique number.
        $fingerprint = AuthorizeNetSIM_Form::getFingerprint($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp);
        $return_url = get_permalink($post_ID);
        $relay_url = add_query_arg(array('epl_action' => '_authnet_sim_process'), epl_get_shortcode_page_permalink());
        $first_name = epl_get_attendee_form_value('ticket_buyer', 'first_name');
        $last_name = epl_get_attendee_form_value('ticket_buyer', 'last_name');
        $address = epl_get_attendee_form_value('ticket_buyer', 'address');
        $city = epl_get_attendee_form_value('ticket_buyer', 'city');
        $state = epl_get_attendee_form_value('ticket_buyer', 'state');
        $zip = epl_get_attendee_form_value('ticket_buyer', 'zip');
        $email = epl_get_attendee_form_value('ticket_buyer', 'email');
        //type=hidden doesn't work.  using a hidden wrapper div
        $this->redirect_form_data = <<<EOT
<div style="display:none">

            <input type='text' name="x_login" value="{$api_login_id}" />
            <input type='text' name="x_fp_hash" value="{$fingerprint}" />
            <input type='text' name="x_amount" value="{$amount}" />
            <input type='text' name="x_fp_timestamp" value="{$fp_timestamp}" />
            <input type='text' name="x_fp_sequence" value="{$fp_sequence}" />
            <input type='text' name="x_description" value="{$description}" />
            <input type='text' name="x_version" value="3.1" />
            <input type='text' name="x_show_form" value="PAYMENT_FORM" />
            <input type='text' name="x_test_request" value="false" />
            <input type='text' name="x_method" value="cc" />


            <input type='text' name="x_invoice_num" value="{$regis_id}" />
            <input type='text' name="x_first_name" value="{$first_name}" />
            <input type='text' name="x_last_name" value="{$last_name}" />
            <input type='text' name="x_address" value="{$address}" />
            <input type='text' name="x_city" value="{$city}" />
            <input type='text' name="x_state" value="{$state}" />
            <input type='text' name="x_zip" value="{$zip}" />
            <input type='text' name="x_email" value="{$email}" />

            <input type='text' name="e_ID" value="{$event_id}" />
            <input type='text' name="p_ID" value="{$post_ID}" />
            <input type='text' name="r_ID" value="{$regis_id}" />
            <input type='text' name="g_ID" value="{$gateway_id}" />

            <input type='text' name="x_receipt_link_method" value="POST" />
          <input type='text' name="x_receipt_link_text" value="PLEASE CLICK HERE TO FINISH YOUR REGISTRATION" />
          <input type='text' name="x_receipt_link_URL" value="{$relay_url}" />
              

</div>


EOT;
        /*
        *                         <input type='text' name="x_relay_response" value="TRUE">
         <input type='text' name="x_relay_url" value="$relay_url">
        *
        */
    }
예제 #10
0
        <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>
          <input type="text" class="text required" size="4" name="x_card_code" value="782"></input>
 /**
  *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'));
 }
예제 #12
0
 public function authorizePay($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp)
 {
     require_once 'anet_php_sdk/AuthorizeNet.php';
     $fingerprint = AuthorizeNetSIM_Form::getFingerprint($api_login_id, $transaction_key, $amount, $fp_sequence, $fp_timestamp);
     return $fingerprint;
 }
예제 #13
0
<?php

require_once $controller->getConst('PLUGIN_DIR') . 'anet_php_sdk/AuthorizeNet.php';
$transaction_key = $tpl['arr']['transkey'];
$url = PJ_TEST_MODE ? 'https://test.authorize.net/gateway/transact.dll' : 'https://secure.authorize.net/gateway/transact.dll';
$x_login = $tpl['arr']['x_login'];
$x_amount = number_format($tpl['arr']['x_amount'], 2, '.', '');
$x_description = $tpl['arr']['x_description'];
$x_fp_sequence = md5(uniqid(rand(), true));
$x_fp_timestamp = time() + (int) $tpl['arr']['timezone'];
$fingerprint = AuthorizeNetSIM_Form::getFingerprint($x_login, $transaction_key, $x_amount, $x_fp_sequence, $x_fp_timestamp);
?>
<form method="post" action="<?php 
echo $url;
?>
" style="display: inline" name="<?php 
echo $tpl['arr']['name'];
?>
" id="<?php 
echo $tpl['arr']['id'];
?>
" target="<?php 
echo @$tpl['arr']['target'];
?>
">
	<input type="hidden" name="x_login" value="<?php 
echo $x_login;
?>
" />
	<input type="hidden" name="x_amount" value="<?php 
echo $x_amount;