copyWith method

PaymentResponse copyWith({
  1. PaymentStatus? status,
  2. String? transactionId,
  3. String? orderId,
  4. PaymentProvider? provider,
  5. String? message,
  6. String? errorCode,
  7. Map<String, dynamic>? rawResponse,
  8. DateTime? timestamp,
  9. double? amount,
  10. String? currency,
  11. Map<String, dynamic>? metadata,
})

Create a copy of this response with updated values

Implementation

PaymentResponse copyWith({
  PaymentStatus? status,
  String? transactionId,
  String? orderId,
  PaymentProvider? provider,
  String? message,
  String? errorCode,
  Map<String, dynamic>? rawResponse,
  DateTime? timestamp,
  double? amount,
  String? currency,
  Map<String, dynamic>? metadata,
}) {
  return PaymentResponse(
    status: status ?? this.status,
    transactionId: transactionId ?? this.transactionId,
    orderId: orderId ?? this.orderId,
    provider: provider ?? this.provider,
    message: message ?? this.message,
    errorCode: errorCode ?? this.errorCode,
    rawResponse: rawResponse ?? this.rawResponse,
    timestamp: timestamp ?? this.timestamp,
    amount: amount ?? this.amount,
    currency: currency ?? this.currency,
    metadata: metadata ?? this.metadata,
  );
}