PlatformPaymentException constructor
PlatformPaymentException({})
Creates a payment exception tied to the specific provider type.
Implementation
PlatformPaymentException({
required this.type,
this.errorCode,
this.transactionId,
this.amount,
this.currency,
String? userMessage,
String? devMessage,
super.cause,
super.stack,
Map<String, dynamic> metadata = const {},
super.severity,
super.isReportable,
}) : super(
userMessage: userMessage ?? '${type.displayName} payment failed.',
devMessage:
devMessage ?? '${type.displayName} payment failed: $errorCode',
metadata: {
'paymentType': type.name,
if (errorCode != null) 'errorCode': errorCode,
if (transactionId != null) 'transactionId': transactionId,
if (amount != null) 'amount': amount,
if (currency != null) 'currency': currency,
...metadata,
},
);