public static function getTransactionResultFromPostVariables($aFormVariables, &$trTransactionResult, &$szHashDigest, &$szOutputMessage)
 {
     $trTransactionResult = null;
     $szHashDigest = "";
     $szOutputMessage = "";
     $boErrorOccurred = false;
     try {
         // hash digest
         if (isset($aFormVariables["HashDigest"])) {
             $szHashDigest = $aFormVariables["HashDigest"];
         }
         // transaction status code
         if (!isset($aFormVariables["StatusCode"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [StatusCode] not received");
             $boErrorOccurred = true;
         } else {
             if ($aFormVariables["StatusCode"] == "") {
                 $nStatusCode = null;
             } else {
                 $nStatusCode = intval($aFormVariables["StatusCode"]);
             }
         }
         // transaction message
         if (!isset($aFormVariables["Message"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Message] not received");
             $boErrorOccurred = true;
         } else {
             $szMessage = $aFormVariables["Message"];
         }
         // status code of original transaction if this transaction was deemed a duplicate
         if (!isset($aFormVariables["PreviousStatusCode"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [PreviousStatusCode] not received");
             $boErrorOccurred = true;
         } else {
             if ($aFormVariables["PreviousStatusCode"] == "") {
                 $nPreviousStatusCode = null;
             } else {
                 $nPreviousStatusCode = intval($aFormVariables["PreviousStatusCode"]);
             }
         }
         // status code of original transaction if this transaction was deemed a duplicate
         if (!isset($aFormVariables["PreviousMessage"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [PreviousMessage] not received");
             $boErrorOccurred = true;
         } else {
             $szPreviousMessage = $aFormVariables["PreviousMessage"];
         }
         // cross reference of transaction
         if (!isset($aFormVariables["CrossReference"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [CrossReference] not received");
             $boErrorOccurred = true;
         } else {
             $szCrossReference = $aFormVariables["CrossReference"];
         }
         // amount (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["Amount"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Amount] not received");
             $boErrorOccurred = true;
         } else {
             if ($aFormVariables["Amount"] == null) {
                 $nAmount = null;
             } else {
                 $nAmount = intval($aFormVariables["Amount"]);
             }
         }
         // currency code (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["CurrencyCode"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [CurrencyCode] not received");
             $boErrorOccurred = true;
         } else {
             if ($aFormVariables["CurrencyCode"] == null) {
                 $nCurrencyCode = null;
             } else {
                 $nCurrencyCode = intval($aFormVariables["CurrencyCode"]);
             }
         }
         // order ID (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["OrderID"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [OrderID] not received");
             $boErrorOccurred = true;
         } else {
             $szOrderID = $aFormVariables["OrderID"];
         }
         // transaction type (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["TransactionType"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [TransactionType] not received");
             $boErrorOccurred = true;
         } else {
             $szTransactionType = $aFormVariables["TransactionType"];
         }
         // transaction date/time (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["TransactionDateTime"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [TransactionDateTime] not received");
             $boErrorOccurred = true;
         } else {
             $szTransactionDateTime = $aFormVariables["TransactionDateTime"];
         }
         // order description (same as value passed into payment form - echoed back out by payment form)
         if (!isset($aFormVariables["OrderDescription"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [OrderDescription] not received");
             $boErrorOccurred = true;
         } else {
             $szOrderDescription = $aFormVariables["OrderDescription"];
         }
         // customer name (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["CustomerName"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [CustomerName] not received");
             $boErrorOccurred = true;
         } else {
             $szCustomerName = $aFormVariables["CustomerName"];
         }
         // address1 (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["Address1"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Address1] not received");
             $boErrorOccurred = true;
         } else {
             $szAddress1 = $aFormVariables["Address1"];
         }
         // address2 (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["Address2"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Address2] not received");
             $boErrorOccurred = true;
         } else {
             $szAddress2 = $aFormVariables["Address2"];
         }
         // address3 (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["Address3"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Address3] not received");
             $boErrorOccurred = true;
         } else {
             $szAddress3 = $aFormVariables["Address3"];
         }
         // address4 (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["Address4"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [Address4] not received");
             $boErrorOccurred = true;
         } else {
             $szAddress4 = $aFormVariables["Address4"];
         }
         // city (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["City"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [City] not received");
             $boErrorOccurred = true;
         } else {
             $szCity = $aFormVariables["City"];
         }
         // state (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["State"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [State] not received");
             $boErrorOccurred = true;
         } else {
             $szState = $aFormVariables["State"];
         }
         // post code (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["PostCode"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [PostCode] not received");
             $boErrorOccurred = true;
         } else {
             $szPostCode = $aFormVariables["PostCode"];
         }
         // country code (not necessarily the same as value passed into payment form - as the customer can change it on the form)
         if (!isset($aFormVariables["CountryCode"])) {
             $szOutputMessage = PaymentFormHelper::addStringToStringList($szOutputMessage, "Expected variable [CountryCode] not received");
             $boErrorOccurred = true;
         } else {
             if ($aFormVariables["CountryCode"] == "") {
                 $nCountryCode = null;
             } else {
                 $nCountryCode = intval($aFormVariables["CountryCode"]);
             }
         }
         if (!$boErrorOccurred) {
             $trTransactionResult = new TransactionResult();
             $trTransactionResult->setStatusCode($nStatusCode);
             // transaction status code
             $trTransactionResult->setMessage($szMessage);
             // transaction message
             $trTransactionResult->setPreviousStatusCode($nPreviousStatusCode);
             // status code of original transaction if duplicate transaction
             $trTransactionResult->setPreviousMessage($szPreviousMessage);
             // status code of original transaction if duplicate transaction
             $trTransactionResult->setCrossReference($szCrossReference);
             // cross reference of transaction
             $trTransactionResult->setAmount($nAmount);
             // amount echoed back
             $trTransactionResult->setCurrencyCode($nCurrencyCode);
             // currency code echoed back
             $trTransactionResult->setOrderID($szOrderID);
             // order ID echoed back
             $trTransactionResult->setTransactionType($szTransactionType);
             // transaction type echoed back
             $trTransactionResult->setTransactionDateTime($szTransactionDateTime);
             // transaction date/time echoed back
             $trTransactionResult->setOrderDescription($szOrderDescription);
             // order description echoed back
             // the customer details that were actually
             // processed (might be different
             // from those passed to the payment form)
             $trTransactionResult->setCustomerName($szCustomerName);
             $trTransactionResult->setAddress1($szAddress1);
             $trTransactionResult->setAddress2($szAddress2);
             $trTransactionResult->setAddress3($szAddress3);
             $trTransactionResult->setAddress4($szAddress4);
             $trTransactionResult->setCity($szCity);
             $trTransactionResult->setState($szState);
             $trTransactionResult->setPostCode($szPostCode);
             $trTransactionResult->setCountryCode($nCountryCode);
         }
     } catch (Exception $e) {
         $boErrorOccurred = true;
         $szOutputMessage = $e->getMessage();
     }
     return !$boErrorOccurred;
 }