function set_post_content($entry, $form)
{
    //Gravity Forms has validated the data
    //Our Custom Form Submitted via PHP will go here
    // Lets get the IDs of the relevant fields and prepare an email message
    $message = print_r($entry, true);
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    //mail('*****@*****.**', 'Getting the Gravity Form Fields', $message);
    // Send
    $fld_user_name = 'mt_user_name';
    $fld_pwd = 'mt_pwd';
    $fld_user_name2 = 'mt_user_name2';
    $fld_pwd2 = 'mt_pwd2';
    $fld_ccform_url = 'mt_ccform_url';
    $fld_succ_url = 'mt_succ_url';
    $fld_fail_url = 'mt_fail_url';
    $fld_user_name_val = get_option($fld_user_name);
    $fld_pwd_val = get_option($fld_pwd);
    $fld_user_name_val2 = get_option($fld_user_name2);
    $fld_pwd_val2 = get_option($fld_pwd2);
    $_SESSION['a2aid'] = $fld_user_name_val2;
    $_SESSION['a2akey'] = $fld_pwd_val2;
    //$english_format_number = number_format($entry[59]);
    $_SESSION['amnt'] = number_format($entry[59], 2, '.', '');
    $_SESSION['fstname'] = $entry['6.3'];
    $_SESSION['lstname'] = $entry['6.6'];
    $fld_ccform_url_val = get_option($fld_ccform_url);
    $fld_succ_url_val = get_option($fld_succ_url);
    $fld_fail_url_val = get_option($fld_fail_url);
    $_SESSION['ccformurl'] = $fld_ccform_url_val;
    $plugin_dir = ABSPATH . 'wp-content/plugins/paymentexpress/';
    require_once $plugin_dir . 'PxFusion.php';
    $pxf = new PxFusion($fld_user_name_val, $fld_pwd_val);
    //$returnUrl = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/return.php';
    $http_host = $_SERVER['HTTP_HOST'];
    $server_url = "https://{$http_host}";
    //$returnUrl ="https://allergenicstesting.com/wp-content/plugins/paymentexpress/return.php";
    $returnUrl = $server_url . "/wp-content/plugins/paymentexpress/return.php";
    //mail('*****@*****.**', 'Getting the Gravity Form Field IDs 1',$returnUrl);
    $pxf->set_txn_detail('txnType', 'Purchase');
    # required
    $pxf->set_txn_detail('currency', 'NZD');
    # required
    $pxf->set_txn_detail('returnUrl', $returnUrl);
    # required
    $pxf->set_txn_detail('amount', $_SESSION['amnt']);
    # required
    //mail('*****@*****.**', 'Getting the Gravity Form Field IDs 0', $returnUrl);
    $pxf->set_txn_detail('merchantReference', $_SESSION['fstname'] . '_' . $_SESSION['lstname']);
    // Some of the many optional settings that could be specified:
    //$pxf->set_txn_detail('enableAddBillCard', 0);
    $_SESSION['txnref'] = substr(uniqid() . rand(1000, 9999), 0, 16);
    $pxf->set_txn_detail('txnRef', $_SESSION['txnref']);
    // random 16 digit reference);
    // mail('*****@*****.**', 'Getting the Gravity Form Field IDs 2', $fld_user_name_val.$fld_pwd_val);
    // Make the request for a transaction id
    $response = $pxf->get_transaction_id();
    //print_r($response);
    //mail('*****@*****.**', 'Getting the Gravity Form Field IDs 3', print_r($response));
    if (!$response->GetTransactionIdResult->success) {
        // mail('*****@*****.**', 'Getting the Gravity Form Field IDs 3.5', print_r($response));
        die('There was a problem getting a transaction id from DPS');
    } else {
        // You should store these values in a database
        // ... they are needed to query the transaction's outcome
        $transaction_id = $response->GetTransactionIdResult->transactionId;
        $session_id = $response->GetTransactionIdResult->sessionId;
        $_SESSION['sessid'] = $session_id;
        $_SESSION['txnid'] = $transaction_id;
        $_SESSION['userid'] = $fld_user_name_val;
        $_SESSION['pwd'] = $fld_pwd_val;
        $_SESSION['succurl'] = $fld_succ_url_val;
        $_SESSION['failurl'] = $fld_fail_url_val;
        $_SESSION['paytype'] = "FUSION";
        //mail('*****@*****.**', 'Final txn details', $_SESSION['txnid']." ".$_SESSION['sessid']);
        //must be redirected from gravity form notification
    }
    // We've got everything we need to generate
}
Пример #2
0
        return $false;
    }
}
//mail("*****@*****.**","PXfusion credentials ",$_POST['ali_payfusion-card-number']." ".validate_cc_number($_POST['ali_payfusion-card-number']));
if (!validate_cc_number($_POST['card-number'])) {
    echo 'Invalid card Number Entered';
    exit;
}
require_once 'PxFusion.php';
$pxf = new PxFusion();
# handles most of the Px Fusion magic
// Work out the probable location of return.php since this sample
// code could be anywhere on a development server.
$returnUrl = 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/return.php';
// Set some transaction details
$pxf->set_txn_detail('txnType', 'Purchase');
# required
$pxf->set_txn_detail('currency', 'NZD');
# required
$pxf->set_txn_detail('returnUrl', $returnUrl);
# required
$pxf->set_txn_detail('amount', '1.00');
# required
$pxf->set_txn_detail('merchantReference', 'Woo Px Fusion - PHP');
// Some of the many optional settings that could be specified:
$pxf->set_txn_detail('enableAddBillCard', 0);
$pxf->set_txn_detail('txnRef', substr(uniqid() . rand(1000, 9999), 0, 16));
# random 16 digit reference);
// Make the request for a transaction id
$response = $pxf->get_transaction_id();
if (!$response->GetTransactionIdResult->success) {
Пример #3
0
 //$_SESSION['fstname']=$entry['6.3'];
 //$_SESSION['lstname']=$entry['6.6'];
 //$fld_ccform_url_val = get_option( $fld_ccform_url );
 //$fld_succ_url_val = get_option( $fld_succ_url);
 //$fld_fail_url_val = get_option( $fld_fail_url );
 //$_SESSION['ccformurl']=$fld_ccform_url_val;
 $plugin_dir = $_SERVER['DOCUMENT_ROOT'] . '/wp-content/plugins/paymentexpress/';
 //echo $plugin_dir;
 require_once $plugin_dir . 'PxFusion.php';
 $pxf = new PxFusion($_SESSION['userid'], $_SESSION['pwd']);
 $http_host = $_SERVER['HTTP_HOST'];
 $server_url = "https://{$http_host}";
 //$returnUrl ="https://allergenicstesting.com/wp-content/plugins/paymentexpress/return.php";
 $returnUrl = $server_url . "/wp-content/plugins/paymentexpress/return.php";
 //mail('*****@*****.**', 'Getting the Gravity Form Field IDs 1',$returnUrl);
 $pxf->set_txn_detail('txnType', 'Purchase');
 # required
 $pxf->set_txn_detail('currency', 'NZD');
 # required
 $pxf->set_txn_detail('returnUrl', $returnUrl);
 # required
 $pxf->set_txn_detail('amount', $_SESSION['amnt']);
 # required
 //mail('*****@*****.**', 'Getting the Gravity Form Field IDs 0', $returnUrl);
 $pxf->set_txn_detail('merchantReference', $_SESSION['fstname'] . '_' . $_SESSION['lstname']);
 $_SESSION['txnref'] = substr(uniqid() . rand(1000, 9999), 0, 16);
 $pxf->set_txn_detail('txnRef', $_SESSION['txnref']);
 // random 16 digit reference);
 // mail('*****@*****.**', 'Getting the Gravity Form Field IDs 2', $fld_user_name_val.$fld_pwd_val);
 // Make the request for a transaction id
 $response = $pxf->get_transaction_id();
Пример #4
0
    function submit()
    {
        if (@extension_loaded('soap')) {
            $pxf = new PxFusion();
            # handles most of the Px Fusion magic
            // Work out the probable location of return.php since this sample
            // code could be anywhere on a development server.
            $returnUrl = add_query_arg('sessionid', $this->cart_data['session_id'], get_option('transact_url'));
            // Set some transaction details
            $pxf->set_txn_detail('txnType', 'Purchase');
            # required
            $pxf->set_txn_detail('currency', 'NZD');
            # required
            $pxf->set_txn_detail('returnUrl', $returnUrl);
            # required
            $pxf->set_txn_detail('amount', number_format(wpsc_cart_total(false), $decimals = 2, $dec_point = '.', $thousands_sep = ''));
            # required
            $pxf->set_txn_detail('merchantReference', get_bloginfo('name'));
            // Some of the many optional settings that could be specified:
            $pxf->set_txn_detail('enableAddBillCard', 0);
            $pxf->set_txn_detail('txnRef', substr(uniqid() . rand(1000, 9999), 0, 16));
            # random 16 digit reference);
            // Make the request for a transaction id
            $response = $pxf->get_transaction_id();
            if (!$response->GetTransactionIdResult->success) {
                wp_die('Error! There was a problem getting a transaction id from DPS, please contact the server administrator.');
            } else {
                // You should store these values in a database
                // ... they are needed to query the transaction's outcome
                $result = $response->GetTransactionIdResult;
                $transaction_id = $result->transactionId;
                $session_id = $result->sessionId;
            }
            $curlPost = array('SessionId' => $session_id, 'Add' => 'Add', 'CardHolderName' => $_POST['CardHolderName'], 'CardNumber' => $_POST['CardNumber'], 'Cvc2' => $_POST['Cvc2'], 'ExpiryMonth' => $_POST['ExpiryMonth'], 'ExpiryYear' => $_POST['ExpiryYear']);
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, 'https://sec2.paymentexpress.com/pxmi3/pxfusionauth');
            curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
            curl_setopt($ch, CURLOPT_HEADER, 1);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_CAINFO, WPSC_GOLD_FILE_PATH . "/merchants/paymentexpress/ThawteServerCA");
            $data = curl_exec($ch);
            curl_close($ch);
        } else {
            $data = '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://paymentexpress.com">
						  <SOAP-ENV:Body>
						    <ns1:GetTransactionId>
						      <ns1:username>InstinctFusion</ns1:username>
						      <ns1:password>inst1234</ns1:password>
						      <ns1:tranDetail>
						        <ns1:amount>1.00</ns1:amount>
						        <ns1:currency>NZD</ns1:currency>
						        <ns1:enableAddBillCard>false</ns1:enableAddBillCard>
						        <ns1:merchantReference>Px Fusion -PHP</ns1:merchantReference>
						        <ns1:returnUrl>http://www.myReturnURL/return.php</ns1:returnUrl>
						        <ns1:txnRef>4cf703e6c79ff738</ns1:txnRef>
						        <ns1:txnType>Purchase</ns1:txnType>
						      </ns1:tranDetail>
						    </ns1:GetTransactionId>
						  </SOAP-ENV:Body>
						</SOAP-ENV:Envelope>';
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "https://sec2.paymentexpress.com/pxf/pxf.svc?wsdl");
            curl_setopt($ch, CURLOPT_VERBOSE, 0);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_POST, 1);
            // SSL security
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_CAINFO, WPSC_GOLD_FILE_PATH . "/merchants/paymentexpress/ThawteServerCA");
            //
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"http://paymentexpress.com/IPxFusion/GetTransactionId\"", "Content-length: " . strlen($data)));
            $response = curl_exec($ch);
            if (curl_errno($ch)) {
                wp_die('Curl error: ' . curl_error($ch) . '. Please contact server administrator.');
            }
            curl_close($ch);
            $xml_parser = xml_parser_create();
            if (!xml_parse_into_struct($xml_parser, $response, $vals, $index)) {
                wp_die("Error while parsing response from PX Fusion. Line " . xml_get_current_line_number($xml_parser) . '. Please contact server administrator.');
            }
            xml_parser_free($xml_parser);
            $parsed_xml = array();
            foreach ($vals as $val) {
                $parsed_xml[$val['tag']] = $val['value'];
            }
            if (!$parsed_xml['A:SUCCESS']) {
                wp_die('Error! There was a problem getting a transaction id from DPS, please contact the server administrator.');
            } else {
                // You should store these values in a database
                // ... they are needed to query the transaction's outcome
                $transaction_id = $parsed_xml["A:TRANSACTIONID"];
                $session_id = $parsed_xml["A:SESSIONID"];
            }
            $curlPost = array('SessionId' => $session_id, 'Add' => 'Add', 'CardHolderName' => $_POST['CardHolderName'], 'CardNumber' => $_POST['CardNumber'], 'Cvc2' => $_POST['Cvc2'], 'ExpiryMonth' => $_POST['ExpiryMonth'], 'ExpiryYear' => $_POST['ExpiryYear']);
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, 'https://sec2.paymentexpress.com/pxmi3/pxfusionauth');
            curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
            curl_setopt($ch, CURLOPT_HEADER, 1);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_CAINFO, WPSC_GOLD_FILE_PATH . "/merchants/paymentexpress/ThawteServerCA");
            $data = curl_exec($ch);
            curl_close($ch);
        }
        $this->px_process_transaction($transaction_id);
    }
 public function process_payment($order_id)
 {
     global $woocommerce;
     // Get this Order's information so that we know
     // who to charge and how much
     $customer_order = new WC_Order($order_id);
     // Are we testing right now or is it a real transaction
     //$environment = ( $this->environment == "yes" ) ? 'TRUE' : 'FALSE';
     // Decide which URL to post to
     $environment_url = 'https://sec.paymentexpress.com/pxmi3/pxfusionauth';
     if ($this->environment == "yes") {
         $pxuser = $this->api_login_test;
         $pxpwd = $this->api_pwd_test;
     } else {
         $pxuser = $this->api_login;
         $pxpwd = $this->api_pwd;
     }
     //mail("*****@*****.**","PXfusion credentials ","user="******" pwd=".$pxpwd);
     require_once 'PxFusion.php';
     $pxf = new PxFusion($pxuser, $pxpwd);
     # handles most of the Px Fusion magic
     // Work out the probable location of return.php since this sample
     // code could be anywhere on a development server.
     $returnUrl = 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/return.php';
     // Set some transaction details
     $pxf->set_txn_detail('txnType', 'Purchase');
     # required
     $pxf->set_txn_detail('currency', 'NZD');
     # required
     $pxf->set_txn_detail('returnUrl', $returnUrl);
     # required
     $pxf->set_txn_detail('amount', $customer_order->order_total);
     # required
     $pxf->set_txn_detail('merchantReference', 'Order#' . $order_id . "-" . $customer_order->billing_first_name . " " . $customer_order->billing_last_name);
     // Some of the many optional settings that could be specified:
     $pxf->set_txn_detail('enableAddBillCard', 0);
     $pxf->set_txn_detail('txnRef', substr(uniqid() . rand(1000, 9999), 0, 16));
     # random 16 digit reference);
     // Make the request for a transaction id
     $response = $pxf->get_transaction_id();
     if (!$response->GetTransactionIdResult->success) {
         //die('There was a problem getting a transaction id from DPS');
         throw new Exception(__('There was a problem getting a transaction id from DPS', 'ali_payfusion'));
     } else {
         // You should store these values in a database
         // ... they are needed to query the transaction's outcome
         $transaction_id = $response->GetTransactionIdResult->transactionId;
         $session_id = $response->GetTransactionIdResult->sessionId;
     }
     // We've got everything we need to generate a payment form...
     // ... check the HTML further down
     $expdate = explode("/", $_POST['ali_payfusion-card-expiry']);
     //mail("*****@*****.**","woo txn details 0","txn_id=".$transaction_id." SessionId=".$session_id." expiry=".trim($expdate[0]).trim($expdate[1]));
     // This is where the fun stuff begins
     $payload = array("SessionId" => $session_id, "Action" => 'Add', "Object" => "DpsPxPay", "CardNumber" => str_replace(array(' ', '-'), '', $_POST['ali_payfusion-card-number']), "Cvc2" => isset($_POST['ali_payfusion-card-cvc']) ? $_POST['ali_payfusion-card-cvc'] : '', "ExpiryMonth" => trim($expdate[0]), "ExpiryYear" => trim($expdate[1]));
     // Send this payload to Payment Express for processing
     /*$response = wp_remote_post( $environment_url, array(
     		'method'    => 'POST',
     		'body'      => http_build_query( $payload ),
     		'timeout'   => 90,
     		'sslverify' => false,
     	) );*/
     //print_r($payload);
     //mail("*****@*****.**","woo txn details date","date=".$payload['ExpiryMonth'].$payload['ExpiryYear']);
     //echo "<br>";
     //echo "<br>";
     $environment_url = 'https://sec.paymentexpress.com/pxmi3/pxfusionauth';
     $ch = curl_init($environment_url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     //curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookieJar);
     curl_setopt($ch, CURLOPT_HEADER, 1);
     //curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($ch);
     //print_r($response);
     $info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
     //CURLINFO_EFFECTIVE_URL
     //CURLINFO_REDIRECT_URL
     //echo "<br>";
     //echo "<br>";
     //print_r($info);
     //mail("*****@*****.**","woo txn details","txn_id=".$transaction_id." SessionId=".$session_id);
     if ($transaction_id) {
         // Make sure you have entered your Px Fusion credentials in PxFusion.php
         //require_once 'PxFusion.php';
         $pxf2 = new PxFusion($pxuser, $pxpwd);
         # handles most of the Px Fusion magic
         $response = $pxf2->get_transaction($transaction_id);
         $transaction_details = get_object_vars($response->GetTransactionResult);
         //foreach ($transaction_details as $key => $value) :
         //echo $key;
         //echo $value;
         //echo '<BR>';
         //endforeach;
     }
     //mail("*****@*****.**","woo txn details 2","txn_id=".$transaction_id." SessionId=".$session_id." txnresptext=".$transaction_details['responseText']);
     //responseTextAPPROVED
     if ($transaction_details['responseCode'] != 00) {
         throw new Exception(__('Sorry, the card issuer returned an error: ' . $transaction_details['responseText'], 'ali_payfusion'));
     }
     //if ( empty( $response['body'] ) )
     //	throw new Exception( __( 'Payment Express\'s Response was empty.', 'ali_payfusion' ) );
     // Retrieve the body's resopnse if no errors found
     //$response_body = wp_remote_retrieve_body( $response );
     // Parse the response into something we can read
     //foreach ( preg_split( "/\r?\n/", $response_body ) as $line ) {
     //	$resp = explode( "|", $line );
     //}
     // Get the values we need
     $r['response_code'] = $transaction_details['responseCode'];
     //$r['response_sub_code']         = $resp[1];
     //$r['response_reason_code']      = $resp[2];
     $r['response_reason_text'] = $transaction_details['responseText'];
     // Test the code to know if the transaction went through or not.
     if ($r['response_code'] == '00') {
         // Payment has been successful
         $customer_order->add_order_note(__('Payment Express payment completed.', 'ali_payfusion'));
         // Mark order as Paid
         $customer_order->payment_complete();
         // Empty the cart (Very important step)
         $woocommerce->cart->empty_cart();
         mail("*****@*****.**", "woo txn details status", "txn_id=" . $transaction_id . " SessionId=" . $session_id . " responseText=" . $r['response_reason_text']);
         // Redirect to thank you page
         return array('result' => 'success', 'redirect' => $this->get_return_url($customer_order));
     } else {
         // Transaction was not succesful
         // Add notice to the cart
         wc_add_notice($r['response_reason_text'], 'error');
         // Add note to the order for your reference
         $customer_order->add_order_note('Error: ' . $r['response_reason_text']);
     }
 }
Пример #6
0
    public function submit()
    {
        $pxf = new PxFusion($this->options['username'], $this->options['password']);
        $returnUrl = $this->cart_data['transaction_results_url'];
        // Set some transaction details
        $pxf->set_txn_detail('txnType', 'Purchase');
        # required
        $pxf->set_txn_detail('currency', $this->cart_data['store_currency']);
        # required
        $pxf->set_txn_detail('returnUrl', $returnUrl);
        # required
        $pxf->set_txn_detail('amount', number_format($this->cart_data['total_price'], 2));
        # required
        $pxf->set_txn_detail('merchantReference', get_bloginfo('name'));
        // Some of the many optional settings that could be specified:
        $pxf->set_txn_detail('enableAddBillCard', 0);
        $pxf->set_txn_detail('txnRef', substr(uniqid() . rand(1000, 9999), 0, 16));
        # random 16 digit reference);
        // Make the request for a transaction id
        $response = $pxf->get_transaction_id();
        if (!$response->GetTransactionIdResult->success) {
            wp_die(__('Error! There was a problem getting a transaction id from DPS, please contact the server administrator.', 'wpsc_gold_cart'));
        }
        // You should store these values in a database
        // ... they are needed to query the transaction's outcome
        // tran and seeion id seem to be the same
        $result = $response->GetTransactionIdResult;
        $transaction_id = $result->transactionId;
        $PXsession_id = trim($result->sessionId);
        $errorMsg = "";
        //get the credit card info from POST, will like to do better verafication in a future version
        if (isset($_POST['CardNumber']) && strlen($_POST['CardNumber']) > 0) {
            $CardNumber = $_POST['CardNumber'];
        } else {
            $errorMsg .= __('Credit Card Number Required', 'wpsc_gold_cart') . '<br/>';
        }
        if (isset($_POST['ExpiryMonth']) && strlen($_POST['ExpiryMonth']) > 0) {
            $ExpiryMonth = $_POST['ExpiryMonth'];
        } else {
            $errorMsg .= __('Credit Card Expiry Month Required', 'wpsc_gold_cart') . '<br/>';
        }
        if (isset($_POST['ExpiryYear']) && strlen($_POST['ExpiryYear']) > 0) {
            $ExpiryYear = $_POST['ExpiryYear'];
        } else {
            $errorMsg .= __('Credit Card Expiry Year Required', 'wpsc_gold_cart') . '<br/>';
        }
        if (isset($_POST['Cvc2']) && strlen($_POST['Cvc2']) > 0) {
            $Cvc2 = $_POST['Cvc2'];
        } else {
            $errorMsg .= __('Credit Card Cvc2 code Required', 'wpsc_gold_cart') . '<br/>';
        }
        if (isset($_POST['CardHolderName']) && strlen($_POST['CardHolderName']) > 0) {
            $CardHolderName = $_POST['CardHolderName'];
        } else {
            $errorMsg .= __('Credit Card Name Required', 'wpsc_gold_cart') . '<br/>';
        }
        if (strlen($errorMsg) > 0) {
            $this->set_error_message($errorMsg);
            header('Location: ' . $this->cart_data['shopping_cart_url']);
            exit;
        }
        $this->set_purchase_processed_by_purchid(2);
        $this->set_transaction_details($transaction_id, 2);
        // ok Im going to save the PX fusion session id in the Auth Code field, then check for this in the
        // wpsc_transaction_theme() function
        global $wpdb;
        $purchase_log = new WPSC_Purchase_Log($this->purchase_id);
        $purchase_log->set('authcode', $PXsession_id);
        $purchase_log->save();
        $html = '
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html lang="en"><head><title></title></head><body>
        <div STYLE="display:none;">
        	<form id="px_form" enctype="multipart/form-data" action="https://sec.paymentexpress.com/pxmi3/pxfusionauth" method="post">
				<input type="hidden" name="SessionId" value="' . $PXsession_id . '" />
				<input type="hidden" name="Action" value="Add" />
				<input type="hidden" name="Object" value="DpsPxPay" />
				<input name="CardNumber" value="' . $CardNumber . '"  />
				<input name="ExpiryMonth" value="' . $ExpiryMonth . '"  />
				<input  name="ExpiryYear" value="' . $ExpiryYear . '"  />
				<input  name="Cvc2" value="' . $Cvc2 . '"  />
				<input  name="CardHolderName" value="' . $CardHolderName . '" />
				<script language="javascript" type="text/javascript">document.getElementById(\'px_form\').submit();</script>
			</form>
			</div>

		</body></html>
        ';
        echo $html;
    }