Example #1
0
$transInfo['from_url'] = $from_url;
$transInfo['bank_id'] = $bank_CreditcardId;
$transInfo['td_rebillingID'] = $rd_subaccount;
$transInfo['td_is_a_rebill'] = '0';
$transInfo['td_enable_rebill'] = $td_enable_rebill;
$transInfo['td_voided_check'] = '0';
$transInfo['td_returned_checks'] = '0';
$transInfo['td_site_ID'] = $site_id;
$transInfo['payment_schedule'] = $_SESSION['payment_schedule'];
$transInfo['nextDateInfo'] = $_SESSION['nextDateInfo'];
$transInfo['td_is_affiliate'] = '0';
$transInfo['td_is_pending_check'] = '0';
$transInfo['td_is_chargeback'] = '0';
$transInfo['td_recur_processed'] = '0';
$transInfo['td_recur_next_date'] = $td_recur_next_date;
$transInfo['td_username'] = $td_username;
$transInfo['td_password'] = $td_password;
$transInfo['td_product_id'] = $td_product_id;
include "includes/integration.php";
$etel_fraud_limit = 8.5;
$response = execute_transaction(&$transInfo, $testmode);
$postback = "";
if ($response['status'] == 'A') {
    $return_message = "SUC";
} else {
    foreach ($HTTP_POST_VARS as $k => $c) {
        $postback .= "<input type='hidden' name='{$k}' value='{$c}' >";
    }
    toLog('error', 'customer', "Customer Recieves error " . $response['errormsg'], $companyid);
}
message($response['errormsg'] . $postback, "", "Response", "creditcard.php");
 function processTransaction($add_fields = NULL)
 {
     if ($this->transphase != 1) {
         return FALSE;
     } else {
         $islive = $this->test ? "Test" : "Live";
         $this->transArr = $this->buildTrans();
         // grab transaction array...burrito
         if ($add_fields != NULL && is_array($add_fields)) {
             foreach ($add_fields as $field => $value) {
                 $this->transArr[$field] = $value;
             }
         }
         $response = execute_transaction(&$this->transArr, $islive);
         // process transaction...burrito
         $this->row['transactionTable']['reference_number'] = $response['reference_number'];
         if ($response['status'] == 'A' || $response['status'] == 'P' && $this->transArr['checkorcard'] == 'C') {
             $result = 1;
         } else {
             $this->errormsg = $response['errormsg'];
             $result = 0;
         }
         $response['result'] = $result;
         return $response;
     }
 }
$transInfo['td_is_pending_check'] = '0';
$transInfo['td_is_chargeback'] = '0';
$transInfo['td_recur_processed'] = '0';
//$transInfo['td_recur_next_date']=$td_recur_next_date;
//$transInfo['td_username']=$td_username;
//$transInfo['td_password']=$td_password;
$transInfo['td_product_id'] = $queryInfo['mt_product_id'];
$transInfo['td_customer_fee'] = $companyInfo['cc_customer_fee'];
$bank_ids = merchant_getTransTypes($transInfo['en_ID'], &$transInfo);
foreach ($bank_ids as $bank) {
    if (strtolower($bank['bank_description']) == $transInfo['cardtype']) {
        $transInfo['bank_id'] = $bank['bank_id'];
    }
}
$responseInfo['mode'] = $queryInfo['mt_live_mode'];
$response = execute_transaction(&$transInfo, $queryInfo['mt_live_mode']);
$responseInfo['td_reference_id'] = $response['reference_number'];
if ($response['status'] == 'A') {
    $responseInfo['error'] = 0;
    $responseInfo['approved'] = 1;
    $responseInfo['amount'] = $transInfo['amount'];
} else {
    $responseInfo['error'] = 1;
    if ($response['success']) {
        $responseInfo['approved'] = 0;
        $responseInfo['amount'] = $transInfo['amount'];
        $responseInfo['error'] = 0;
    }
    $responseInfo['errormsg'][] = $response['errormsg'];
}
die(http_build_query($responseInfo));
     $transInfo['td_rebillingID'] = $mt_subAccount;
     $transInfo['td_is_a_rebill'] = '0';
     $transInfo['td_enable_rebill'] = $td_enable_rebill;
     $transInfo['td_voided_check'] = '0';
     $transInfo['td_returned_checks'] = '0';
     $transInfo['td_site_ID'] = $site_id;
     $transInfo['td_is_affiliate'] = '0';
     $transInfo['td_is_pending_check'] = '0';
     $transInfo['td_is_chargeback'] = '0';
     $transInfo['td_recur_processed'] = '0';
     $transInfo['td_recur_next_date'] = $td_recur_next_date;
     $transInfo['td_username'] = $td_username;
     $transInfo['td_password'] = $td_password;
     $transInfo['td_product_id'] = $td_product_id;
     include "includes/integration.php";
     $response = execute_transaction(&$transInfo, $_SESSION['integration_mode']);
     if ($response['status'] == 'A') {
         $return_message = "SUC";
     } else {
         $postback = "";
         foreach ($HTTP_POST_VARS as $k => $c) {
             $postback .= "<input type='hidden' name='{$k}' value='{$c}' >";
         }
         $msgdisplay = "<font face='verdana' size='2' color='black'>Error: " . $response['errormsg'] . ".</font>";
         $msgtodisplay = "<form name='Frmname' action='integrationCreditCard.php' method='post'><input type='hidden' name='errormsg' value='" . $response['errormsg'] . "' >{$postback}<table width='350' height='100' align='center' valign='middle' style='border:1px solid black'><tr><td align='center' valign='middle'>{$msgdisplay}</td></tr><tr><td align='center'><input name='imageField' type='image' src='http://www.etelegate.com/images/back.jpg' width='43' height='20' border='0'></td></tr></table></form>";
         $return_message = "UIN";
         print $msgtodisplay;
         exit;
     }
 }
 //print_r($response); die();
 $transaction['reference_number'] = genRefId("transaction", $transaction['checkorcard']);
 if ($transaction['checkorcard'] == 'H') {
     $transaction['bank_id'] = $transactionInfo['bank_Creditcard'];
 }
 //TODO BANK SELECTION
 foreach ($transaction as $key => $data) {
     $transaction[$key] = quote_smart($data);
 }
 $sql = "UPDATE `cs_transactiondetails` SET `td_recur_processed` = '2' WHERE `transactionId` = '{$oldTransId}' LIMIT 1";
 if (!$testonly) {
     $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query");
 }
 $etel_fraud_limit = 2.5;
 $transaction['td_recur_num']++;
 if (!$testonly) {
     $response = execute_transaction(&$transaction, "Live");
 }
 if ($response['status'] == 'A' || $response['status'] == 'P' && $transaction['checkorcard'] == 'C') {
     $suboutput .= "Transaction Approved/Accepted.\n\r";
     $suboutput .= "Next Payment for this rebilling account will fall on '" . $transaction['td_recur_next_date'] . "'\n\r";
     // Disable Recur Billing for this transaction
     $sql = "UPDATE `cs_transactiondetails` SET `td_recur_processed` = '1' WHERE `transactionId` = '{$oldTransId}' LIMIT 1";
     if (!$testonly) {
         $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query");
     }
     $nextRecurCharge = $transactionInfo['chargeAmount'];
     $suboutput .= "Old Transaction Rebilling Disabled.\n\r";
     $newTransId = $response['transactionId'];
     $suboutput .= "New Transaction (ID={$newTransId}) Created Successfully.\n\r";
     $suboutput .= "Customer Charged successfully.\n\r";
 } else {