Exemplo n.º 1
0
 public static function fromDict($rsp, $txnType, $returnType = 'HpsVoid')
 {
     $void = parent::fromDict($rsp, $txnType, $returnType);
     $void->responseCode = '00';
     $void->responseText = '';
     return $void;
 }
 public static function fromDict($rsp, $txnType, $returnType = 'HpsOfflineAuthorization')
 {
     $offlineAuth = parent::fromDict($rsp, $txnType, $returnType);
     $offlineAuth->responseCode = '00';
     $offlineAuth->responseText = '';
     return $offlineAuth;
 }
Exemplo n.º 3
0
 /**
  * @param \SimpleXMLElement $rsp
  * @param null   $txnType
  * @param string $returnType
  *
  * @return HpsManageTokensResponse
  */
 public static function fromDict($rsp, $txnType = null, $returnType = 'HpsManageTokensResponse')
 {
     $transaction = parent::fromDict($rsp, $txnType, $returnType);
     $transaction->responseCode = '00';
     $transaction->responseText = '';
     return $transaction;
 }
Exemplo n.º 4
0
 public static function fromDict($rsp, $txnType, $returnType = 'HpsCPCEdit')
 {
     $cpcEdit = parent::fromDict($rsp, $txnType, $returnType);
     $cpcEdit->responseCode = '00';
     $cpcEdit->responseText = '';
     return $cpcEdit;
 }
Exemplo n.º 5
0
 public static function fromDict($rsp, $txnType, $returnType = 'HpsRefund')
 {
     $refund = parent::fromDict($rsp, $txnType, $returnType);
     $refund->responseCode = '00';
     $refund->responseText = '';
     return $refund;
 }
Exemplo n.º 6
0
 public static function fromDict($rsp, $txnType, $returnType = 'HpsReversal')
 {
     $reverseResponse = $rsp->Transaction->{$txnType};
     $reverse = parent::fromDict($rsp, $txnType, $returnType);
     $reverse->avsResultCode = isset($reverseResponse->AVSRsltCode) ? $reverseResponse->AVSRsltCode : null;
     $reverse->avsResultText = isset($reverseResponse->AVSRsltText) ? $reverseResponse->AVSRsltText : null;
     $reverse->ccpIndicator = isset($reverseResponse->CPCInd) ? $reverseResponse->CPCInd : null;
     $reverse->cvvResultCode = isset($reverseResponse->CVVRsltCode) ? $reverseResponse->CVVRsltCode : null;
     $reverse->cvvResultText = isset($reverseResponse->CVVRsltText) ? $reverseResponse->CVVRsltText : null;
     return $reverse;
 }
Exemplo n.º 7
0
 /**
  * @param \SimpleXMLElement $rsp
  * @param null $txnType
  * @param string $returnType
  *
  * @return HpsAttachment
  */
 public static function fromDict($rsp, $txnType, $returnType = 'HpsAttachment')
 {
     $attResponse = $rsp->Transaction->{$txnType}->Details;
     $transaction = parent::fromDict($rsp, $txnType, $returnType);
     foreach (get_object_vars($attResponse) as $key => $prop) {
         if (property_exists($transaction, lcfirst($key))) {
             $transaction->__set(lcfirst($key), $prop);
         }
     }
     return $transaction;
 }
