Dont send a HTTP POST when removing non-persisted nested fields

Fixes #3204
Check promotion eligilbity before performing CreateLineItems promo action

See coresponding 1-2-stable fix in pull request 3147.

Fixes #3219
Wrap permalink saving in a with_lock block to lock the table during updating

In addition, only select the permalink field from the table when querying all similarly-prefixed permalinks

This should prevent duplicate permalinks being generated by different processes hitting the database at the same time.

Fixes #2714

Conflicts:
	core/lib/spree/core/permalinks.rb
Improve comment for Order#has_unprocessed_payments?

Fixes #3226
jQuery Validate IE9 event handle fix
Reload shipments during Order#finalize to prevent possible attempts to call update_column on objects representing records that no longer exist

Code to repo:

bundle exec rails c

require 'ffaker'
require 'spree/core/testing_support/factories'
order_number = R583837274
shipping_method = FactoryGirl.create(:shipping_method)
payment_method = FactoryGirl.create(:payment_method, :display_on => front_end)
order = FactoryGirl.create(:order, :number => order_number)
order.shipping_method = shipping_method
order.state
order.next
order.state
order.next
order.state

Stacktrace is this:

ActiveRecord::ActiveRecordError: can not update on a new record object
  from /Users/ryanbigg/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/active_record/persistence.rb:195:in `update_column'
  from /Users/ryanbigg/Projects/gems/spree/core/app/models/spree/shipment.rb:105:in `update!'
  from /Users/ryanbigg/Projects/gems/spree/core/app/models/spree/order.rb:392:in `block in finalize!'
  from /Users/ryanbigg/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:89:in `each'
  from /Users/ryanbigg/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
  from /Users/ryanbigg/Projects/gems/spree/core/app/models/spree/order.rb:392:in `finalize!'
Add inventory units for order, now necessary when testing create_shipment method
Newer jQuery.attr returns undefined, handle gracefully

Fixes #3236
replace ids/names for select boxes as well

Fixes #3236
Log CVV response messages on payments

Fixes #3266
Not all promotions respond_to :products

Fixes #3265
Fixes #3261
Remove dash from list of components that top-level test_app generates

Thanks to @mrpollo
Fix race condition with product permalink generation

See this comment for a nice script on how to reproduce: https://github.com/spree/spree/issues/2714#issuecomment-19798918

Product creation in the API will now automatically be retried if an ActiveRecord::RecordNotUnique exception is thrown. This would be thrown due to the unique index which now exists on the spree_products table.

This commit also adds similar unique indexes to the orders, shipments and stock_transfers tables, although I was unable to get these showing similar behaviour to the products API in my testing.

Fixes #2714

Conflicts:
	core/lib/spree/core/permalinks.rb
Update product_spec to check for ActiveRecord::RecordNotUnique when creating a product with duplicate permalinks, rather than a typical validation error
Test clicking logo in admin returns to /admin

Fixes #3221
Add authorization to the update action for Checkouts API
Fix last_incomplete_spree_order to return 'last' order (cherry picked from commit 8c970aac82a0a16ba19eaa6b81c8ae393b435325)

Fixes #3296
Bump activemerchant dependency to 1.34

Fixes #3319
Makes cvv_response optional

Fixes #3330
Execute transition callbacks in promos

Fixes #3364