PlatformPaymentException.notAvailable constructor

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

Convenience constructor when the payment method is currently unavailable.

Implementation

factory PlatformPaymentException.notAvailable({
  required PlatformPaymentType type,
  Object? cause,
  StackTrace? stack,
  Map<String, dynamic> metadata = const {},
}) {
  final msg = type.requiresDeviceCapability
      ? '${type.displayName} is not available on this device.'
      : '${type.displayName} is currently unavailable.';
  return PlatformPaymentException(
    type: type,
    errorCode: 'payment_not_available',
    userMessage: msg,
    devMessage: '${type.displayName} payment method not available.',
    cause: cause,
    stack: stack,
    metadata: metadata,
  );
}