Added type checking in checkout/order model

Fixes #2052