Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
AddChangeOfAddress is having a problem with using account numbers. What is the best way to resolve the issue?

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?

Votes Newest

Answers 2


Hello Ethan,

There are some doc improvements to be made here, but for the most part even though it says optional. In almost all cases AccountsIds are required. The list of AccountIds is expecting something like: account_ids=AccountIds(1, 2, 3) so in your case: account_ids=AccountIds(account_models)

Hopefully this helps,

-Trey

Posted 4 years ago
Trey Teter
124 × 2 Administrator
0

Thank you for the response. I tried using account_ids=AccountIds(account_models) like you said and imported AccountIds with from q2_sdk.hq.hq_api.wedge_online_banking.AddChangeOfAddress import AccountIds. I am now getting an error message saying "Logon Failure" and nothing more.

— Ethan Pittman   4 years ago
0

My mistake, from q2_sdk.hq.hq_api.q2_api.AddChangeOfAddress import AccountIds instead of q2_sdk.hq.hq_api.wedge_online_banking.AddChangeOfAddress import AccountIds is being used and causing a Logon Failure. @Trey Teter

— Ethan Pittman   4 years ago
0

What is your full import list?

— Trey Teter   4 years ago
0

from datetime import date
from q2_sdk.hq.hq_api.q2_api.AddChangeOfAddress import AccountIds
from q2_sdk.core.web import ajax
from q2_sdk.models.tecton import Success
from q2_sdk.core.http_handlers.tecton_server_handler import Q2TectonServerRequestHandler
from q2_sdk.hq.hq_api.q2_api import AddChangeOfAddress
from q2_sdk.hq.db.customer import GetCustomerParams
from .install.db_plan import DbPlan

— Ethan Pittman   4 years ago
1

We've identified a bug in Q2API AddChangeOfAddress that causes this error. It will need to be resolved in an HQ fix. Recommendation is to try the WedgeOnlineBanking version of AddChangeOfAddress:

https://docs.q2developer.com/api_references/hq_api/wedge_online_banking/AddChangeOfAddress.html

— Ryan Hollister   4 years ago

There is, at the time of writing this, a confirmed bug with the Q2 AddChangeOfAddress API. Quoting Ryan Hollister, a senior engineer at Q2:

"We've identified a bug in Q2API AddChangeOfAddress that causes this error. It will need to be resolved in an HQ fix. Recommendation is to try the WedgeOnlineBanking version of AddChangeOfAddress: https://docs.q2developer.com/api_references/hq_api/wedge_online_banking/AddChangeOfAddress.html"

Posted 4 years ago