sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

Response class (file) does not exist.

Open iaroslavglodov opened this issue 4 years ago • 3 comments

https://github.com/AuthorizeNet/sdk-php/blob/a3e76f96f674d16e892f87c58bedb99dada4b067/lib/net/authorize/api/controller/GetTransactionListForCustomerController.php#L11

There is no such file in the repository \net\authorize\api\contract\v1\GetTransactionListForCustomerResponse

iaroslavglodov avatar Apr 12 '21 09:04 iaroslavglodov

I was going to create a PR to fix this but as per their contribution guidelines:

Part of the SDK is auto-generated based on the XML schema. Due to this auto-generation, we cannot merge contributions for request or response classes. You are welcome to open an issue to report problems or suggest improvements. Auto-generated classes include all files inside contract/v1 and controller folders, except controller/base.

Anywho, based on the same issue in the python SDK the issue is resolved by changing a class name in a controller.

In the controller net\authorize\api\controller\GetTransactionListForCustomerController.php you need to change the $responseType to: net\authorize\api\contract\v1\GetTransactionListResponse.

PR in Python SDK: https://github.com/AuthorizeNet/sdk-python/pull/142/files

bvisonl avatar Jul 07 '21 14:07 bvisonl

Same issue here. We am tempted to fork this repository for the company we work on, and apply the change ourselves to continue working without the issue, but we don't want to lose track on the actual official updates for this SDK. Any chance Authorize.net SDK development team can implement a change to fix this issue? If the problem is caused by some automatically generated code, it will need a solution somewhere else, not as a PR as mentioned in the previous comment.

jdavidzapatab avatar Jul 13 '21 16:07 jdavidzapatab

For anyone stopping by, making your own class works just fine.

\app\Patches\AuthorizeTransactionListForCustomerController.php

<?php

namespace App\Patches;

use net\authorize\api\controller\base\ApiOperationBase;

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

Then use it like you normally would:

$controller = new AuthorizeTransactionListForCustomerController($transactionListRequest);
$transactionDetailsResponse = $controller->executeWithApiResponse($this->endpoint);

WalrusSoup avatar Mar 14 '23 19:03 WalrusSoup