payWithCard method

Implementation

Future<ValueResult<PaymentStatusResponse>> payWithCard(
  CardPaymentRequest request,
) async {
  try {
    final response = await _client.dio.post(
      '/payments/card',
      data: request.toJson(),
    );
    final data = PaymentStatusResponse.fromJson(response.data);
    return ValueResult.success(data);
  } on DioException catch (e) {
    return _parseGatewayError<PaymentStatusResponse>(e);
  } catch (e) {
    return ValueResult.failure('Erro inesperado ao processar pagamento.');
  }
}