getPaymentAccountForm method
Retrieves the payment account form for a specific payment method.
paymentMethodId
- The ID of the payment method.
Returns a PaymentAccountForm
if the operation is successful.
Throws a DaemonNotConnectedException if the client is not connected.
Returns null
if the form could not be retrieved or does not exist.
Implementation
Future<PaymentAccountForm?> getPaymentAccountForm(String paymentMethodId) async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
PaymentAccountForm? paymentAccountForm;
try {
// Fetch from the remote service if not found locally
final paymentAccountFormReply = await havenoChannel.paymentAccountsClient!.getPaymentAccountForm(
GetPaymentAccountFormRequest(paymentMethodId: paymentMethodId),
);
if (paymentAccountFormReply.hasPaymentAccountForm()) {
paymentAccountForm = paymentAccountFormReply.paymentAccountForm;
return paymentAccountForm;
} else {
return null;
}
} on GrpcError catch (e) {
handleGrpcError(e);
return paymentAccountForm;
}
}