Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse does not exist #105

Closed
abgaryanharutyun opened this issue Feb 10, 2016 · 11 comments

Comments

@abgaryanharutyun
Copy link

Hi everyone....
Please add this file in composer.....

@ramittal
Copy link
Contributor

Pl. advise your need for this Response?

In case you are looking for response from CreateCustomerProfileFromTransactionController, the actual response type returned is CreateCustomerProfileResponse. Here is the link:
https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php

The response type you have mentioned does not exist because the API does not return this response.

@abgaryanharutyun
Copy link
Author

ok thanks....

@brianmc brianmc closed this as completed Feb 10, 2016
@growthdyn-luke
Copy link

growthdyn-luke commented May 19, 2021

I don't understand.

I'm doing this:

$request = new AnetAPI\CreateCustomerProfileFromTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setTransId($data['transaction_id']); if($data['customer_profile']) { $request->setCustomerProfileId($data['customer_profile']->uid); }else{ $request->setCustomer($customerProfile); } $controller = new AnetController\CreateCustomerProfileFromTransactionController($request);

And I'm getting this error: Class 'net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse' not found

But when I manually edit this file https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php

from this:
`<?php
namespace net\authorize\api\controller;

use net\authorize\api\contract\v1\AnetApiRequestType;
use net\authorize\api\controller\base\ApiOperationBase;

class CreateCustomerProfileFromTransactionController extends ApiOperationBase
{
public function __construct(AnetApiRequestType $request)
{
$responseType = 'net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse';
parent::__construct($request, $responseType);
}

protected function validateRequest()
{
    //validate required fields of $this->apiRequest->

    //validate non-required fields of $this->apiRequest->
}

}`

To this:
`<?php
namespace net\authorize\api\controller;

use net\authorize\api\contract\v1\AnetApiRequestType;
use net\authorize\api\controller\base\ApiOperationBase;

class CreateCustomerProfileFromTransactionController extends ApiOperationBase
{
public function __construct(AnetApiRequestType $request)
{
$responseType = 'net\authorize\api\contract\v1\CreateCustomerProfileResponse';
parent::__construct($request, $responseType);
}

protected function validateRequest()
{
    //validate required fields of $this->apiRequest->

    //validate non-required fields of $this->apiRequest->
}

}`

it works. Why is it specifying the wrong response type? Or am I missing something very obvious here?

Thanks

@ramittal

@sdenathaniel
Copy link

BUMP

@brianmc I have no idea why this issue is marked as closed it VERY much does NOT work with the composer files as of August 4th, 2021. @growthdyn-luke 's recommendation IS correct and WILL make this API work.

Solution (as per Luke): Manually edit this file https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php

Change line 11 to $responseType = 'net\authorize\api\contract\v1\CreateCustomerProfileResponse';

@josegreyes
Copy link

The solution provided by Luke fixes this for me, but because i am using Elastic Beanstalk the fix gets overwritten every time I push a change into production which is very annoying. I am not sure why this isn't slated to be fixed in a future release.

@villav
Copy link

villav commented Sep 30, 2021

Fixed worked for me as well. Could you reopen this one? Thanks

@efitz16
Copy link

efitz16 commented Oct 18, 2021

As of October 18, 2021, this is still an issue. Luke's solution fixes the issue, but of course I have to manually edit the file. Please reopen.

@wbrian-onlineed
Copy link

wbrian-onlineed commented Apr 28, 2023

This still isnt fixed as of April 2023. If anyone needs a stop-gap solution that doesnt involve editing the original Composer installation, you can just invent the missing class in your userland code as follows:

create a new file FixForAnetSDK202.php

<?php
namespace net\authorize\api\contract\v1 {
	if ( !class_exists('net\authorize\api\contract\v1CreateCustomerProfileFromTransactionResponse') ) {
		class CreateCustomerProfileFromTransactionResponse 
		extends CreateCustomerProfileResponse {}
	}
}

Include the file above at the top of whatever code file needs to use the Authorize.net SDK functions

require_once('FixForAnetSDK202.php');
// ... the rest of your userland code goes here ...

@ankitaginhotry-1890
Copy link

Yes, I am experiencing an issue where the class 'CreateCustomerProfileFromTransactionResponse' is missing. Why has this major problem not been fixed until now??

Please respond, AuthorizeNet Developer Team.

Screenshot from 2023-12-08 17-19-25

@ankitaginhotry-1890
Copy link

This still isnt fixed as of April 2023. If anyone needs a stop-gap solution that doesnt involve editing the original Composer installation, you can just invent the missing class in your userland code as follows:

create a new file FixForAnetSDK202.php

<?php
namespace net\authorize\api\contract\v1 {
	if ( !class_exists('net\authorize\api\contract\v1CreateCustomerProfileFromTransactionResponse') ) {
		class CreateCustomerProfileFromTransactionResponse 
		extends CreateCustomerProfileResponse {}
	}
}

Include the file above at the top of whatever code file needs to use the Authorize.net SDK functions

require_once('FixForAnetSDK202.php');
// ... the rest of your userland code goes here ...

Yes, it's December 2023 and the issue I'm facing isn't resolved yet. Have you found any solutions to this problem? Please share if you have.

@Nykilor
Copy link

Nykilor commented Jan 17, 2024

I know it's closed but just leaving a working workaround

(For Linux and Composer. For different OS you might need to replace the 'cp' command with a different one)

Create a file that fixes the issue:

<?php
namespace net\authorize\api\controller;

use net\authorize\api\contract\v1\AnetApiRequestType;
use net\authorize\api\controller\base\ApiOperationBase;

class CreateCustomerProfileFromTransactionController extends ApiOperationBase
{
    public function __construct(AnetApiRequestType $request)
    {
        $responseType = 'net\authorize\api\contract\v1\CreateCustomerProfileResponse';
        parent::__construct($request, $responseType);
    }

    protected function validateRequest()
    {
        //validate required fields of $this->apiRequest->

        //validate non-required fields of $this->apiRequest->
    }
}

In the composer.json add a new entry in the post-install-cmd and post-update-cmd.

{
...
"scripts": {
       ...
	"post-install-cmd": [
      "cp PATH_TO_REPLACE_CLASS vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php
      ],
      "post-update-cmd": [
      "cp PATH_TO_REPLACE_CLASS vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php"
      ]
      ...
  }
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests