getWalletTransactionByCorrelationId method

Future<Content?> getWalletTransactionByCorrelationId({
  1. required String partnerId,
  2. required String correlationId,
})

Implementation

Future<Content?> getWalletTransactionByCorrelationId({
  required String partnerId,
  required String correlationId,
}) async {
  String requestTime = "";
  try {
    final value = await ApiClient(
      baseUrl: ApiConstant.baseUrl,
      onFetchRequestTime: (time) {
        requestTime = time;
      },
      onFetchResponseTime: (time) {},
      screenName: "wallet",
    ).getWalletTransactions(
      partnerId: partnerId,
      correlationId: correlationId,
      page: 1,
      size: 10,
      sort: "transactionTime",
      order: "desc",
    );
    return value.content?.isNotEmpty == true ? value.content!.first : null;
  } catch (e) {
    ConditionalLogs().customLog("error $e");
    if (e is DioException) {
      UDID.setTraceId(
        e.response?.headers.map[Constants.traceIdKey]?[0] ?? "",
      );
      Helper.logEvent(
        "ERROR_EVENT",
        failure: true,
        requestDate: requestTime,
        endPoint: Api.fetchWalletTransactions,
        responseDate: DateTime.now().toString(),
        screenName: "wallet",
        error: e,
      );
    }
    return null;
  }
}