Only showing unique order records if searching on attributes of associated models like bill_address or line_items

Fixes #3919
Only respond with js if .xhr? is true

Prevents user private data leak for GET requests from other domains
See discussion on rails-core mailing list
https://groups.google.com/forum/#!topic/rubyonrails-core/rwzM8MKJbKU
Remove duplicated product method

Fixes #4042
Consider both line item and variant when removing iu

Applications and extensions might set up inventory units where line item
and variant does not refer to the same product. By matching both when
removing inventory we make sure that the right inventory units are
always removed. It follows the same logic already implemented when
inventory units are create via the same OrderInventory class
Improve method naming for OrderInventory
Fix frontend features locale_spec

It failed with:

     ActionView::Template::Error:
       undefined method `content_tag' for Spree:Module

Probably due to recent changes in rails i18n api related to the security
patch in 4.0.2, see https://groups.google.com/forum/#!topic/ruby-security-ann/pLrh6DUw998
and https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a
ManifestItem struct for items in manifest

Prefer Struct over OpenStruct (which is slower and masks errors)

Fixes #4039
multi_currency is not supported out of the box, so to make the sandbox work with the EU_VAT zone, it has to be in USD.

Fixes #3986
Fixes #3987
[backend] Added "Risk Analysis" section to the order page

Will check AVS+CVV responses to validate if orders are "risky" or not

Fixes #4021
listing_spec: use active_support date functions

This could fail if run in the evening when running specs in timezones
with negative offsets.

Using Time.current and Date.current ensures values entered are in UTC.

Fixes #4038 AND probably the CI build.

Conflicts:
	backend/spec/features/admin/orders/listing_spec.rb
Use single quotes in Order#is_risky, as double quotes are interpreted by PostgreSQL as meaning a column name, not a value
Only restock on_hand inventory units

Example: Spree restocks items once you cancel an order. However it
shouldn't add stock (restock) items from backordered inventory units.

Conflicts:
	core/spec/models/spree/shipment_spec.rb
Restock items but dont process backorders for canceled orders

Fixes possible issue where canceling an order with backordered inventory
units would make other orders inventory transition from backordered to
on_hand. e.g.

    - create two separate orders of the same item at the same stock location
    - both orders will have shipment state of backorder
    - cancel one of the orders
    - the second order inventory will transition from backorder to ready

Now the second order inventory remains backorder
Only show risk analysis section if there have been payments for this order
Fix a "United States of Foo" in a test

The country factory used to generate "United States of Foo", but that
was corrected in 81898b1. With the current select2 helper, this is a
silent failure (the select2 menu is left open) as it was already the
default.
better/faster capybara select2 macros

Existing select2 (and variants) used sleep(1) to wait for the select2
dropdown to appear and then executed some javascript to select the
desired option.

This commit replaces that with a standard capybara page.find(...).click.
As well with avoiding the sleep(1), this raises an exception if the
desired option doesn't exist.

Fixes #4043