コード例 #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
 public function testMastercardDebitWhenValidTrackDataShouldReverseOk()
 {
     $service = new HpsDebitService(TestServicesConfig::validMultiUseConfig());
     $charge = $service->charge(50, "usd", "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?", "F505AD81659AA42A3D123412324000AB", null, true);
     $this->assertNotNull($charge);
     $this->assertEquals("00", $charge->responseCode);
     $reverse = $service->reverse($charge->transactionId, 50, "%B5473500000000014^MC TEST CARD^251210199998888777766665555444433332?;5473500000000014=25121019999888877776?");
     $this->assertNotNull($reverse);
     $this->assertEquals("00", $reverse->responseCode);
 }
コード例 #3
0
 public function testVisaDebitWhenValidTrackDataShouldReverseOk()
 {
     $service = new HpsDebitService(TestServicesConfig::validMultiUseConfig());
     $charge = $service->charge(50, "usd", "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?", "32539F50C245A6A93D123412324000AA", null, true);
     $this->assertNotNull($charge);
     $this->assertEquals("00", $charge->responseCode);
     $reverse = $service->reverse($charge->transactionId, 50, "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?");
     $this->assertNotNull($reverse);
     $this->assertEquals("00", $reverse->responseCode);
 }
コード例 #4
0
 private function getToken($card, $key = null)
 {
     if ($key != null and $key != "") {
         $this->publicKey = $key;
     } else {
         $this->publicKey = TestServicesConfig::validMultiUsePublicKey();
     }
     $this->tokenService = new HpsTokenService($this->publicKey);
     $tokenResponse = $this->tokenService->getToken($card);
     if (isset($tokenResponse->token_value)) {
         $token = new HpsTokenData();
         $token->tokenValue = $tokenResponse->token_value;
         return $token;
     } else {
         return $tokenResponse;
     }
 }
コード例 #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
ファイル: GeneralTest.php プロジェクト: hps/heartland-php
 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);
 }
コード例 #7
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");
 }
コード例 #8
0
 public function testACHDebitCorporate8SavingsBusiness()
 {
     $check = TestCheck::certification();
     $check->accountType = 'savings';
     $check->checkType = 'business';
     $check->secCode = 'ccd';
     $checkService = new HpsCheckService(TestServicesConfig::CertServicesConfigWithDescriptor());
     $response = $checkService->sale('SALE', $check, 18.0);
     $this->assertNotNull($response, 'Response is null');
     $this->assertEquals('0', $response->responseCode);
     $this->assertEquals('Transaction Approved', $response->responseText);
 }
コード例 #9
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;
 }
コード例 #10
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;
 }
コード例 #11
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");
 }
コード例 #12
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);
 }
コード例 #13
0
 /**
  * @test
  * Testing getting a single use token then running a verify with visa
  */
 public function testIntegrationWhenTokenIsAcquiredShouldBeAbleToVerifyVisa()
 {
     $token = $this->getToken(TestCreditCard::validVisaCreditCard());
     $chargeService = new HpsCreditService(TestServicesConfig::validMultiUseConfig());
     $response = $chargeService->verify($token, TestCardHolder::validCardHolder());
     $this->assertEquals($response->responseCode, "85");
 }
コード例 #14
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);
 }
コード例 #15
0
 protected function config()
 {
     return TestServicesConfig::validMultiUseConfig();
 }
コード例 #16
0
ファイル: FluentCheckTest.php プロジェクト: hps/heartland-php
 protected function setUp()
 {
     $this->service = new HpsFluentCheckService(TestServicesConfig::validMultiUseConfig());
 }
コード例 #17
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);
 }
コード例 #18
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);
 }
コード例 #19
0
 public function testListTransactions()
 {
     date_default_timezone_set("UTC");
     $config = TestServicesConfig::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);
     $transactions = $this->service->listTransactions()->withStartDate($dateMinus10Utc)->withEndDate($nowUtc)->withFilterBy("CreditSale")->execute();
     $this->assertTrue(0 != count($transactions));
     $charge0 = $transactions[0]->originalTransactionId;
     $charge1 = $transactions[1]->originalTransactionId;
     $this->assertNotNull($charge0);
     $this->assertNotNull($charge1);
 }
コード例 #20
0
 public function setUp()
 {
     $this->checkService = new HpsCheckService(TestServicesConfig::validMultiUseConfig());
 }
コード例 #21
0
ファイル: GeneralTest.php プロジェクト: cdrive/heartland-php
 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);
 }