コード例 #1
0
 public function _submitTransaction($transaction, $txnType, $clientTxnId = null)
 {
     $response = $this->doTransaction($transaction, $clientTxnId);
     HpsGatewayResponseValidation::checkResponse($response, $txnType);
     HpsIssuerResponseValidation::checkResponse($response->Header->GatewayTxnId, $response->Transaction->{$txnType}->RspCode, $response->Transaction->{$txnType}->RspText);
     $rvalue = '';
     switch ($txnType) {
         case 'GiftCardActivate':
             $rvalue = HpsGiftCardActivate::fromDict($response, $txnType, 'HpsGiftCardActivate');
             break;
         case 'GiftCardAddValue':
             $rvalue = HpsGiftCardAddValue::fromDict($response, $txnType, 'HpsGiftCardAddValue');
             break;
         case 'GiftCardAlias':
             $rvalue = HpsGiftCardAlias::fromDict($response, $txnType, 'HpsGiftCardAlias');
             break;
         case 'GiftCardBalance':
             $rvalue = HpsGiftCardBalance::fromDict($response, $txnType, 'HpsGiftCardBalance');
             break;
         case 'GiftCardDeactivate':
             $rvalue = HpsGiftCardDeactivate::fromDict($response, $txnType, 'HpsGiftCardDeactivate');
             break;
         case 'GiftCardReplace':
             $rvalue = HpsGiftCardReplace::fromDict($response, $txnType, 'HpsGiftCardReplace');
             break;
         case 'GiftCardReward':
             $rvalue = HpsGiftCardReward::fromDict($response, $txnType, 'HpsGiftCardReward');
             break;
         case 'GiftCardSale':
             $rvalue = HpsGiftCardSale::fromDict($response, $txnType, 'HpsGiftCardSale');
             break;
         case 'GiftCardVoid':
             $rvalue = HpsGiftCardVoid::fromDict($response, $txnType, 'HpsGiftCardVoid');
             break;
         case 'GiftCardReversal':
             $rvalue = HpsGiftCardReversal::fromDict($response, $txnType, 'HpsGiftCardReversal');
             break;
         default:
             break;
     }
     return $rvalue;
 }
コード例 #2
0
 private function _submitTransaction($transaction, $txnType, $clientTxnId = null)
 {
     $response = $this->doTransaction($transaction, $clientTxnId);
     HpsGatewayResponseValidation::checkResponse($response, $txnType);
     HpsIssuerResponseValidation::checkResponse($response->Header->GatewayTxnId, $response->Transaction->{$txnType}->RspCode, $response->Transaction->{$txnType}->RspText);
     $rvalue = '';
     if ($txnType == 'GiftCardActivate') {
         $rvalue = HpsGiftCardActivate::fromDict($response, $txnType, 'HpsGiftCardActivate');
     } else {
         if ($txnType == 'GiftCardAddValue') {
             $rvalue = HpsGiftCardAddValue::fromDict($response, $txnType, 'HpsGiftCardAddValue');
         } else {
             if ($txnType == 'GiftCardAlias') {
                 $rvalue = HpsGiftCardAlias::fromDict($response, $txnType, 'HpsGiftCardAlias');
             } else {
                 if ($txnType == 'GiftCardBalance') {
                     $rvalue = HpsGiftCardBalance::fromDict($response, $txnType, 'HpsGiftCardBalance');
                 } else {
                     if ($txnType == 'GiftCardDeactivate') {
                         $rvalue = HpsGiftCardDeactivate::fromDict($response, $txnType, 'HpsGiftCardDeactivate');
                     } else {
                         if ($txnType == 'GiftCardReplace') {
                             $rvalue = HpsGiftCardReplace::fromDict($response, $txnType, 'HpsGiftCardReplace');
                         } else {
                             if ($txnType == 'GiftCardReward') {
                                 $rvalue = HpsGiftCardReward::fromDict($response, $txnType, 'HpsGiftCardReward');
                             } else {
                                 if ($txnType == 'GiftCardSale') {
                                     $rvalue = HpsGiftCardSale::fromDict($response, $txnType, 'HpsGiftCardSale');
                                 } else {
                                     if ($txnType == 'GiftCardVoid') {
                                         $rvalue = HpsGiftCardVoid::fromDict($response, $txnType, 'HpsGiftCardVoid');
                                     } else {
                                         if ($txnType == 'GiftCardReversal') {
                                             $rvalue = HpsGiftCardReversal::fromDict($response, $txnType, 'HpsGiftCardReversal');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $rvalue;
 }
コード例 #3
0
ファイル: HpsDebitService.php プロジェクト: hps/heartland-php
 private function _processChargeIssuerResponse($response, $expectedType)
 {
     $transactionId = isset($response->Header->GatewayTxnId) ? $response->Header->GatewayTxnId : null;
     $item = $response->Transaction->{$expectedType};
     if ($item != null) {
         $responseCode = isset($item->RspCode) ? $item->RspCode : null;
         $responseText = isset($item->RspText) ? $item->RspText : null;
         if ($responseCode != null) {
             // check if we need to do a reversal
             if ($responseCode == '91') {
                 try {
                     $this->reverse($transactionId, $this->_amount, $this->_currency);
                 } catch (HpsGatewayException $e) {
                     // if the transaction wasn't found; throw the original timeout exception
                     if ($e->details->gatewayResponseCode == 3) {
                         HpsIssuerResponseValidation::checkResponse($transactionId, $responseCode, $responseText);
                     }
                     throw new HpsCreditException($transactionId, HpsExceptionCodes::ISSUER_TIMEOUT_REVERSAL_ERROR, 'Error occurred while reversing a charge due to HPS issuer timeout', $e);
                 } catch (HpsException $e) {
                     throw new HpsCreditException($transactionId, HpsExceptionCodes::ISSUER_TIMEOUT_REVERSAL_ERROR, 'Error occurred while reversing a charge due to HPS issuer timeout', $e);
                 }
             }
             HpsIssuerResponseValidation::checkResponse($transactionId, $responseCode, $responseText);
         }
     }
 }
コード例 #4
0
 /**
  * @expectedException        HpsCreditException
  * @expectedExceptionCode    HpsExceptionCodes::CARD_DECLINED
  * @expectedExceptionMessage The card was declined.
  */
 public function testCheckResponseFailure()
 {
     HpsIssuerResponseValidation::checkResponse(null, '02', null);
 }