[insert_php]
namespace TransaX;
class Params
{
public $TransactionType = “”;
public $GatewayUserName = “”;
public $GatewayPassword = “”;
public $PaymentType = “”;
public $Amount = “”;
public $Tax = “”;
public $Shipping = “”;
public $OrderDescription = “”;
public $OrderID = “”;
public $PONumber = “”;
public $CCNumber = “”;
public $CCExpDate = “”;
public $CVV = “”;
public $CheckName = “”;
public $CheckABA = “”;
public $CheckAccount = “”;
public $AccountHolderType = “”;
public $AccountType = “”;
public $SecCode = “”;
public $FirstName = “”;
public $LastName = “”;
public $Company = “”;
public $Address1 = “”;
public $Address2 = “”;
public $City = “”;
public $State = “”;
public $Zip = “”;
public $Country = “”;
public $Phone = “”;
public $Fax = “”;
public $EMail = “”;
public $Website = “”;
public $ShippingFirstName = “”;
public $ShippingLastName = “”;
public $ShippingCompany = “”;
public $ShippingAddress1 = “”;
public $ShippingAddress2 = “”;
public $ShippingCity = “”;
public $ShippingState = “”;
public $ShippingZip = “”;
public $ShippingCountry = “”;
public $ShippingEmail = “”;
public $ShippingPhone = “”;
public $ShippingFax = “”;
//public $ProcessorID = “”;
public $TransactionID = “”;
public $Tracking_Number = “”;
public $Shipping_Carrier = “”;
public $IPAddress = “”;
public $Track1 = “”;
public $Track2 = “”;
public $Track3 = “”;
public $Track_Type = “”;
public $Custom_Field_1 = “”;
public $Custom_Field_2 = “”;
public $Custom_Field_3 = “”;
public $Custom_Field_4 = “”;
public $Custom_Field_5 = “”;
public $Custom_Field_6 = “”;
public $Custom_Field_7 = “”;
public $Custom_Field_8 = “”;
public $Custom_Field_9 = “”;
public $Custom_Field_10 = “”;
public $Custom_Field_11 = “”;
public $Custom_Field_12 = “”;
public $Custom_Field_13 = “”;
public $Custom_Field_14 = “”;
public $Custom_Field_15 = “”;
public $Custom_Field_16 = “”;
public $Custom_Field_17 = “”;
public $Custom_Field_18 = “”;
public $Custom_Field_19 = “”;
public $Custom_Field_20 = “”;
public $SAFE_Action = “”;
public $SAFE_ID = “”;
public $ReceiptType = “”;
public $MICR = “”;
public $MICRSymbolSet = “”;
public $CheckFrontTIFF = “”;
public $CheckBackTIFF = “”;
public $CheckNumber = “”;
public $Terminal_ID = “”;
public $CCNumber2 = “”;
public $Clerk_ID = “”;
public $Billing_Code = “”;
public $InvoiceID = “”;
public $BatchID = “”;
public $DLNumber = “”;
public $DLState = “”;
public $IdentityVerification = “”;
public $CourtesyCardID = “”;
public $MagData = “”;
}
class Responses
{
public $STATUS_CODE = “”;
public $STATUS_MSG = “”;
public $TRANS_ID = “”;
public $AUTH_CODE = “”;
public $AVS_CODE = “”;
public $AVS_MSG = “”;
public $CVV2_CODE = “”;
public $CVV2_MSG = “”;
public $ORDERID = “”;
public $SAFE_ID = “”;
public $FULLRESPONSE = “”;
public $POSTSTRING = “”;
public $BALANCE = “”;
public $GIFTRESPONSE = “”;
public $MERCHANT_ID = “”;
public $CUSTOMER_MESSAGE = “”;
}
class RoXAPI
{
function ProcessTransaction(Params $Params)
{
$Responses = new Responses();
try
{
$values[‘TransactionType’] = $Params->TransactionType;
$values[‘GatewayUserName’] = $Params->GatewayUserName;
$values[‘GatewayPassword’] = $Params->GatewayPassword;
$values[‘PaymentType’] = $Params->PaymentType;
$values[‘Amount’] = $Params->Amount;
$values[‘Tax’] = $Params->Tax;
$values[‘Shipping’] = $Params->Shipping;
$values[‘OrderDescription’] = $Params->OrderDescription;
$values[‘OrderID’] = $Params->OrderID;
$values[‘PONumber’] = $Params->PONumber;
$values[‘CCNumber’] = $Params->CCNumber;
$values[‘CCExpDate’] = $Params->CCExpDate;
$values[‘CVV’] = $Params->CVV;
$values[‘CheckName’] = $Params->CheckName;
$values[‘CheckABA’] = $Params->CheckABA;
$values[‘CheckAccount’] = $Params->CheckAccount;
$values[‘AccountHolderType’] = $Params->AccountHolderType;
$values[‘AccountType’] = $Params->AccountType;
$values[‘SecCode’] = $Params->SecCode;
$values[‘FirstName’] = $Params->FirstName;
$values[‘LastName’] = $Params->LastName;
$values[‘Company’] = $Params->Company;
$values[‘Address1’] = $Params->Address1;
$values[‘Address2’] = $Params->Address2;
$values[‘City’] = $Params->City;
$values[‘State’] = $Params->State;
$values[‘Zip’] = $Params->Zip;
$values[‘Country’] = $Params->Country;
$values[‘Phone’] = $Params->Phone;
$values[‘Fax’] = $Params->Fax;
$values[‘EMail’] = $Params->EMail;
$values[‘Website’] = $Params->Website;
$values[‘ShippingFirstName’] = $Params->ShippingFirstName;
$values[‘ShippingLastName’] = $Params->ShippingLastName;
$values[‘ShippingCompany’] = $Params->ShippingCompany;
$values[‘ShippingAddress1’] = $Params->ShippingAddress1;
$values[‘ShippingAddress2’] = $Params->ShippingAddress2;
$values[‘ShippingCity’] = $Params->ShippingCity;
$values[‘ShippingState’] = $Params->ShippingState;
$values[‘ShippingZip’] = $Params->ShippingZip;
$values[‘ShippingCountry’] = $Params->ShippingCountry;
$values[‘ShippingEmail’] = $Params->ShippingEmail;
$values[‘ShippingPhone’] = $Params->ShippingPhone;
$values[‘ShippingFax’] = $Params->ShippingFax;
//$values[‘ProcessorID’] = $Params->ProcessorID;
$values[‘TransactionID’] = $Params->TransactionID;
$values[‘Tracking_Number’] = $Params->Tracking_Number;
$values[‘Shipping_Carrier’] = $Params->Shipping_Carrier;
$values[‘IPAddress’] = $Params->IPAddress;
$values[‘Track1’] = $Params->Track1;
$values[‘Track2’] = $Params->Track2;
$values[‘Track3’] = $Params->Track3;
$values[‘Track_Type’] = $Params->Track_Type;
$values[‘Custom_Field_1’] = $Params->Custom_Field_1;
$values[‘Custom_Field_2’] = $Params->Custom_Field_2;
$values[‘Custom_Field_3’] = $Params->Custom_Field_3;
$values[‘Custom_Field_4’] = $Params->Custom_Field_4;
$values[‘Custom_Field_5’] = $Params->Custom_Field_5;
$values[‘Custom_Field_6’] = $Params->Custom_Field_6;
$values[‘Custom_Field_7’] = $Params->Custom_Field_7;
$values[‘Custom_Field_8’] = $Params->Custom_Field_8;
$values[‘Custom_Field_9’] = $Params->Custom_Field_9;
$values[‘Custom_Field_10’] = $Params->Custom_Field_10;
$values[‘Custom_Field_11’] = $Params->Custom_Field_11;
$values[‘Custom_Field_12’] = $Params->Custom_Field_12;
$values[‘Custom_Field_13’] = $Params->Custom_Field_13;
$values[‘Custom_Field_14’] = $Params->Custom_Field_14;
$values[‘Custom_Field_15’] = $Params->Custom_Field_15;
$values[‘Custom_Field_16’] = $Params->Custom_Field_16;
$values[‘Custom_Field_17’] = $Params->Custom_Field_17;
$values[‘Custom_Field_18’] = $Params->Custom_Field_18;
$values[‘Custom_Field_19’] = $Params->Custom_Field_19;
$values[‘Custom_Field_20’] = $Params->Custom_Field_20;
$values[‘SAFE_Action’] = $Params->SAFE_Action;
$values[‘SAFE_ID’] = $Params->SAFE_ID;
$values[‘ReceiptType’] = $Params->ReceiptType;
$values[‘MICR’] = $Params->MICR;
$values[‘MICRSymbolSet’] = $Params->MICRSymbolSet;
$values[‘CheckFrontTIFF’] = $Params->CheckFrontTIFF;
$values[‘CheckBackTIFF’] = $Params->CheckBackTIFF;
$values[‘CheckNumber’] = $Params->CheckNumber;
$values[‘Terminal_ID’] = $Params->Terminal_ID;
$values[‘CCNumber2’] = $Params->CCNumber2;
$values[‘Clerk_ID’] = $Params->Clerk_ID;
$values[‘Billing_Code’] = $Params->Billing_Code;
$values[‘InvoiceID’] = $Params->InvoiceID;
$values[‘BatchID’] = $Params->BatchID;
$values[‘DLNumber’] = $Params->DLNumber;
$values[‘DLState’] = $Params->DLState;
$values[‘IdentityVerification’] = $Params->IdentityVerification;
$values[‘CourtesyCardID’] = $Params->CourtesyCardID;
$values[‘MagData’] = $Params->MagData;
$client = @new \SoapClient(“https://secure.transaxgateway.com/roxapi/rox.asmx?WSDL”);
$res = $client->ProcessTransaction(array(“objparameters”,objparameters => $values));
$Responses->AUTH_CODE = $res->ProcessTransactionResult->AUTH_CODE;
$Responses->AVS_CODE = $res->ProcessTransactionResult->AVS_CODE;
$Responses->AVS_MSG = $res->ProcessTransactionResult->AVS_MSG;
$Responses->BALANCE = $res->ProcessTransactionResult->BALANCE;
$Responses->CUSTOMER_MESSAGE = $res->ProcessTransactionResult->CUSTOMER_MESSAGE;
$Responses->CVV2_CODE = $res->ProcessTransactionResult->CVV2_CODE;
$Responses->CVV2_MSG = $res->ProcessTransactionResult->CVV2_MSG;
$Responses->FULLRESPONSE = $res->ProcessTransactionResult->FULLRESPONSE;
$Responses->GIFTRESPONSE = $res->ProcessTransactionResult->GIFTRESPONSE;
$Responses->MERCHANT_ID = $res->ProcessTransactionResult->MERCHANT_ID;
$Responses->ORDERID = $res->ProcessTransactionResult->ORDERID;
$Responses->POSTSTRING = $res->ProcessTransactionResult->POSTSTRING;
$Responses->SAFE_ID = $res->ProcessTransactionResult->SAFE_ID;
$Responses->STATUS_CODE = $res->ProcessTransactionResult->STATUS_CODE;
$Responses->STATUS_MSG = $res->ProcessTransactionResult->STATUS_MSG;
$Responses->TRANS_ID = $res->ProcessTransactionResult->TRANS_ID;
}
catch (\SoapFault $e)
{
$Responses->STATUS_CODE = “-1”;
$Responses->STATUS_MSG = $e->getMessage();
}
catch (\Exception $e)
{
$Responses->STATUS_CODE = “-1”;
$Responses->STATUS_MSG = $e->getMessage();
}
return $Responses;
}
}
[/insert_php]
[insert_php]
require(“/var/www/html/wp-content/themes/TheFox/BillpayDb.class.php”);
try
{
// Create a new DB class instance
$db = new BillpayDB();
// Get GatewayUserName & Password
$nelixUserName = $db->single(“SELECT value from App_Config WHERE [key] = :username”, array(“username” => “nelix_user”));
$nelixPassword = $db->single(“SELECT value from App_Config WHERE [key] = :pwd”, array(“pwd” => “nelix_pass”));
$ws = new TransaX\RoXAPI();
$ws_params = new TransaX\Params();
$payType = $_POST[“PaymentType”];
$ws_params->GatewayUserName = $nelixUserName;
$ws_params->GatewayPassword = $nelixPassword;
$ws_params->TransactionType = “sale”;
//Send paymeny type for all trasnactions
$ws_params->PaymentType = $payType;
$ws_params->OrderDescription = ($payType == “creditcard”) ? “Reds CC Payment” : “Reds ACH Payment”;
$ws_params->Amount = $_POST[“Amount”];
// Check if the fields are not empty or null
$isSafeAction = (isset($_POST[‘SAFE_Action’]) && !empty($_POST[‘SAFE_Action’]));
$isSafeId = (isset($_POST[‘SAFE_ID’]) && !empty($_POST[‘SAFE_ID’]));
//Existing payment source
if ($isSafeAction && $_POST[“SAFE_Action”] == “update_safe” && $isSafeId)
{
// We need to only send the amount, safeid, and payment type here
// to process transaction for this customer.
$ws_params->SAFE_ID = $_POST[“SAFE_ID”];
echo “
“;
}
else
{
//Adding new source
if ($isSafeAction && $_POST[“SAFE_Action”] == “add_safe”){
$ws_params->SAFE_Action = $_POST[“SAFE_Action”];
// Adding a SAFE record of type ‘check’ requires an AccountHolderType
if ($payType == “check”)
$ws_params->AccountHolderType = $_POST[“CheckAccountHolderType”];
}
// Check the payment type
if ($payType == “creditcard”)
{
$ws_params->CCNumber = $_POST[“CCNumber”];
$ws_params->CCExpDate = $_POST[“CCExpDate”];
$ws_params->CVV = $_POST[“CVV”];
}
else
{
$ws_params->CheckName = $_POST[“CheckName”];
$ws_params->CheckABA = $_POST[“CheckABA”];
$ws_params->CheckAccount = $_POST[“CheckAccount”];
$ws_params->SecCode = “PPD”; // Required for “sale” and “auth” if PaymentType=”check” and SAFE_ID not specified
$ws_params->AccountType = $_POST[“CheckAccountType”]; // Account type is required for ACH Transactions
$ws_params->Phone = $_POST[“CheckPhoneNumber”]; // Phone number is required for guaranteed ACH transactions
}
}
// Get the response back from gateway
$ws_response = $ws->ProcessTransaction($ws_params);
if ($isSafeAction && $_POST[“SAFE_Action”] == “add_safe”){
echo “
“;
}
echo “
** Payment made can take up to 4 hours before posting against your current balance.
“;
// Append other response properties too, so that we can save the data in Online_Payment table
$response_string = “”;
$response_string .= “
“;
echo $response_string;
if ($ws_response->STATUS_CODE != 1) //&& $ws_response->STATUS_CODE != 2)
{
$errorString = “
“;
echo $errorString;
}
}
catch (Exception $e)
{
$excepString = “
“;
echo $excepString;
}
[/insert_php]