Whenever you validate accounts, conditions are returned. You must define how your application reacts to each condition. You can:
Occasionally new conditions can be introduced or support for conditions added to other countries, typically in an updated Database Table Files. Your application must be designed to react to these new conditions as follows:
You must design your application such that it can handle multiple conditions. For example, if the account details have been incorrectly entered, the application could report that the Institution does not exist and that modulus checking cannot be applied.
If you use your own wording for condition messages, you should include the severity and condition code returned by Bank Wizard to help your support team diagnose problems.
This example shows how you can validate the basic account details at the default validation level for the United Kingdom. For simplicity, it assumes that the Bank Wizard core has already been initialised.
/* Initialise a return code to indicate the status of a validation */ ret = OK /* Create a handle */ BWICreateHandle(h) /* Check that the handle is valid */ if (BWIValidHandle(h) != 0) { /* If not valid, log the error and send a suitable return code */ logBWCondition(h,"Check") return NO_BANK_WIZARD } /* Specify which country the validation is for */ BWISetValue(h,BWI_V_COUNTRY_CHECK,BWI_C_UK) /* Enter the data to validate, for the UK this is sort code and account number */ BWISetString(h,BWI_UK_SORT_CODE,sort_code) BWISetString(h,BWI_UK_ACCOUNT_NO,account_no) /* Run the validation */ BWICheck(h) /* Check for and log any fatal conditions */ if (BWINext(h,BWI_N_FATAL)) { logBWCondition(h,"Check") /* Your application must react to Bank Wizard being unavailable */ /* Free the handle */ BWIFree(h) /* Finish with a suitable return code */ return NO_BANK_WIZARD } /* Process non-fatal conditions according to your business logic */ /* Iterate through all error conditions that mean the account is invalid */ while(BWINext(h, BWI_N_ERROR) { /* Obtain the condition code */ BWIGetValue(h,BWI_V_NEXT,cond) /* Obtain the condition string */ BWIGetString(h,BWI_V_NEXT,string) /* Set the return code to reject the account details */ /* Do not finish, there may be other conditions */ ret = INVALID_ACCOUNT_DETAILS /* If this validation was initiated by a user interface, report the error */ ReportToUser(BWI_N_ERROR,cond,string) } /* Handle the warning and information conditions that mean the account details are invalid for your business application */ /* This example uses the warnings for direct debit transactions */ if(h.isCondSet(BWI_N_WARNING,BWG_W_ACCOUNT_NO_DD)) { /* Obtain the condition string */ BWIGetString(h,BWI_V_NEXT,string) /* Set the return code to reject the account details */ /* Do not finish, there may be other conditions */ ret = INVALID_ACCOUNT_DETAILS /* If this validation was initiated by a user interface, report the error */ ReportToUser(BWI_N_WARNING,BWG_W_ACCOUNT_NO_DD,string) } if(h.isCondSet(BWI_N_WARNING,BWG_W_BRANCH_NO_DD)) { /* Obtain the condition string */ BWIGetString(h,BWI_V_NEXT,string) /* Set the return code to reject the account details */ /* Do not finish, there may be other conditions */ ret = INVALID_ACCOUNT_DETAILS /* If this validation was initiated by a user interface, report the error */ ReportToUser(BWI_N_WARNING,BWG_W_BRANCH_NO_DD,string) } /* Next, handle transposition */ if(h.isCondSet(BWI_N_WARNING,BWG_W_TRANSPOSED)) { BWIGetString(h,BWI_UK_SORT_CODE,ret_sort_code) BWIGetString(h,BWI_UK_ACCOUNT_NO,ret_account_no) } else { ret_sort_code = sort_code ret_account_no = account_no } /* Now return branch data */ BWIGetValue(h,BWI_V_DATA,branch_data) if(branch_data) { /* Obtain each required field */ } /* Free the handle */ BWIFree(h) return ret |