You are here

orderConfirmationCheckSum

Used by the following Containers: 
Variable Type: 
Custom Javascript
Verifies that orderRevenue = orderTax + orderShippingCost + (sum of productQuantity * productUnitPrice )
	function() {
 var eventCommand = {{eventCommand}};
 if( eventCommand == 'orderConfirmation') {
   var productList = {{productList}};
   var productListLength = {{productListLength}};
   var productListSumValue = 0;
   var i;
   for ( i = 0; i < productListLength; i++ ) {
     productListSumValue = productListSumValue + (productList[i].productUnitPrice * productList[i].productQuantity);
   }
   var orderRevenue = {{orderRevenue}};
   var orderTax = {{orderTax}};
   var orderShippingCost = {{orderShippingCost}};

// Calculates and should expect a 0 as the Checksum
   var transactionCheckSum = orderRevenue - orderTax - orderShippingCost - productListSumValue
		
    } else {
    	return 'no order here'
    }
}