function Process_card(&$tNG) { require_once('../../includes/authorize/authorizenet.class.php'); require_once("../../includes/site_config.php"); global $authnet_url,$authnet_sellerId,$authnet_transkey,$credit, $payment, $sbal, $initial_bal,$credit_line_id, $uid_usr, $trans_id; //varex($tNG->columns); $transaction = new authorizenet_class; $transaction->add_field('x_login', $authnet_sellerId); $transaction->add_field('x_tran_key', $authnet_transkey); $transaction->add_field('x_version', '3.1'); $transaction->add_field('x_type', 'AUTH_CAPTURE'); //can be CAPTURE_ONLY, AUTH_ONLY, CREDIT, PRIOR_AUTH_CAPTURE, VOID $transaction->add_field('x_relay_response', 'FALSE'); $transaction->add_field('x_delim_data', 'TRUE'); $transaction->add_field('x_delim_char', '|'); $transaction->add_field('x_encap_char', ''); //$transaction->add_field('x_trans_id', $transaction_id); //$transaction->add_field('x_first_name', $_POST['fname']); $transaction->add_field('x_last_name', $_POST['nameoncard_acc']); $transaction->add_field('x_address',$_POST['billingaddress_acc']); $transaction->add_field('x_city', $_POST['billingcity_acc']); $transaction->add_field('x_state', $_POST['billingstate_acc']); $transaction->add_field('x_zip', $_POST['billingzip_acc']); $transaction->add_field('x_country', 'US'); //$transaction->add_field('x_phone', $tNG->columns['']); $transaction->add_field('x_method', 'CC'); $transaction->add_field('x_card_num', $_POST['card_number_acc']); // test failure card number $transaction->add_field('x_amount', $payment); $transaction->add_field('x_exp_date', $_POST['ccexpmonth_acc']."-".$_POST['ccexpyear_acc']); // march of 2008 $transaction->add_field('x_card_code', $_POST['ccv2_acc']); // Card CAVV Security code //$transaction->add_field('x_merchant_email', 'benny@referralpartnermarketing.com'); $transaction->add_field('x_email', $_POST['billing_email_acc']); $transaction->add_field('x_email_customer', 'FALSE'); $transaction->add_field('x_description', "$ $payment Book Purchase: $credit_line_id \n http://www.oxpublishing.com/admin/users/details.php?id_usr=$uid_usr"); $transaction->add_field('x_cust_id', $uid_usr); $transaction->add_field('x_duplicate_window', 600); $transaction->set_gateway($authnet_url); //echo '
';
//print_r($transaction);
if($_REQUEST['debug']==1){
$transaction->add_field('x_test_request', 'TRUE'); // Just a test transaction
//echo '';
//print_r($transaction);
//echo '
';
//break;
}
else {
$transaction->add_field('x_test_request', 'FALSE'); // Just a test transaction
}
//$transaction->dump_fields();
$results = $transaction->process();
$trans_id = $transaction->get_transaction_id();
//$debug = 1;
//if ($debug == 1){
//$transaction->dump_response();
//$transaction->dump_fields();
//}
if ($results !=1) {
$error_txt = $transaction->get_response_reason_text();
$errObj = new tNG_error($error_txt, array(), array());
return $errObj;
}
else {
return null;
}
}