public static function fromDict($rsp, $txnType, $filterBy = null, $returnType = 'HpsReportTransactionSummary')
 {
     $transactions = array();
     if ((string) $rsp->Transaction->ReportActivity->Header->TxnCnt == "0") {
         return $transactions;
     }
     if ($filterBy != null && is_string($filterBy)) {
         $filterBy = HpsTransaction::serviceNameToTransactionType($filterBy);
     }
     $summary = null;
     $serviceName = isset($filterBy) ? HpsTransaction::transactionTypeToServiceName($filterBy) : null;
     foreach ($rsp->Transaction->ReportActivity->Details as $charge) {
         if (isset($serviceName) && $serviceName != (string) $charge->ServiceName) {
             continue;
         }
         $summary = new HpsReportTransactionSummary();
         // Hydrate the header
         $summary->_header = new HpsTransactionHeader();
         $summary->_header->gatewayResponseCode = (string) $charge->GatewayRspCode;
         $summary->_header->gatewayResponseMessage = (string) $charge->GatewayRspMsg;
         $summary->transactionId = (string) $charge->GatewayTxnId;
         $summary->originalTransactionId = isset($charge->OriginalGatewayTxnId) ? (string) $charge->OriginalGatewayTxnId : null;
         $summary->maskedCardNumber = isset($charge->MaskedCardNbr) ? (string) $charge->MaskedCardNbr : null;
         $summary->responseCode = isset($charge->IssuerRspCode) ? (string) $charge->IssuerRspCode : null;
         $summary->responseText = isset($charge->IssuerRspText) ? (string) $charge->IssuerRspText : null;
         $summary->amount = isset($charge->Amt) ? (string) $charge->Amt : null;
         $summary->settlementAmount = isset($charge->SettlementAmt) ? (string) $charge->SettlementAmt : null;
         $summary->transactionType = isset($charge->ServiceName) ? HpsTransaction::serviceNameToTransactionType((string) $charge->ServiceName) : null;
         $summary->transactionUTCDate = isset($charge->TxnUtcDT) ? (string) $charge->TxnUtcDT : null;
         $gwResponseCode = isset($charge->GatewayRspCode) ? (string) $charge->GatewayRspCode : null;
         $issuerResponseCode = isset($charge->IssuerRspCode) ? (string) $charge->IssuerRspCode : null;
         if ($gwResponseCode != "0" || $issuerResponseCode != "00") {
             $exceptions = new HpsChargeExceptions();
             if ($gwResponseCode != "0") {
                 $message = (string) $charge->GatewayRspMsg;
                 $exceptions->hpsException = HpsGatewayResponseValidation::getException((string) $charge->GatewayTxnId, $gwResponseCode, $message);
             }
             if ($issuerResponseCode != "00") {
                 $message = (string) $charge->IssuerRspText;
                 $exceptions->cardException = HpsIssuerResponseValidation::getException((string) $charge->GatewayTxnId, $issuerResponseCode, $message);
             }
             $summary->exceptions = $exceptions;
         }
         $transactions[] = $summary;
     }
     return $transactions;
 }
 public static function fromDict($rsp, $txnType, $filterBy = null, $returnType = 'HpsReportTransactionSummary')
 {
     $transactions = array();
     if ($rsp->Transaction->ReportActivity->Header->TxnCnt == "0") {
         return $transactions;
     }
     $summary = null;
     $serviceName = isset($filterBy) ? HpsTransaction::transactionTypeToServiceName($filterBy) : null;
     foreach ($rsp->Transaction->ReportActivity->Details as $charge) {
         if ($filterBy == null || $charge->ServiceName != $serviceName) {
             $summary = parent::fromDict($rsp, $txnType, $returnType);
             $summary->originalTransactionId = isset($charge->OriginalGatewayTxnId) ? $charge->OriginalGatewayTxnId : null;
             $summary->maskedCardNumber = isset($charge->MaskedCardNbr) ? $charge->MaskedCardNbr : null;
             $summary->responseCode = isset($charge->IssuerRspCode) ? $charge->IssuerRspCode : null;
             $summary->responseText = isset($charge->IssuerRspText) ? $charge->IssuerRspText : null;
             $summary->amount = isset($charge->Amt) ? $charge->Amt : null;
             $summary->settlementAmount = isset($charge->SettlementAmt) ? $charge->SettlementAmt : null;
             $summary->transactionType = isset($charge->ServiceName) ? HpsTransaction::serviceNameToTransactionType($charge->ServiceName) : null;
             $summary->transactionUTCDate = isset($charge->TxnUtcDT) ? $charge->TxnUtcDT : null;
             if ($filterBy != null) {
                 $summary->transactionType = $filterBy;
             }
             $gwResponseCode = isset($charge->GatewayRspCode) ? $charge->GatewayRspCode : null;
             $issuerResponseCode = isset($charge->IssuerRspCode) ? $charge->IssuerRspCode : null;
             if ($gwResponseCode != "0" || $issuerResponseCode != "00") {
                 $exceptions = new HpsChargeExceptions();
                 if ($gwResponseCode != "0") {
                     $message = $charge->GatewayRspMsg;
                     $exceptions->gatewayException = HpsGatewayResponseValidation::getException($charge->GatewayTxnId, $gwResponseCode, $message);
                 }
                 if ($issuerResponseCode != "00") {
                     $message = $charge->IssuerRspText;
                     $exceptions->issuerException = HpsIssuerResponseValidation::getException($charge->GatewayTxnId, $issuerResponseCode, $message);
                 }
                 $summary->exceptions = $exceptions;
             }
         }
         $transactions[] = $summary;
     }
     return $transactions;
 }
 public static function fromDict($rsp, $txnType, $returnType = 'HpsReportTransactionDetails')
 {
     $reportResponse = $rsp->Transaction->{$txnType};
     $details = parent::fromDict($rsp, $txnType, $returnType);
     $details->originalTransactionId = isset($reportResponse->OriginalGatewayTxnId) ? (string) $reportResponse->OriginalGatewayTxnId : null;
     $details->authorizedAmount = isset($reportResponse->Data->AuthAmt) ? (string) $reportResponse->Data->AuthAmt : null;
     $details->maskedCardNumber = isset($reportResponse->Data->MaskedCardNbr) ? (string) $reportResponse->Data->MaskedCardNbr : null;
     $details->authorizationCode = isset($reportResponse->Data->AuthCode) ? (string) $reportResponse->Data->AuthCode : null;
     $details->avsResultCode = isset($reportResponse->Data->AVSRsltCode) ? (string) $reportResponse->Data->AVSRsltCode : null;
     $details->avsResultText = isset($reportResponse->Data->AVSRsltText) ? (string) $reportResponse->Data->AVSRsltText : null;
     $details->cardType = isset($reportResponse->Data->CardType) ? (string) $reportResponse->Data->CardType : null;
     $details->descriptor = isset($reportResponse->Data->TxnDescriptor) ? (string) $reportResponse->Data->TxnDescriptor : null;
     $details->transactionType = isset($reportResponse->ServiceName) ? HpsTransaction::serviceNameToTransactionType((string) $reportResponse->ServiceName) : null;
     $details->transactionUTCDate = isset($reportResponse->RspUtcDT) ? (string) $reportResponse->RspUtcDT : null;
     $details->cpcIndicator = isset($reportResponse->Data->CPCInd) ? (string) $reportResponse->Data->CPCInd : null;
     $details->cvvResultCode = isset($reportResponse->Data->CVVRsltCode) ? (string) $reportResponse->Data->CVVRsltCode : null;
     $details->cvvResultText = isset($reportResponse->Data->CVVRsltText) ? (string) $reportResponse->Data->CVVRsltText : null;
     $details->referenceNumber = isset($reportResponse->Data->RefNbr) ? (string) $reportResponse->Data->RefNbr : null;
     $details->responseCode = isset($reportResponse->Data->RspCode) ? (string) $reportResponse->Data->RspCode : null;
     $details->responseText = isset($reportResponse->Data->RspText) ? (string) $reportResponse->Data->RspText : null;
     $details->transactionStatus = isset($reportResponse->Data->TxnStatus) ? (string) $reportResponse->Data->TxnStatus : null;
     if (isset($reportResponse->Data->TokenizationMsg)) {
         $details->tokenData = new HpsTokenData();
         $details->tokenData->responseMessage = (string) $reportResponse->Data->TokenizationMsg;
     }
     if (isset($reportResponse->Data->AdditionalTxnFields)) {
         $additionalTxnFields = $reportResponse->Data->AdditionalTxnFields;
         $details->memo = isset($additionalTxnFields->Description) ? (string) $additionalTxnFields->Description : null;
         $details->invoiceNumber = isset($additionalTxnFields->InvoiceNbr) ? (string) $additionalTxnFields->InvoiceNbr : null;
         $details->customerId = isset($additionalTxnFields->CustomerID) ? (string) $additionalTxnFields->CustomerID : null;
     }
     if ((string) $reportResponse->Data->RspCode != '00') {
         if ($details->exceptions == null) {
             $details->exceptions = new HpsChargeExceptions();
         }
         $details->exceptions->issuerException = HpsIssuerResponseValidation::getException((string) $rsp->Header->GatewayTxnId, (string) $reportResponse->Data->RspCode, (string) $reportResponse->Data->RspText);
     }
     return $details;
 }
 public function get($transactionId)
 {
     if ($transactionId <= 0) {
         throw $this->exceptionMapper->map_sdk_exception(HpsSdkCodes::$invalidTransactionId);
     }
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsReportTxnDetail = $xml->createElement('hps:ReportTxnDetail');
     $hpsReportTxnDetail->appendChild($xml->createElement('hps:TxnId', $transactionId));
     $hpsTransaction->appendChild($hpsReportTxnDetail);
     $response = $this->doTransaction($hpsTransaction);
     $detail = $response->Transaction->ReportTxnDetail;
     $header = $this->hydrateTransactionHeader($response->Header);
     $result = new HpsReportTransactionDetails($header);
     $result->transactionId = $detail->GatewayTxnId;
     $result->originalTransactionId = isset($detail->OriginalGatewayTxnId) ? $detail->OriginalGatewayTxnId : null;
     $result->authorizedAmount = isset($detail->Data->AuthAmt) ? $detail->Data->AuthAmt : null;
     $result->authorizationCode = isset($detail->Data->AuthCode) ? $detail->Data->AuthCode : null;
     $result->avsResultCode = isset($detail->Data->AVSRsltCode) ? $detail->Data->AVSRsltCode : null;
     $result->avsResultText = isset($detail->Data->AVSRsltText) ? $detail->Data->AVSRsltText : null;
     $result->cardType = isset($detail->Data->CardType) ? $detail->Data->CardType : null;
     $result->maskedCardNumber = isset($detail->Data->MaskedCardNbr) ? $detail->Data->MaskedCardNbr : null;
     $result->transactionType = isset($detail->ServiceName) ? HpsTransaction::serviceNameToTransactionType($detail->ServiceName) : null;
     $result->transactionDate = isset($detail->RspUtcDT) ? $detail->RspUtcDT : null;
     $result->cpcIndicator = isset($detail->Data->CPCInd) ? $detail->Data->CPCInd : null;
     $result->cvvResultCode = isset($detail->Data->CVVRsltCode) ? $detail->Data->CVVRsltCode : null;
     $result->cvvResultText = isset($detail->Data->CVVRsltText) ? $detail->Data->CVVRsltText : null;
     $result->referenceNumber = isset($detail->Data->RefNbr) ? $detail->Data->RefNbr : null;
     $result->responseCode = isset($detail->Data->RspCode) ? $detail->Data->RspCode : null;
     $result->responseText = isset($detail->Data->RspText) ? $detail->Data->RspText : null;
     $tokenizationMessage = isset($detail->Data->TokenizationMsg) ? $detail->Data->TokenizationMsg : null;
     if ($tokenizationMessage != null) {
         $result->tokenData = new HpsTokenData($tokenizationMessage);
     }
     $headerResponseCode = isset($response->Header->GatewayRspCode) ? $response->Header->GatewayRspCode : null;
     $dataResponseCode = isset($detail->Data->RspCode) ? $detail->Data->RspCode : null;
     if ($headerResponseCode != "0" || $dataResponseCode != "00") {
         $exceptions = new HpsChargeExceptions();
         if ($headerResponseCode != "0") {
             $message = $response->Header->GatewayRspMsg;
             $exceptions->hpsException = $this->exceptionMapper->map_gateway_exception($result->transactionId, $headerResponseCode, $message);
         }
         if ($dataResponseCode != "00") {
             $message = $detail->Data->RspText;
             $exceptions->cardException = $this->exceptionMapper->map_issuer_exception($transactionId, $dataResponseCode, $message);
         }
         $result->exceptions = $exceptions;
     }
     return $result;
 }