/**
  * @test
  * /// <summary>Mastercard return test.</summary>
  */
 public function testMastercardReturnShouldBeOk()
 {
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeSvc->refund(15.15, "usd", TestCreditCard::validMasterCardCreditCard(), TestCardHolder::certCardHolderShortZip());
     if ($response == null) {
         $this->fail("Response is null.");
     }
     $this->assertEquals($response->responseCode, "0");
 }
 /**
  * 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);
 }
 /**
  * @test
  * /// Visa multi Token refund test with token
  */
 public function testVisaMultiTokenReturnShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $charge = $chargeSvc->charge(50, 'usd', $token, TestCardHolder::ValidCardHolder(), true);
     $this->assertEquals($charge->responseCode, "0");
     $this->assertNotNull($charge->tokenData->tokenValue);
     $multiToken = $charge->tokenData;
     $refundMultiToken = $chargeSvc->refund(50, "usd", $multiToken, TestCardHolder::certCardHolderShortZip());
     $this->assertEquals('00', $refundMultiToken->responseCode);
 }
 /**
  * @test
  * /// MasterCard refund test.
  */
 public function testMasterCardShouldRefundOk()
 {
     $testConfig = new TestServicesConfig();
     $chargeSvc = new HpsCreditService($testConfig::validMultiUseConfig());
     $chargeResponse = $chargeSvc->charge(25.0, "usd", TestCreditCard::validMasterCardCreditCard(), TestCardHolder::certCardHolderShortZipNoStreet());
     $refundResponse = $chargeSvc->refund(25.0, "usd", $chargeResponse->transactionId);
     $this->assertEquals($refundResponse->responseCode, "0");
 }
 /**
  * @test
  * /// Visa refund test with token
  */
 public function testVisaTokenRefundShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $response = $chargeSvc->refund(15.15, "usd", $token, TestCardHolder::certCardHolderShortZip());
     $this->assertEquals($response->responseCode, "0");
 }
 public function testSaleAndReturnAmex()
 {
     $amount = '53.00';
     $card = TestCreditCard::validAmexCreditCard();
     $card->cvv = null;
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeSvc->charge($amount, "usd", $card);
     $chargeSvc->refund($amount, 'usd', $response->transactionId);
     if ($response == null) {
         $this->fail("Response is null.");
     }
     $this->assertEquals($response->responseCode, "00");
 }