예제 #1
0
 /**
  * @test
  * /// <summary>VISA verify cert test.</summary>
  */
 public function testVisaShouldReverseOk()
 {
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeSvc->reverse(TestCreditCard::validVisaCreditCard(), 17.01, "usd");
     if ($response == null) {
         $this->fail("Response is null.");
     }
     $this->assertEquals($response->responseCode, "00");
 }
 /**
  * @test
  * Visa charge and reverseTransaction should return response code '00'.
  */
 public function testVisaChargeAndTransactionShouldReturnOk()
 {
     $testConfig = new TestServicesConfig();
     $chargeSvc = new HpsCreditService($testConfig->validMultiUseConfig());
     $response = $chargeSvc->charge(50, "usd", TestCreditCard::validVisaCreditCard(), TestCardHolder::ValidCardHolder(), true);
     $this->assertEquals("0", $response->tokenData->responseCode);
     $this->assertEquals("00", $response->responseCode);
     $reverseResponse = $chargeSvc->reverse($response->transactionId, 50, 'usd');
     $this->assertEquals("00", $reverseResponse->responseCode);
 }
 /**
  * @test
  * /// Visa Reverse multi Token tests
  */
 public function testVisaMultiTokenReverseShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $chargeResponse = $chargeSvc->charge(17.01, 'usd', $token, null, true);
     $this->assertEquals($chargeResponse->responseCode, "0");
     $muToken = $chargeResponse->tokenData;
     $response = $chargeSvc->reverse($muToken, 17.01, "usd");
     $this->assertEquals($response->responseCode, "0");
 }
 /**
  * @test
  * /// Visa Token refund test with token
  */
 public function testVisaTokenReverseShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $reverse = $chargeSvc->reverse($token, 50, 'usd');
     $this->assertEquals('00', $reverse->responseCode);
 }
 public function testAuthAndReversalAmex()
 {
     $amount = '63.00';
     $card = TestCreditCard::validAmexCreditCard();
     $card->cvv = null;
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeSvc->authorize($amount, "usd", $card);
     $chargeSvc->capture($response->transactionId);
     $chargeSvc->reverse($response->transactionId, $amount, 'usd');
     if ($response == null) {
         $this->fail("Response is null.");
     }
     $this->assertEquals($response->responseCode, "00");
 }
 /**
  * Creates a reverse transaction through the HpsCreditService
  */
 public function execute()
 {
     parent::execute();
     $reverseSvc = new HpsCreditService($this->service->servicesConfig());
     return $reverseSvc->reverse(isset($this->card) ? $this->card : (isset($this->token) ? $this->token : $this->transactionId), $this->amount, $this->currency, $this->details);
 }