cancel
Showing results for 
Search instead for 
Did you mean: 

Someone enrolls to an event, authorize.net not talking Event Registration Pro after transaction

We have 3 programs working together on our site- Joomla, authorize.net and Event Registration Pro. Our website is http://www.worldworkstrainings.com/enroll/events.

 

The issue is someone enrolls to an event here on our site, authorize.net is not talking back to Event Registration Pro after the transaction. We don't get the email registration form automatically emailed to is, we have to go in and manually forward the registration from from within the system to process it. I want it to be automatic.

 

Is this some line of code missing from the page? That's what I'm assuming. Or is it possible to do? Not sure, Please help!

 

We're using SIM.

 

 

Here's the code:

<?php
defined('_JEXEC') or die();
/**
 * Adds the ability to use Authorize.net's AIM gateway.
 *
 * @author `corePHP«
 */

$file = realpath(dirname(__FILE__) . DS . '..' . DS . 'corephp' . DS . 'payment_gateway.php');
if (is_readable($file)) {
    include_once $file;
}

class PlgRegpro_gatewaysauthorize_net_sim extends PaymentGateway {

    protected $_version = '1.1';

    private $_devUrl = 'https://test.authorize.net/gateway/transact.dll';
    private $_url = 'https://secure.authorize.net/gateway/transact.dll';
    protected $_formAction = null;

    /**
     * Required form fields for SIM
     *
     * @var $_formData array
     */
    protected $_formData = array (
        'x_login' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_test_request' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_fp_hash' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_method' => array (
            'type' => 'hidden',
            'value' => 'CC'
        ),
        'x_show_form' => array (
            'type' => 'hidden',
            'value' => 'PAYMENT_FORM'
        ),
        'x_type' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_amount' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_receipt_link_method' => array (
            'type' => 'hidden',
            'value' => 'LINK'
        ),
        'x_receipt_link_text' => array (
            'type' => 'hidden',
            'value' => 'Return to our online store to complete your order.'
        ),
        'x_receipt_link_URL' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_fp_sequence' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'x_fp_timestamp' => array (
            'type' => 'hidden',
            'value' => ''
        ),
        'submit-btn' => array (
            'type' => 'submit',
            'value' => 'Continue to Authorize.net'
        ),
        'x_version' => array (
            'type' => 'hidden',
            'value' => '3.1'
        ),
        'x_relay_response' => array (
            'type' => 'hidden',
            'value' => 'false'
        ),
        'x_relay_url' => array (
            'type' => 'hidden',
            'value' => 'https://developer.authorize.net/tools/paramdump/index.php'
        ),
        'x_header_html_payment_form' => array (
            'type' => 'hidden',
            'value' => '<style type=\'text/css\' media=\'all\'>#tableCustomerShippingInformation,#tableCustomerShippingHeading{display:none}</style>'
        )
    );

    protected function _startOrderProcess($orderData) {
       // echo '<div><pre>',var_dump($orderData),'</pre></div>';exit;
        $doc = & JFactory::getDocument();
        $script = 'window.onload=function(){document.getElementById(\'checkout-form\').submit();}';
        $doc->addScriptDeclaration($script);

        $this->_formData['x_login']['value'] = $this->params->get('dev') ? $this->params->get('dev_x_login') : $this->params->get('x_login');
        $this->_formData['x_test_request']['value'] = $this->params->get('x_test_request') ? 'true' : 'false';
        $this->_formData['x_type']['value'] = $this->params->get('x_type');
        $this->_formData['x_fp_hash']['value'] = $this->_buildFingerprint();
        $this->_formData['x_amount']['value'] = $orderData['order_amount'];
        $this->_formData['x_amount']['type'] = 'hidden';
        $this->_formData['x_first_name']['value'] = $orderData['firstname'];
        $this->_formData['x_first_name']['type'] = 'hidden';
        $this->_formData['x_last_name']['value'] = $orderData['lastname'];
        $this->_formData['x_last_name']['type'] = 'hidden';
        $this->_formData['x_email']['value'] = $orderData['email'];
        $this->_formData['x_email']['type'] = 'hidden';
        $this->_formData['x_cust_id']['value'] = $orderData['user_id'];
        $this->_formData['x_cust_id']['type'] = 'hidden';
        $this->_formData['x_invoice_num']['value'] = $orderData['order_id'];
        $this->_formData['x_invoice_num']['type'] = 'hidden';
        $this->_formData['x_description']['value'] = $orderData['items'][0]->product_name;
        $this->_formData['x_description']['type'] = 'hidden';

        $data = $this->_convert2RegPro($orderData, $this->_successUrl);
        $this->_formData['x_receipt_link_URL']['value'] = 'http://' . $_SERVER['HTTP_HOST'] . JURI::root(true) . '/index.php?' . $this->_array2Url($data);

        $this->_formAction = $this->params->get('dev') ? $this->_devUrl : $this->_url;
        $this->_buildForm();
    }

    protected function _buildFingerprint() {
        $sequence = rand(1, 1000);
        $this->_formData['x_fp_sequence']['value'] = $sequence;
        $timeStamp = gmmktime();
        $this->_formData['x_fp_timestamp']['value'] = $timeStamp;
        $transactionKey = $this->params->get('dev') ? $this->params->get('dev_x_tran_key') : $this->params->get('x_tran_key');
        $loginID = $this->_formData['x_login']['value'];
        $amount = $this->_getOrderData('order_amount');



        if (version_compare(PHP_VERSION, '5.1.2') >= 0) {
            return hash_hmac("md5", $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey);
        } else {
            return bin2hex(mhash(MHASH_MD5, $loginID . "^" . $sequence . "^" . $timeStamp . "^" . $amount . "^", $transactionKey));
        }

    }

}

hollyfinn
Member
1 REPLY 1

Hi holly finn,

 

Since Receipt link method depends upon the customer to continue through the process manually. For example if the customer leaves your receipt page and doesn't click the button to go back to your site, you will not receive the transaction response. If you want to receive the transaction response, your best option is to use Relay Response, it instructs the payment gateway to return transaction results to you using an HTML form POST to a specified URL on your Web server. For more information please check this: 

 

http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Relay-Response-Basics-a...

 

Joy
Administrator Administrator
Administrator