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

Cannot use "parent" when current class scope has no parent #412

Closed
mglaman opened this issue Mar 22, 2021 · 4 comments
Closed

Cannot use "parent" when current class scope has no parent #412

mglaman opened this issue Mar 22, 2021 · 4 comments

Comments

@mglaman
Copy link

mglaman commented Mar 22, 2021

Error on PHP 7.4. Looks to be due to PaymentMaskedType.

in Composer\Autoload\includeFile called at /srv/deploy/releases/3/vendor/composer/ClassLoader.php (346)
in Composer\Autoload\ClassLoader::loadClass called at ? (?)
in spl_autoload_call called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/PaymentMaskedType.php (162)
in net\authorize\api\contract\v1\PaymentMaskedType::set called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileMaskedType.php (306)
in net\authorize\api\contract\v1\CustomerPaymentProfileMaskedType::set called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileMaskedType.php (215)
in net\authorize\api\contract\v1\CustomerProfileMaskedType::set called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/GetCustomerProfileResponse.php (132)
in net\authorize\api\contract\v1\GetCustomerProfileResponse::set called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php (151)
in net\authorize\api\controller\base\ApiOperationBase::execute called at /srv/deploy/releases/3/vendor/authorizenet/authorizenet/lib/net/authorize/api/controller/base/ApiOperationBase.php (104)
in net\authorize\api\controller\base\ApiOperationBase::executeWithApiResponse called at /srv/deploy/releases/3/app/Helpers/AuthorizeNet.php (232)
@mglaman
Copy link
Author

mglaman commented Mar 23, 2021

See

    // Json Serialize Code
    public function jsonSerialize(){
        $values = array_filter((array)get_object_vars($this),
        function ($val){
            return !is_null($val);
        });
        $mapper = \net\authorize\util\Mapper::Instance();
        foreach($values as $key => $value){
            $classDetails = $mapper->getClass(get_class() , $key);
            if (isset($value)){
                if ($classDetails->className === 'Date'){
                    $dateTime = $value->format('Y-m-d');
                    $values[$key] = $dateTime;
                }
                else if ($classDetails->className === 'DateTime'){
                    $dateTime = $value->format('Y-m-d\TH:i:s\Z');
                    $values[$key] = $dateTime;
                }
                if (is_array($value)){
                    if (!$classDetails->isInlineArray){
                        $subKey = $classDetails->arrayEntryname;
                        $subArray = [$subKey => $value];
                        $values[$key] = $subArray;
                    }
                }
            }
        }
        if (get_parent_class() == ""){
            return $values;
        }
        else{
            return array_merge(parent::jsonSerialize(), $values);
        }
    }

https://github.com/AuthorizeNet/sdk-php/blob/master/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php

It's littered throughout the code.

@ray-moncada
Copy link

You might want to look in
#383

and

#382

@venkataadithan
Copy link

update "authorizenet/authorizenet": "2.0.2", dependency, and it works for me.

@gnongsie
Copy link
Contributor

This issue does not appear in the latest version, as evidenced by recent commits and CI runs.
Closing this issue based on this.

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

4 participants