PlatformPaymentException.authenticationFailed constructor

PlatformPaymentException.authenticationFailed({
  1. required PlatformPaymentType type,
  2. String? transactionId,
  3. String? details,
  4. Object? cause,
  5. StackTrace? stack,
  6. Map<String, dynamic> metadata = const {},
})

Convenience constructor for payment authentication failures.

Implementation

factory PlatformPaymentException.authenticationFailed({
  required PlatformPaymentType type,
  String? transactionId,
  String? details,
  Object? cause,
  StackTrace? stack,
  Map<String, dynamic> metadata = const {},
}) {
  return PlatformPaymentException(
    type: type,
    errorCode: 'authentication_failed',
    userMessage: 'Payment authentication failed.',
    devMessage:
        '${type.displayName} authentication failed${details != null ? ': $details' : ''}.',
    transactionId: transactionId,
    cause: cause,
    stack: stack,
    metadata: {
      if (details != null) 'authDetails': details,
      ...metadata,
    },
  );
}