public static function getPaymentMessageGatewayOutput($GatewayOutput, CSV_GatewayOutput $goGatewayOutput = null) { $nPreviousStatusCode = null; $szPreviousMessage = null; $ptdPreviousTransactionResult = null; $pmgoPaymentMessageGatewayOutput = null; $boAuthorisationAttempted = null; if ($GatewayOutput->attributes()) { try { $szAuthorisationAttempted = current($GatewayOutput->attributes()->AuthorisationAttempted); if (strtolower($boAuthorisationAttempted) == 'false') { $boAuthorisationAttempted = new CSV_NullableBool(false); } elseif (strtolower($boAuthorisationAttempted) == 'true') { $boAuthorisationAttempted = new CSV_NullableBool(true); } else { throw new Exception('Return value must be true or false'); } } catch (Exception $e) { $boAuthorisationAttempted = null; } } //check to see if there is any previous transaction data if ($GatewayOutput->PreviousTransactionResult->StatusCode) { $nPreviousStatusCode = new CSV_NullableInt(current($GatewayOutput->PreviousTransactionResult->StatusCode[0])); } if ($GatewayOutput->PreviousTransactionResult->Message) { $szPreviousMessage = current($GatewayOutput->PreviousTransactionResult->Message[0]); } if ($nPreviousStatusCode != null && !CSV_SharedFunctions::isStringNullOrEmpty($szPreviousMessage)) { $ptdPreviousTransactionResult = new CSV_PreviousTransactionResult($nPreviousStatusCode, $szPreviousMessage); } $pmgoPaymentMessageGatewayOutput = new CSV_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(), $goGatewayOutput->getMessage(), $boAuthorisationAttempted, $ptdPreviousTransactionResult, $goGatewayOutput->getErrorMessages()); return $pmgoPaymentMessageGatewayOutput; }