/** * @test * /// Discover authorize should return response code '00'. */ public function testDiscoverCaptureShouldReturnOk() { // Authorize the card. $testConfig = new TestServicesConfig(); $chargeSvc = new HpsCreditService($testConfig->ValidMultiUseConfig()); $authResponse = $chargeSvc->authorize(50, "usd", TestCreditCard::validDiscoverCreditCard(), TestCardHolder::ValidCardHolder()); $this->assertEquals("00", $authResponse->responseCode); // Capture the authorization. $captureResponse = $chargeSvc->capture($authResponse->transactionId); $this->assertEquals("0", $captureResponse->responseCode); }
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"); }
/** * @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); }
/** * Creates a capture transaction through the HpsCreditService */ public function execute() { parent::execute(); $captureSvc = new HpsCreditService($this->service->servicesConfig()); return $captureSvc->capture($this->transactionId, $this->amount, $this->gratuity, $this->clientTransactionId, $this->directMarketData); }