solidus_core 1.1.4 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/images/logo/solidus_logo.png +0 -0
- data/app/helpers/spree/base_helper.rb +2 -3
- data/app/models/concerns/spree/adjustment_source.rb +1 -1
- data/app/models/concerns/spree/default_price.rb +3 -1
- data/app/models/concerns/spree/named_type.rb +1 -1
- data/app/models/concerns/spree/user_methods.rb +10 -0
- data/app/models/spree/adjustment.rb +1 -1
- data/app/models/spree/adjustment_reason.rb +2 -4
- data/app/models/spree/app_configuration.rb +36 -0
- data/app/models/spree/base.rb +10 -1
- data/app/models/spree/calculator/tiered_percent.rb +2 -1
- data/app/models/spree/classification.rb +1 -1
- data/app/models/spree/country.rb +3 -3
- data/app/models/spree/credit_card.rb +2 -2
- data/app/models/spree/customer_return.rb +3 -4
- data/app/models/spree/inventory_unit.rb +13 -24
- data/app/models/spree/item_adjustments.rb +5 -5
- data/app/models/spree/line_item.rb +6 -15
- data/app/models/spree/log_entry.rb +1 -1
- data/app/models/spree/option_type.rb +4 -2
- data/app/models/spree/option_type_prototype.rb +6 -0
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/order.rb +18 -63
- data/app/models/spree/order/checkout.rb +4 -2
- data/app/models/spree/order_cancellations.rb +52 -1
- data/app/models/spree/order_contents.rb +1 -1
- data/app/models/spree/order_merger.rb +143 -0
- data/app/models/spree/order_shipping.rb +3 -3
- data/app/models/spree/order_update_attributes.rb +42 -0
- data/app/models/spree/order_updater.rb +1 -1
- data/app/models/spree/payment.rb +16 -10
- data/app/models/spree/payment_create.rb +68 -0
- data/app/models/spree/payment_method.rb +0 -1
- data/app/models/spree/preference.rb +1 -1
- data/app/models/spree/price.rb +1 -8
- data/app/models/spree/product.rb +9 -44
- data/app/models/spree/product/scopes.rb +9 -7
- data/app/models/spree/promotion/rules/nth_order.rb +1 -1
- data/app/models/spree/promotion/rules/taxon.rb +2 -1
- data/app/models/spree/promotion_chooser.rb +1 -0
- data/app/models/spree/promotion_code.rb +1 -1
- data/app/models/spree/promotion_rule_taxon.rb +6 -0
- data/app/models/spree/property.rb +2 -1
- data/app/models/spree/property_prototype.rb +6 -0
- data/app/models/spree/prototype.rb +6 -2
- data/app/models/spree/reimbursement.rb +10 -0
- data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +1 -1
- data/app/models/spree/return_reason.rb +1 -7
- data/app/models/spree/role_user.rb +3 -5
- data/app/models/spree/shipment.rb +6 -11
- data/app/models/spree/shipping_method.rb +1 -7
- data/app/models/spree/shipping_rate.rb +3 -14
- data/app/models/spree/stock/coordinator.rb +48 -4
- data/app/models/spree/stock/estimator.rb +3 -6
- data/app/models/spree/stock/packer.rb +18 -2
- data/app/models/spree/stock/shipping_rate_selector.rb +16 -0
- data/app/models/spree/stock/shipping_rate_sorter.rb +16 -0
- data/app/models/spree/stock_item.rb +19 -15
- data/app/models/spree/stock_location.rb +2 -12
- data/app/models/spree/stock_transfer.rb +3 -3
- data/app/models/spree/store_credit.rb +2 -2
- data/app/models/spree/tax_category.rb +3 -2
- data/app/models/spree/tax_rate.rb +7 -14
- data/app/models/spree/taxon.rb +4 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/transfer_item.rb +2 -2
- data/app/models/spree/unit_cancel.rb +2 -0
- data/app/models/spree/variant.rb +9 -14
- data/app/models/spree/zone.rb +6 -0
- data/app/models/spree/zone_member.rb +1 -4
- data/app/views/spree/order_mailer/cancel_email.text.erb +0 -0
- data/config/locales/en.yml +7 -5
- data/db/default/spree/countries.rb +1 -1
- data/db/default/spree/zones.rb +5 -11
- data/db/migrate/20130213191427_create_default_stock.rb +1 -1
- data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +1 -1
- data/db/migrate/20140309033438_create_store_from_preferences.rb +5 -2
- data/db/migrate/20141009204607_add_store_id_to_orders.rb +6 -2
- data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +5 -0
- data/db/migrate/20141217215630_update_product_slug_index.rb +6 -0
- data/db/migrate/20150225205344_move_promotion_code_to_promotion_code_value.rb +2 -2
- data/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +10 -0
- data/db/migrate/20151117063249_convert_habtm_to_hmt_for_properties_prototypes.rb +17 -0
- data/db/migrate/20151124062500_convert_habtm_to_hmt_for_option_type_prototypes.rb +17 -0
- data/db/migrate/20151126063028_convert_habtm_to_hmt_for_taxons_promotion_rules.rb +15 -0
- data/db/migrate/20151219020209_add_stock_item_unique_index.rb +9 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +1 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +1 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -1
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/backend/all.js +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/backend/all.css +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +3 -0
- data/lib/spree/core/controller_helpers/common.rb +1 -1
- data/lib/spree/core/controller_helpers/order.rb +1 -1
- data/lib/spree/core/controller_helpers/payment_parameters.rb +104 -5
- data/lib/spree/core/engine.rb +3 -2
- data/lib/spree/core/stock_configuration.rb +11 -0
- data/lib/spree/core/unreturned_item_charger.rb +4 -4
- data/lib/spree/core/version.rb +9 -1
- data/lib/spree/permission_sets/restricted_stock_transfer_management.rb +15 -24
- data/lib/spree/permitted_attributes.rb +3 -1
- data/lib/spree/testing_support/capybara_ext.rb +14 -40
- data/lib/spree/testing_support/factories.rb +0 -15
- data/lib/spree/testing_support/factories/address_factory.rb +3 -0
- data/lib/spree/testing_support/factories/adjustment_factory.rb +9 -1
- data/lib/spree/testing_support/factories/carton_factory.rb +4 -1
- data/lib/spree/testing_support/factories/customer_return_factory.rb +4 -0
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +5 -0
- data/lib/spree/testing_support/factories/line_item_factory.rb +3 -0
- data/lib/spree/testing_support/factories/option_type_factory.rb +6 -0
- data/lib/spree/testing_support/factories/{options_factory.rb → option_value_factory.rb} +0 -5
- data/lib/spree/testing_support/factories/order_factory.rb +13 -3
- data/lib/spree/testing_support/factories/order_promotion_factory.rb +3 -0
- data/lib/spree/testing_support/factories/payment_factory.rb +13 -5
- data/lib/spree/testing_support/factories/price_factory.rb +2 -0
- data/lib/spree/testing_support/factories/product_factory.rb +7 -1
- data/lib/spree/testing_support/factories/product_option_type_factory.rb +3 -0
- data/lib/spree/testing_support/factories/product_property_factory.rb +3 -0
- data/lib/spree/testing_support/factories/promotion_code_factory.rb +3 -0
- data/lib/spree/testing_support/factories/promotion_factory.rb +3 -0
- data/lib/spree/testing_support/factories/prototype_factory.rb +2 -0
- data/lib/spree/testing_support/factories/refund_factory.rb +10 -5
- data/lib/spree/testing_support/factories/refund_reason_factory.rb +5 -0
- data/lib/spree/testing_support/factories/reimbursement_factory.rb +2 -0
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -4
- data/lib/spree/testing_support/factories/return_item_factory.rb +4 -0
- data/lib/spree/testing_support/factories/return_reason_factory.rb +5 -0
- data/lib/spree/testing_support/factories/shipment_factory.rb +6 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +22 -10
- data/lib/spree/testing_support/factories/shipping_rate_factory.rb +9 -0
- data/lib/spree/testing_support/factories/state_factory.rb +2 -0
- data/lib/spree/testing_support/factories/stock_item_factory.rb +4 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -0
- data/lib/spree/testing_support/factories/stock_movement_factory.rb +2 -0
- data/lib/spree/testing_support/factories/{stock_factory.rb → stock_package_factory.rb} +5 -10
- data/lib/spree/testing_support/factories/stock_packer_factory.rb +13 -0
- data/lib/spree/testing_support/factories/stock_transfer_factory.rb +2 -2
- data/lib/spree/testing_support/factories/store_credit_event_factory.rb +4 -1
- data/lib/spree/testing_support/factories/store_credit_factory.rb +10 -6
- data/lib/spree/testing_support/factories/tax_category_factory.rb +2 -0
- data/lib/spree/testing_support/factories/tax_rate_factory.rb +4 -0
- data/lib/spree/testing_support/factories/taxon_factory.rb +2 -0
- data/lib/spree/testing_support/factories/user_factory.rb +6 -2
- data/lib/spree/testing_support/factories/variant_factory.rb +5 -0
- data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +3 -0
- data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +4 -0
- data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +3 -0
- data/lib/spree/testing_support/factories/zone_factory.rb +6 -0
- data/lib/spree/testing_support/sequences.rb +9 -0
- data/lib/tasks/exchanges.rake +4 -3
- data/lib/tasks/migrations/copy_shipped_shipments_to_cartons.rake +2 -2
- data/solidus_core.gemspec +4 -5
- data/spec/helpers/base_helper_spec.rb +6 -6
- data/spec/helpers/order_helper_spec.rb +1 -1
- data/spec/helpers/products_helper_spec.rb +2 -2
- data/spec/helpers/taxons_helper_spec.rb +1 -1
- data/spec/lib/spree/core/controller_helpers/payment_parameters_spec.rb +107 -7
- data/spec/lib/spree/core/importer/order_spec.rb +1 -1
- data/spec/lib/spree/core/stock_configuration_spec.rb +16 -0
- data/spec/lib/spree/core/testing_support/factories/address_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/adjustment_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/adjustment_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/calculator_factory_spec.rb +42 -0
- data/spec/lib/spree/core/testing_support/factories/carton_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/country_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/credit_card_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb +28 -0
- data/spec/lib/spree/core/testing_support/factories/image_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/inventory_unit_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/line_item_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/option_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/option_value_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +49 -0
- data/spec/lib/spree/core/testing_support/factories/order_promotion_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/payment_method_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/price_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/product_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/product_option_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/product_property_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_code_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/property_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/prototype_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/refund_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/refund_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/reimbursement_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/reimbursement_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/return_authorization_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/return_item_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/return_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/role_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/shipment_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +28 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_rate_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/state_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_item_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_location_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/stock_movement_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_package_factory_spec.rb +26 -0
- data/spec/lib/spree/core/testing_support/factories/stock_packer_factory_spec.rb +16 -0
- data/spec/lib/spree/core/testing_support/factories/stock_transfer_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_event_factory_spec.rb +42 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_type_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_update_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tax_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tax_rate_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/taxon_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/taxonomy_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tracker_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/user_factory_spec.rb +22 -0
- data/spec/lib/spree/core/testing_support/factories/variant_factory_spec.rb +36 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_condition_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_value_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/zone_factory_spec.rb +18 -0
- data/spec/lib/spree/core/unreturned_item_charger_spec.rb +1 -1
- data/spec/lib/spree/core/version_spec.rb +17 -0
- data/spec/lib/spree/money_spec.rb +1 -1
- data/spec/mailers/carton_mailer_spec.rb +1 -1
- data/spec/mailers/order_mailer_spec.rb +1 -1
- data/spec/mailers/reimbursement_mailer_spec.rb +1 -3
- data/spec/mailers/test_mailer_spec.rb +1 -3
- data/spec/models/spree/address_spec.rb +4 -4
- data/spec/models/spree/adjustment_reason_spec.rb +1 -3
- data/spec/models/spree/app_configuration_spec.rb +4 -0
- data/spec/models/spree/calculator/price_sack_spec.rb +3 -3
- data/spec/models/spree/calculator/shipping/price_sack_spec.rb +3 -3
- data/spec/models/spree/calculator/tiered_percent_spec.rb +86 -10
- data/spec/models/spree/carton_spec.rb +3 -1
- data/spec/models/spree/classification_spec.rb +3 -3
- data/spec/models/spree/credit_card_spec.rb +16 -16
- data/spec/models/spree/customer_return_spec.rb +1 -1
- data/spec/models/spree/gateway/bogus_simple.rb +1 -1
- data/spec/models/spree/inventory_unit_spec.rb +3 -3
- data/spec/models/spree/item_adjustments_spec.rb +1 -1
- data/spec/models/spree/line_item_spec.rb +2 -2
- data/spec/models/spree/option_type_spec.rb +2 -2
- data/spec/models/spree/option_value_spec.rb +2 -2
- data/spec/models/spree/order/callbacks_spec.rb +1 -1
- data/spec/models/spree/order/checkout_spec.rb +16 -11
- data/spec/models/spree/order/payment_spec.rb +24 -22
- data/spec/models/spree/order/state_machine_spec.rb +1 -1
- data/spec/models/spree/order/validations_spec.rb +1 -1
- data/spec/models/spree/order_cancellations_spec.rb +63 -0
- data/spec/models/spree/order_contents_spec.rb +1 -1
- data/spec/models/spree/order_merger_spec.rb +133 -0
- data/spec/models/spree/order_spec.rb +39 -159
- data/spec/models/spree/order_update_attributes_spec.rb +82 -0
- data/spec/models/spree/order_updater_spec.rb +6 -4
- data/spec/models/spree/payment_create_spec.rb +131 -0
- data/spec/models/spree/payment_spec.rb +130 -48
- data/spec/models/spree/permission_sets/restricted_stock_transfer_management_spec.rb +91 -33
- data/spec/models/spree/product_filter_spec.rb +3 -3
- data/spec/models/spree/product_spec.rb +80 -26
- data/spec/models/spree/promotion/actions/create_adjustment_spec.rb +1 -1
- data/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/nth_order_spec.rb +1 -1
- data/spec/models/spree/promotion/rules/user_spec.rb +2 -2
- data/spec/models/spree/promotion_handler/coupon_spec.rb +2 -2
- data/spec/models/spree/promotion_spec.rb +18 -18
- data/spec/models/spree/reimbursement_spec.rb +22 -0
- data/spec/models/spree/return_item_spec.rb +2 -2
- data/spec/models/spree/shipment_spec.rb +28 -12
- data/spec/models/spree/shipping_method_spec.rb +2 -2
- data/spec/models/spree/shipping_rate_spec.rb +3 -3
- data/spec/models/spree/stock/coordinator_spec.rb +5 -0
- data/spec/models/spree/stock/estimator_spec.rb +35 -1
- data/spec/models/spree/stock/package_spec.rb +1 -1
- data/spec/models/spree/stock/packer_spec.rb +2 -3
- data/spec/models/spree/stock/shipping_rate_selector_spec.rb +16 -0
- data/spec/models/spree/stock/shipping_rate_sorter_spec.rb +16 -0
- data/spec/models/spree/stock_item_spec.rb +5 -7
- data/spec/models/spree/stock_location_spec.rb +5 -9
- data/spec/models/spree/stock_transfer_spec.rb +33 -13
- data/spec/models/spree/store_credit_event_spec.rb +1 -1
- data/spec/models/spree/store_credit_spec.rb +1 -1
- data/spec/models/spree/tax_rate_spec.rb +381 -120
- data/spec/models/spree/taxon_spec.rb +3 -3
- data/spec/models/spree/transfer_item_spec.rb +4 -4
- data/spec/models/spree/unit_cancel_spec.rb +1 -1
- data/spec/models/spree/variant_spec.rb +3 -3
- data/spec/models/spree/zone_spec.rb +35 -1
- data/spec/support/concerns/working_factories.rb +9 -0
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
- data/vendor/assets/javascripts/jquery.payment.js +231 -80
- metadata +103 -27
- data/app/models/spree/order/currency_updater.rb +0 -40
- data/spec/models/spree/order/currency_updater_spec.rb +0 -32
@@ -11,8 +11,8 @@ class MovePromotionCodeToPromotionCodeValue < ActiveRecord::Migration
|
|
11
11
|
select
|
12
12
|
spree_promotions.id,
|
13
13
|
spree_promotions.code,
|
14
|
-
'#{Time.
|
15
|
-
'#{Time.
|
14
|
+
'#{Time.current.to_s(:db)}',
|
15
|
+
'#{Time.current.to_s(:db)}'
|
16
16
|
from spree_promotions
|
17
17
|
left join spree_promotion_codes
|
18
18
|
on spree_promotion_codes.promotion_id = spree_promotions.id
|
@@ -10,6 +10,16 @@ class IncreaseScaleOnPreTaxAmounts < ActiveRecord::Migration
|
|
10
10
|
WHERE pre_tax_amount IS NULL;
|
11
11
|
SQL
|
12
12
|
|
13
|
+
# set pre_tax_amount on line_items to discounted_amount - included_tax_total
|
14
|
+
# so that the null: false option on the line_item pre_tax_amount doesn't generate
|
15
|
+
# errors.
|
16
|
+
#
|
17
|
+
execute(<<-SQL)
|
18
|
+
UPDATE spree_line_items
|
19
|
+
SET pre_tax_amount = (price * quantity + promo_total) - included_tax_total
|
20
|
+
WHERE pre_tax_amount IS NULL;
|
21
|
+
SQL
|
22
|
+
|
13
23
|
change_column :spree_line_items, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false
|
14
24
|
change_column :spree_shipments, :pre_tax_amount, :decimal, precision: 12, scale: 4, default: 0.0, null: false
|
15
25
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class ConvertHabtmToHmtForPropertiesPrototypes < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :spree_properties_prototypes, :id, :primary_key
|
4
|
+
add_column :spree_properties_prototypes, :created_at, :datetime
|
5
|
+
add_column :spree_properties_prototypes, :updated_at, :datetime
|
6
|
+
|
7
|
+
rename_table :spree_properties_prototypes, :spree_property_prototypes
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
rename_table :spree_property_prototypes, :spree_properties_prototypes
|
12
|
+
|
13
|
+
remove_column :spree_properties_prototypes, :id, :primary_key
|
14
|
+
remove_column :spree_properties_prototypes, :created_at, :datetime
|
15
|
+
remove_column :spree_properties_prototypes, :updated_at, :datetime
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class ConvertHabtmToHmtForOptionTypePrototypes < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :spree_option_types_prototypes, :id, :primary_key
|
4
|
+
add_column :spree_option_types_prototypes, :created_at, :datetime
|
5
|
+
add_column :spree_option_types_prototypes, :updated_at, :datetime
|
6
|
+
|
7
|
+
rename_table :spree_option_types_prototypes, :spree_option_type_prototypes
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
remove_column :spree_option_types_prototypes, :id
|
12
|
+
remove_column :spree_option_types_prototypes, :created_at
|
13
|
+
remove_column :spree_option_types_prototypes, :updated_at
|
14
|
+
|
15
|
+
rename_table :spree_option_type_prototypes, :spree_option_types_prototypes
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ConvertHabtmToHmtForTaxonsPromotionRules < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :spree_taxons_promotion_rules, :created_at, :datetime
|
4
|
+
add_column :spree_taxons_promotion_rules, :updated_at, :datetime
|
5
|
+
|
6
|
+
rename_table :spree_taxons_promotion_rules, :spree_promotion_rule_taxons
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
rename_table :spree_promotion_rule_taxons, :spree_taxons_promotion_rules
|
11
|
+
|
12
|
+
remove_column :spree_taxons_promotion_rules, :created_at, :datetime
|
13
|
+
remove_column :spree_taxons_promotion_rules, :updated_at, :datetime
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddStockItemUniqueIndex < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
# Add a database-level uniqueness constraint for databases that support it
|
4
|
+
# (postgres & sqlite)
|
5
|
+
if connection.adapter_name =~ /postgres|sqlite/i
|
6
|
+
add_index 'spree_stock_items', ['variant_id', 'stock_location_id'], where: 'deleted_at is null', unique: true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -26,7 +26,7 @@ production:
|
|
26
26
|
adapter: mysql2
|
27
27
|
database: <%= database_prefix %><%= options[:lib_name] %>_spree_production
|
28
28
|
encoding: utf8
|
29
|
-
<% when 'postgres' %>
|
29
|
+
<% when 'postgres', 'postgresql' %>
|
30
30
|
<% db_host = ENV['DB_HOST'] -%>
|
31
31
|
development:
|
32
32
|
adapter: postgresql
|
@@ -47,8 +47,32 @@ Spree.config do |config|
|
|
47
47
|
# secret_key: ENV['STRIPE_SECRET_KEY'],
|
48
48
|
# publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
|
49
49
|
# server: Rails.env.production? ? 'production' : 'test',
|
50
|
-
#
|
50
|
+
# test_mode: !Rails.env.production?
|
51
51
|
# )
|
52
52
|
end
|
53
53
|
|
54
|
+
<% if defined?(Spree::Frontend::Engine) -%>
|
55
|
+
Spree::Frontend::Config.configure do |config|
|
56
|
+
config.use_static_preferences!
|
57
|
+
|
58
|
+
config.locale = 'en'
|
59
|
+
end
|
60
|
+
<% end -%>
|
61
|
+
|
62
|
+
<% if defined?(Spree::Backend::Engine) -%>
|
63
|
+
Spree::Backend::Config.configure do |config|
|
64
|
+
config.use_static_preferences!
|
65
|
+
|
66
|
+
config.locale = 'en'
|
67
|
+
end
|
68
|
+
<% end -%>
|
69
|
+
|
70
|
+
<% if defined?(Spree::Api::Engine) -%>
|
71
|
+
Spree::Api::Config.configure do |config|
|
72
|
+
config.use_static_preferences!
|
73
|
+
|
74
|
+
config.requires_authentication = true
|
75
|
+
end
|
76
|
+
<% end -%>
|
77
|
+
|
54
78
|
Spree.user_class = <%= (options[:user_class].blank? ? "Spree::LegacyUser" : options[:user_class]).inspect %>
|
@@ -4,6 +4,9 @@
|
|
4
4
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
5
|
*
|
6
6
|
*= require spree/backend
|
7
|
+
<% unless options[:lib_name] == 'spree' || options[:lib_name] == 'spree/backend' %>
|
8
|
+
*= require spree/backend/<%= options[:lib_name].gsub("/", "_") %>
|
9
|
+
<% end %>
|
7
10
|
*= require_self
|
8
11
|
*= require_tree .
|
9
12
|
*/
|
data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/frontend/all.css
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
5
|
*
|
6
6
|
*= require spree/frontend
|
7
|
+
<% unless options[:lib_name] == 'spree' || options[:lib_name] == 'spree/frontend' %>
|
8
|
+
*= require spree/frontend/<%= options[:lib_name].gsub("/", "_") %>
|
9
|
+
<% end %>
|
7
10
|
*= require_self
|
8
11
|
*= require_tree .
|
9
12
|
*/
|
@@ -53,7 +53,7 @@ module Spree
|
|
53
53
|
locale = session[:locale]
|
54
54
|
locale ||= config_locale if respond_to?(:config_locale, true)
|
55
55
|
locale ||= Rails.application.config.i18n.default_locale
|
56
|
-
locale ||= I18n.default_locale
|
56
|
+
locale ||= I18n.default_locale
|
57
57
|
I18n.locale = locale
|
58
58
|
end
|
59
59
|
|
@@ -38,7 +38,7 @@ module Spree
|
|
38
38
|
if options[:create_order_if_necessary] && (@current_order.nil? || @current_order.completed?)
|
39
39
|
@current_order = Spree::Order.new(current_order_params)
|
40
40
|
@current_order.user ||= try_spree_current_user
|
41
|
-
# See issue
|
41
|
+
# See issue https://github.com/spree/spree/issues/3346 for reasons why this line is here
|
42
42
|
@current_order.created_by ||= try_spree_current_user
|
43
43
|
@current_order.save!
|
44
44
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Spree
|
2
2
|
module Core::ControllerHelpers::PaymentParameters
|
3
3
|
# This method handles the awkwardness of how the html forms are currently
|
4
|
-
# set up for frontend
|
4
|
+
# set up for frontend.
|
5
5
|
#
|
6
6
|
# This method expects a params hash in the format of:
|
7
7
|
#
|
@@ -23,7 +23,7 @@ module Spree
|
|
23
23
|
# ...other params...
|
24
24
|
# }
|
25
25
|
#
|
26
|
-
# And this method
|
26
|
+
# And this method modifies the params into the format of:
|
27
27
|
#
|
28
28
|
# {
|
29
29
|
# order: {
|
@@ -38,9 +38,7 @@ module Spree
|
|
38
38
|
# ...other params...
|
39
39
|
# }
|
40
40
|
#
|
41
|
-
def move_payment_source_into_payments_attributes(
|
42
|
-
params = original_params.deep_dup
|
43
|
-
|
41
|
+
def move_payment_source_into_payments_attributes(params)
|
44
42
|
# Step 1: Gather all the information and ensure all the pieces are there.
|
45
43
|
|
46
44
|
return params if params[:payment_source].blank?
|
@@ -63,5 +61,106 @@ module Spree
|
|
63
61
|
|
64
62
|
params
|
65
63
|
end
|
64
|
+
|
65
|
+
# This method handles the awkwardness of how the html forms are currently
|
66
|
+
# set up for frontend.
|
67
|
+
#
|
68
|
+
# This method expects a params hash in the format of:
|
69
|
+
#
|
70
|
+
# {
|
71
|
+
# order: {
|
72
|
+
# existing_card: '123',
|
73
|
+
# ...other params...
|
74
|
+
# },
|
75
|
+
# cvc_confirm: '456', # optional
|
76
|
+
# ...other params...
|
77
|
+
# }
|
78
|
+
#
|
79
|
+
# And this method modifies the params into the format of:
|
80
|
+
#
|
81
|
+
# {
|
82
|
+
# order: {
|
83
|
+
# payments_attributes: [
|
84
|
+
# {
|
85
|
+
# source_attributes: {
|
86
|
+
# existing_card_id: '123',
|
87
|
+
# verification_value: '456',
|
88
|
+
# },
|
89
|
+
# },
|
90
|
+
# ]
|
91
|
+
# ...other params...
|
92
|
+
# },
|
93
|
+
# ...other params...
|
94
|
+
# }
|
95
|
+
#
|
96
|
+
def move_existing_card_into_payments_attributes(params)
|
97
|
+
return params if params[:order].blank?
|
98
|
+
|
99
|
+
card_id = params[:order][:existing_card].presence
|
100
|
+
cvc_confirm = params[:cvc_confirm].presence
|
101
|
+
|
102
|
+
return params if card_id.nil?
|
103
|
+
|
104
|
+
params[:order][:payments_attributes] = [
|
105
|
+
{
|
106
|
+
source_attributes: {
|
107
|
+
existing_card_id: card_id,
|
108
|
+
verification_value: cvc_confirm,
|
109
|
+
}
|
110
|
+
},
|
111
|
+
]
|
112
|
+
|
113
|
+
params[:order].delete(:existing_card)
|
114
|
+
params.delete(:cvc_confirm)
|
115
|
+
|
116
|
+
params
|
117
|
+
end
|
118
|
+
|
119
|
+
# This is a strange thing to do since an order can have multiple payments
|
120
|
+
# but we always assume that it only has a single payment and that its
|
121
|
+
# amount should be the current order total. Also, this is pretty much
|
122
|
+
# overridden when the order transitions to confirm by the logic inside of
|
123
|
+
# Order#add_store_credit_payments.
|
124
|
+
# We should reconsider this method and its usage at some point.
|
125
|
+
#
|
126
|
+
# This method expects a params hash in the format of:
|
127
|
+
#
|
128
|
+
# {
|
129
|
+
# order: {
|
130
|
+
# # Note that only a single entry is expected/handled in this array
|
131
|
+
# payments_attributes: [
|
132
|
+
# {
|
133
|
+
# ...params...
|
134
|
+
# },
|
135
|
+
# ],
|
136
|
+
# ...other params...
|
137
|
+
# },
|
138
|
+
# ...other params...
|
139
|
+
# }
|
140
|
+
#
|
141
|
+
# And this method modifies the params into the format of:
|
142
|
+
#
|
143
|
+
# {
|
144
|
+
# order: {
|
145
|
+
# payments_attributes: [
|
146
|
+
# {
|
147
|
+
# ...params...
|
148
|
+
# amount: <the order total>,
|
149
|
+
# },
|
150
|
+
# ],
|
151
|
+
# ...other params...
|
152
|
+
# },
|
153
|
+
# ...other params...
|
154
|
+
# }
|
155
|
+
#
|
156
|
+
def set_payment_parameters_amount(params, order)
|
157
|
+
return params if params[:order].blank?
|
158
|
+
return params if params[:order][:payments_attributes].blank?
|
159
|
+
|
160
|
+
params[:order][:payments_attributes].first[:amount] = order.total
|
161
|
+
|
162
|
+
params
|
163
|
+
end
|
164
|
+
|
66
165
|
end
|
67
166
|
end
|
data/lib/spree/core/engine.rb
CHANGED
@@ -69,11 +69,12 @@ module Spree
|
|
69
69
|
app.config.spree.calculators.promotion_actions_create_item_adjustments = [
|
70
70
|
Spree::Calculator::PercentOnLineItem,
|
71
71
|
Spree::Calculator::FlatRate,
|
72
|
-
Spree::Calculator::FlexiRate
|
72
|
+
Spree::Calculator::FlexiRate,
|
73
|
+
Spree::Calculator::TieredPercent
|
73
74
|
]
|
74
75
|
|
75
76
|
app.config.spree.calculators.add_class('promotion_actions_create_quantity_adjustments')
|
76
|
-
app.config.spree.calculators.
|
77
|
+
app.config.spree.calculators.promotion_actions_create_quantity_adjustments = [
|
77
78
|
Spree::Calculator::PercentOnLineItem,
|
78
79
|
Spree::Calculator::FlatRate
|
79
80
|
]
|
@@ -10,7 +10,7 @@ module Spree
|
|
10
10
|
|
11
11
|
class_attribute :failure_handler
|
12
12
|
|
13
|
-
attr_reader :original_order
|
13
|
+
attr_reader :original_order, :new_order
|
14
14
|
|
15
15
|
def initialize(shipment, return_items)
|
16
16
|
@shipment = shipment
|
@@ -19,6 +19,8 @@ module Spree
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def charge_for_items
|
22
|
+
self.new_order = Spree::Order.create!(exchange_order_attributes)
|
23
|
+
|
22
24
|
new_order.associate_user!(@original_order.user) if @original_order.user
|
23
25
|
|
24
26
|
add_exchange_variants_to_order
|
@@ -55,9 +57,7 @@ module Spree
|
|
55
57
|
|
56
58
|
private
|
57
59
|
|
58
|
-
|
59
|
-
@new_order ||= Spree::Order.create!(exchange_order_attributes)
|
60
|
-
end
|
60
|
+
attr_writer :new_order
|
61
61
|
|
62
62
|
def add_exchange_variants_to_order
|
63
63
|
@return_items.group_by(&:exchange_variant).map do |variant, variant_return_items|
|
data/lib/spree/core/version.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module Spree
|
2
2
|
def self.version
|
3
|
-
ActiveSupport::Deprecation.warn("Spree.version does not work and will be removed from solidus")
|
3
|
+
ActiveSupport::Deprecation.warn("Spree.version does not work and will be removed from solidus. Use Spree.solidus_version instead to determine the solidus version")
|
4
4
|
"2.4.6.beta"
|
5
5
|
end
|
6
|
+
|
7
|
+
def self.solidus_version
|
8
|
+
"1.2.0.beta1"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.solidus_gem_version
|
12
|
+
Gem::Version.new(solidus_version)
|
13
|
+
end
|
6
14
|
end
|
@@ -20,20 +20,21 @@ module Spree
|
|
20
20
|
def activate!
|
21
21
|
if user.stock_locations.any?
|
22
22
|
can :display, Spree::StockLocation, id: user_location_ids
|
23
|
-
can [:admin, :create], Spree::StockTransfer
|
24
|
-
can :display, Spree::StockTransfer, source_location_id: source_location_ids
|
25
|
-
can :display, Spree::StockTransfer, destination_location_id: destination_location_ids
|
26
|
-
can :manage, Spree::StockTransfer,
|
27
|
-
source_location_id: source_location_ids,
|
28
|
-
destination_location_id: destination_location_ids_with_undefined_destination
|
29
23
|
|
30
|
-
can :transfer_from, Spree::StockLocation, id:
|
31
|
-
can :transfer_to, Spree::StockLocation, id:
|
24
|
+
can :transfer_from, Spree::StockLocation, id: user_location_ids
|
25
|
+
can :transfer_to, Spree::StockLocation, id: user_location_ids
|
32
26
|
|
33
|
-
can :
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
can :display, Spree::StockTransfer, source_location_id: user_location_ids
|
28
|
+
can :manage, Spree::StockTransfer, source_location_id: user_location_ids + [nil], shipped_at: nil
|
29
|
+
can :manage, Spree::StockTransfer, destination_location_id: user_location_ids
|
30
|
+
# Do not allow managing transfers to a permitted destination_location_id from an
|
31
|
+
# unauthorized stock location until it's been shipped to the permitted location.
|
32
|
+
cannot :manage, Spree::StockTransfer, source_location_id: not_permitted_location_ids, shipped_at: nil
|
33
|
+
|
34
|
+
can :display, Spree::TransferItem, stock_transfer: { source_location_id: user_location_ids }
|
35
|
+
can :manage, Spree::TransferItem, stock_transfer: { source_location_id: user_location_ids + [nil], shipped_at: nil }
|
36
|
+
can :manage, Spree::TransferItem, stock_transfer: { destination_location_id: user_location_ids }
|
37
|
+
cannot :manage, Spree::TransferItem, stock_transfer: { source_location_id: not_permitted_location_ids, shipped_at: nil }
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -43,18 +44,8 @@ module Spree
|
|
43
44
|
@user_location_ids ||= user.stock_locations.pluck(:id)
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
user_location_ids
|
49
|
-
end
|
50
|
-
|
51
|
-
# @note Meant to facilitate extension - override to define custom ids
|
52
|
-
def destination_location_ids
|
53
|
-
user_location_ids
|
54
|
-
end
|
55
|
-
|
56
|
-
def destination_location_ids_with_undefined_destination
|
57
|
-
destination_location_ids + [nil]
|
47
|
+
def not_permitted_location_ids
|
48
|
+
@not_permitted_location_ids ||= Spree::StockLocation.where.not(id: user_location_ids).pluck(:id)
|
58
49
|
end
|
59
50
|
end
|
60
51
|
end
|