I am trying to use AddChangeOfAddress to update a user's information. A problem that I am running into is that the field 'accounts_ids' does not seem to be taking proper inputs. When I feed account numbers into the field I am given errors in my HQ response.
This is the code I am using to fill-out the API call.
# User data to go to database based on user input from previous route
home_addr = {
'addr_line1': self.form_fields['addr-line-primary'],
'addr_line2': self.form_fields['addr-line-secondary'],
'city': self.form_fields['city'],
'state': self.form_fields['state'],
'zip_code': str(self.form_fields['zip-code'])
}
home_phone = str(self.form_fields['home-tel'])
mobile_phone = str(self.form_fields['mobile-tel'])
email_addr = self.form_fields['email']
account_models = []
# Collect all account numbers for the user
for account in self.account_list:
account_models.append(account.host_acct_id)
# Query UserRow in order to obtain the user's Address ID
# This will be needed to use AddChangeOfAddress
user_res = await self.db.user.get(user_id=self.online_user.user_id)
# Extract Address ID from UserRow in the DB
address_id = user_res[0].DefaultAddressID
# Query AddressRow in order to obtain the user's country ID and Province
address_res = await self.db.address.get(address_id=address_id)
# Pull Country ID and Province from AddressRow in the DB
country_id = address_res[0].CountryID
province = address_res[0].Province
# Parameters that will be used to change the user's information based on their prior input
params_obj = AddChangeOfAddress.ParamsObj(
logger=self.logger,
end_user_logon_name=self.online_user.login_name,
ui_source='OnlineBanking',
process_date=str(date.today()),
old_address_id=address_id,
description='Updated info from verification',
street_address1=home_addr['addr_line1'],
street_address2=home_addr['addr_line2'],
city=home_addr['city'],
state=home_addr['state'],
postal_code=home_addr['zip_code'],
email_address=email_addr,
home_phone_number=home_phone,
work_phone_number=self.online_user.work_phone,
cell_phone_number=mobile_phone,
country_id=country_id,
province=province,
account_ids=account_models,
hq_credentials=self.hq_credentials
)
# Change the user's information in the DB based on the previous parameters
hq_response = await AddChangeOfAddress.execute(params_obj, use_json=False)
From this code, the HQ response I am receiving is this:
: { "Result": { "ErrorCode": "-1", "ErrorDescription": "HydraError:-2/Exception Message:Exception: HrMsg:Q2.Hydra.Framework.HydraException: No account specified ExMsg:No account specified [AuditId:2937623]", "HydraErrorReturnCode": "-2", "HydraErrorReturnCodeDescription": "Exception", "HydraExceptionMessage": "Exception: HrMsg:Q2.Hydra.Framework.HydraException: No account specified ExMsg:No account specified [AuditId:2937623]" } }
When I try to execute the API call using JSON with AddChangeOfAddress.execute(params_obj, use_json=True) I am given this in the HQ response:
: { "Result": { "ErrorCode": "-1", "ErrorDescription": "Logon failure", "HydraErrorReturnCode": "0" } }
Since account_ids was causing issues and it is optional according to the docs, I decided to try to get rid of it with account_ids=None or just deleting it from the code, but that returned another error message in my HQ response:
: { "Result": { "ErrorCode": "-1", "ErrorDescription": "Object reference not set to an instance of an object.", "HydraErrorReturnCode": "0" } }
At this point, I'm unsure as to what the error is. I know there are valid account numbers in the dictionary because I printed them to the console using a template. Are there any ideas to why the field would be rejecting the input and not updating the DB?