getUserPaymentTransactions method
Implementation
Future<RxList<Transactions>> getUserPaymentTransactions({
String? purpose,
}) async {
try {
paymentTransactions.value = [];
paymentPurpose.value='ALL';
if (purpose != null) {
paymentPurpose.value = purpose;
}
isPaymentTransactionLoading.value = true;
var response;
response = await Requests.getDio().get(buildUrl());
print("PaymentsHistoryResponse${response.toString()}");
if (response.statusCode == 200) {
totalRequests.value = response.data["total"];
totalPages.value = (totalRequests.value / rowsPerPage.value).ceil();
var results = PaymentTransactionsModel.fromJson(response.data);
paymentTransactions.value = [];
paymentTransactions.value = results.transactions ?? [];
isPaymentTransactionLoading.value = false;
} else {
isPaymentTransactionLoading.value = false;
}
} catch (e) {
print('PaymentsHistoryExeption${e.toString()}');
isPaymentTransactionLoading.value = false;
}
return paymentTransactions;
}