refund method
Implementation
@override
Future<IfoodPagoRefundResponse> refund({required IfoodPagoRefundPayload payload}) async {
try {
final response = await methodChannel.invokeMethod<Map>('refund', payload.toJson());
if (response is Map) {
if (response['code'] == IfoodPagoStatusDeeplink.SUCCESS.name && response['data'] is Map) {
return IfoodPagoRefundResponse.fromJson(Map<String, dynamic>.from(response['data']));
} else {
throw IfoodPagoRefundException(message: response['message']);
}
} else {
throw IfoodPagoRefundException(message: 'invalid response');
}
} on IfoodPagoRefundException catch (e) {
throw IfoodPagoRefundException(message: e.message);
} on PlatformException catch (e) {
throw IfoodPagoRefundException(message: e.message ?? 'PlatformException');
} catch (e) {
throw IfoodPagoRefundException(message: "Refund Error: $e");
}
}