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

Display the error code when the "Profile could not be created." #27

Open
lewisje opened this issue Jun 17, 2018 · 0 comments
Open

Display the error code when the "Profile could not be created." #27

lewisje opened this issue Jun 17, 2018 · 0 comments

Comments

@lewisje
Copy link

lewisje commented Jun 17, 2018

I was testing this extension during migration to a Magento 2 storefront and I got the unhelpful message, while trying to put a test transaction through, that the "Profile could not be created."

I ended up modifying AuthorizenetAdapter.php a little after line 269 to look like this:

        if ($result->getMessages()->getData('resultCode') === 'Error') {
            $err = $result->getMessages()->getMessage()[0]->getCode();
            if ($err !== self::ERROR_CODE_DUPLICATE) {
                throw new PaymentException(
                    __('Profile could not be created: ' . $err)
                );
            }
        }

This way, I could look up the error code to figure out what was wrong; in my case, the error was E00044, which meant that CIM was not enabled (I was accustomed to AIM on the Magento 1 site, and I had forgotten that CIM was something that I needed to specifically enable).

I could just submit a PR with this change, but it might not be the best way overall to give more information about an error; maybe this could be something toggled in the admin area.


(After the aforementioned quick-and-dirty change, I reverted it and more properly extended the Pmclain\AuthorizenetCim\Model\Adapter\AuthorizenetAdapter class inside my own Magento module.)

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

No branches or pull requests

1 participant