linkNewUpiAccount method
void
linkNewUpiAccount({})
Implementation
void linkNewUpiAccount({
required String? customerMobile,
String? color,
required OnSuccess<List<UpiAccount>> onSuccess,
required OnFailure<Error> onFailure,
}) async {
try {
if (!_isTurboPluginAvailable) {
_emitFailure(onFailure);
return;
}
var requestLinkNewUpiAccountWithUI = <String, dynamic>{
"customerMobile": customerMobile,
"color": color,
};
final Map<dynamic, dynamic> getLinkedUpiAccountsResponse = await _channel
.invokeMethod('linkNewUpiAccount', requestLinkNewUpiAccountWithUI);
if (getLinkedUpiAccountsResponse["data"] != "") {
onSuccess(_getUpiAccounts(getLinkedUpiAccountsResponse["data"]));
} else {
onFailure(
Error(
errorCode: "NO_ACCOUNT_FOUND",
errorDescription: "No Account Found",
),
);
}
} on PlatformException catch (error) {
onFailure(Error(errorCode: error.code, errorDescription: error.message!));
}
}