public function testAuthAndCaptureAmexShortZipStreet()
 {
     $amount = '18.00';
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeSvc->authorize($amount, "usd", TestCreditCard::validAmexCreditCard(), TestCardHolder::certCardHolderShortZipStreet());
     $capture = $chargeSvc->capture($response->transactionId, $amount);
     if ($response == null) {
         $this->fail("Response is null.");
     }
     $this->assertEquals($response->responseCode, "00");
 }
 private function chargeValidDiscover($amt)
 {
     $testConfig = new TestServicesConfig();
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $response = $chargeSvc->charge($amt, "usd", TestCreditCard::validDiscoverCreditCard(), TestCardHolder::ValidCardHolder());
     if ($response == null) {
         $this->fail("Response is null.");
     }
     return $response;
 }
 /**
  * @test
  * /// Discover authorize and capture should return response code '00'.
  */
 public function testDiscoverAuthorizeAndCaptureShouldReturnOk()
 {
     $chargeService = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $auth = $chargeService->authorize(17.08, "usd", TestCreditCard::validDiscoverCreditCard(), TestCardHolder::ValidCardHolder());
     $this->assertEquals("00", $auth->responseCode);
     $capture = $chargeService->capture($auth->transactionId, 17.08);
     $this->assertEquals("0", $capture->responseCode);
 }
 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;
 }
 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);
 }
Example #6
0
 public function testSecretKeyWhitespaceTrimming()
 {
     $keyConfig = TestServicesConfig::validMultiUseConfig();
     $keyConfig->secretApiKey = " " . $keyConfig->secretApiKey . "  ";
     $chargeSvc = new HpsCreditService($keyConfig);
     $card = new HpsCreditCard();
     $card->number = "4111111111111111";
     $card->expMonth = 12;
     $card->expYear = 2025;
     $card->cvv = "012";
     $response = $chargeSvc->charge(10, 'usd', $card, TestCardHolder::validCardHolder());
     $this->assertEquals('00', $response->responseCode);
     $this->assertNotNull($response->gatewayResponse()->code);
     $this->assertNotNull($response->gatewayResponse()->message);
 }
 /**
  * @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);
 }
 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);
 }
 public function testWithCardData()
 {
     $response = $this->service->recurring($this->schedule, 10, TestCreditCard::validVisaCreditCard(), TestCardHolder::ValidCardHolder());
     $this->assertNotNull($response);
     $this->assertEquals('00', $response->responseCode);
 }
 /**
  * @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");
 }
Example #11
0
 public function testCvvWithLeadingZero()
 {
     $chargeSvc = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $card = new HpsCreditCard();
     $card->number = "4111111111111111";
     $card->expMonth = 12;
     $card->expYear = 2025;
     $card->cvv = "012";
     $response = $chargeSvc->charge(10, 'usd', $card, TestCardHolder::validCardHolder());
     $this->assertEquals('00', $response->responseCode);
     $this->assertNotNull($response->gatewayResponse()->code);
     $this->assertNotNull($response->gatewayResponse()->message);
 }