fetchCouponBalanceByPartnerId method

Future<Response?> fetchCouponBalanceByPartnerId(
  1. String partnerId, {
  2. bool showLoader = false,
})

Implementation

Future<walletResponse.Response?> fetchCouponBalanceByPartnerId(
  String partnerId, {
  bool showLoader = false,
}) async {
  String requestTime = "";
  try {
    if (showLoader) {
      Helper.progressDialog(Get.context!, "");
    }
    final value = await ApiClient(
      baseUrl: ApiConstant.baseUrl,
      onFetchRequestTime: (time) {
        requestTime = time;
      },
      screenName: "couponTransfer",
    ).getWalletBalance(
      body: {
        "partnerId": partnerId,
      },
    );
    Helper.logEvent(
      "RESPONSE_EVENT",
      success: true,
      endPoint: Api.fetchWalletBalance,
      responseDate: DateTime.now().toString(),
      screenName: "couponTransfer",
      requestDate: requestTime,
    );
    return value.response;
  } 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.fetchWalletBalance,
        responseDate: DateTime.now().toString(),
        screenName: "couponTransfer",
        error: e,
      );
    }
    return null;
  } finally {
    if (showLoader) {
      Helper.close();
    }
  }
}