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; }
/** * @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); }
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; }
/** * @test * /// Visa multi Token refund test with token */ public function testVisaMultiTokenReturnShouldBeOk() { $testConfig = new TestServicesConfig(); $token = $this->getToken(TestCreditCard::validVisaCreditCard()); $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig()); $charge = $chargeSvc->charge(50, 'usd', $token, TestCardHolder::ValidCardHolder(), true); $this->assertEquals($charge->responseCode, "0"); $this->assertNotNull($charge->tokenData->tokenValue); $multiToken = $charge->tokenData; $refundMultiToken = $chargeSvc->refund(50, "usd", $multiToken, TestCardHolder::certCardHolderShortZip()); $this->assertEquals('00', $refundMultiToken->responseCode); }
/** * @expectedException HpsArgumentException * @expectedExceptionMessage Charge can only use one payment method */ public function testChargeWithMultiplePaymentOptions() { $this->service->charge()->withAmount(10)->withCard(TestCreditCard::validVisaCreditCard())->withToken('123456789')->withCardHolder(TestCardHolder::ValidCardHolder())->execute(); }
public function testWithCardData() { $response = $this->service->recurring($this->schedule, 10, TestCreditCard::validVisaCreditCard(), TestCardHolder::ValidCardHolder()); $this->assertNotNull($response); $this->assertEquals('00', $response->responseCode); }