Implement a state lock version to prevent race conditions in checkout controller. refs #4190

Fix broken specs.

Add regression test for state lock version. Fixes #4190

Conflicts:
	frontend/spec/controllers/spree/checkout_controller_spec.rb
Add circle CI setup

fixes #5506
Set specs failing in upstream to pending
Change #current_order to always lock the order when querying

* I believe some of the problem with the deadlocks is happening because
  of inconsistent locking, and updating without acquiring a lock properly. As a
  test I am going to enable it across the board and see how things perform.

Conflicts:
	core/lib/spree/core/controller_helpers/order.rb
	frontend/app/controllers/spree/checkout_controller.rb
Add validations to stock items and stock movements
Change Spree::OrderUpdater#update to be performed inside a transaction
Fix spec formatting and spelling
Refactor CreateItemAdjustments#perform to not use an unscoped query

* The previous query for adjustments would return every adjustment for every
  order's line items. This would then result in a huge list of ids passed into
  the NOT IN clause, causing a huge generated SQL query to be executed.
* Refactor code to be simpler
Add adjustment total to the order summary
Change adjustments controller to only display eligible adjustments
Fix the discount to be the order adjustment total

* The promo_total does not include manual adjustments
Fix the cookie domain used for google analytics

* This is a test fix to see if GA will start tracking sessions again.

Conflicts:
	frontend/app/views/spree/shared/_google_analytics.html.erb
Refactor gateway error reporting to be more extensible
Add error parameter that includes the gateway error message
Fix variant price validation to allow nil

* The check_price validation already asserts presence, or not depending on
  the system config, and unnecessarily validations are done when
  the master variant price is not required.

Conflicts:
	core/app/models/spree/variant.rb
Fix line item quantity validation to be more precise
Refactor availability validator to use a guard clause
Fix bug where line item quantity cannot be set to zero for out-of-stock items
Change an inventory unit to be removed when it's line item is removed

* This will fix the foreign key violation when a line item is removed
  in the cart.
Add required attributes to required product admin form fields

* Adjust spec example inputs to allow submit with that restrictions.