refund method
Future<LaranjinhaRefundResponse>
refund({
- required LaranjinhaRefundPayload refundPayload,
override
Implementation
@override
Future<LaranjinhaRefundResponse> refund({required LaranjinhaRefundPayload refundPayload}) async {
try {
final refund = refundPayload.toJson();
final response = await methodChannel.invokeMethod<Map>('refund', refund);
if (response is Map) {
if (response['code'] == LaranjinhaStatusDeeplink.SUCCESS.name) {
final jsonData = Map.from(response['data']);
return LaranjinhaRefundResponse.fromJson(json: jsonData.cast());
} else {
throw LaranjinhaRefundException(message: response['message']);
}
} else {
throw LaranjinhaRefundException(message: 'invalid response');
}
} on LaranjinhaRefundException catch (e) {
throw LaranjinhaRefundException(message: e.message);
} on PlatformException catch (e) {
throw LaranjinhaRefundException(message: e.message ?? 'PlatformException');
} catch (e) {
throw LaranjinhaRefundException(message: "Status payment Error: $e");
}
}