コード例 #1
0
 public function testGiftCardManualCardShouldReverseUsingGiftCard()
 {
     $giftService = new HpsGiftCardService(TestServicesConfig::ValidMultiUseConfig());
     $response = $giftService->sale(TestGiftCard::validGiftCardNotEncrypted(), 10.0);
     $this->assertEquals('0', $response->responseCode);
     $reverseResponse = $giftService->reverse(TestGiftCard::validGiftCardNotEncrypted(), 10.0);
     $this->assertEquals('0', $reverseResponse->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
 /**
  * @group test
  * The get first charge test method.
  */
 public function testGetFirstWhenConfigValidShouldGetTheFirstCharge()
 {
     date_default_timezone_set("UTC");
     $testConfig = new TestServicesConfig();
     $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig());
     $dateFormat = 'Y-m-d\\TH:i:s.00\\Z';
     $dateMinus10 = new DateTime();
     $dateMinus10->sub(new DateInterval('PT10H'));
     $dateMinus10Utc = gmdate($dateFormat, $dateMinus10->Format('U'));
     $nowUtc = gmdate($dateFormat);
     $items = $chargeSvc->ListTransactions($dateMinus10Utc, $nowUtc, "CreditSale");
     // HpsTransactionType::Capture
     $this->assertTrue(0 != count($items));
     $charge0 = $items[0]->transactionId;
     $charge1 = $items[1]->transactionId;
     $this->assertNotNull($charge0);
     $this->assertNotNull($charge1);
     $this->assertNotEquals($charge0, $charge1);
 }
コード例 #4
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");
 }
コード例 #5
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);
 }
コード例 #6
0
 public function testEBronzeVerify40SavingsBusiness()
 {
     $check = TestCheck::certification();
     $check->secCode = HpsSECCode::EBRONZE;
     $check->checkType = HpsCheckType::BUSINESS;
     $check->accountType = HpsAccountType::SAVINGS;
     $checkService = new HpsCheckService(TestServicesConfig::ValidMultiUseConfig());
     $response = $checkService->sale($check, 1);
     $this->assertNotNull($response, 'Response is null');
     $this->assertEquals('0', $response->responseCode);
     $this->assertEquals('Transaction Approved', $response->responseText);
 }
コード例 #7
0
ファイル: CheckTest.php プロジェクト: cdrive/heartland-php
 public function setUp()
 {
     $this->checkService = new HpsCheckService(TestServicesConfig::ValidMultiUseConfig());
 }
コード例 #8
0
 /**
  * @test
  * Testing getting a single use token then running a verify with visa and requesting a multiuse token
  */
 public function testGetTokenFromVisaVerifyGetMultiTokenTestAndOnError()
 {
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeService = new HpsCreditService(TestServicesConfig::ValidMultiUseConfig());
     $response = $chargeService->verify($token, TestCardHolder::ValidCardHolder(), true);
     $this->assertEquals('85', $response->responseCode);
     $this->assertNotNull($response->tokenData->tokenValue);
     $multiToken = $response->tokenData;
     $verifyMultiToken = $chargeService->verify($multiToken);
     $this->assertEquals('85', $verifyMultiToken->responseCode);
 }
コード例 #9
0
ファイル: VisaTest.php プロジェクト: cdrive/heartland-php
 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;
 }