コード例 #1
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;
 }
コード例 #2
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);
 }
コード例 #3
0
 /**
  * @test
  * /// Discover Reverse multi Token tests
  */
 public function testDiscoverMultiTokenReverseShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validDiscoverCreditCard());
     $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");
 }
コード例 #4
0
 /**
  * @test
  * /// Discover Token refund test with token
  */
 public function testDiscoverTokenReverseShouldBeOk()
 {
     $testConfig = new TestServicesConfig();
     $token = $this->getToken(TestCreditCard::validDiscoverCreditCard());
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $reverse = $chargeSvc->reverse($token, 50, 'usd');
     $this->assertEquals('00', $reverse->responseCode);
 }
コード例 #5
0
 public function test020PartialApprovalMastercard()
 {
     $cardHolder = new HpsCardHolder();
     $cardHolder->address = new HpsAddress();
     $cardHolder->address->address = '6860';
     $cardHolder->address->zip = '75024';
     $directMarketData = new HpsDirectMarketData('123456');
     $response = $this->service->charge(155)->withCard(TestCreditCard::validDiscoverCreditCard())->withCardHolder($cardHolder)->withDirectMarketData($directMarketData)->withAllowPartialAuth(true)->execute();
     $this->assertEquals(true, $response != null);
     $this->assertEquals('10', $response->responseCode);
     $this->assertEquals(true, $response->authorizedAmount != null);
     $this->assertEquals('100.00', $response->authorizedAmount);
     self::$transactionId20 = $response->transactionId;
 }
コード例 #6
0
 public function testAuthAndReversalDiscover()
 {
     $amount = '62.00';
     $card = TestCreditCard::validDiscoverCreditCard();
     $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");
 }