Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
25
vendor/authorizenet/authorizenet/tests/AuthorizeNetSSL_Test.php
vendored
Normal file
25
vendor/authorizenet/authorizenet/tests/AuthorizeNetSSL_Test.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class AuthorizeNetSSL_Test extends PHPUnit_Framework_TestCase {
|
||||
public function testSandboxSSLCertIsValid()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
exec("echo | openssl s_client -connect test.authorize.net:443 -showcerts -verify 10 -CAfile ../lib/ssl/cert.pem 2>&1", $output, $return_value);
|
||||
$this->assertEquals(0, $return_value);
|
||||
$this->assertTrue(in_array('Verify return code: 0 (ok)', array_map('trim', $output)));
|
||||
exec("echo | openssl s_client -connect apitest.authorize.net:443 -showcerts -verify 10 -CAfile ../lib/ssl/cert.pem 2>&1", $output, $return_value);
|
||||
$this->assertEquals(0, $return_value);
|
||||
$this->assertTrue(in_array('Verify return code: 0 (ok)', array_map('trim', $output)));
|
||||
}
|
||||
|
||||
public function testLiveSSLCertIsValid()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
exec("echo | openssl s_client -connect secure2.authorize.net:443 -showcerts -verify 10 -CAfile ../lib/ssl/cert.pem 2>&1", $output, $return_value);
|
||||
$this->assertEquals(0, $return_value);
|
||||
$this->assertTrue(in_array('Verify return code: 0 (ok)', array_map('trim', $output)));
|
||||
exec("echo | openssl s_client -connect api2.authorize.net:443 -showcerts -verify 10 -CAfile ../lib/ssl/cert.pem 2>&1", $output, $return_value);
|
||||
$this->assertEquals(0, $return_value);
|
||||
$this->assertTrue(in_array('Verify return code: 0 (ok)', array_map('trim', $output)));
|
||||
}
|
||||
}
|
||||
172
vendor/authorizenet/authorizenet/tests/AuthorizeNetTD_Test.php
vendored
Normal file
172
vendor/authorizenet/authorizenet/tests/AuthorizeNetTD_Test.php
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
class AuthorizeNetTD_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
|
||||
public function testGetSettledBatchList()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getSettledBatchList();
|
||||
$this->assertTrue($response->isOk());
|
||||
$this->assertEquals("I00001",(string)array_pop($response->xpath("messages/message/code")));
|
||||
}
|
||||
|
||||
public function testGetSettledBatchListIncludeStatistics()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getSettledBatchList(true);
|
||||
$this->assertTrue($response->isOk());
|
||||
}
|
||||
|
||||
public function testGetSettledBatchListForMonth()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getSettledBatchListForMonth();
|
||||
$this->assertTrue($response->isOk());
|
||||
}
|
||||
|
||||
public function testGetTransactionsForDay()
|
||||
{
|
||||
$request = new AuthorizeNetTD;
|
||||
$transactions = $request->getTransactionsForDay(12, 8, 2010);
|
||||
$this->assertTrue(is_array($transactions));
|
||||
}
|
||||
|
||||
public function testGetTransactionList()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getSettledBatchList();
|
||||
$this->assertTrue($response->isOk());
|
||||
$batches = $response->xpath("batchList/batch");
|
||||
$batch_id = (string)$batches[0]->batchId;
|
||||
$response = $request->getTransactionList($batch_id);
|
||||
$this->assertTrue($response->isOk());
|
||||
}
|
||||
|
||||
public function testGetTransactionListReturnedItems()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$batchId = 0; // Set your $batchId here
|
||||
$response = $request->getTransactionList($batchId);
|
||||
$this->assertTrue($response->isOk());
|
||||
$transactions = $response->xpath("transactions/transaction");
|
||||
$transId = $transactions[0]->transId;
|
||||
|
||||
$details = new AuthorizeNetTD;
|
||||
$response = $details->getTransactionDetails($transId);
|
||||
$this->assertTrue($response->isOk());
|
||||
$transaction = $response->xml->transaction[0];
|
||||
$this->assertFalse(empty($transaction->returnedItems));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testGetTransactionListSubscription()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$transId = 0; // Set your $transId here
|
||||
|
||||
$details = new AuthorizeNetTD;
|
||||
$response = $details->getTransactionDetails($transId);
|
||||
$this->assertTrue($response->isOk());
|
||||
$transaction = $response->xml->transaction[0];
|
||||
|
||||
$this->assertFalse(empty($transaction->subscription));
|
||||
}
|
||||
|
||||
public function testGetTransactionDetails()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$sale = new AuthorizeNetAIM;
|
||||
$amount = rand(1, 100);
|
||||
$response = $sale->authorizeAndCapture($amount, '4012888818888', '04/17');
|
||||
$this->assertTrue($response->approved);
|
||||
|
||||
$transId = $response->transaction_id;
|
||||
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getTransactionDetails($transId);
|
||||
$this->assertTrue($response->isOk());
|
||||
|
||||
$this->assertEquals($transId, (string)$response->xml->transaction->transId);
|
||||
$this->assertEquals($amount, (string)$response->xml->transaction->authAmount);
|
||||
$this->assertEquals("Visa", (string)$response->xml->transaction->payment->creditCard->cardType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testGetTransactionDetailsWithSolutionId()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$sale = new AuthorizeNetAIM;
|
||||
$amount = rand(1, 100);
|
||||
$sale->setCustomField('x_solution_id', 'A1000002');
|
||||
$response = $sale->authorizeAndCapture($amount, '4012888818888', '04/17');
|
||||
$this->assertTrue($response->approved);
|
||||
|
||||
$transId = $response->transaction_id;
|
||||
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getTransactionDetails($transId);
|
||||
$this->assertTrue($response->isOk());
|
||||
|
||||
$this->assertEquals($transId, (string)$response->xml->transaction->transId);
|
||||
$this->assertEquals($amount, (string)$response->xml->transaction->authAmount);
|
||||
$this->assertEquals("Visa", (string)$response->xml->transaction->payment->creditCard->cardType);
|
||||
$this->assertEquals("A1000002", (string)$response->xml->transaction->solution->id);
|
||||
}
|
||||
|
||||
public function testGetUnsettledTransactionList()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$sale = new AuthorizeNetAIM;
|
||||
$amount = rand(1, 100);
|
||||
$response = $sale->authorizeAndCapture($amount, '4012888818888', '04/17');
|
||||
$this->assertTrue($response->approved);
|
||||
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getUnsettledTransactionList();
|
||||
$this->assertTrue($response->isOk());
|
||||
$this->assertTrue($response->xml->transactions->count() >= 1);
|
||||
}
|
||||
|
||||
public function testGetUnsettledTransactionListHasNoReturnedItems()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getUnsettledTransactionList();
|
||||
$this->assertTrue($response->isOk());
|
||||
$this->assertTrue($response->xml->transactions->count() >= 1);
|
||||
|
||||
foreach($response->xml->transactions->transaction as $transaction)
|
||||
{
|
||||
if($transaction->hasReturnedItems)
|
||||
{
|
||||
$this->assertEquals("false", $transaction->hasReturnedItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testGetBatchStatistics()
|
||||
{
|
||||
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getSettledBatchList();
|
||||
$this->assertTrue($response->isOk());
|
||||
$this->assertTrue($response->xml->batchList->count() >= 1);
|
||||
$batchId = $response->xml->batchList->batch[0]->batchId;
|
||||
|
||||
$request = new AuthorizeNetTD;
|
||||
$response = $request->getBatchStatistics($batchId);
|
||||
$this->assertTrue($response->isOk());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
183
vendor/authorizenet/authorizenet/tests/Controller_Test.php
vendored
Normal file
183
vendor/authorizenet/authorizenet/tests/Controller_Test.php
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
use \net\authorize\api\controller\base\ApiOperationBase;
|
||||
|
||||
require_once __DIR__ . '/../autoload.php';
|
||||
//include if tests/bootstrap.php is not loaded automatically
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
class Controller_Test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testARBGetSubscriptionList()
|
||||
{
|
||||
//$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 net\authorize\api\contract\v1\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName($name);
|
||||
$merchantAuthentication->setTransactionKey($transactionKey);
|
||||
//$merchantAuthentication->setMobileDeviceId()
|
||||
|
||||
$refId = 'ref' . time();
|
||||
|
||||
$sorting = new net\authorize\api\contract\v1\ARBGetSubscriptionListSortingType();
|
||||
$sorting->setOrderBy('firstName');
|
||||
$sorting->setOrderDescending(false);
|
||||
|
||||
$paging = new net\authorize\api\contract\v1\PagingType();
|
||||
$paging->setLimit(10);
|
||||
$paging->setOffset(1);
|
||||
|
||||
$request = new net\authorize\api\contract\v1\ARBGetSubscriptionListRequest();
|
||||
$request->setSearchType('subscriptionActive');
|
||||
$request->setRefId( $refId);
|
||||
$request->setSorting($sorting);
|
||||
$request->setPaging($paging);
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
|
||||
//$controller = new ApiOperationBase($request, 'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse');
|
||||
$controller = new net\authorize\api\controller\ARBGetSubscriptionListController( $request);
|
||||
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
||||
public function testARBGetSubscription()
|
||||
{
|
||||
$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 net\authorize\api\contract\v1\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName($name);
|
||||
$merchantAuthentication->setTransactionKey($transactionKey);
|
||||
|
||||
$refId = 'ref' . time();
|
||||
|
||||
$request = new net\authorize\api\contract\v1\ARBGetSubscriptionRequest();
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setRefId($refId);
|
||||
$request->setSubscriptionId("2930242");
|
||||
|
||||
$controller = new net\authorize\api\controller\ARBGetSubscriptionController($request);
|
||||
|
||||
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
||||
|
||||
$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());
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetCustomerPaymentProfileList()
|
||||
{
|
||||
$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 net\authorize\api\contract\v1\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName($name);
|
||||
$merchantAuthentication->setTransactionKey($transactionKey);
|
||||
|
||||
$refId = 'ref' . time();
|
||||
|
||||
$paging = new net\authorize\api\contract\v1\PagingType();
|
||||
$paging->setLimit("1000");
|
||||
$paging->setOffset("1");
|
||||
|
||||
|
||||
$sorting = new net\authorize\api\contract\v1\CustomerPaymentProfileSortingType();
|
||||
$sorting->setOrderBy("id");
|
||||
$sorting->setOrderDescending("false");
|
||||
|
||||
$request = new net\authorize\api\contract\v1\GetCustomerPaymentProfileListRequest();
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setRefId($refId);
|
||||
$request->setPaging($paging);
|
||||
$request->setSorting($sorting);
|
||||
$request->setSearchType("cardsExpiringInMonth");
|
||||
$request->setMonth("2020-12");
|
||||
|
||||
$controller = new net\authorize\api\controller\GetCustomerPaymentProfileListController($request);
|
||||
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
||||
|
||||
$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());
|
||||
}
|
||||
}
|
||||
|
||||
public function testDecryptPaymentData()
|
||||
{
|
||||
//$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
|
||||
|
||||
//using sandbox account log in to mint and enable visa checkout
|
||||
//You'll get a VCO api key.
|
||||
//on web page you can create and grab (from the JS console) Visa Checkout Payment Data
|
||||
//http://brianmc.github.io/checkout.html
|
||||
|
||||
$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 net\authorize\api\contract\v1\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName($name);
|
||||
$merchantAuthentication->setTransactionKey($transactionKey);
|
||||
|
||||
$refId = 'ref' . time();
|
||||
$callId = "8880580142324354001";
|
||||
|
||||
$opaqueData = new net\authorize\api\contract\v1\OpaqueDataType();
|
||||
$opaqueData->setDataDescriptor("COMMON.VCO.ONLINE.PAYMENT");
|
||||
$opaqueData->setDataKey("TD3LP3/b2IGMVDAxcAq8414q6L/6mKZ3RItyemrW4BAEIx3GQYOa52cduN1FIU7PQC/Ie4RHQZyp+amY4BTzPg485tn5lJTib++K1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AmGLhtMTFExOBDsQsJWp5w+cdJJ8VJg1w1bXt6NxcZ9U9qfkpf4wJ8TYROF349Zgcl0gjBjCRlTaQnisySXcZBfpweYCVuwKKHXw=");
|
||||
//"partialShippingAddress":{"countryCode":"US","postalCode":"98103"},"callid":"8880580142324354001","vInitRequest":{"apikey":"GY3CQNLRHKE63GWCVLHH13Ff12umyj4ZglGhGdCM6y6Liy0YE","paymentRequest":{"currencyCode":"USD","total":"16.00"},"parentUrl":"http://brianmc.github.io/checkout.html","browserLocale":"en_US","clientId":"848a93dc-8d84-48fe-9d88-e7d1e9e50abb","allowEnrollment":true,"settings":{}}}
|
||||
|
||||
$request = new net\authorize\api\contract\v1\DecryptPaymentDataRequest();
|
||||
$request->setRefId( $refId);
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setOpaqueData($opaqueData);
|
||||
$request->setCallId($callId);
|
||||
|
||||
$controller = new net\authorize\api\controller\DecryptPaymentDataController( $request);
|
||||
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
59
vendor/authorizenet/authorizenet/tests/bootstrap.php
vendored
Normal file
59
vendor/authorizenet/authorizenet/tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Bootstraps the AuthorizeNet PHP SDK test suite
|
||||
*/
|
||||
|
||||
//properties set in file take precedence over environment
|
||||
//default the value to use
|
||||
$global_api_login_id = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id");
|
||||
$global_transaction_key = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key");
|
||||
if (!defined('AUTHORIZENET_LOG_FILE'))
|
||||
{
|
||||
define( "AUTHORIZENET_LOG_FILE", "./authorize-net.log");
|
||||
}
|
||||
|
||||
// Append to log file
|
||||
$logMessage = sprintf("Logging Started: %s\n", date(DATE_RFC2822));
|
||||
if (AUTHORIZENET_LOG_FILE)
|
||||
{
|
||||
file_put_contents(AUTHORIZENET_LOG_FILE, $logMessage, FILE_APPEND);
|
||||
} else {
|
||||
echo $logMessage;
|
||||
}
|
||||
|
||||
// validate existence of available extensions
|
||||
if (!function_exists('simplexml_load_file'))
|
||||
{
|
||||
$errorMessage = 'The AuthorizeNet SDK requires the SimpleXML PHP extension.';
|
||||
throw new RuntimeException( $errorMessage );
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init'))
|
||||
{
|
||||
$errorMessage = 'The AuthorizeNet SDK requires the cURL PHP extension.';
|
||||
throw new RuntimeException( $errorMessage );
|
||||
}
|
||||
|
||||
// validate existence of credentials
|
||||
if (null == $global_api_login_id || "" == $global_api_login_id)
|
||||
{
|
||||
$errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'api_login_id'";
|
||||
throw new RuntimeException( $errorMessage );
|
||||
}
|
||||
|
||||
if (null == $global_transaction_key || "" == $global_transaction_key)
|
||||
{
|
||||
$errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'transaction_key'";
|
||||
throw new RuntimeException( $errorMessage );
|
||||
}
|
||||
|
||||
ini_set('error_reporting', E_ALL);
|
||||
|
||||
/*
|
||||
$loader = require '../vendor/autoload.php';
|
||||
if (!isset($loader))
|
||||
{
|
||||
$errorMessage = 'vendor/autoload.php could not be found.';
|
||||
throw new RuntimeException( $errorMessage );
|
||||
}
|
||||
*/
|
||||
51
vendor/authorizenet/authorizenet/tests/domain.crt
vendored
Normal file
51
vendor/authorizenet/authorizenet/tests/domain.crt
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
CONNECTED(00000003)
|
||||
---
|
||||
Certificate chain
|
||||
0 s:/C=US/ST=Utah/L=American Fork/O=Authorize.Net Corp./OU=AUTHORIZE.NET CORP./CN=secure.authorize.net
|
||||
i:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
|
||||
1 s:/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
|
||||
i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
|
||||
---
|
||||
Server certificate
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDSTCCArKgAwIBAgIQfmO9EP9/fYY45sRzhqgfGzANBgkqhkiG9w0BAQUFADBM
|
||||
MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg
|
||||
THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wOTA0MDkwMDAwMDBaFw0x
|
||||
MTA0MTEyMzU5NTlaMIGPMQswCQYDVQQGEwJVUzENMAsGA1UECBMEVXRhaDEWMBQG
|
||||
A1UEBxMNQW1lcmljYW4gRm9yazEcMBoGA1UEChMTQXV0aG9yaXplLk5ldCBDb3Jw
|
||||
LjEcMBoGA1UECxMTQVVUSE9SSVpFLk5FVCBDT1JQLjEdMBsGA1UEAxMUc2VjdXJl
|
||||
LmF1dGhvcml6ZS5uZXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAN0dh86L
|
||||
70MHbun7wTNGV0pNXsnebt3z9mCpndLUiBp5J/b57hQO5/HvevkhkDyCrky/Dn7y
|
||||
4SEJh6RHYuP4ZBk30DS8iH5dWCRHqSQgpMKhUl/+D7KHbVqgPzOpOR44TiSa1P5m
|
||||
Fv0qicvRR3iwSK/6ESywNvEJk1iiYPnpnnlvAgMBAAGjgecwgeQwDAYDVR0TAQH/
|
||||
BAIwADA2BgNVHR8ELzAtMCugKaAnhiVodHRwOi8vY3JsLnRoYXd0ZS5jb20vVGhh
|
||||
d3RlU0dDQ0EuY3JsMCgGA1UdJQQhMB8GCCsGAQUFBwMBBggrBgEFBQcDAgYJYIZI
|
||||
AYb4QgQBMHIGCCsGAQUFBwEBBGYwZDAiBggrBgEFBQcwAYYWaHR0cDovL29jc3Au
|
||||
dGhhd3RlLmNvbTA+BggrBgEFBQcwAoYyaHR0cDovL3d3dy50aGF3dGUuY29tL3Jl
|
||||
cG9zaXRvcnkvVGhhd3RlX1NHQ19DQS5jcnQwDQYJKoZIhvcNAQEFBQADgYEARa0l
|
||||
PaGn4TOw3KOMVu8eiSdho4Nmal6u9AWE3rWHDakO2/a1AkZTM2/Wpt6KI3fp6WWK
|
||||
LSsa9wLoVYSJ6pI7bmiJTvyx42yPP0PZXQSz05PHgTEGyW2jAn4N1hFvbTj28mZT
|
||||
jv2jd12xgrmX34nulLdydNaM8J7CauhMvqwwvZ0=
|
||||
-----END CERTIFICATE-----
|
||||
subject=/C=US/ST=Utah/L=American Fork/O=Authorize.Net Corp./OU=AUTHORIZE.NET CORP./CN=secure.authorize.net
|
||||
issuer=/C=ZA/O=Thawte Consulting (Pty) Ltd./CN=Thawte SGC CA
|
||||
---
|
||||
No client certificate CA names sent
|
||||
---
|
||||
SSL handshake has read 1791 bytes and written 306 bytes
|
||||
---
|
||||
New, TLSv1/SSLv3, Cipher is RC4-MD5
|
||||
Server public key is 1024 bit
|
||||
Compression: NONE
|
||||
Expansion: NONE
|
||||
SSL-Session:
|
||||
Protocol : TLSv1
|
||||
Cipher : RC4-MD5
|
||||
Session-ID: 03130000B43AEDC6A4B731EB5FA519E70B6CAC52856869A8593521601F677C28
|
||||
Session-ID-ctx:
|
||||
Master-Key: C92AA33E812EFC279AAFF16922CFB3519F94FDA820ED3158A72BD97D3BB2D0EC938E7E71817958DB545EA2E147CCC84A
|
||||
Key-Arg : None
|
||||
Start Time: 1297707939
|
||||
Timeout : 300 (sec)
|
||||
Verify return code: 20 (unable to get local issuer certificate)
|
||||
---
|
||||
196
vendor/authorizenet/authorizenet/tests/net/authorize/api/controller/ApiCoreTestBase.php
vendored
Normal file
196
vendor/authorizenet/authorizenet/tests/net/authorize/api/controller/ApiCoreTestBase.php
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
namespace net\authorize\api\controller\test;
|
||||
|
||||
use net\authorize\api\contract\v1 AS apiContract;
|
||||
use net\authorize\api\controller AS apiController;
|
||||
|
||||
require_once __DIR__ . '/../../../../../autoload.php';
|
||||
//include if tests/bootstrap.php is not loaded automatically
|
||||
//require_once __DIR__ . '/../../../../bootstrap.php';
|
||||
|
||||
class ApiCoreTestBase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $paymentOne = null;
|
||||
protected $orderType = null;
|
||||
protected $customerDataOne = null;
|
||||
protected $customerAddressOne = null;
|
||||
protected $payPalOne = null;
|
||||
|
||||
protected $counter = 0;
|
||||
protected $counterStr = "0";
|
||||
protected $refId = '';
|
||||
|
||||
protected static $LoginName = '';
|
||||
protected static $TransactionKey = '';
|
||||
|
||||
protected static $TestEnvironment = \net\authorize\api\constants\ANetEnvironment::SANDBOX;
|
||||
protected static $log_file = false;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!defined('AUTHORIZENET_LOG_FILE'))
|
||||
{
|
||||
define( "AUTHORIZENET_LOG_FILE", __DIR__ . "/../../../../../log/authorize-net.log");
|
||||
}
|
||||
self::$LoginName = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id");
|
||||
self::$TransactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key");
|
||||
self::$log_file = (defined('AUTHORIZENET_LOG_FILE') ? AUTHORIZENET_LOG_FILE : false);
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Test '%s' Starting.", \net\authorize\util\Helpers::now(), $this->getName());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
|
||||
$this->refId = 'ref' . time();
|
||||
|
||||
$this->counter = rand();
|
||||
$this->counterStr = sprintf("%s", $this->counter);
|
||||
|
||||
$driversLicenseOne = new apiContract\DriversLicenseType();
|
||||
$driversLicenseOne->setNumber( $this->getRandomString( "DL-" ));
|
||||
$driversLicenseOne->setState( "WA");
|
||||
$driversLicenseOne->setDateOfBirth( "01/01/1960");
|
||||
|
||||
$customerOne = new apiContract\CustomerType();
|
||||
$customerOne->setType("individual"); //TODO: CHANGE TO ENUM
|
||||
$customerOne->setId( $this->getRandomString( "Id" ));
|
||||
$customerOne->setEmail ( $this->counterStr . ".customerOne@test.anet.net");
|
||||
$customerOne->setPhoneNumber("1234567890");
|
||||
$customerOne->setFaxNumber("1234567891");
|
||||
//$customerOne->setDriversLicense( $driversLicenseOne);
|
||||
$customerOne->setTaxId( "911011011");
|
||||
|
||||
$creditCardOne = new apiContract\CreditCardType();
|
||||
$creditCardOne->setCardNumber( "4111111111111111" );
|
||||
$creditCardOne->setExpirationDate( "2038-12");
|
||||
|
||||
$this->paymentOne = new apiContract\PaymentType();
|
||||
$this->paymentOne->setCreditCard( $creditCardOne);
|
||||
|
||||
$this->orderType = new apiContract\OrderType();
|
||||
$this->orderType->setInvoiceNumber( $this->getRandomString( "Inv:" ));
|
||||
$this->orderType->setDescription( $this->getRandomString( "Description" ));
|
||||
|
||||
$this->customerDataOne = new apiContract\CustomerDataType();
|
||||
//$this->customerDataOne->setDriversLicense( $customerOne->getDriversLicense());
|
||||
$this->customerDataOne->setEmail( $customerOne->getEmail());
|
||||
$this->customerDataOne->setId( $customerOne->getId());
|
||||
$this->customerDataOne->setTaxId( $customerOne->getTaxId());
|
||||
$this->customerDataOne->setType( $customerOne->getType());
|
||||
|
||||
$this->customerAddressOne = new apiContract\CustomerAddressType();
|
||||
$this->customerAddressOne->setFirstName( $this->getRandomString( "FName" ));
|
||||
$this->customerAddressOne->setLastName( $this->getRandomString( "LName" ));
|
||||
$this->customerAddressOne->setCompany( $this->getRandomString( "Company" ));
|
||||
$this->customerAddressOne->setAddress( $this->getRandomString( "StreetAdd" ));
|
||||
$this->customerAddressOne->setCity( "Bellevue");
|
||||
$this->customerAddressOne->setState( "WA");
|
||||
$this->customerAddressOne->setZip( "98004");
|
||||
$this->customerAddressOne->setCountry( "USA");
|
||||
$this->customerAddressOne->setPhoneNumber( $customerOne->getPhoneNumber());
|
||||
$this->customerAddressOne->setFaxNumber( $customerOne->getFaxNumber());
|
||||
|
||||
$this->payPalOne = new apiContract\PayPalType();
|
||||
$this->payPalOne->setPaypalLc( "IT" );
|
||||
$this->payPalOne->setPaypalPayflowcolor( "FFFFF0");
|
||||
$this->payPalOne->setSuccessUrl( $this->getRandomString( "http://success.anet.net"));
|
||||
$this->payPalOne->setCancelUrl( $this->getRandomString( "http://cancel.anet.net"));
|
||||
//payPalHdrImg = GetRandomString("Hdr"),
|
||||
//payerID = GetRandomString("PayerId"),
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Test '%s' Completed.\n", \net\authorize\util\Helpers::now(), $this->getName());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRandomString( $title)
|
||||
{
|
||||
return sprintf( "%s%s", $title, $this->counterStr);
|
||||
}
|
||||
|
||||
protected function setValidAmount( $number)
|
||||
{
|
||||
$amount = $number;
|
||||
if ( self::MaxTransactionAmount < $amount)
|
||||
{
|
||||
$amount = rand(1, self::MaxTransactionAmount); //generate between 1 and MaxTransactionAmount, inclusive
|
||||
}
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param apiContract\ANetApiResponseType $response
|
||||
*/
|
||||
protected static function displayMessages( apiContract\ANetApiResponseType $response)
|
||||
{
|
||||
if ( null != $response)
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Controller Response is not null, iterating messages.", \net\authorize\util\Helpers::now());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
$msgCount = 0;
|
||||
$allMessages = $response->getMessages();
|
||||
if ( null != $allMessages )
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Controller ResultCode: '%s'.", \net\authorize\util\Helpers::now(), $allMessages->getResultCode());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
if (null != $allMessages->getMessage())
|
||||
{
|
||||
foreach ($allMessages->getMessage() as $message)
|
||||
{
|
||||
$msgCount++;
|
||||
$logMessage = sprintf("\n%d - Message, Code: '%s', Text: '%s'", $msgCount, $message->getCode(), $message->getText());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$logMessage = sprintf("\n%s: Controller Response contains '%d' messages.", \net\authorize\util\Helpers::now(), $msgCount);
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Response is null.", \net\authorize\util\Helpers::now());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const MaxTransactionAmount = 10000; //214747;
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
<?php
|
||||
namespace net\authorize\api\controller\test;
|
||||
|
||||
use net\authorize\api\contract\v1 AS apiContract;
|
||||
use net\authorize\api\controller AS apiController;
|
||||
|
||||
require_once __DIR__ . '/ApiCoreTestBase.php';
|
||||
|
||||
class CreateTransactionControllerTest extends ApiCoreTestBase
|
||||
{
|
||||
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());
|
||||
$logMessage = sprintf("\n%s: Controller Response ResultCode: '%s'.", \net\authorize\util\Helpers::now(), $response->getMessages()->getResultCode());
|
||||
if (self::$log_file) {
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
} else {
|
||||
echo $logMessage;
|
||||
}
|
||||
$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 testCreateTransactionPayPal()
|
||||
{
|
||||
$merchantAuthentication = new apiContract\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName(self::$LoginName);
|
||||
$merchantAuthentication->setTransactionKey(self::$TransactionKey);
|
||||
|
||||
$paymentType = new apiContract\PaymentType();
|
||||
$paymentType->setPayPal($this->payPalOne);
|
||||
|
||||
//create a transaction
|
||||
$transactionRequestType = new apiContract\TransactionRequestType();
|
||||
$transactionRequestType->setTransactionType( "authOnlyTransaction"); // TODO Change to Enum
|
||||
$transactionRequestType->setAmount( $this->setValidAmount( $this->counter));
|
||||
$transactionRequestType->setPayment( $paymentType);
|
||||
|
||||
$request = new apiContract\CreateTransactionRequest();
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setTransactionRequest( $transactionRequestType);
|
||||
|
||||
$controller = new apiController\CreateTransactionController($request);
|
||||
$response = $controller->executeWithApiResponse( self::$TestEnvironment);
|
||||
|
||||
// Handle the response.
|
||||
$this->assertNotNull($response, "null response");
|
||||
$this->assertNotNull($response->getMessages());
|
||||
|
||||
self::displayMessages( $response);
|
||||
if ( "Ok" != $response->getMessages()->getResultCode())
|
||||
{
|
||||
$this->displayTransactionMessages( $response);
|
||||
//Ignore assertion for now
|
||||
//$this->assertTrue( false, "Should not reach here.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertEquals("Ok", $response->getMessages()->getResultCode());
|
||||
$this->assertTrue(0 < count($response->getMessages()));
|
||||
foreach ($response->getMessages() as $message)
|
||||
{
|
||||
$this->assertEquals("I00001", $message->getCode());
|
||||
$this->assertEquals("Successful.", $response->getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testCreateTransactionApplePay()
|
||||
{
|
||||
$merchantAuthentication = new apiContract\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName(self::$LoginName);
|
||||
$merchantAuthentication->setTransactionKey(self::$TransactionKey);
|
||||
|
||||
$OpaqueData = new apiContract\OpaqueDataType();
|
||||
$OpaqueData->setDataDescriptor("COMMON.APPLE.INAPP.PAYMENT");
|
||||
$OpaqueData->setDataValue("eyJkYXRhIjoiQkRQTldTdE1tR2V3UVVXR2c0bzdFXC9qKzFjcTFUNzhxeVU4NGI2N2l0amNZSTh3UFlBT2hzaGpoWlBycWRVcjRYd1BNYmo0emNHTWR5KysxSDJWa1BPWStCT01GMjV1YjE5Y1g0bkN2a1hVVU9UakRsbEIxVGdTcjhKSFp4Z3A5ckNnc1NVZ2JCZ0tmNjBYS3V0WGY2YWpcL284WkliS25yS1E4U2gwb3VMQUtsb1VNbit2UHU0K0E3V0tycXJhdXo5SnZPUXA2dmhJcStIS2pVY1VOQ0lUUHlGaG1PRXRxK0grdzB2UmExQ0U2V2hGQk5uQ0hxenpXS2NrQlwvMG5xTFpSVFliRjBwK3Z5QmlWYVdIZWdoRVJmSHhSdGJ6cGVjelJQUHVGc2ZwSFZzNDhvUExDXC9rXC8xTU5kNDdrelwvcEhEY1JcL0R5NmFVTStsTmZvaWx5XC9RSk4rdFMzbTBIZk90SVNBUHFPbVhlbXZyNnhKQ2pDWmxDdXcwQzltWHpcL29iSHBvZnVJRVM4cjljcUdHc1VBUERwdzdnNjQybTRQendLRitIQnVZVW5lV0RCTlNEMnU2amJBRzMiLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIiOnsiYXBwbGljYXRpb25EYXRhIjoi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SjB4Z2VBd2dkMENBUUV3T3pBbk1TVXdJd1lEVlFRREhod0FZd0JvQUcwQVlRQnBBRUFBZGdCcEFITUFZUUF1QUdNQWJ3QnRBaEJjbCtQZjMrVTRwazEzblZEOW53UVFNQWtHQlNzT0F3SWFCUUF3RFFZSktvWklodmNOQVFFQkJRQUVnWUJhSzNFbE9zdGJIOFdvb3NlREFCZitKZ1wvMTI5SmNJYXdtN2M2VnhuN1phc05iQXEzdEF0OFB0eSt1UUNnc3NYcVprTEE3a3oyR3pNb2xOdHY5d1ltdTlVandhcjFQSFlTK0JcL29Hbm96NTkxd2phZ1hXUnowbk1vNXkzTzFLelgwZDhDUkhBVmE4OFNyVjFhNUpJaVJldjNvU3RJcXd2NXh1WmxkYWc2VHI4dz09In0=");
|
||||
|
||||
$paymentType = new apiContract\PaymentType();
|
||||
$paymentType->setOpaqueData( $OpaqueData);
|
||||
|
||||
//create a transaction
|
||||
$transactionRequestType = new apiContract\TransactionRequestType();
|
||||
$transactionRequestType->setTransactionType( "authCaptureTransaction"); // TODO Change to Enum
|
||||
$transactionRequestType->setAmount( $this->setValidAmount( $this->counter));
|
||||
$transactionRequestType->setPayment( $paymentType);
|
||||
|
||||
$request = new apiContract\CreateTransactionRequest();
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setTransactionRequest( $transactionRequestType);
|
||||
|
||||
$controller = new apiController\CreateTransactionController($request);
|
||||
$response = $controller->executeWithApiResponse( self::$TestEnvironment);
|
||||
|
||||
// Handle the response.
|
||||
$this->assertNotNull($response, "null response");
|
||||
$this->assertNotNull($response->getMessages());
|
||||
|
||||
self::displayMessages( $response);
|
||||
if ( "Ok" != $response->getMessages()->getResultCode())
|
||||
{
|
||||
$this->displayTransactionMessages( $response);
|
||||
//Ignore assertion for now
|
||||
//$this->assertTrue( false, "Should not reach here.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertEquals("Ok", $response->getMessages()->getResultCode());
|
||||
$this->assertTrue(0 < count($response->getMessages()));
|
||||
foreach ($response->getMessages() as $message)
|
||||
{
|
||||
$this->assertEquals("I00001", $message->getCode());
|
||||
$this->assertEquals("Successful.", $response->getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function displayTransactionMessages( apiContract\CreateTransactionResponse $response)
|
||||
{
|
||||
if ( null != $response)
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Displaying Transaction Response.", \net\authorize\util\Helpers::now());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
|
||||
if ( null != $response->getTransactionResponse())
|
||||
{
|
||||
$logMessage = sprintf("\n%s: Transaction Response Code: '%s'.", \net\authorize\util\Helpers::now(), $response->getTransactionResponse()->getResponseCode());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
|
||||
$allMessages = $response->getTransactionResponse()->getMessages();
|
||||
$allErrors = $response->getTransactionResponse()->getErrors();
|
||||
$errorCount = 0;
|
||||
if ( null != $allErrors)
|
||||
{
|
||||
foreach ( $allErrors as $error)
|
||||
{
|
||||
$errorCount++;
|
||||
$logMessage = sprintf("\n%s: %d - Error: Code:'%s', Text:'%s'", \net\authorize\util\Helpers::now(), $errorCount, $error->getErrorCode(), $error->getErrorText());
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
$messageCount = 0;
|
||||
if ( null != $allMessages)
|
||||
{
|
||||
foreach ( $allMessages as $message)
|
||||
{
|
||||
$messageCount++;
|
||||
//$logMessage = sprintf("\n%s: %d - Message: Code:'%s', Description:'%s'", \net\authorize\util\Helpers::now(), $errorCount, $message->getCode(), $message->getDescription());
|
||||
$logMessage = sprintf("\n%s: %d - Message: ", \net\authorize\util\Helpers::now(), $messageCount);
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
$logMessage = sprintf("\n%s: Transaction Response, Errors: '%d', Messages: '%d'.", \net\authorize\util\Helpers::now(), $errorCount, $messageCount);
|
||||
echo $logMessage;
|
||||
if (self::$log_file)
|
||||
{
|
||||
file_put_contents(self::$log_file, $logMessage, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
vendor/authorizenet/authorizenet/tests/net/authorize/api/controller/LogoutControllerTest.php
vendored
Normal file
36
vendor/authorizenet/authorizenet/tests/net/authorize/api/controller/LogoutControllerTest.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace net\authorize\api\controller\test;
|
||||
|
||||
use net\authorize\api\contract\v1 AS apiContract;
|
||||
use net\authorize\api\controller AS apiController;
|
||||
|
||||
require_once __DIR__ . '/ApiCoreTestBase.php';
|
||||
|
||||
class LogoutControllerTest extends ApiCoreTestBase
|
||||
{
|
||||
public function testLogout()
|
||||
{
|
||||
$merchantAuthentication = new apiContract\MerchantAuthenticationType();
|
||||
$merchantAuthentication->setName(self::$LoginName);
|
||||
$merchantAuthentication->setTransactionKey(self::$TransactionKey);
|
||||
|
||||
$request = new apiContract\LogoutRequest();
|
||||
$request->setMerchantAuthentication($merchantAuthentication);
|
||||
$request->setRefId( $this->refId);
|
||||
|
||||
$controller = new apiController\LogoutController($request);
|
||||
$response = $controller->executeWithApiResponse( self::$TestEnvironment);
|
||||
// Handle the response.
|
||||
$this->assertNotNull($response, "null response");
|
||||
$this->assertNotNull($response->getMessages());
|
||||
|
||||
$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());
|
||||
}
|
||||
}
|
||||
}
|
||||
1
vendor/authorizenet/authorizenet/tests/report.html
vendored
Normal file
1
vendor/authorizenet/authorizenet/tests/report.html
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<html><body><h2 id="AuthorizeNet_SOAP_Test">AuthorizeNet_SOAP_</h2><ul><li>Save soap doc</li><li>Get customer ids</li></ul><h2 id="AuthorizeNetAIM_Sandbox_Test">AuthorizeNetAIM_Sandbox_</h2><ul><li>Auth capture</li><li>Auth capture alternate</li><li>Auth capture short</li><li>Auth capture partial</li><li>Auth capture short no verify</li><li>Aim response fields</li><li>Void</li><li>Void short</li><li>Auth capture e check sandbox</li><li>Amex</li><li>Discover</li><li>Visa</li><li>Auth only</li><li>Auth capture void</li><li>Advanced a i m</li><li>Auth capture custom fields</li><li>Encap character</li><li>Auth capture set multiple custom fields</li><li>Invalid merchant credentials</li><li>Invalid credit card</li><li>Error</li><li>Multiple line items</li><li>All fields long method</li><li>Response methods</li><li>Set bad field</li></ul><h2 id="AuthorizeNetAIM_Live_Test">AuthorizeNetAIM_Live_</h2><ul><li>Auth capture set e check method</li><li>Auth capture e check</li><li>Auth capture live server test request</li><li>Auth capture live server</li><li>Invalid credentials</li></ul><h2 id="AuthorizeNetARB_Test">AuthorizeNetARB_</h2><ul><li><strike>All methods</strike></li><li>Create subscription long</li><li>Create subscription e check</li></ul><h2 id="AuthorizeNetCIM_Test">AuthorizeNetCIM_</h2><ul><li>Delete all customer profiles</li><li>X path</li><li>Create customer profile</li><li>Get customer profile</li><li>Create customer profile with validation mode</li><li>Update split tender group</li><li>All</li><li>Get customer profile ids</li></ul><h2 id="AuthorizeNetCP_Test">AuthorizeNetCP_</h2><ul><li>Auth capture</li><li>Auth capture track 1</li><li>Auth capture track</li><li>Auth capture track 2 error</li><li>Response fields</li><li>Xml response</li><li>Xml response failure</li></ul><h2 id="AuthorizeNetDPM_Test">AuthorizeNetDPM_</h2><ul><li>Generate fingerprint</li><li>Get credit card form</li><li>Relay response url</li></ul><h2 id="AuthorizeNetSIM_Test">AuthorizeNetSIM_</h2><ul><li>Generate hash</li><li>Amount</li><li>Is auth net</li><li>Is error</li></ul><h2 id="AuthorizeNetTD_Test">AuthorizeNetTD_</h2><ul><li>Get settled batch list</li><li>Get settled batch list include statistics</li><li>Get settled batch list for month</li><li>Get transactions for day</li><li>Get transaction list</li><li>Get transaction details</li></ul></body></html>
|
||||
Reference in New Issue
Block a user