cancel
Showing results for 
Search instead for 
Did you mean: 

PHP SDK

When I am using this api
CreateCustomerProfileFromTransactionController the response class included below is not in this path and the sdk 
net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse.
 
So I am getting error
If anybody know Please help
sanjo
Member
2 REPLIES 2

In CreateCustomerProfileFromTransactionController  class we have included the response class net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse. But it is not in PHP SDK latest version.

So the error showing is

Throwable - : Class "net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse" not found on File /var/www/html/web/application/libraries/sdk-php-master/lib/net/authorize/api/controller/base/ApiOperationBase.php at Line no. 150

If anybody faced this issue and solved ,Please help 

 

sanjo
Member

The code we used is below

function createCustomerProfile($transactionId) {
$this->paymentLog($transactionId, 'Webhook Response - Visited 1 - 9: ', 3, '', "Response : ");
$PaymentConfig = get_payment_config(null);
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($PaymentConfig['anet_api_login_id']);
$merchantAuthentication->setTransactionKey($PaymentConfig['anet_translation_key']);

//$customerProfile = new AnetAPI\CustomerProfileType();
$customerProfile = new AnetAPI\CustomerProfileBaseType();
//$customerProfile->setMerchantCustomerId("123212");
//$customerProfile->setEmail(rand(0, 10000) . "@test" .".com");
//$customerProfile->setDescription(rand(0, 10000) ."sample description");
$customerProfile->setDescription('Transaction:'.$transactionId);

//$request = new AnetAPI\CreateCustomerProfileRequest();
//$request->setMerchantAuthentication($merchantAuthentication);
//$request->setProfile($customerProfile);

$request = new AnetAPI\CreateCustomerProfileFromTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setTransId($transactionId);
$request->setCustomer($customerProfile);

//$controller = new AnetController\CreateCustomerProfileController($request);
$controller = new AnetController\CreateCustomerProfileFromTransactionController($request);
 

 


$controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);



$this->paymentLog($transactionId, 'Webhook Response - Visited after controller 2 - 9: ', 14, '', "Response : ".json_encode($response));


if ($response != null && $response->getMessages()->getResultCode() == "Ok") {

$customerProfileId = $response->getCustomerProfileId();
$this->paymentLog($transactionId, 'Webhook Response - Visited 3 - 9: profile Id:'.$customerProfileId, 16, '', "Response : ");
} else {
// Handle customer profile creation errors
$customerProfileId = 0;
//$errorMessages = $response->getMessages()->getMessage();
$this->paymentLog($transactionId, 'Webhook Response - Visited 1 - 9: profile ID'.$customerProfileId, 16, '', "Response : ");
}
return $customerProfileId;
}

sanjo
Member