We noticed that transactions using eCheck went through just fine with authorize, but the payments in Drupal still showed as "Pending". The checkout flow is configured to do "authorize and capture".
I'm not entirely sure what's going on here. There's a bunch of code in the module that seems to be in place to do the "capture" steps, but nothing invokes it.
There's a "Capture" argument for Echeck::CreatePayment, but it is unused in the code.
There's also Echeck::capturePayment()
, but it doesn't get invoked, of course, because the order already passed along $capture = true
to CreatePayment()
.
So, my theory is that CreatePayment()
is just always doing capture through the API, regardless of the settings for the Checkout Flow's "Payment Process" Pane. In contrast, it universally marks the payment as pending, regardless of if the capture is successful or not.
The code for CreatePayment()
includes this:
// Transaction request.
// eChecks have a pseudo "authorized" state, so just do AUTH_CAPTURE.
$transaction_request = new TransactionRequest([
'transactionType' => TransactionRequest::AUTH_CAPTURE,
'amount' => $payment->getAmount()->getNumber(),
]);
The comment here is a nice hint but doesn't entirely resolve the mystery -- and it seems like a disaster for someone who doesn't read the code but configures their Order for "authorize" only. Especially if they tell the purchaser that's what's going to happen! "Hey give us the info, we won't actually charge you right now." Charge them anyway. Cue angry customer. Cue looking it up in Drupal and seeing it marked "Pending" and maybe arguing with the customer. Thus the "Major" on the priority here.
(the configuration options on the order do include this caveat: "This setting is only respected if the chosen payment gateway supports authorizations." -- but we offer the site builder no clue about whether or not Echeck supports this. We just confidently indicate that it does by happily marking all payments "pending", strongly implying that we DO support it.)
This code is definitely capturing regardless of the value of $capture
argument, and doing it quietly. And this being the case, why in the world does this same function confidently set the state to "pending"?
Configure for authorize and capture. Set up eCheck and use it to make a payment. In Authorize.net, see that the money is received. Look at the Order's payment's tab, note the status of the payment.
It seems like this needs a bit of reworking, but I'll submit a patch that at least accurately sets the payment status, and perhaps includes some helpful information on the Echeck payment configuration page.
Active
1.11
Code