public static function fromDict($rsp, $txnType, $returnType = 'HpsAltPaymentResponse') { $response = $rsp->Transaction->{$txnType}; $altPayment = parent::fromDict($rsp, $txnType, $returnType); if ($response->RspCode != 0) { $error = self::nvpToArray($response->Processor->Response); $altPayment->error = new HpsProcessorError(); $altPayment->error->code = isset($error['Code']) ? $error['Code'] : null; $altPayment->error->message = isset($error['Message']) ? $error['Message'] : null; $altPayment->error->type = isset($error['Type']) ? $error['Type'] : null; } return $altPayment; }
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 __construct($header) { parent::__construct($header); }
private function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null) { try { $response = $this->doTransaction($transaction, $clientTxnId); } catch (HpsException $e) { if ($e->innerException != null && $e->innerException->getMessage() == "gateway_time-out") { if ($txnType == 'CreditSale' || $txnType == 'CreditAuth') { try { $this->reverse($cardData, $this->_amount, $this->_currency); } catch (Exception $e) { throw new HpsGatewayException('0', HpsExceptionCodes::GatewayTimeoutReversalError); } } throw new HpsException("An error occurred and the gateway has timed out", 'gateway_timeout', $e, 'gateway_timeout'); } throw $e; } $this->_processChargeGatewayResponse($response, $txnType); $this->_processChargeIssuerResponse($response, $txnType); $rvalue = null; if ($txnType == 'ReportTxnDetail') { $rvalue = HpsReportTransactionDetails::fromDict($response, $txnType); } elseif ($txnType == 'ReportActivity') { $rvalue = HpsReportTransactionSummary::fromDict($response, $txnType, $this->_filterBy); } elseif ($txnType == 'CreditSale') { $rvalue = HpsCharge::fromDict($response, $txnType); } elseif ($txnType == 'CreditAccountVerify') { $rvalue = HpsAccountVerify::fromDict($response, $txnType); } elseif ($txnType == 'CreditAuth') { $rvalue = HpsAuthorization::fromDict($response, $txnType); } elseif ($txnType == 'CreditReturn') { $rvalue = HpsRefund::fromDict($response, $txnType); } elseif ($txnType == 'CreditReversal') { $rvalue = HpsReversal::fromDict($response, $txnType); } elseif ($txnType == 'CreditVoid') { $rvalue = HpsVoid::fromDict($response, $txnType); } return $rvalue; }
public function _submitTransaction($transaction, $txnType, $clientTxnId = null, $cardData = null) { try { $response = $this->doRequest($transaction, $clientTxnId); } catch (HpsException $e) { if ($e->innerException != null && $e->innerException->getMessage() == 'gateway_time-out') { if (in_array($txnType, array('CreditSale', 'CreditAuth'))) { try { $this->reverse($cardData, $this->_amount, $this->_currency); } catch (Exception $e) { throw new HpsGatewayException('0', HpsExceptionCodes::GATEWAY_TIMEOUT_REVERSAL_ERROR); } } throw new HpsException('An error occurred and the gateway has timed out', 'gateway_timeout', $e, 'gateway_timeout'); } throw $e; } $this->_processChargeGatewayResponse($response, $txnType); $this->_processChargeIssuerResponse($response, $txnType); $rvalue = null; switch ($txnType) { case 'ReportTxnDetail': $rvalue = HpsReportTransactionDetails::fromDict($response, $txnType); break; case 'ReportActivity': $rvalue = HpsReportTransactionSummary::fromDict($response, $txnType, $this->_filterBy); break; case 'CreditSale': $rvalue = HpsCharge::fromDict($response, $txnType); break; case 'CreditAccountVerify': $rvalue = HpsAccountVerify::fromDict($response, $txnType); break; case 'CreditAuth': $rvalue = HpsAuthorization::fromDict($response, $txnType); break; case 'CreditReturn': $rvalue = HpsRefund::fromDict($response, $txnType); break; case 'CreditReversal': $rvalue = HpsReversal::fromDict($response, $txnType); break; case 'CreditVoid': $rvalue = HpsVoid::fromDict($response, $txnType); break; case 'CreditCPCEdit': $rvalue = HpsCPCEdit::fromDict($response, $txnType); break; case 'CreditTxnEdit': $rvalue = HpsTransaction::fromDict($response, $txnType); break; case 'RecurringBilling': $rvalue = HpsRecurringBilling::fromDict($response, $txnType); break; case 'CreditAdditionalAuth': $rvalue = HpsAuthorization::fromDict($response, $txnType); break; case 'PrePaidBalanceInquiry': $rvalue = HpsAuthorization::fromDict($response, $txnType); break; case 'PrePaidAddValue': $rvalue = HpsAuthorization::fromDict($response, $txnType); break; case 'CreditOfflineAuth': $rvalue = HpsOfflineAuthorization::fromDict($response, $txnType); break; case 'CreditOfflineAuth': $rvalue = HpsOfflineAuthorization::fromDict($response, $txnType); break; case 'ManageTokens': $rvalue = HpsManageTokensResponse::fromDict($response, $txnType); break; default: break; } return $rvalue; }