JavaScript

Parent Previous Next

Get Billing Organizations


We need to import useful data from these 4 sources, and to load 4 different types of functions below.









There is a function called "loadReferenceData". It contains 4 different types of functions:



The "loadReferenceData" function is to ensure functions are executed sequentially. Without it, these 4 functions above are not be able to execute.









We will create a function called: getBillingOrgName.

BillingOrgID is the data that we are going to match.

Then, we will use for loop to loop BillingOrgs, and use an empty variable product to store all the looped BillingOrgs(Every time to loop BillingOrgs, there will be different value coming out.).

If BeneficiaryID in the variable product can match BillingOrgID, then it will return the BillingOrgName from the variable product.

Else, if BeneficiaryID in the variable product cannot match BillingOrgID, then it will return undefined.









function retrieveBillingOrgName used loop to get BillingOrgName in BillingOrgs[i].

function retrieveBillingOrgAccountID used loop to get AccountID in BillingOrgs[i].

function countBillingOrg is used to get length in BillingOrgs.










We will create an empty variable BillingOrgs(used in function getBillingOrgName(BillingOrgID)) and a function "loadBillingOrganizations".

Then, we will set request parameters by creating a variable headerobj:

The header contains:




Then set up http request and http event handlers.

If globalErrorID is equal to "010000"(means no error),

BillingOrgs will contain all the data in responseObj.Content.ServiceResponse.BillingOrgList.BillingOrg;.

Else, the system will come out an alert message: "Error retrieving document type list."

Once time is out, the system will come out an alert message: "Timeout retrieving document type list."





onreadystatechange



This code required data variable onreadystatechange from Jsp, please refer to onreadystatechange above.



xmlHttp



This code required data variable xmlHttp from Jsp, please refer to xmlHttp above.



ApiURL



This code required data variable ApiURL from Jsp, please refer to ApiURL above.



ontimeout



This code required data variable ontimeout from Jsp, please refer to ontimeout above.







How can we test the getBillingOrgName function?

In order to test getBillingOrgName function, we can use billPayment.html to test it.


Created with the Personal Edition of HelpNDoc: Write EPub books for the iPad