File: /var/www/dev.captainschairit.com/wp-content/themes/captainschare/get-customer-profile.php
<?php
require VENDOR_AUTOLOAD;
require_once CONSTANTS;
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
function getCustomerProfile($profileIdRequested)
{
/* Create a merchantAuthenticationType object with authentication details
retrieved from the constants file */
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
// Set the transaction's refId
$refId = 'ref' . time();
// Retrieve an existing customer profile along with all the associated payment profiles and shipping addresses
$request = new AnetAPI\GetCustomerProfileRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setCustomerProfileId($profileIdRequested);
$controller = new AnetController\GetCustomerProfileController($request);
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
// $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::PRODUCTION);
return $response;
}
if(!defined('DONT_RUN_SAMPLES'))
{
// getCustomerProfile($profileIdRequested);
}
?>