コード例 #1
0
 public function testWithTokenData()
 {
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $response = $this->service->recurring($this->schedule, 10, $token);
     $this->assertNotNull($response);
     $this->assertEquals('00', $response->responseCode);
 }
コード例 #2
0
 /**
  * @test
  * /// Visa authorize and Capture should return response code '00'.
  */
 public function testVisaAuthorizeAndCaptureShouldReturnOk()
 {
     $chargeService = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $auth = $chargeService->authorize(17.06, "usd", TestCreditCard::validVisaCreditCard(), TestCardHolder::ValidCardHolder());
     $this->assertEquals("00", $auth->responseCode);
     $capture = $chargeService->capture($auth->transactionId, 17.06);
     $this->assertEquals("0", $capture->responseCode);
 }
コード例 #3
0
 private function chargeValidVisa($amt, $multiUseRequest = false, $details = null, $txnDescriptors = null)
 {
     $testConfig = new TestServicesConfig();
     $chargeSvc = new HpsCreditService($testConfig->validMultiUseConfig());
     $response = $chargeSvc->charge($amt, "usd", TestCreditCard::validVisaCreditCard(), TestCardHolder::ValidCardHolder(), $multiUseRequest, $details, $txnDescriptors);
     if ($response == null) {
         $this->fail("Response is null.");
     }
     return $response;
 }
コード例 #4
0
 public function testGatewayResponseAccessible()
 {
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     echo $response = $chargeSvc->charge(10, 'usd', TestCreditCard::validVisaCreditCard(), TestCardHolder::validCardHolder());
     $this->assertEquals('00', $response->responseCode);
     $this->assertNotNull($response->gatewayResponse()->code);
     $this->assertNotNull($response->gatewayResponse()->message);
 }
コード例 #5
0
 /**
  * @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");
 }
コード例 #6
0
 public function testVoid()
 {
     $charge = $this->service->charge()->withAmount(10)->withCurrency("usd")->withCard(TestCreditCard::validVisaCreditCard())->withCardHolder(TestCardHolder::certCardHolderShortZip())->execute();
     $this->assertNotNull($charge->transactionId);
     $void = $this->service->void()->withTransactionId($charge->transactionId)->execute();
     $this->assertNotNull($void);
     $this->assertEquals("00", $void->responseCode);
 }
コード例 #7
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);
 }
コード例 #8
0
 /** @group debug */
 public function test038FraudPreventionReturn()
 {
     $response = $this->service->refund(15000)->withCard(TestCreditCard::validVisaCreditCard())->execute();
     $this->assertEquals(true, $response != null);
     $this->assertEquals('41', $response->responseCode);
     $this->assertEquals('FR', $response->issuerResponseCode);
 }
コード例 #9
0
 public function testAuthAndReversalVisa()
 {
     $amount = '60.00';
     $card = TestCreditCard::validVisaCreditCard();
     $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");
 }