/**
  * Creates a verify transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditAccountVerify = $xml->createElement('hps:CreditAccountVerify');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     if ($this->cardHolder != null) {
         $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml));
     }
     $cardData = $xml->createElement('hps:CardData');
     if ($this->card != null) {
         $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml, $this->cardPresent, $this->readerPresent));
         if ($this->card->encryptionData != null) {
             $cardData->appendChild($this->service->_hydrateEncryptionData($this->card->encryptionData));
         }
     } else {
         if ($this->token != null) {
             $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml, $this->cardPresent, $this->readerPresent));
         } else {
             if ($this->trackData != null) {
                 $cardData->appendChild($this->service->_hydrateTrackData($this->trackData));
                 if ($this->trackData->encryptionData != null) {
                     $cardData->appendChild($this->service->_hydrateEncryptionData($this->trackData->encryptionData));
                 }
             }
         }
     }
     $cardData->appendChild($xml->createElement('hps:TokenRequest', $this->requestMultiUseToken ? 'Y' : 'N'));
     $hpsBlock1->appendChild($cardData);
     $hpsCreditAccountVerify->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCreditAccountVerify);
     return $this->service->_submitTransaction($hpsTransaction, 'CreditAccountVerify', $this->clientTransactionId);
 }
 /**
  * Creates an add value transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditAuth = $xml->createElement('hps:PrePaidAddValue');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
     $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', $this->allowDuplicates ? 'Y' : 'N'));
     $cardData = $xml->createElement('hps:CardData');
     if ($this->card != null) {
         $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml));
     } else {
         if ($this->trackData != null) {
             $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml));
         } else {
             if ($this->token != null) {
                 $tokenData = $xml->createElement('hps:TokenData');
                 $tokenData->appendChild($xml->createElement('hps:TokenValue', $this->token->tokenValue));
                 $cardData->appendChild($tokenData);
             }
         }
     }
     $hpsBlock1->appendChild($cardData);
     $hpsCreditAuth->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCreditAuth);
     return $this->service->_submitTransaction($hpsTransaction, 'PrePaidAddValue');
 }
 /**
  * Creates a reverse transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     HpsInputValidation::checkCurrency($this->currency);
     HpsInputValidation::checkAmount($this->amount);
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditReversal = $xml->createElement('hps:CreditReversal');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
     if ($this->authAmount != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:AuthAmt', $this->authAmount));
     }
     if ($this->card != null) {
         $cardData = $xml->createElement('hps:CardData');
         $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml));
         $hpsBlock1->appendChild($cardData);
     } else {
         if ($this->token != null) {
             $cardData = $xml->createElement('hps:CardData');
             $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml));
             $hpsBlock1->appendChild($cardData);
         } else {
             $hpsBlock1->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
         }
     }
     if ($this->details != null) {
         $hpsBlock1->appendChild($this->service->_hydrateAdditionalTxnFields($this->details, $xml));
     }
     $hpsCreditReversal->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCreditReversal);
     return $this->service->_submitTransaction($hpsTransaction, 'CreditReversal', isset($this->details->clientTransactionId) ? $this->details->clientTransationId : null);
 }
 /**
  * Creates an search transaction through the HpsPayPlanCustomerService
  */
 public function execute()
 {
     parent::execute();
     $service = new HpsPayPlanCustomerService($this->service->servicesConfig());
     $usableData = array_intersect_key($this->data, array_flip(HpsPayPlanCustomer::getSearchableFields()));
     return $service->search($usableData);
 }
 /**
  * Creates an edit transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsManageTokens = $xml->createElement('hps:ManageTokens');
     $hpsManageTokens->appendChild($xml->createElement('hps:TokenValue', trim((string) $this->token)));
     $hpsTokenActions = $xml->createElement('hps:TokenActions');
     $hpsSet = $xml->createElement('hps:Set');
     $hpsAttribute = $xml->createElement('hps:Attribute');
     $hpsAttribute->appendChild($xml->createElement('hps:Name', 'ExpMonth'));
     $hpsAttribute->appendChild($xml->createElement('hps:Value', (string) sprintf("%'.02d", (int) $this->expMonth)));
     $hpsSet->appendChild($hpsAttribute);
     $hpsAttribute = $xml->createElement('hps:Attribute');
     $hpsAttribute->appendChild($xml->createElement('hps:Name', 'ExpYear'));
     $hpsAttribute->appendChild($xml->createElement('hps:Value', (string) $this->expYear));
     $hpsSet->appendChild($hpsAttribute);
     $hpsTokenActions->appendChild($hpsSet);
     $hpsManageTokens->appendChild($hpsTokenActions);
     $hpsTransaction->appendChild($hpsManageTokens);
     $trans = $this->service->_submitTransaction($hpsTransaction, 'ManageTokens', null);
     $trans->responseCode = '00';
     $trans->responseText = '';
     return $trans;
 }
 /**
  * Creates a sale transaction through the HpsCheckService
  */
 public function execute()
 {
     parent::execute();
     HpsInputValidation::checkAmount($this->amount);
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCheckSale = $xml->createElement('hps:CheckSale');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', sprintf("%0.2f", round($this->amount, 3))));
     $hpsBlock1->appendChild($xml->createElement('hps:CheckAction', 'SALE'));
     $hpsBlock1->appendChild($xml->createElement('hps:PaymentMethodKey', $this->paymentMethodKey));
     $recurringData = $xml->createElement('hps:RecurringData');
     if ($this->schedule != null) {
         $scheduleKey = $this->schedule;
         if ($this->schedule instanceof HpsPayPlanSchedule) {
             $scheduleKey = $this->schedule->scheduleKey;
         }
         $recurringData->appendChild($xml->createElement('hps:ScheduleID', $scheduleKey));
     }
     $recurringData->appendChild($xml->createElement('hps:OneTime', $this->oneTime ? 'Y' : 'N'));
     $hpsBlock1->appendChild($recurringData);
     $hpsCheckSale->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCheckSale);
     return $this->_submitTransaction($hpsTransaction, 'CheckSale', $clientTransactionId);
 }
 /**
  * Creates a balance inquiry transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditAuth = $xml->createElement('hps:PrePaidBalanceInquiry');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $cardData = $xml->createElement('hps:CardData');
     if ($this->card != null) {
         $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml));
     } else {
         if ($this->trackData != null) {
             $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml));
         } else {
             if ($this->token != null) {
                 $tokenData = $xml->createElement('hps:TokenData');
                 $tokenData->appendChild($xml->createElement('hps:TokenValue', $this->token->tokenValue));
                 $cardData->appendChild($tokenData);
             }
         }
     }
     $hpsBlock1->appendChild($cardData);
     if ($this->cardHolder != null) {
         $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml));
     }
     $hpsCreditAuth->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCreditAuth);
     return $this->service->_submitTransaction($hpsTransaction, 'PrePaidBalanceInquiry');
 }
 /**
  * Creates a offline auth transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditOfflineAuth = $xml->createElement('hps:CreditOfflineAuth');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', $this->allowDuplicates ? 'Y' : 'N'));
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
     if ($this->gratuity != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity));
     }
     if ($this->cardHolder != null) {
         $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder));
     }
     $cardData = $xml->createElement('hps:CardData');
     if ($this->card != null) {
         $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml, $this->cardPresent, $this->readerPresent));
     } else {
         if ($this->token != null) {
             $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml, $this->cardPresent, $this->readerPresent));
         } else {
             if ($this->trackData != null) {
                 $cardData->appendChild($this->service->_hydrateTrackData($this->trackData, $xml));
                 if ($this->trackData->encryptionData != null) {
                     $cardData->appendChild($this->service->_hydrateEncryptionData($this->trackData->encryptionData));
                 }
             } else {
                 if ($this->paymentData != null) {
                     $manualEntry = $xml->createElement('hps:ManualEntry');
                     $manualEntry->appendChild($xml->createElement('hps:CardNbr', $this->paymentData->applicationPrimaryAccountNumber));
                     $expDate = (string) $this->paymentData->applicationExpirationDate;
                     $manualEntry->appendChild($xml->createElement('hps:ExpMonth', substr($expDate, 2, 2)));
                     $manualEntry->appendChild($xml->createElement('hps:ExpYear', substr($expDate, 0, 2)));
                     $cardData->appendChild($manualEntry);
                 }
             }
         }
     }
     $cardData->appendChild($xml->createElement('hps:TokenRequest', $this->requestMultiUseToken ? 'Y' : 'N'));
     $hpsBlock1->appendChild($cardData);
     if ($this->paymentData != null) {
         $hpsBlock1->appendChild($this->service->_hydrateSecureEcommerce($this->paymentData->paymentData));
     }
     if ($this->cpcReq == true) {
         $hpsBlock1->appendChild($xml->createElement('hps:CPCReq', 'Y'));
     }
     if ($this->txnDescriptor != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:TxnDescriptor', $this->txnDescriptor));
     }
     if ($this->autoSubstantiation != null) {
         $hpsBlock1->appendChild($this->service->_hydrateAutoSubstantiation($this->autoSubstantiation));
     }
     if ($this->offlineAuthCode != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:OfflineAuthCode', $this->offlineAuthCode));
     }
     $hpsCreditOfflineAuth->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCreditOfflineAuth);
     return $this->service->_submitTransaction($hpsTransaction, 'CreditOfflineAuth', isset($this->details->clientTransactionId) ? $this->details->clientTransactionId : null);
 }
 /**
  * Creates an get transaction through the HpsPayPlanCustomerService
  */
 public function execute()
 {
     parent::execute();
     if ($this->customer != null) {
         $this->customerKey = $this->customer->customerKey;
     }
     $service = new HpsPayPlanCustomerService($this->service->servicesConfig());
     return $service->get($this->customerKey);
 }
 /**
  * Creates an delete transaction through the HpsPayPlanScheduleService
  */
 public function execute()
 {
     parent::execute();
     if ($this->paymentSchedule != null) {
         $this->paymentScheduleKey = $this->paymentSchedule->paymentScheduleKey;
     }
     $service = new HpsPayPlanScheduleService($this->service->servicesConfig());
     return $service->delete($this->paymentScheduleKey);
 }
 /**
  * Creates an get transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     if ($this->paymentMethod != null) {
         $this->paymentMethodKey = $this->paymentMethod->paymentMethodKey;
     }
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     return $service->get($this->paymentMethodKey);
 }
 /**
  * Creates a void transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditVoid = $xml->createElement('hps:CreditVoid');
     $hpsCreditVoid->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
     $hpsTransaction->appendChild($hpsCreditVoid);
     return $this->service->_submitTransaction($hpsTransaction, 'CreditVoid', $this->clientTransactionId);
 }
 /**
  * Creates an add transaction through the HpsPayPlanScheduleService
  */
 public function execute()
 {
     parent::execute();
     $service = new HpsPayPlanScheduleService($this->service->servicesConfig());
     $obj = new HpsPayPlanSchedule();
     foreach ($this->data as $k => $v) {
         $obj->{$k} = $v;
     }
     unset($usableData, $k, $v);
     return $service->add($obj);
 }
 /**
  * Creates a cpcEdit transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsPosCreditCPCEdit = $xml->createElement('hps:CreditCPCEdit');
     $hpsPosCreditCPCEdit->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
     $hpsPosCreditCPCEdit->appendChild($this->service->_hydrateCPCData($this->cpcData, $xml));
     $hpsTransaction->appendChild($hpsPosCreditCPCEdit);
     return $this->service->_submitTransaction($hpsTransaction, 'CreditCPCEdit');
 }
 /**
  * Creates a get transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     if ($this->transactionId <= 0) {
         throw new HpsArgumentException('Invalid Transaction Id');
     }
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsReportTxnDetail = $xml->createElement('hps:ReportTxnDetail');
     $hpsReportTxnDetail->appendChild($xml->createElement('hps:TxnId', $this->transactionId));
     $hpsTransaction->appendChild($hpsReportTxnDetail);
     return $this->service->_submitTransaction($hpsTransaction, 'ReportTxnDetail');
 }
 /**
  * Creates an edit transaction through the HpsPayPlanPaymentMethodService
  */
 public function execute()
 {
     parent::execute();
     if ($this->paymentMethod != null) {
         $this->paymentMethodKey = $this->paymentMethod->paymentMethodKey;
     }
     $service = new HpsPayPlanPaymentMethodService($this->service->servicesConfig());
     $obj = new HpsPayPlanPaymentMethod();
     $obj->paymentMethodKey = $this->paymentMethodKey;
     $usableData = array_intersect_key($this->data, array_flip(HpsPayPlanPaymentMethod::getEditableFields()));
     foreach ($usableData as $k => $v) {
         $obj->{$k} = $v;
     }
     unset($usableData, $k, $v);
     return $service->edit($obj);
 }
 /**
  * Creates an alias transaction through the HpsGiftCardService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsGiftAlias = $xml->createElement('hps:GiftCardAlias');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:Action', $this->action));
     $hpsBlock1->appendChild($xml->createElement('hps:Alias', $this->alias));
     if ($this->card != null) {
         $hpsBlock1->appendChild($this->service->_hydrateGiftCardData($this->card, $xml));
     }
     $hpsGiftAlias->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsGiftAlias);
     return $this->service->_submitTransaction($hpsTransaction, 'GiftCardAlias');
 }
 /**
  * Creates a recurring billing transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     HpsInputValidation::checkAmount($this->amount);
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsRecurringBilling = $xml->createElement('hps:RecurringBilling');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y'));
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
     if ($this->cardHolder != null) {
         $hpsBlock1->appendChild($this->_hydrateCardHolderData($this->cardHolder, $xml));
     }
     if ($this->details != null) {
         $hpsBlock1->appendChild($this->_hydrateAdditionalTxnFields($this->details, $xml));
     }
     if ($this->card != null) {
         $cardData = $xml->createElement('hps:CardData');
         $cardData->appendChild($this->_hydrateManualEntry($this->card, $xml));
         $hpsBlock1->appendChild($cardData);
     } else {
         if ($this->token != null) {
             $cardData = $xml->createElement('hps:CardData');
             $tokenData = $xml->createElement('hps:TokenData');
             $tokenData->appendChild($xml->createElement('hps:TokenValue', $this->token->tokenValue));
             $cardData->appendChild($tokenData);
             $hpsBlock1->appendChild($cardData);
         } else {
             if ($this->paymentMethodKey != null) {
                 $hpsBlock1->appendChild($xml->createElement('hps:PaymentMethodKey', $this->paymentMethodKey));
             }
         }
     }
     $recurringData = $xml->createElement('hps:RecurringData');
     if ($this->schedule != null) {
         $id = $this->schedule;
         if ($this->schedule instanceof HpsPayPlanSchedule) {
             $id = $this->schedule->scheduleIdentifier;
         }
         $recurringData->appendChild($xml->createElement('hps:ScheduleID', $id));
     }
     $recurringData->appendChild($xml->createElement('hps:OneTime', $this->oneTime ? 'Y' : 'N'));
     $hpsBlock1->appendChild($recurringData);
     $hpsRecurringBilling->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsRecurringBilling);
     return $this->service->_submitTransaction($hpsTransaction, 'RecurringBilling', isset($this->details->clientTransactionId) ? $this->details->clientTransactionId : null);
 }
 /**
  * Creates a listTransactions transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     date_default_timezone_set("UTC");
     $dateFormat = 'Y-m-d\\TH:i:s.00\\Z';
     $current = new DateTime();
     $currentTime = $current->format($dateFormat);
     HpsInputValidation::checkDateNotFuture($this->startDate);
     HpsInputValidation::checkDateNotFuture($this->endDate);
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsReportActivity = $xml->createElement('hps:ReportActivity');
     $hpsReportActivity->appendChild($xml->createElement('hps:RptStartUtcDT', $this->startDate));
     $hpsReportActivity->appendChild($xml->createElement('hps:RptEndUtcDT', $this->endDate));
     $hpsTransaction->appendChild($hpsReportActivity);
     return $this->service->_submitTransaction($hpsTransaction, 'ReportActivity');
 }
 /**
  * Creates a void transaction through the HpsCheckService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCheckVoid = $xml->createElement('hps:CheckVoid');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     if ($this->transactionId != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
     } else {
         if ($this->clientTransactionId != null) {
             $hpsBlock1->appendChild($xml->createElement('hps:ClientTxnId', $this->clientTransactionId));
         }
     }
     $hpsCheckVoid->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsCheckVoid);
     return $this->service->_submitTransaction($hpsTransaction, 'CheckVoid');
 }
 /**
  * Creates an edit transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditTxnEdit = $xml->createElement('hps:CreditTxnEdit');
     $hpsCreditTxnEdit->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
     if ($this->amount != null) {
         $amount = sprintf('%0.2f', round($this->amount, 3));
         $hpsCreditTxnEdit->appendChild($xml->createElement('hps:Amt', $amount));
     }
     if ($this->gratuity != null) {
         $hpsCreditTxnEdit->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity));
     }
     $hpsTransaction->appendChild($hpsCreditTxnEdit);
     $trans = $this->service->_submitTransaction($hpsTransaction, 'CreditTxnEdit', $this->clientTransactionId);
     $trans->responseCode = '00';
     $trans->responseText = '';
     return $trans;
 }
 /**
  * Creates a capture transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsCreditAddToBatch = $xml->createElement('hps:CreditAddToBatch');
     $hpsCreditAddToBatch->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
     if ($this->amount != null) {
         $amount = sprintf("%0.2f", round($this->amount, 3));
         $hpsCreditAddToBatch->appendChild($xml->createElement('hps:Amt', $amount));
     }
     if ($this->gratuity != null) {
         $hpsCreditAddToBatch->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity));
     }
     if ($this->directMarketData != null && $this->directMarketData->invoiceNumber != null) {
         $hpsCreditAddToBatch->appendChild($this->_hydrateDirectMarketData($this->directMarketData, $xml));
     }
     $hpsTransaction->appendChild($hpsCreditAddToBatch);
     $response = $this->doTransaction($hpsTransaction);
     $this->_processChargeGatewayResponse($response, 'CreditAddToBatch');
     return $this->service->get($this->transactionId)->execute();
 }
 /**
  * Creates a sale transaction through the HpsGiftCardService
  */
 public function execute()
 {
     parent::execute();
     HpsInputValidation::checkAmount($this->amount);
     $this->currency = strtolower($this->currency);
     $xml = new DOMDocument();
     $hpsTransaction = $xml->createElement('hps:Transaction');
     $hpsGiftSale = $xml->createElement('hps:GiftCardSale');
     $hpsBlock1 = $xml->createElement('hps:Block1');
     $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
     $hpsBlock1->appendChild($this->service->_hydrateGiftCardData($this->card, $xml));
     if (in_array($this->currency, array('points', 'usd'))) {
         $hpsBlock1->appendChild($xml->createElement('hps:Currency', strtoupper($this->currency)));
     }
     if ($this->gratuity != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $this->gratuity));
     }
     if ($this->tax != null) {
         $hpsBlock1->appendChild($xml->createElement('hps:TaxAmtInfo', $this->tax));
     }
     $hpsGiftSale->appendChild($hpsBlock1);
     $hpsTransaction->appendChild($hpsGiftSale);
     return $this->service->_submitTransaction($hpsTransaction, 'GiftCardSale');
 }
 /**
  * Creates a void transaction through the HpsCheckService
  */
 public function execute()
 {
     parent::execute();
     $voidSvc = new HpsCheckService($this->service->servicesConfig());
     return $voidSvc->void($this->transactionId, $this->clientTransactionId);
 }
 /**
  * Creates a refund transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $refundSvc = new HpsCreditService($this->service->servicesConfig());
     return $refundSvc->refund($this->amount, $this->currency, isset($this->card) ? $this->card : (isset($this->token) ? $this->token : $this->transactionId), $this->cardHolder, $this->details);
 }
 /**
  * Creates an edit transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $editSvc = new HpsCreditService($this->service->servicesConfig());
     return $editSvc->edit($this->transactionId, $this->amount, $this->gratuity, $this->clientTransactionId);
 }
 /**
  * Creates a listTransactions transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $listTransactionsSvc = new HpsCreditService($this->service->servicesConfig());
     return $listTransactionsSvc->listTransactions($this->startDate, $this->endDate, $this->filterBy);
 }
 /**
  * Creates a cpcEdit transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $cpcEditSvc = new HpsCreditService($this->service->servicesConfig());
     return $cpcEditSvc->cpcEdit($this->transactionId, $this->cpcData);
 }
 /**
  * Creates a sale transaction through the HpsCheckService
  */
 public function execute()
 {
     parent::execute();
     return $this->service->_buildTransaction('SALE', $this->check, $this->amount, $this->clientTransactionId, $this->checkVerify, $this->achVerify);
 }
 /**
  * Creates a addValue transaction through the HpsDebitService
  */
 public function execute()
 {
     parent::execute();
     $addValueSvc = new HpsDebitService($this->service->servicesConfig());
     return $addValueSvc->addValue($this->amount, $this->currency, $this->trackData, $this->pinBlock, $this->encryptionData, $this->allowDuplicates, $this->cardHolder, $this->details, $this->clientTransactionId);
 }