callTransactionAssetApi method

Future<void> callTransactionAssetApi(
  1. String transactionId,
  2. String productCode, {
  3. required String status,
  4. int offset = 0,
})

Implementation

Future<void> callTransactionAssetApi(
  String transactionId,
  String productCode, {
  required String status,
  int offset = 0,
}) async {
  BuildContext context = Get.context!;
  Helper.progressDialog(context, "Please wait..");
  try {
    String requestTime = "";
    String responseTime = "";
    CheckStockAssetModel model = await ApiClient(
      baseUrl: ApiConstant.armBaseUrl,
      onFetchRequestTime: (time) {
        requestTime = time;
      },
      onFetchResponseTime: (time) {
        responseTime = time;
      },
      screenName: "collectStockHistoryDetails",
    ).getCollectStockTransactionsAsset(
      filterStatus: status.isNotEmpty ? status : "NEW",
      scanInOrderId: transactionId,
      productCode: productCode,
      pageNo: 0,
      perPageCount: 2000,
      xUserId: SecureStorageService.readSecureData(
            SecureStorageService.xUserId,
          ) ??
          "",
    );
    Helper.logEvent(
      "RESPONSE_EVENT",
      success: true,
      endPoint: Api.getCollectStockTransactionsAsset,
      responseDate: responseTime,
      screenName: "collectStockHistoryDetails",
      requestDate: requestTime,
    );
    if (model.status == true) {
      transactionAssetList = model.data!.content ?? [];
      searchedAssetList.value = transactionAssetList;
      Get.back();
    } else {
      Get.back();
      if (model.errors != null) {
        Helper.messageDialog(
            Get.context!,
            model.errors![0].errorCode ?? "Try again!!",
            model.errors![0].errorDescription ?? "Something went wrong");
      }
    }
  } catch (err, stacktrace) {
    ConditionalLogs().customLog("$stacktrace");
    Get.back();
    MainController mainController = Get.put(MainController());
    mainController.showErrorPopup();
  }
}