AuthorizeNet / sdk-php

PHP SDK for Authorize.Net API
Other
430 stars 403 forks source link

Response class (file) does not exist. #417

Closed iaroslavglodov closed 1 month ago

iaroslavglodov commented 3 years ago

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

bvisonl commented 3 years ago

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

jdavidzapatab commented 3 years ago

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.

WalrusSoup commented 1 year ago

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);
gnongsie commented 1 month ago

This has been corrected in the latest version. Closing this issue based on that.