Exemplo n.º 8
0
 public static function fromDict($rsp, $txnType, $returnType = 'HpsTransactionStatus')
 {
     $statusResponse = $rsp->Transaction->{$txnType};
     $status = parent::fromDict($rsp, $txnType, $returnType);
     $status->authorizationCode = isset($statusResponse->TransactionStatus->AuthCode) ? (string) $statusResponse->TransactionStatus->AuthCode : null;
     $status->originalGatewayResponseCode = isset($statusResponse->TransactionStatus->GatewayRspCode) ? (string) $statusResponse->TransactionStatus->GatewayRspCode : null;
     $status->originalGatewayResponseText = isset($statusResponse->TransactionStatus->GatewayRspMsg) ? (string) $statusResponse->TransactionStatus->GatewayRspMsg : null;
     $status->originalResponseCode = isset($statusResponse->TransactionStatus->RspCode) ? (string) $statusResponse->TransactionStatus->RspCode : null;
     $status->originalResponseText = isset($statusResponse->TransactionStatus->RspText) ? (string) $statusResponse->TransactionStatus->RspText : null;
     $status->transactionStatus = isset($statusResponse->TransactionStatus->TxnStatus) ? (string) $statusResponse->TransactionStatus->TxnStatus : null;
     $status->originalTransactionId = isset($statusResponse->TransactionStatus->GatewayTxnId) ? (string) $statusResponse->TransactionStatus->GatewayTxnId : null;
     $status->altPayment = isset($statusResponse->TransactionStatus->AltPayment) ? $statusResponse->TransactionStatus->AltPayment : null;
     $status->timezoneConversion = isset($statusResponse->TzConversion) ? (string) $statusResponse->TzConversion : null;
     return $status;
 }
 public static function fromDict($rsp, $txnType, $returnType = 'HpsCheckResponse')
 {
     $response = $rsp->Transaction->{$txnType};
     $sale = parent::fromDict($rsp, $txnType, $returnType);
     $sale->responseCode = isset($response->RspCode) ? $response->RspCode : null;
     $sale->responseText = isset($response->RspMessage) ? $response->RspMessage : null;
     $sale->authorizationCode = isset($response->AuthCode) ? $response->AuthCode : null;
     if ($response->CheckRspInfo) {
         $sale->details = array();
         if (count($response->CheckRspInfo) > 1) {
             foreach ($response->CheckRspInfo as $key => $details) {
                 $sale->details[] = self::_hydrateRspDetails($details);
             }
         } else {
             $sale->details = self::_hydrateRspDetails($response->CheckRspInfo);
         }
     }
     return $sale;
 }
 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 = 'HpsAuthorization')
 {
     $authResponse = $rsp->Transaction->{$txnType};
     $auth = parent::fromDict($rsp, $txnType, $returnType);
     $auth->authorizationCode = isset($authResponse->AuthCode) ? $authResponse->AuthCode : null;
     $auth->avsResultCode = isset($authResponse->AVSRsltCode) ? $authResponse->AVSRsltCode : null;
     $auth->avsResultText = isset($authResponse->AVSRsltText) ? $authResponse->AVSRsltText : null;
     $auth->cvvResultCode = isset($authResponse->CVVRsltCode) ? $authResponse->CVVRsltCode : null;
     $auth->cvvResultText = isset($authResponse->CVVRsltText) ? $authResponse->CVVRsltText : null;
     $auth->authorizedAmount = isset($authResponse->AuthAmt) ? $authResponse->AuthAmt : null;
     $auth->cardType = isset($authResponse->CardType) ? $authResponse->CardType : null;
     $auth->descriptor = isset($authResponse->TxnDescriptor) ? $authResponse->TxnDescriptor : null;
     $auth->cpcIndicator = isset($authResponse->CPCInd) ? $authResponse->CPCInd : null;
     if (isset($rsp->Header->TokenData)) {
         $auth->tokenData = new HpsTokenData();
         $auth->tokenData->responseCode = isset($rsp->Header->TokenData->TokenRspCode) ? $rsp->Header->TokenData->TokenRspCode : null;
         $auth->tokenData->responseMessage = isset($rsp->Header->TokenData->TokenRspMsg) ? $rsp->Header->TokenData->TokenRspMsg : null;
         $auth->tokenData->tokenValue = isset($rsp->Header->TokenData->TokenValue) ? $rsp->Header->TokenData->TokenValue : null;
     }
     return $auth;
 }
Exemplo n.º 12
0
 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;
 }