コード例 #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
 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;
 }
コード例 #3
0
 /**
  * @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);
 }
コード例 #4
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;
 }
コード例 #5
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);
 }
コード例 #6
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");
 }
コード例 #7
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);
 }
コード例 #8
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);
 }
コード例 #9
0
 public function test040ChargeGsb()
 {
     $cardHolder = new HpsCardHolder();
     $cardHolder->address = new HpsAddress();
     $cardHolder->address->address = '6860';
     $cardHolder->address->zip = '75024';
     $directMarketData = new HpsDirectMarketData('123456');
     $response = $this->service->charge(2.1)->withCard(TestCreditCard::validGsbCardEcommerce())->withCardHolder($cardHolder)->withDirectMarketData($directMarketData)->execute();
     $this->assertEquals(true, $response != null);
     $this->assertEquals('00', $response->responseCode);
 }
コード例 #10
0
 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");
 }