RefundRequest class
Request model for processing refunds.
Supports both full and partial refunds. The amount can be less than or equal to the original transaction amount for partial refunds.
Example
// Full refund
final fullRefund = RefundRequest(
transactionId: 'TXN_123456',
amount: 100.0,
reason: 'Customer requested cancellation',
);
// Partial refund
final partialRefund = RefundRequest(
transactionId: 'TXN_123456',
amount: 25.0, // Refund only 25 TL of original 100 TL
reason: 'Partial return - damaged item',
);
final result = await provider.refund(fullRefund);
if (result.isSuccess) {
print('Refunded: ${result.refundedAmount}');
}
Important Notes
- Refunds can only be processed for successful payments
- Multiple partial refunds are allowed until the full amount is refunded
- Refund processing time varies by provider (typically 3-10 business days)
- Annotations
-
- @immutable
Constructors
-
RefundRequest({required String transactionId, required double amount, Currency currency = Currency.tryLira, String? ip, String? reason, Map<
String, dynamic> ? metadata}) -
Creates a new RefundRequest instance.
const
-
RefundRequest.fromJson(Map<
String, dynamic> json) -
Creates a RefundRequest instance from a JSON map.
factory
Properties
- amount → double
-
Amount to refund in the original transaction currency.
final
- currency → Currency
-
Currency of the refund.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- ip → String?
-
IP address of the user or admin initiating the refund.
final
-
metadata
→ Map<
String, dynamic> ? -
Additional metadata for the refund.
final
- reason → String?
-
Reason for the refund.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transactionId → String
-
The transaction ID of the original payment.
final
Methods
-
copyWith(
{String? transactionId, double? amount, Currency? currency, String? ip, String? reason, Map< String, dynamic> ? metadata}) → RefundRequest - Creates a copy of this instance with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this instance to a JSON-compatible map.
-
toString(
) → String -
A string representation of this object.
override
-
validate(
) → void - Validates the refund request and throws ValidationException if invalid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override