api/payment/js/common/payment_dispatcher.js
/*
	 * Checks arguments of getExistingPurchases([boolean], function, [function])
	 * Example: getExistingPurchases(boolean, function)
	 * 			getExistingPurchases(function)
	 *			getExistingPurchases(function, function)
	 * Note: arg1 can be either a boolean or a function
	 */
Checks arguments of getExistingPurchases([boolean], function, [function])
Example: getExistingPurchases(boolean, function)
getExistingPurchases(function)
getExistingPurchases(function, function)
Note: arg1 can be either a boolean or a function
Checks arguments of getExistingPurchases ( [ boolean ] function [ function ] ) Example : getExistingPurchases ( boolean function ) getExistingPurchases ( function ) getExistingPurchases ( function function ) Note : arg1 can be either a boolean or a function
function validateGEPArgs(arg1, arg2, arg3) {
		if (arg1 === undefined) {
			throw new Error("getExistingPurchases parameters must be defined.");
		}
		if (arg1 === null) {
			throw new Error("getExistingPurchases Parameters cannot be null.");
		}
		if (arg2 !== undefined) {
			if (arg2 === null) {
				throw new Error("getExistingPurchases Parameters cannot be null.");
			}
		}
		if (arg3 !== undefined) {
			if (arg3 === null) {
				throw new Error("getExistingPurchases Parameters cannot be null.");
			}
		}
		if (arg1.constructor === Boolean) {
			if (!(typeof arg2 === 'function')) {
				throw new Error("Please make sure callbackOnSuccess parameter is a function.");
			}
			if (arg3 !== undefined) {
				if (!(typeof arg3 === 'function')) {
					throw new Error("Please make sure callbackOnFailure parameter is a function.");
				}
			}
		} else if (typeof arg1 === 'function') {
			if (arg2 !== undefined) {
				if (!(typeof arg2 === 'function')) {
					throw new Error("Please make sure callbackOnFailure parameter is a function.");
				}
			}
		} else {
			throw new Error("getExistingPurchases() Invalid parameter type")
		}
	}
function validateGEPArgs ( arg1 , arg2 , arg3 ) { if ( arg1 === undefined ) { throw new Error ( "getExistingPurchases parameters must be defined." ) ; } if ( arg1 === null ) { throw new Error ( "getExistingPurchases Parameters cannot be null." ) ; } if ( arg2 !== undefined ) { if ( arg2 === null ) { throw new Error ( "getExistingPurchases Parameters cannot be null." ) ; } } if ( arg3 !== undefined ) { if ( arg3 === null ) { throw new Error ( "getExistingPurchases Parameters cannot be null." ) ; } } if ( arg1 . constructor === Boolean ) { if ( ! ( typeof arg2 === 'function' ) ) { throw new Error ( "Please make sure callbackOnSuccess parameter is a function." ) ; } if ( arg3 !== undefined ) { if ( ! ( typeof arg3 === 'function' ) ) { throw new Error ( "Please make sure callbackOnFailure parameter is a function." ) ; } } } else if ( typeof arg1 === 'function' ) { if ( arg2 !== undefined ) { if ( ! ( typeof arg2 === 'function' ) ) { throw new Error ( "Please make sure callbackOnFailure parameter is a function." ) ; } } } else { throw new Error ( "getExistingPurchases() Invalid parameter type" ) } }
Checks arguments of getExistingPurchases([boolean], function, [function])
 Example: getExistingPurchases(boolean, function)
                      getExistingPurchases(function)
                      getExistingPurchases(function, function)
 Note: arg1 can be either a boolean or a function
Checks arguments of getExistingPurchases ( [ boolean ] function [ function ] ) Example : getExistingPurchases ( boolean function ) getExistingPurchases ( function ) getExistingPurchases ( function function ) Note : arg1 can be either a boolean or a function
// arg1 must be defined and not null
 // if arg2 is defined, check if null 
 // if arg3 is defined, check if null 
 // Check if arg1 is a boolean or a function to determine type for second and third arguments
 // assume getExistingPurchases(boolean, function, [function]);
 // assume getExistingPurchases(function, [function]);
 // arg1 is either a boolean or function
