public static function ErrorHelper::handleErrors3ds in Commerce Braintree 8
Translates Braintree 3D Secure errors into Commerce exceptions.
Parameters
object $result: The Braintree result object.
bool $required: Whether 3D Secure enrollment is required.
Throws
\Drupal\commerce_payment\Exception\PaymentGatewayException The Commerce exception.
1 call to ErrorHelper::handleErrors3ds()
- Braintree3DSReview::validatePaneForm in src/
Plugin/ Commerce/ CheckoutPane/ Braintree3DSReview.php - Validates the pane form.
File
- src/
ErrorHelper.php, line 144
Class
- ErrorHelper
- Translates Braintree exceptions and errors into Commerce exceptions.
Namespace
Drupal\commerce_braintreeCode
public static function handleErrors3ds($result, $required = FALSE) {
if (empty($result)) {
// The nonce was not 3D Secured.
throw new InvalidRequestException(sprintf('The nonce was not 3D Secured'));
}
if ($result->liabilityShifted) {
return;
}
if ($result->liabilityShiftPossible || $result->status == 'authentication_unavailable') {
// Have the customer attempt the transaction again.
throw new SoftDeclineException($result->status);
}
// Customer not enrolled. Liability shift is not possible.
if ($required) {
throw new HardDeclineException($result->status);
}
}