public function testCreateTransactionCreditCard() { $merchantAuthentication = new apiContract\MerchantAuthenticationType(); $merchantAuthentication->setName(self::$LoginName); $merchantAuthentication->setTransactionKey(self::$TransactionKey); //create a transaction $transactionRequestType = new apiContract\TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureTransaction"); // TODO Change to Enum $transactionRequestType->setAmount($this->setValidAmount($this->counter)); $transactionRequestType->setPayment($this->paymentOne); $transactionRequestType->setOrder($this->orderType); $transactionRequestType->setCustomer($this->customerDataOne); $transactionRequestType->setBillTo($this->customerAddressOne); $request = new apiContract\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($this->refId); $request->setTransactionRequest($transactionRequestType); $controller = new apiController\CreateTransactionController($request); $controller->execute(self::$TestEnvironment); $response = $controller->getApiResponse(); // Handle and validate the response self::displayMessages($response); $this->assertNotNull($response, "null response"); $this->assertNotNull($response->getMessages()); file_put_contents(self::$log_file, sprintf("\n%s: Controller Response ResultCode: '%s'.", \net\authorize\util\Helpers::now(), $response->getMessages()->getResultCode()), FILE_APPEND); $this->assertEquals("Ok", $response->getMessages()->getResultCode()); $this->assertEquals($this->refId, $response->getRefId()); $this->assertTrue(0 < count($response->getMessages())); foreach ($response->getMessages() as $message) { $this->assertEquals("I00001", $message->getCode()); $this->assertEquals("Successful.", $response->getText()); } }
public function testCreateTransactionCreditCard() { $this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO $name = defined('AUTHORIZENET_API_LOGIN_ID') && '' != AUTHORIZENET_API_LOGIN_ID ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id"); $transactionKey = defined('AUTHORIZENET_TRANSACTION_KEY') && '' != AUTHORIZENET_TRANSACTION_KEY ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key"); $merchantAuthentication = new MerchantAuthenticationType(); $merchantAuthentication->setName($name); $merchantAuthentication->setTransactionKey($transactionKey); $refId = 'ref' . time(); //create a transaction $transactionRequestType = new TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureTransaction"); // TODO Change to Enum $transactionRequestType->setAmount($this->setValidAmount($this->counter)); $transactionRequestType->setPayment($this->paymentOne); $transactionRequestType->setOrder($this->orderType); $transactionRequestType->setCustomer($this->customerDataOne); $transactionRequestType->setBillTo($this->customerAddressOne); $request = new CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setTransactionRequest($transactionRequestType); $controller = new CreateTransactionController($request); $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); $response = $controller->getApiResponse(); // Handle the response. $this->assertNotNull($response, "null response"); $this->assertNotNull($response->getMessages()); $this->assertEquals("Ok", $response->getMessages()->getResultCode()); $this->assertEquals($response->getRefId(), $refId); $this->assertTrue(0 < count($response->getMessages())); foreach ($response->getMessages() as $message) { $this->assertEquals("I00001", $message->getCode()); $this->assertEquals("Successful.", $response->getText()); } }