added server-side order and discount calculation