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); }
<?php require_once "../../Hps.php"; $config = new HpsServicesConfig(); $config->secretApiKey = 'skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ'; $config->versionNumber = '0000'; $config->developerId = '000000'; $giftService = new HpsGiftCardService($config); try { $card = new HpsGiftCard(); $card->number = $_GET["card-number"]; $response = $giftService->sale($card, 1.0); } catch (HpsException $e) { echo $e->getMessage(); } //echo $response->responseCode; echo "Transaction Id: " . $response->transactionId;
/** * Creates a sale transaction through the HpsGiftCardService */ public function execute() { parent::execute(); $saleSvc = new HpsGiftCardService($this->service->servicesConfig()); return $saleSvc->sale($this->card, $this->amount, $this->currency, $this->gratuity, $this->tax); }
/** * @expectedException HpsException * @expectedExceptionMessage The pin is invalid * @expectedExceptionCode HpsExceptionCodes::INVALID_PIN */ public function testGiftCardManualCardWithInvalidPin() { $giftService = new HpsGiftCardService(TestServicesCOnfig::validMultiUseConfig()); $response = $giftService->sale(TestGiftCard::validGiftCardNotEncrypted(), 3.05); }