callTransactionDetailsApi method
Future<void>
callTransactionDetailsApi(
- CollectStockHistoryContentModel data,
- String transactionId, {
- required String status,
- String? name,
- String? userId,
Implementation
Future<void> callTransactionDetailsApi(
CollectStockHistoryContentModel data,
String transactionId, {
required String status,
String? name,
String? userId,
}) async {
BuildContext context = Get.context!;
Helper.progressDialog(context, "Please wait..");
try {
String requestTime = "";
String responseTime = "";
CollectStockHistoryDetailsModel model = await ApiClient(
baseUrl: ApiConstant.posBFF,
onFetchRequestTime: (time) {
requestTime = time;
},
onFetchResponseTime: (time) {
responseTime = time;
},
screenName: "collectStockHistoryDetails",
).getCollectStockHistoryProducts(
assetsTransactionId: transactionId,
limit: "10",
offset: "0",
type: "SCAN_IN",
xUserId: SecureStorageService.readSecureData(
SecureStorageService.xUserId,
) ??
"",
);
Get.back();
Helper.logEvent(
"RESPONSE_EVENT",
success: true,
endPoint: "${Api.getCollectStockHistoryTransactions}/SCAN_IN/products",
responseDate: responseTime,
screenName: "collectStockHistoryDetails",
requestDate: requestTime,
);
if (model.status == "POS200") {
transactionDetailsList = model.data?.list ?? [];
searchedDetailsList.value = transactionDetailsList;
Get.to(
() => CollectStockHistoryTransactionDetails(
transactionId: transactionId,
date: data.createdDate,
status: status,
name: name,
userId: userId,
),
);
} else {
if (model.errors != null) {
Helper.messageDialog(
Get.context!,
model.errors![0].code ?? "Try again!!",
model.errors![0].description ?? "Something went wrong");
}
}
} catch (err, stacktrace) {
ConditionalLogs().customLog("$stacktrace");
Get.back();
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
}
}