- Issue created by @tonytheferg
I do think this is a bug, as changes to the transaction type through the provided event do not properly affect the capture behavior.
Right now, if you use TransactionRequestEvent
to add custom logic for Authorization, the request is changed as it should be, but if the site is set to $capture
, the payment will be completed on the site, while it is still only auth, pending capture on the Authnet side.
This is because the response, even though the auth is set to authOnlyTransaction
, $response->getMessageCode();
will still return a code 1
See AcceptJs.php for example:
// Select the next state based on fraud detection results.
$code = $response->getMessageCode();
$expires = 0;
$next_state = 'authorization';
if ($code == 1 && $capture) {
$next_state = 'completed';
}
Create a TransactionRequestEvent event subscriber with the payment setting on the site set to capture:
$transaction_type = TransactionRequest::AUTH_ONLY;
$transaction_request->addData('transactionType', $transaction_type);
Either pass the $capture
parameter through the event subscriber or provide a check for TransactionRequest::AUTH_ONLY;
setting after the event has been dispatched
Providing a hacky patch for AcceptJs.php.
Need to sort out best solution. Maybe I am missing something here.
Active
1.0
Code
I do think this is a bug, as changes to the transaction type through the provided event do not properly affect the capture behavior.