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); }
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; }
/** * @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); }
/** * @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"); }
/** * @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); }
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); }
public function setUp() { $this->checkService = new HpsCheckService(TestServicesConfig::ValidMultiUseConfig()); }
/** * @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); }
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; }