Problem/Motivation

Error 33: Email is required. This error appears when you have set the email field as required in your Authorize.net account. Other fields might be the cause as well, so it's best if you check that other fields are also optional, such as Phone or Bill to First Name.

Steps to reproduce

On auth.net accounts that have email required, you must past the email address in the customer property. Without it you get the generic error code of E00027 displayed in the Drupal log. However if you actually inspect the response, you'll see the Error 33 above.

Proposed resolution

Add email to the request.

Remaining tasks

Merge request incoming.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andyg5000 created an issue. See original summary.

andyg5000’s picture

Assigned: andyg5000 » Unassigned
Status: Active » Needs review

Merge request for this module submitted. We're just adding the customer->email to the request as an array which works and solves the problem. However, we can also coordinate with the upstream library (commerceguys/authnet) for which I have a pull request to add the data type https://github.com/commerceguys/authnet/issues/39. Since having that merged and a release rolled will likely take some time, I setteld for the "quick and dirty" fix here. If it is merged, we'll change this to :

   use CommerceGuys\AuthNet\DataTypes\Customer;
...
    $transaction_request->addDataType(new Customer([
      'email' => $order->getEmail(),
    ]));

#2911837: Error on refund if payment hasn't been settled should also be updated to include this in the void request.

rhovland’s picture

Email addresses are not required for orders. We shouldn't assume there is one on the order. Based on the code in Entity/Order.php it looks like $order->getEmail() can return an empty string. Will $transaction_request handle the email being an empty string or does it need to check if there is an email set before adding an email item to the transaction request?

andyg5000’s picture

Good point. Let me confirm that an empty string would break this request and I'll add a condition if necessary.

andyg5000’s picture

I went ahead and added the condition so we're good either way.

andyg5000’s picture

StatusFileSize
new372.41 KB

andyg5000’s picture

I realized the default branch for this is 7.x so when I opened the origin MR it was on the wrong branch. Fixed that up in https://git.drupalcode.org/project/commerce_authnet/-/merge_requests/27