getAllPaymentAccountForms method
Retrieves all available payment account forms for the current user.
Returns a List of PaymentAccountForm
if the operation is successful.
Throws a DaemonNotConnectedException if the client is not connected. Returns an empty list if the operation fails.
Implementation
Future<List<PaymentAccountForm>?> getAllPaymentAccountForms() async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
List<PaymentAccountForm> paymentAccountForms = [];
List<PaymentMethod> paymentMethods = (await getPaymentMethods())!;
try {
for (var paymentMethod in paymentMethods) {
var paymentAccountForm = await getPaymentAccountForm(paymentMethod.id);
if (paymentAccountForm == null) continue;
if (!paymentAccountForms.contains(paymentAccountForm)) {
paymentAccountForms.add(paymentAccountForm);
}
}
return paymentAccountForms;
} on GrpcError catch (e) {
handleGrpcError(e);
return paymentAccountForms;
}
}