solidus_core 2.3.1 → 2.4.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/controllers/spree/base_controller.rb +0 -1
- data/app/models/concerns/spree/calculated_adjustments.rb +2 -0
- data/app/models/concerns/spree/user_methods.rb +19 -3
- data/app/models/spree/address.rb +5 -11
- data/app/models/spree/adjustment.rb +10 -1
- data/app/models/spree/base.rb +4 -0
- data/app/models/spree/calculator/default_tax.rb +7 -18
- data/app/models/spree/calculator/returns/default_refund_amount.rb +3 -3
- data/app/models/spree/calculator.rb +2 -3
- data/app/models/spree/customer_return.rb +6 -3
- data/app/models/spree/exchange.rb +1 -1
- data/app/models/spree/fulfilment_changer.rb +125 -0
- data/app/models/spree/legacy_user.rb +0 -8
- data/app/models/spree/line_item.rb +24 -7
- data/app/models/spree/order/checkout.rb +2 -2
- data/app/models/spree/order.rb +42 -47
- data/app/models/spree/order_cancellations.rb +1 -1
- data/app/models/spree/order_capturing.rb +2 -0
- data/app/models/spree/order_shipping.rb +1 -1
- data/app/models/spree/order_update_attributes.rb +0 -2
- data/app/models/spree/order_updater.rb +4 -4
- data/app/models/spree/payment/cancellation.rb +60 -0
- data/app/models/spree/payment/processing.rb +1 -2
- data/app/models/spree/payment.rb +4 -7
- data/app/models/spree/payment_method/bogus_credit_card.rb +2 -1
- data/app/models/spree/payment_method/check.rb +1 -2
- data/app/models/spree/payment_method/store_credit.rb +4 -3
- data/app/models/spree/payment_method.rb +19 -2
- data/app/models/spree/promotion.rb +1 -1
- data/app/models/spree/promotion_action.rb +2 -1
- data/app/models/spree/promotion_handler/coupon.rb +1 -1
- data/app/models/spree/promotion_handler/free_shipping.rb +6 -58
- data/app/models/spree/promotion_handler/shipping.rb +55 -0
- data/app/models/spree/refund.rb +4 -2
- data/app/models/spree/reimbursement/credit.rb +17 -15
- data/app/models/spree/return_authorization.rb +8 -5
- data/app/models/spree/return_item/eligibility_validator/base_validator.rb +19 -15
- data/app/models/spree/return_item/eligibility_validator/default.rb +25 -21
- data/app/models/spree/return_item/eligibility_validator/inventory_shipped.rb +15 -11
- data/app/models/spree/return_item/eligibility_validator/no_reimbursements.rb +16 -11
- data/app/models/spree/return_item/eligibility_validator/order_completed.rb +15 -11
- data/app/models/spree/return_item/eligibility_validator/rma_required.rb +15 -11
- data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +15 -11
- data/app/models/spree/return_item/exchange_variant_eligibility/same_option_value.rb +37 -35
- data/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb +6 -4
- data/app/models/spree/return_item.rb +6 -3
- data/app/models/spree/shipment.rb +63 -45
- data/app/models/spree/shipping_method.rb +1 -1
- data/app/models/spree/shipping_rate.rb +2 -0
- data/app/models/spree/shipping_rate_tax.rb +1 -5
- data/app/models/spree/stock/availability.rb +70 -0
- data/app/models/spree/stock/estimator.rb +1 -1
- data/app/models/spree/stock/simple_coordinator.rb +105 -0
- data/app/models/spree/stock/splitter/base.rb +8 -4
- data/app/models/spree/stock/splitter/weight.rb +0 -2
- data/app/models/spree/stock/splitter_chain.rb +32 -0
- data/app/models/spree/stock_quantities.rb +81 -0
- data/app/models/spree/store_credit.rb +7 -15
- data/app/models/spree/store_credit_category.rb +1 -1
- data/app/models/spree/store_credit_type.rb +3 -1
- data/app/models/spree/tax/tax_helpers.rb +3 -35
- data/app/models/spree/tax_rate.rb +2 -5
- data/app/models/spree/taxon.rb +2 -0
- data/app/models/spree/zone.rb +1 -50
- data/app/views/spree/order_mailer/confirm_email.html.erb +1 -1
- data/app/views/spree/order_mailer/confirm_email.text.erb +1 -1
- data/config/locales/en.yml +77 -45
- data/db/default/spree/countries.rb +40 -10
- data/db/default/spree/store_credit.rb +2 -2
- data/db/migrate/20160101010000_solidus_one_four.rb +1153 -0
- data/db/migrate/20170831201542_remove_default_tax_from_spree_zones.rb +5 -0
- data/db/seeds.rb +15 -2
- data/lib/generators/spree/dummy/templates/rails/database.yml +4 -0
- data/lib/generators/spree/install/install_generator.rb +0 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +0 -12
- data/{app/models → lib}/spree/app_configuration.rb +26 -59
- data/lib/spree/config.rb +3 -0
- data/lib/spree/core/controller_helpers/order.rb +0 -2
- data/lib/spree/core/engine.rb +6 -1
- data/lib/spree/core/environment.rb +3 -1
- data/lib/spree/core/search/base.rb +13 -5
- data/lib/spree/core/search/variant.rb +2 -0
- data/lib/spree/core/stock_configuration.rb +1 -1
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +8 -7
- data/lib/spree/deprecation.rb +2 -0
- data/lib/spree/i18n.rb +1 -0
- data/lib/spree/money.rb +2 -0
- data/lib/spree/permission_sets/product_management.rb +6 -5
- data/{app/models → lib}/spree/preferences/configuration.rb +29 -2
- data/lib/spree/preferences/preferable.rb +142 -0
- data/{app/models → lib}/spree/preferences/preferable_class_methods.rb +0 -0
- data/{app/models → lib}/spree/preferences/scoped_store.rb +0 -0
- data/{app/models → lib}/spree/preferences/static_model_preferences.rb +0 -0
- data/{app/models → lib}/spree/preferences/statically_configurable.rb +0 -0
- data/{app/models → lib}/spree/preferences/store.rb +0 -0
- data/lib/spree/promo/environment.rb +1 -0
- data/lib/spree/testing_support/ability_helpers.rb +9 -9
- data/lib/spree/testing_support/factories/address_factory.rb +2 -3
- data/lib/spree/testing_support/factories/adjustment_factory.rb +2 -2
- data/lib/spree/testing_support/factories/adjustment_reason_factory.rb +1 -1
- data/lib/spree/testing_support/factories/calculator_factory.rb +6 -6
- data/lib/spree/testing_support/factories/carton_factory.rb +1 -1
- data/lib/spree/testing_support/factories/country_factory.rb +1 -1
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -1
- data/lib/spree/testing_support/factories/customer_return_factory.rb +1 -1
- data/lib/spree/testing_support/factories/image_factory.rb +1 -1
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +1 -1
- data/lib/spree/testing_support/factories/line_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/option_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/option_value_factory.rb +1 -1
- data/lib/spree/testing_support/factories/order_factory.rb +2 -2
- data/lib/spree/testing_support/factories/order_promotion_factory.rb +1 -1
- data/lib/spree/testing_support/factories/payment_factory.rb +3 -3
- data/lib/spree/testing_support/factories/payment_method_factory.rb +4 -4
- data/lib/spree/testing_support/factories/price_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_option_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/product_property_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/promotion_factory.rb +1 -1
- data/lib/spree/testing_support/factories/property_factory.rb +1 -1
- data/lib/spree/testing_support/factories/refund_factory.rb +1 -1
- data/lib/spree/testing_support/factories/refund_reason_factory.rb +1 -1
- data/lib/spree/testing_support/factories/reimbursement_factory.rb +1 -1
- data/lib/spree/testing_support/factories/reimbursement_type_factory.rb +1 -1
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +2 -2
- data/lib/spree/testing_support/factories/return_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/return_reason_factory.rb +1 -1
- data/lib/spree/testing_support/factories/role_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipment_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +3 -3
- data/lib/spree/testing_support/factories/shipping_rate_factory.rb +1 -1
- data/lib/spree/testing_support/factories/state_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_item_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_movement_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_package_factory.rb +1 -1
- data/lib/spree/testing_support/factories/stock_transfer_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_event_factory.rb +2 -2
- data/lib/spree/testing_support/factories/store_credit_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_credit_type_factory.rb +3 -3
- data/lib/spree/testing_support/factories/store_credit_update_reason_factory.rb +1 -1
- data/lib/spree/testing_support/factories/store_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tax_category_factory.rb +1 -1
- data/lib/spree/testing_support/factories/tax_rate_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxon_factory.rb +1 -1
- data/lib/spree/testing_support/factories/taxonomy_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +1 -1
- data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +1 -1
- data/lib/spree/testing_support/factories/zone_factory.rb +2 -2
- data/lib/spree/testing_support/preferences.rb +1 -2
- data/lib/spree/testing_support/sequences.rb +6 -1
- data/lib/tasks/core.rake +17 -10
- data/solidus_core.gemspec +0 -6
- data/spec/helpers/base_helper_spec.rb +2 -2
- data/spec/helpers/products_helper_spec.rb +2 -2
- data/spec/helpers/taxons_helper_spec.rb +2 -2
- data/spec/jobs/promotion_code_batch_job_spec.rb +2 -2
- data/spec/lib/calculated_adjustments_spec.rb +2 -2
- data/spec/lib/i18n_spec.rb +2 -2
- data/spec/lib/search/base_spec.rb +10 -8
- data/spec/lib/search/variant_spec.rb +2 -2
- data/spec/lib/spree/core/class_constantizer_spec.rb +2 -1
- data/spec/lib/spree/core/controller_helpers/auth_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/order_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/payment_parameters_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/pricing_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/search_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/store_spec.rb +2 -2
- data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +2 -2
- data/spec/lib/spree/core/current_store_spec.rb +2 -2
- data/spec/lib/spree/core/environment_extension_spec.rb +2 -1
- data/spec/lib/spree/core/importer/order_spec.rb +2 -2
- data/spec/lib/spree/core/role_configuration_spec.rb +2 -2
- data/spec/lib/spree/core/stock_configuration_spec.rb +2 -2
- data/spec/lib/spree/core/testing_support/factories/address_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/adjustment_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/adjustment_reason_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/calculator_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/carton_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/country_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/credit_card_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/image_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/inventory_unit_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/line_item_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/option_type_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/option_value_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +2 -2
- data/spec/lib/spree/core/testing_support/factories/order_promotion_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/payment_method_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/price_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/product_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/product_option_type_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/product_property_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/promotion_category_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/promotion_code_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/promotion_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/property_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/refund_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/refund_reason_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/reimbursement_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/reimbursement_type_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/return_authorization_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/return_item_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/return_reason_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/role_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/shipment_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/shipping_category_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +10 -1
- data/spec/lib/spree/core/testing_support/factories/shipping_rate_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/state_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/stock_item_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/stock_location_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/stock_movement_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/stock_package_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/stock_transfer_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_credit_category_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_credit_event_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_credit_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_credit_type_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_credit_update_reason_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/store_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/tax_category_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/tax_rate_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/taxon_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/taxonomy_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/user_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/variant_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_condition_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_value_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/factories/zone_factory_spec.rb +1 -1
- data/spec/lib/spree/core/testing_support/preferences_spec.rb +1 -1
- data/spec/lib/spree/core/validators/email_spec.rb +3 -2
- data/spec/lib/spree/core/version_spec.rb +1 -1
- data/spec/lib/spree/localized_number_spec.rb +2 -1
- data/spec/lib/spree/migrations_spec.rb +2 -2
- data/spec/lib/spree/money_spec.rb +3 -1
- data/spec/lib/spree/permission_sets/default_customer_spec.rb +2 -2
- data/spec/lib/tasks/dummy_task_spec.rb +2 -2
- data/spec/lib/tasks/migrations/migrate_shipping_rate_taxes_spec.rb +2 -2
- data/spec/mailers/carton_mailer_spec.rb +2 -2
- data/spec/mailers/order_mailer_spec.rb +2 -2
- data/spec/mailers/promotion_code_batch_mailer_spec.rb +2 -2
- data/spec/mailers/reimbursement_mailer_spec.rb +2 -2
- data/spec/mailers/test_mailer_spec.rb +2 -2
- data/spec/models/spree/ability_spec.rb +2 -2
- data/spec/models/spree/address_spec.rb +2 -37
- data/spec/models/spree/adjustment_reason_spec.rb +2 -2
- data/spec/models/spree/adjustment_spec.rb +4 -4
- data/spec/models/spree/app_configuration_spec.rb +2 -2
- data/spec/models/spree/asset_spec.rb +2 -2
- data/spec/models/spree/calculator/default_tax_spec.rb +21 -56
- data/spec/models/spree/calculator/distributed_amount_spec.rb +2 -2
- data/spec/models/spree/calculator/flat_percent_item_total_spec.rb +2 -2
- data/spec/models/spree/calculator/flat_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/flexi_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/free_shipping_spec.rb +2 -2
- data/spec/models/spree/calculator/percent_on_line_item_spec.rb +2 -2
- data/spec/models/spree/calculator/percent_per_item_spec.rb +2 -2
- data/spec/models/spree/calculator/price_sack_spec.rb +2 -2
- data/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/flat_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/per_item_spec.rb +2 -2
- data/spec/models/spree/calculator/shipping/price_sack_spec.rb +2 -2
- data/spec/models/spree/calculator/tiered_flat_rate_spec.rb +2 -2
- data/spec/models/spree/calculator/tiered_percent_spec.rb +2 -2
- data/spec/models/spree/calculator_spec.rb +12 -2
- data/spec/models/spree/carton_spec.rb +2 -2
- data/spec/models/spree/classification_spec.rb +2 -2
- data/spec/models/spree/concerns/display_money_spec.rb +2 -2
- data/spec/models/spree/concerns/ordered_property_value_list_spec.rb +2 -2
- data/spec/models/spree/concerns/user_address_book_spec.rb +26 -26
- data/spec/models/spree/concerns/user_methods_spec.rb +80 -2
- data/spec/models/spree/country_spec.rb +2 -2
- data/spec/models/spree/credit_card_spec.rb +2 -2
- data/spec/models/spree/customer_return_spec.rb +2 -2
- data/spec/models/spree/distributed_amounts_handler_spec.rb +1 -1
- data/spec/models/spree/exchange_spec.rb +2 -2
- data/spec/models/spree/fulfilment_changer_spec.rb +273 -0
- data/spec/models/spree/gateway/bogus_simple.rb +2 -2
- data/spec/models/spree/gateway/bogus_spec.rb +2 -2
- data/spec/models/spree/gateway_spec.rb +2 -2
- data/spec/models/spree/image_spec.rb +2 -2
- data/spec/models/spree/inventory_unit_spec.rb +3 -3
- data/spec/models/spree/line_item_spec.rb +23 -6
- 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/address_spec.rb +2 -2
- data/spec/models/spree/order/adjustments_spec.rb +2 -2
- data/spec/models/spree/order/callbacks_spec.rb +2 -2
- data/spec/models/spree/order/checkout_spec.rb +6 -6
- data/spec/models/spree/order/finalizing_spec.rb +3 -3
- data/spec/models/spree/order/number_generator_spec.rb +1 -1
- data/spec/models/spree/order/outstanding_balance_integration_spec.rb +3 -3
- data/spec/models/spree/order/payment_spec.rb +61 -30
- data/spec/models/spree/order/risk_assessment_spec.rb +2 -2
- data/spec/models/spree/order/state_machine_spec.rb +2 -2
- data/spec/models/spree/order/totals_spec.rb +2 -2
- data/spec/models/spree/order/updating_spec.rb +3 -3
- data/spec/models/spree/order/validations_spec.rb +2 -2
- data/spec/models/spree/order_cancellations_spec.rb +3 -3
- data/spec/models/spree/order_capturing_spec.rb +7 -143
- data/spec/models/spree/order_contents_spec.rb +2 -2
- data/spec/models/spree/order_inventory_spec.rb +2 -2
- data/spec/models/spree/order_merger_spec.rb +2 -2
- data/spec/models/spree/order_mutex_spec.rb +2 -2
- data/spec/models/spree/order_promotion_spec.rb +2 -2
- data/spec/models/spree/order_shipping_spec.rb +2 -2
- data/spec/models/spree/order_spec.rb +60 -108
- data/spec/models/spree/order_stock_location_spec.rb +2 -2
- data/spec/models/spree/order_taxation_spec.rb +1 -1
- data/spec/models/spree/order_update_attributes_spec.rb +2 -6
- data/spec/models/spree/order_updater_spec.rb +16 -16
- data/spec/models/spree/payment/cancellation_spec.rb +81 -0
- data/spec/models/spree/payment_create_spec.rb +1 -1
- data/spec/models/spree/payment_method/bogus_credit_card_spec.rb +2 -2
- data/spec/models/spree/payment_method/check_spec.rb +8 -8
- data/spec/models/spree/payment_method/credit_card_spec.rb +2 -2
- data/spec/models/spree/payment_method/simple_bogus_credit_card_spec.rb +2 -2
- data/spec/models/spree/payment_method/store_credit_spec.rb +39 -27
- data/spec/models/spree/payment_method_spec.rb +2 -2
- data/spec/models/spree/payment_spec.rb +71 -17
- data/spec/models/spree/permission_sets/base_spec.rb +2 -2
- data/spec/models/spree/permission_sets/configuration_display.rb +2 -2
- data/spec/models/spree/permission_sets/configuration_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/dashboard_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/order_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/order_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/product_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/product_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/promotion_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/promotion_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/report_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/restricted_stock_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/restricted_stock_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/restricted_stock_transfer_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/restricted_stock_transfer_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/stock_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/stock_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/stock_transfer_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/stock_transfer_management_spec.rb +2 -2
- data/spec/models/spree/permission_sets/user_display_spec.rb +2 -2
- data/spec/models/spree/permission_sets/user_management_spec.rb +2 -2
- data/spec/models/spree/preference_spec.rb +2 -2
- data/spec/models/spree/preferences/configuration_spec.rb +2 -2
- data/spec/models/spree/preferences/preferable_spec.rb +2 -2
- data/spec/models/spree/preferences/scoped_store_spec.rb +2 -2
- data/spec/models/spree/preferences/static_model_preferences_spec.rb +1 -1
- data/spec/models/spree/preferences/statically_configurable_spec.rb +1 -1
- data/spec/models/spree/preferences/store_spec.rb +2 -2
- data/spec/models/spree/price_spec.rb +2 -2
- data/spec/models/spree/product/scopes_spec.rb +2 -2
- data/spec/models/spree/product_duplicator_spec.rb +2 -2
- data/spec/models/spree/product_filter_spec.rb +2 -2
- data/spec/models/spree/product_property_spec.rb +2 -2
- data/spec/models/spree/product_spec.rb +2 -2
- data/spec/models/spree/promotion/actions/create_adjustment_spec.rb +2 -2
- data/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +2 -2
- data/spec/models/spree/promotion/actions/create_quantity_adjustments_spec.rb +4 -4
- data/spec/models/spree/promotion/actions/free_shipping_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/first_order_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/first_repeat_purchase_since_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/item_total_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/nth_order_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/one_use_per_user_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/option_value_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/product_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/taxon_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/user_logged_in_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/user_role_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/user_spec.rb +2 -2
- data/spec/models/spree/promotion_action_spec.rb +2 -2
- data/spec/models/spree/promotion_category_spec.rb +2 -2
- data/spec/models/spree/promotion_code/batch_builder_spec.rb +2 -2
- data/spec/models/spree/promotion_code_batch_spec.rb +2 -2
- data/spec/models/spree/promotion_code_spec.rb +1 -1
- data/spec/models/spree/promotion_handler/cart_spec.rb +3 -3
- data/spec/models/spree/promotion_handler/coupon_spec.rb +2 -2
- data/spec/models/spree/promotion_handler/page_spec.rb +2 -2
- data/spec/models/spree/promotion_handler/{free_shipping_spec.rb → shipping_spec.rb} +28 -3
- data/spec/models/spree/promotion_rule_spec.rb +2 -2
- data/spec/models/spree/promotion_spec.rb +4 -4
- data/spec/models/spree/refund_spec.rb +10 -2
- data/spec/models/spree/reimbursement/credit_spec.rb +2 -2
- data/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb +2 -2
- data/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb +2 -2
- data/spec/models/spree/reimbursement_performer_spec.rb +2 -2
- data/spec/models/spree/reimbursement_spec.rb +5 -5
- data/spec/models/spree/reimbursement_tax_calculator_spec.rb +2 -2
- data/spec/models/spree/reimbursement_type/credit_spec.rb +2 -2
- data/spec/models/spree/reimbursement_type/exchange_spec.rb +2 -2
- data/spec/models/spree/reimbursement_type/original_payment_spec.rb +2 -2
- data/spec/models/spree/reimbursement_type/store_credit_spec.rb +2 -2
- data/spec/models/spree/return_authorization_spec.rb +19 -7
- data/spec/models/spree/return_item/eligibility_validator/default_spec.rb +2 -2
- data/spec/models/spree/return_item/eligibility_validator/inventory_shipped_spec.rb +2 -2
- data/spec/models/spree/return_item/eligibility_validator/no_reimbursements_spec.rb +2 -2
- data/spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb +2 -2
- data/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb +2 -2
- data/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb +2 -2
- data/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb +2 -2
- data/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +2 -2
- data/spec/models/spree/return_item_spec.rb +6 -6
- data/spec/models/spree/returns_calculator_spec.rb +2 -2
- data/spec/models/spree/shipment_spec.rb +35 -18
- data/spec/models/spree/shipping_calculator_spec.rb +2 -2
- data/spec/models/spree/shipping_manifest_spec.rb +2 -2
- data/spec/models/spree/shipping_method_spec.rb +2 -2
- data/spec/models/spree/shipping_rate_spec.rb +3 -37
- data/spec/models/spree/shipping_rate_tax_spec.rb +1 -7
- data/spec/models/spree/state_spec.rb +2 -2
- data/spec/models/spree/stock/availability_spec.rb +127 -0
- data/spec/models/spree/stock/availability_validator_spec.rb +2 -2
- data/spec/models/spree/stock/differentiator_spec.rb +2 -2
- data/spec/models/spree/stock/estimator_spec.rb +2 -2
- data/spec/models/spree/stock/inventory_unit_builder_spec.rb +2 -2
- data/spec/models/spree/stock/package_spec.rb +2 -2
- data/spec/models/spree/stock/quantifier_spec.rb +3 -3
- data/spec/models/spree/stock/shipping_rate_selector_spec.rb +2 -2
- data/spec/models/spree/stock/shipping_rate_sorter_spec.rb +2 -2
- data/spec/models/spree/stock/{coordinator_spec.rb → simple_coordinator_spec.rb} +47 -28
- data/spec/models/spree/stock/splitter/backordered_spec.rb +5 -5
- data/spec/models/spree/stock/splitter/base_spec.rb +5 -5
- data/spec/models/spree/stock/splitter/shipping_category_spec.rb +6 -6
- data/spec/models/spree/stock/splitter/weight_spec.rb +6 -6
- data/spec/models/spree/stock/splitter_chain_spec.rb +64 -0
- data/spec/models/spree/stock_item_spec.rb +2 -2
- data/spec/models/spree/stock_location_spec.rb +2 -2
- data/spec/models/spree/stock_movement_spec.rb +2 -2
- data/spec/models/spree/stock_quantities_spec.rb +247 -0
- data/spec/models/spree/stock_transfer_spec.rb +2 -2
- data/spec/models/spree/store_credit_category_spec.rb +2 -2
- data/spec/models/spree/store_credit_event_spec.rb +2 -2
- data/spec/models/spree/store_credit_spec.rb +2 -2
- data/spec/models/spree/store_selector/by_server_name_spec.rb +2 -2
- data/spec/models/spree/store_selector/legacy_spec.rb +2 -2
- data/spec/models/spree/store_spec.rb +2 -2
- data/spec/models/spree/tax/order_adjuster_spec.rb +1 -1
- data/spec/models/spree/tax/shipping_rate_taxer_spec.rb +2 -2
- data/spec/models/spree/tax/tax_location_spec.rb +1 -1
- data/spec/models/spree/tax/taxation_integration_spec.rb +9 -10
- data/spec/models/spree/tax_calculator/default_spec.rb +1 -1
- data/spec/models/spree/tax_category_spec.rb +2 -2
- data/spec/models/spree/tax_rate_spec.rb +21 -65
- data/spec/models/spree/taxon_spec.rb +2 -2
- data/spec/models/spree/taxonomy_spec.rb +2 -2
- data/spec/models/spree/transfer_item_spec.rb +2 -2
- data/spec/models/spree/unit_cancel_spec.rb +2 -2
- data/spec/models/spree/user_spec.rb +12 -3
- data/spec/models/spree/validations/db_maximum_length_validator_spec.rb +2 -2
- data/spec/models/spree/variant/price_selector_spec.rb +2 -2
- data/spec/models/spree/variant/pricing_options_spec.rb +2 -2
- data/spec/models/spree/variant/scopes_spec.rb +2 -2
- data/spec/models/spree/variant/vat_price_generator_spec.rb +2 -2
- data/spec/models/spree/variant_property_rule_condition_spec.rb +2 -2
- data/spec/models/spree/variant_property_rule_spec.rb +2 -2
- data/spec/models/spree/variant_property_rule_value_spec.rb +2 -2
- data/spec/models/spree/variant_spec.rb +2 -2
- data/spec/models/spree/wallet_payment_source_spec.rb +2 -2
- data/spec/models/spree/wallet_spec.rb +2 -2
- data/spec/models/spree/zone_spec.rb +2 -260
- data/spec/rails_helper.rb +49 -0
- data/spec/shared_examples/calculator_shared_examples.rb +1 -1
- data/spec/spec_helper.rb +3 -40
- data/spec/support/concerns/default_price.rb +1 -1
- data/spec/support/shared_contexts/rake.rb +1 -1
- metadata +28 -414
- data/app/helpers/spree/orders_helper.rb +0 -16
- data/app/models/spree/preferences/preferable.rb +0 -133
- data/app/models/spree/stock/adjuster.rb +0 -28
- data/app/models/spree/stock/coordinator.rb +0 -150
- data/app/models/spree/stock/packer.rb +0 -63
- data/app/models/spree/stock/prioritizer.rb +0 -48
- data/db/migrate/20120831092320_spree_one_two.rb +0 -473
- data/db/migrate/20120831092359_spree_promo_one_two.rb +0 -45
- data/db/migrate/20120905145253_add_tax_rate_label.rb +0 -5
- data/db/migrate/20120905151823_add_toggle_tax_rate_display.rb +0 -5
- data/db/migrate/20120929093553_remove_unused_preference_columns.rb +0 -8
- data/db/migrate/20121009142519_add_lock_version_to_variant.rb +0 -5
- data/db/migrate/20121010142909_add_states_required_to_countries.rb +0 -5
- data/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb +0 -6
- data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +0 -11
- data/db/migrate/20121031162139_split_prices_from_variants.rb +0 -31
- data/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb +0 -9
- data/db/migrate/20121107184631_add_currency_to_line_items.rb +0 -5
- data/db/migrate/20121107194006_add_currency_to_orders.rb +0 -5
- data/db/migrate/20121109173623_add_cost_currency_to_variants.rb +0 -5
- data/db/migrate/20121111231553_remove_display_on_from_payment_methods.rb +0 -5
- data/db/migrate/20121124203911_add_position_to_taxonomies.rb +0 -5
- data/db/migrate/20121126040517_add_last_ip_to_spree_orders.rb +0 -5
- data/db/migrate/20121213162028_add_state_to_spree_adjustments.rb +0 -6
- data/db/migrate/20130114053446_add_display_on_to_spree_payment_methods.rb +0 -9
- data/db/migrate/20130120201805_add_position_to_product_properties.spree.rb +0 -5
- data/db/migrate/20130203232234_add_identifier_to_spree_payments.rb +0 -5
- data/db/migrate/20130207155350_add_order_id_index_to_payments.rb +0 -9
- data/db/migrate/20130208032954_add_primary_to_spree_products_taxons.rb +0 -5
- data/db/migrate/20130211190146_create_spree_stock_items.rb +0 -14
- data/db/migrate/20130211191120_create_spree_stock_locations.rb +0 -11
- data/db/migrate/20130213191427_create_default_stock.rb +0 -25
- data/db/migrate/20130222032153_add_order_id_index_to_shipments.rb +0 -5
- data/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +0 -5
- data/db/migrate/20130226191231_add_stock_location_id_to_spree_shipments.rb +0 -5
- data/db/migrate/20130227143905_add_pending_to_inventory_unit.rb +0 -6
- data/db/migrate/20130228164411_remove_on_demand_from_product_and_variant.rb +0 -6
- data/db/migrate/20130228210442_create_shipping_method_zone.rb +0 -21
- data/db/migrate/20130301162745_remove_shipping_category_id_from_shipping_method.rb +0 -5
- data/db/migrate/20130301162924_create_shipping_method_categories.rb +0 -13
- data/db/migrate/20130301205200_add_tracking_url_to_spree_shipping_methods.rb +0 -5
- data/db/migrate/20130304162240_create_spree_shipping_rates.rb +0 -24
- data/db/migrate/20130304192936_remove_category_match_attributes_from_shipping_method.rb +0 -7
- data/db/migrate/20130305143310_create_stock_movements.rb +0 -12
- data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +0 -21
- data/db/migrate/20130306191917_add_active_field_to_stock_locations.rb +0 -5
- data/db/migrate/20130306195650_add_backorderable_to_stock_item.rb +0 -5
- data/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb +0 -5
- data/db/migrate/20130318151756_add_source_and_destination_to_stock_movements.rb +0 -8
- data/db/migrate/20130319062004_change_orders_total_precision.rb +0 -8
- data/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +0 -5
- data/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +0 -5
- data/db/migrate/20130319082943_change_adjustments_amount_precision.rb +0 -5
- data/db/migrate/20130319183250_add_originator_to_stock_movement.rb +0 -7
- data/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb +0 -15
- data/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb +0 -9
- data/db/migrate/20130326175857_add_stock_location_to_rma.rb +0 -5
- data/db/migrate/20130328130308_update_shipment_state_for_canceled_orders.rb +0 -15
- data/db/migrate/20130328195253_add_seo_metas_to_taxons.rb +0 -9
- data/db/migrate/20130329134939_remove_stock_item_and_variant_lock.rb +0 -14
- data/db/migrate/20130413230529_add_name_to_spree_credit_cards.rb +0 -5
- data/db/migrate/20130414000512_update_name_fields_on_spree_credit_cards.rb +0 -13
- data/db/migrate/20130417120034_add_index_to_source_columns_on_adjustments.rb +0 -5
- data/db/migrate/20130417120035_update_adjustment_states.rb +0 -16
- data/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +0 -15
- data/db/migrate/20130418125341_create_spree_stock_transfers.rb +0 -14
- data/db/migrate/20130423110707_drop_products_count_on_hand.rb +0 -5
- data/db/migrate/20130423223847_set_default_shipping_rate_cost.rb +0 -5
- data/db/migrate/20130509115210_add_number_to_stock_transfer.rb +0 -23
- data/db/migrate/20130514151929_add_sku_index_to_spree_variants.rb +0 -5
- data/db/migrate/20130515180736_add_backorderable_default_to_spree_stock_location.rb +0 -5
- data/db/migrate/20130516151222_add_propage_all_variants_to_spree_stock_location.rb +0 -5
- data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +0 -5
- data/db/migrate/20130611185927_add_user_id_index_to_spree_orders.rb +0 -5
- data/db/migrate/20130618041418_add_updated_at_to_spree_countries.rb +0 -9
- data/db/migrate/20130619012236_add_updated_at_to_spree_states.rb +0 -9
- data/db/migrate/20130626232741_add_cvv_result_code_and_cvv_result_message_to_spree_payments.rb +0 -6
- data/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb +0 -5
- data/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb +0 -7
- data/db/migrate/20130708052307_add_deleted_at_to_spree_tax_rates.rb +0 -5
- data/db/migrate/20130711200933_remove_lock_version_from_inventory_units.rb +0 -6
- data/db/migrate/20130718042445_add_cost_price_to_line_item.rb +0 -5
- data/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb +0 -6
- data/db/migrate/20130725031716_add_created_by_id_to_spree_orders.rb +0 -5
- data/db/migrate/20130729214043_index_completed_at_on_spree_orders.rb +0 -5
- data/db/migrate/20130802014537_add_tax_category_id_to_spree_line_items.rb +0 -5
- data/db/migrate/20130802022321_migrate_tax_categories_to_line_items.rb +0 -10
- data/db/migrate/20130806022521_drop_spree_mail_methods.rb +0 -12
- data/db/migrate/20130806145853_set_default_stock_location_on_shipments.rb +0 -8
- data/db/migrate/20130807024301_upgrade_adjustments.rb +0 -40
- data/db/migrate/20130807024302_rename_adjustment_fields.rb +0 -14
- data/db/migrate/20130809164245_add_admin_name_column_to_spree_shipping_methods.rb +0 -5
- data/db/migrate/20130809164330_add_admin_name_column_to_spree_stock_locations.rb +0 -5
- data/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb +0 -5
- data/db/migrate/20130813140619_expand_order_number_size.rb +0 -9
- data/db/migrate/20130813232134_rename_activators_to_promotions.rb +0 -5
- data/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb +0 -5
- data/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb +0 -5
- data/db/migrate/20130826062534_add_depth_to_spree_taxons.rb +0 -14
- data/db/migrate/20130828234942_add_tax_total_to_line_items_shipments_and_orders.rb +0 -8
- data/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +0 -15
- data/db/migrate/20130830001159_migrate_old_shipping_calculators.rb +0 -19
- data/db/migrate/20130903183026_add_code_to_spree_promotion_rules.rb +0 -5
- data/db/migrate/20130909115621_change_states_required_for_countries.rb +0 -9
- data/db/migrate/20130915032339_add_deleted_at_to_spree_stock_items.rb +0 -5
- data/db/migrate/20130917024658_remove_promotions_event_name_field.rb +0 -5
- data/db/migrate/20130924040529_add_promo_total_to_line_items_and_shipments_and_orders.rb +0 -7
- data/db/migrate/20131001013410_remove_unused_credit_card_fields.rb +0 -17
- data/db/migrate/20131026154747_add_track_inventory_to_variant.rb +0 -5
- data/db/migrate/20131107132123_add_tax_category_to_variants.rb +0 -6
- data/db/migrate/20131113035136_add_channel_to_spree_orders.rb +0 -5
- data/db/migrate/20131118043959_add_included_to_adjustments.rb +0 -5
- data/db/migrate/20131118050234_rename_tax_total_fields.rb +0 -11
- data/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb +0 -20
- data/db/migrate/20131120234456_add_updated_at_to_variants.rb +0 -5
- data/db/migrate/20131127001002_add_position_to_classifications.rb +0 -5
- data/db/migrate/20131211112807_create_spree_orders_promotions.rb +0 -8
- data/db/migrate/20131211192741_unique_shipping_method_categories.rb +0 -24
- data/db/migrate/20131218054603_add_item_count_to_spree_orders.rb +0 -5
- data/db/migrate/20140106065820_remove_value_type_from_spree_preferences.rb +0 -9
- data/db/migrate/20140106224208_rename_permalink_to_slug_for_products.rb +0 -5
- data/db/migrate/20140120160805_add_index_to_variant_id_and_currency_on_prices.rb +0 -5
- data/db/migrate/20140124023232_rename_activator_id_in_rules_and_actions_to_promotion_id.rb +0 -6
- data/db/migrate/20140129024326_add_deleted_at_to_spree_prices.rb +0 -5
- data/db/migrate/20140203161722_add_approver_id_and_approved_at_to_orders.rb +0 -6
- data/db/migrate/20140204115338_add_confirmation_delivered_to_spree_orders.rb +0 -5
- data/db/migrate/20140204192230_add_auto_capture_to_payment_methods.rb +0 -5
- data/db/migrate/20140205120320_create_spree_payment_capture_events.rb +0 -12
- data/db/migrate/20140205144710_add_uncaptured_amount_to_payments.rb +0 -5
- data/db/migrate/20140205181631_default_variant_weight_to_zero.rb +0 -11
- data/db/migrate/20140207085910_add_tax_category_id_to_shipping_methods.rb +0 -5
- data/db/migrate/20140207093021_add_tax_rate_id_to_shipping_rates.rb +0 -5
- data/db/migrate/20140211040159_add_pre_tax_amount_to_line_items_and_shipments.rb +0 -6
- data/db/migrate/20140213184916_add_more_indexes.rb +0 -13
- data/db/migrate/20140219060952_add_considered_risky_to_orders.rb +0 -5
- data/db/migrate/20140227112348_add_preference_store_to_everything.rb +0 -8
- data/db/migrate/20140307235515_add_user_id_to_spree_credit_cards.rb +0 -13
- data/db/migrate/20140309023735_migrate_old_preferences.rb +0 -52
- data/db/migrate/20140309024355_create_spree_stores.rb +0 -25
- data/db/migrate/20140309033438_create_store_from_preferences.rb +0 -34
- data/db/migrate/20140315053743_add_timestamps_to_spree_assets.rb +0 -6
- data/db/migrate/20140318191500_create_spree_taxons_promotion_rules.rb +0 -8
- data/db/migrate/20140331100557_add_additional_store_fields.rb +0 -8
- data/db/migrate/20140410141842_add_many_missing_indexes.rb +0 -19
- data/db/migrate/20140410150358_correct_some_polymorphic_index_and_add_more_missing.rb +0 -65
- data/db/migrate/20140415041315_add_user_id_created_by_id_index_to_order.rb +0 -5
- data/db/migrate/20140508151342_change_spree_price_amount_precision.rb +0 -8
- data/db/migrate/20140518174634_add_token_to_spree_orders.rb +0 -5
- data/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb +0 -29
- data/db/migrate/20140601011216_set_shipment_total_for_users_upgrading.rb +0 -22
- data/db/migrate/20140604135309_drop_credit_card_first_name_and_last_name.rb +0 -6
- data/db/migrate/20140609201656_add_deleted_at_to_spree_promotion_actions.rb +0 -6
- data/db/migrate/20140616202624_remove_uncaptured_amount_from_spree_payments.rb +0 -5
- data/db/migrate/20140625214618_create_spree_refunds.rb +0 -12
- data/db/migrate/20140702140656_create_spree_return_authorization_inventory_unit.rb +0 -12
- data/db/migrate/20140707125621_rename_return_authorization_inventory_unit_to_return_items.rb +0 -5
- data/db/migrate/20140708132019_create_order_mutex.rb +0 -11
- data/db/migrate/20140709160534_backfill_line_item_pre_tax_amount.rb +0 -10
- data/db/migrate/20140710041921_recreate_spree_return_authorizations.rb +0 -54
- data/db/migrate/20140710181204_add_amount_fields_to_return_items.rb +0 -7
- data/db/migrate/20140710190048_drop_return_authorization_amount.rb +0 -5
- data/db/migrate/20140713140455_create_spree_return_authorization_reasons.rb +0 -32
- data/db/migrate/20140713140527_create_spree_refund_reasons.rb +0 -14
- data/db/migrate/20140713142214_rename_return_authorization_reason.rb +0 -5
- data/db/migrate/20140715182625_create_spree_promotion_categories.rb +0 -11
- data/db/migrate/20140716204111_drop_received_at_on_return_items.rb +0 -9
- data/db/migrate/20140716212330_add_reception_and_acceptance_status_to_return_items.rb +0 -6
- data/db/migrate/20140717155155_create_default_refund_reason.rb +0 -9
- data/db/migrate/20140717185932_add_default_to_spree_stock_locations.rb +0 -7
- data/db/migrate/20140718133010_create_spree_customer_returns.rb +0 -9
- data/db/migrate/20140718133349_add_customer_return_id_to_return_item.rb +0 -6
- data/db/migrate/20140718195325_create_friendly_id_slugs.rb +0 -15
- data/db/migrate/20140723004419_rename_spree_refund_return_authorization_id.rb +0 -5
- data/db/migrate/20140723152808_increase_return_item_pre_tax_amount_precision.rb +0 -13
- data/db/migrate/20140723214541_copy_product_slugs_to_slug_history.rb +0 -13
- data/db/migrate/20140725131539_create_spree_reimbursements.rb +0 -21
- data/db/migrate/20140728225422_add_promotionable_to_spree_products.rb +0 -5
- data/db/migrate/20140729133613_add_exchange_inventory_unit_foreign_keys.rb +0 -7
- data/db/migrate/20140730155938_add_acceptance_status_errors_to_return_item.rb +0 -5
- data/db/migrate/20140731150017_create_spree_reimbursement_types.rb +0 -20
- data/db/migrate/20140804185157_add_default_to_shipment_cost.rb +0 -10
- data/db/migrate/20140805171035_add_default_to_spree_credit_cards.rb +0 -5
- data/db/migrate/20140805171219_make_existing_credit_cards_default.rb +0 -11
- data/db/migrate/20140806144901_add_type_to_reimbursement_type.rb +0 -9
- data/db/migrate/20140808184039_create_spree_reimbursement_credits.rb +0 -10
- data/db/migrate/20140827170513_add_meta_title_to_spree_products.rb +0 -7
- data/db/migrate/20140924164824_add_code_to_spree_tax_categories.rb +0 -5
- data/db/migrate/20140927193717_default_pre_tax_amount_should_be_zero.rb +0 -6
- data/db/migrate/20141002191113_add_code_to_spree_shipping_methods.rb +0 -5
- data/db/migrate/20141007230328_add_cancel_audit_fields_to_spree_orders.rb +0 -6
- data/db/migrate/20141009204607_add_store_id_to_orders.rb +0 -12
- data/db/migrate/20141012083513_create_spree_taxons_prototypes.rb +0 -8
- data/db/migrate/20141023005240_add_counter_cache_from_spree_variants_to_spree_stock_items.rb +0 -8
- data/db/migrate/20141101231208_fix_adjustment_order_presence.rb +0 -13
- data/db/migrate/20141105213646_update_classifications_positions.rb +0 -9
- data/db/migrate/20141120135441_add_guest_token_index_to_spree_orders.rb +0 -5
- data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +0 -5
- data/db/migrate/20141217215630_update_product_slug_index.rb +0 -8
- data/db/migrate/20141231151320_add_default_column_to_price.rb +0 -5
- data/db/migrate/20150112194216_add_position_to_stock_location.rb +0 -5
- data/db/migrate/20150113002122_create_spree_promotion_codes.rb +0 -13
- data/db/migrate/20150113002123_create_adjustment_promotion_code_association.rb +0 -6
- data/db/migrate/20150121022521_remove_environment_from_payment_method.rb +0 -6
- data/db/migrate/20150121202544_add_restock_inventory_to_stock_location.rb +0 -5
- data/db/migrate/20150122202432_add_code_to_spree_promotion_categories.rb +0 -5
- data/db/migrate/20150127161843_create_order_stock_locations.rb +0 -12
- data/db/migrate/20150203151219_add_fulfillable_to_stock_location.rb +0 -5
- data/db/migrate/20150205210527_add_code_to_refund_reason.rb +0 -5
- data/db/migrate/20150213160148_add_promotion_code_id_to_orders_promotions.rb +0 -7
- data/db/migrate/20150213163612_add_approver_name_to_spree_orders.rb +0 -5
- data/db/migrate/20150225205344_move_promotion_code_to_promotion_code_value.rb +0 -64
- data/db/migrate/20150226195213_downcase_promotion_codes_values.rb +0 -11
- data/db/migrate/20150227161934_add_order_ids_to_adjustments_where_missing.rb +0 -9
- data/db/migrate/20150303212749_add_per_code_usage_limit_to_promotions.rb +0 -5
- data/db/migrate/20150303212826_remove_usage_limit_from_promotion_codes.rb +0 -5
- data/db/migrate/20150304211616_add_timestamps_to_order_promotions.rb +0 -6
- data/db/migrate/20150305043021_create_spree_cartons.rb +0 -24
- data/db/migrate/20150305210403_add_timestamps_to_spree_roles_users.rb +0 -7
- data/db/migrate/20150313140507_remove_considered_risky_from_spree_orders.rb +0 -5
- data/db/migrate/20150313192827_add_index_to_inventory_units_carton_id.rb +0 -5
- data/db/migrate/20150313201235_add_imported_from_shipment_id_to_cartons.rb +0 -8
- data/db/migrate/20150313201503_copy_shipped_shipments_to_cartons.rb +0 -12
- data/db/migrate/20150330144639_create_spree_user_stock_locations.rb +0 -10
- data/db/migrate/20150331134544_add_stock_location_code.rb +0 -5
- data/db/migrate/20150402210430_create_unit_cancels.rb +0 -10
- data/db/migrate/20150407173305_add_fields_to_stock_transfer.rb +0 -12
- data/db/migrate/20150407173531_create_transfer_items.rb +0 -14
- data/db/migrate/20150424143547_drop_stock_transfer_type.rb +0 -10
- data/db/migrate/20150424161102_add_stock_transfer_finalized_at.rb +0 -8
- data/db/migrate/20150429125822_rename_stock_transfer_reference.rb +0 -5
- data/db/migrate/20150430233803_create_line_item_actions.rb +0 -10
- data/db/migrate/20150506181159_create_spree_store_credit_categories.rb +0 -10
- data/db/migrate/20150506181244_create_spree_store_credits.rb +0 -19
- data/db/migrate/20150506181539_create_spree_store_credit_events.rb +0 -17
- data/db/migrate/20150506181611_create_spree_store_credit_payment_method.rb +0 -21
- data/db/migrate/20150506181715_create_store_credit_types.rb +0 -17
- data/db/migrate/20150506182045_create_store_credit_reimbursement_type.rb +0 -5
- data/db/migrate/20150508044622_add_resellable_to_return_items.rb +0 -5
- data/db/migrate/20150514185559_add_invalidated_at_to_spree_store_credits.rb +0 -5
- data/db/migrate/20150514201836_migrate_deleted_store_credits_to_invalidated.rb +0 -13
- data/db/migrate/20150515170322_add_check_stock_on_transfer.rb +0 -5
- data/db/migrate/20150515211137_fix_adjustment_order_id.rb +0 -79
- data/db/migrate/20150528125647_delete_inventory_units_without_shipment.rb +0 -25
- data/db/migrate/20150601191251_add_deleted_at_to_stock_transfers.rb +0 -5
- data/db/migrate/20150601204148_add_deleted_at_to_transfer_items.rb +0 -5
- data/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +0 -26
- data/db/migrate/20150609193231_add_preferences_to_promotion_actions.rb +0 -5
- data/db/migrate/20150610182638_add_id_to_spree_option_values_variants.rb +0 -5
- data/db/migrate/20150611200247_add_frontend_viewable_to_spree_orders.rb +0 -5
- data/db/migrate/20150612205731_remove_spree_configurations.rb +0 -15
- data/db/migrate/20150616204659_add_preference_source_to_spree_payment_methods.rb +0 -5
- data/db/migrate/20150618191713_remove_credit_card_address_id.rb +0 -7
- data/db/migrate/20150618212517_create_spree_store_credit_update_reasons.rb +0 -8
- data/db/migrate/20150619160613_create_adjustment_reason.rb +0 -18
- data/db/migrate/20150622144655_add_update_reason_to_store_credit_events.rb +0 -5
- data/db/migrate/20150623194316_add_return_authorization_reason_id_to_return_items.rb +0 -7
- data/db/migrate/20150623214058_seed_store_credit_update_reasons.rb +0 -9
- data/db/migrate/20150626200816_remove_shipping_method_id_from_spree_orders.rb +0 -9
- data/db/migrate/20150626214817_remove_counter_cache_from_spree_variants_to_spree_stock_items.rb +0 -10
- data/db/migrate/20150629175931_add_address_id_to_credit_card.rb +0 -5
- data/db/migrate/20150630175644_copy_order_bill_address_to_credit_card.rb +0 -12
- data/db/migrate/20150723224133_remove_unnecessary_indexes.rb +0 -62
- data/db/migrate/20150724163716_remove_state_lock_version_from_order.rb +0 -11
- data/db/migrate/20150731201146_add_spree_user_addresses.rb +0 -15
- data/db/migrate/20150806190833_add_id_and_timestamp_to_promotion_rule_user.rb +0 -13
- data/db/migrate/20150811210350_remove_mandatory_from_adjustments.rb +0 -5
- data/db/migrate/20150811211025_add_finalized_to_spree_adjustments.rb +0 -11
- data/db/migrate/20150820160821_add_store_payment_methods.rb +0 -10
- data/db/migrate/20150824213633_convert_habtm_to_hmt_for_shipping_methods_zones.rb +0 -17
- data/db/migrate/20150824214129_convert_habtm_to_hmt_for_products_promotion_rules.rb +0 -17
- data/db/migrate/20150825204216_drop_spree_gateways.rb +0 -20
- data/db/migrate/20150826002555_convert_habtm_to_hmt_for_taxon_prototypes.rb +0 -15
- data/db/migrate/20150909123605_create_variant_properties_and_rules.rb +0 -28
- data/db/migrate/20151001121454_create_spree_shipping_method_stock_locations.rb +0 -13
- data/db/migrate/20151002023248_add_foreign_key_to_shipping_method_stock_location.rb +0 -6
- data/db/migrate/20151010003252_add_foreign_keys_for_taxons_prototypes.rb +0 -6
- data/db/migrate/20151013222921_remove_token_permissions_table.rb +0 -16
- data/db/migrate/20151014213349_rename_identifier_to_number_for_payment.rb +0 -7
- data/db/migrate/20151015203732_add_foreign_keys_for_product_promotion_rules.rb +0 -9
- data/db/migrate/20151021113730_add_sale_to_spree_promotions.rb +0 -6
- data/db/migrate/20151021163309_convert_sale_promotions.rb +0 -28
- data/db/migrate/20151026093607_change_return_item_pre_tax_amount_to_amount.rb +0 -29
- data/db/migrate/20151117063249_convert_habtm_to_hmt_for_properties_prototypes.rb +0 -17
- data/db/migrate/20151124062500_convert_habtm_to_hmt_for_option_type_prototypes.rb +0 -17
- data/db/migrate/20151126063028_convert_habtm_to_hmt_for_taxons_promotion_rules.rb +0 -15
- data/db/migrate/20151219020209_add_stock_item_unique_index.rb +0 -9
- data/db/migrate/20160111091912_add_column_available_to_all_on_spree_shipping_method.rb +0 -5
- data/db/migrate/20160116133604_add_position_to_spree_payment_methods.rb +0 -5
- data/db/migrate/20160122182105_add_carrier_and_service_level_to_spree_shipping_methods.rb +0 -6
- data/db/migrate/20160224201413_create_spree_shipping_rate_taxes.rb +0 -11
- data/db/migrate/20160229133259_add_cart_tax_country_iso_to_spree_store.rb +0 -5
- data/db/migrate/20160301103333_remove_pre_tax_amount_on_line_item_and_shipment.rb +0 -6
- data/db/migrate/20160308000300_disallow_adjustment_finalized_nulls.rb +0 -19
- data/db/migrate/20160318145302_add_timestamps_to_prices.rb +0 -5
- data/db/migrate/20160330204846_add_missing_timestamp_columns.rb +0 -20
- data/db/migrate/20160420044191_create_spree_wallet_payment_sources.rb +0 -23
- data/db/migrate/20160420181916_migrate_credit_cards_to_wallet_payment_sources.rb +0 -27
- data/db/migrate/20160509181311_add_country_iso_to_prices.rb +0 -8
- data/db/migrate/20160527070401_rename_shipment_address_field.rb +0 -7
- data/db/migrate/20160608162651_ensure_default_store.rb +0 -13
- data/db/migrate/20160608180751_ensure_store_on_orders.rb +0 -12
- data/db/migrate/20160616232103_remove_user_id_from_promotion_rules.rb +0 -11
- data/db/migrate/20160718205341_add_payment_id_index_to_spree_refunds.rb +0 -5
- data/db/migrate/20160718205859_add_reimbursement_id_index_to_spree_refunds.rb +0 -5
- data/lib/spree/core/controller_helpers/respond_with.rb +0 -65
- data/lib/spree/core/price_migrator.rb +0 -30
- data/lib/spree/responder.rb +0 -44
- data/lib/spree/testing_support/factories/stock_packer_factory.rb +0 -13
- data/lib/tasks/migrations/copy_shipped_shipments_to_cartons.rake +0 -172
- data/lib/tasks/migrations/create_vat_prices.rake +0 -15
- data/lib/tasks/upgrade.rake +0 -11
- data/spec/helpers/order_helper_spec.rb +0 -12
- data/spec/lib/spree/core/price_migrator_spec.rb +0 -358
- data/spec/lib/spree/core/testing_support/factories/stock_packer_factory_spec.rb +0 -16
- data/spec/lib/tasks/migrations/copy_shipped_shipments_to_cartons_spec.rb +0 -111
- data/spec/lib/tasks/migrations/create_vat_prices_spec.rb +0 -31
- data/spec/lib/tasks/order_capturing_spec.rb +0 -53
- data/spec/lib/tasks/upgrade_spec.rb +0 -20
- data/spec/models/spree/order/tax_spec.rb +0 -98
- data/spec/models/spree/stock/packer_spec.rb +0 -90
- data/spec/models/spree/stock/prioritizer_spec.rb +0 -125
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'truncate_html'
|
2
|
-
require 'app/helpers/truncate_html_helper'
|
3
|
-
|
4
|
-
module Spree
|
5
|
-
module OrdersHelper
|
6
|
-
include TruncateHtmlHelper
|
7
|
-
|
8
|
-
def truncated_product_description(product)
|
9
|
-
truncate_html(raw(product.description))
|
10
|
-
end
|
11
|
-
|
12
|
-
def order_just_completed?(order)
|
13
|
-
flash[:order_completed] && order.present?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
# Preferable allows defining preference accessor methods.
|
2
|
-
#
|
3
|
-
# A class including Preferable must implement #preferences which should return
|
4
|
-
# an object responding to .fetch(key), []=(key, val), and .delete(key).
|
5
|
-
#
|
6
|
-
# The generated writer method performs typecasting before assignment into the
|
7
|
-
# preferences object.
|
8
|
-
#
|
9
|
-
# Examples:
|
10
|
-
#
|
11
|
-
# # Spree::Base includes Preferable and defines preferences as a serialized
|
12
|
-
# # column.
|
13
|
-
# class Settings < Spree::Base
|
14
|
-
# preference :color, :string, default: 'red'
|
15
|
-
# preference :temperature, :integer, default: 21
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# s = Settings.new
|
19
|
-
# s.preferred_color # => 'red'
|
20
|
-
# s.preferred_temperature # => 21
|
21
|
-
#
|
22
|
-
# s.preferred_color = 'blue'
|
23
|
-
# s.preferred_color # => 'blue'
|
24
|
-
#
|
25
|
-
# # Typecasting is performed on assignment
|
26
|
-
# s.preferred_temperature = '24'
|
27
|
-
# s.preferred_color # => 24
|
28
|
-
#
|
29
|
-
# # Modifications have been made to the .preferences hash
|
30
|
-
# s.preferences #=> {color: 'blue', temperature: 24}
|
31
|
-
#
|
32
|
-
# # Save the changes. All handled by activerecord
|
33
|
-
# s.save!
|
34
|
-
module Spree::Preferences::Preferable
|
35
|
-
extend ActiveSupport::Concern
|
36
|
-
|
37
|
-
included do
|
38
|
-
extend Spree::Preferences::PreferableClassMethods
|
39
|
-
end
|
40
|
-
|
41
|
-
# Get a preference
|
42
|
-
# @param name [#to_sym] name of preference
|
43
|
-
# @return [Object] The value of preference +name+
|
44
|
-
def get_preference(name)
|
45
|
-
has_preference! name
|
46
|
-
send self.class.preference_getter_method(name)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Set a preference
|
50
|
-
# @param name [#to_sym] name of preference
|
51
|
-
# @param value [Object] new value for preference +name+
|
52
|
-
def set_preference(name, value)
|
53
|
-
has_preference! name
|
54
|
-
send self.class.preference_setter_method(name), value
|
55
|
-
end
|
56
|
-
|
57
|
-
# @param name [#to_sym] name of preference
|
58
|
-
# @return [Symbol] The type of preference +name+
|
59
|
-
def preference_type(name)
|
60
|
-
has_preference! name
|
61
|
-
send self.class.preference_type_getter_method(name)
|
62
|
-
end
|
63
|
-
|
64
|
-
# @param name [#to_sym] name of preference
|
65
|
-
# @return [Object] The default for preference +name+
|
66
|
-
def preference_default(name)
|
67
|
-
has_preference! name
|
68
|
-
send self.class.preference_default_getter_method(name)
|
69
|
-
end
|
70
|
-
|
71
|
-
# Raises an exception if the +name+ preference is not defined on this class
|
72
|
-
# @param name [#to_sym] name of preference
|
73
|
-
def has_preference!(name)
|
74
|
-
raise NoMethodError.new "#{name} preference not defined" unless has_preference? name
|
75
|
-
end
|
76
|
-
|
77
|
-
# @param name [#to_sym] name of preference
|
78
|
-
# @return [Boolean] if preference exists on this class
|
79
|
-
def has_preference?(name)
|
80
|
-
defined_preferences.include?(name.to_sym)
|
81
|
-
end
|
82
|
-
|
83
|
-
# @return [Array<Symbol>] All preferences defined on this class
|
84
|
-
def defined_preferences
|
85
|
-
self.class.defined_preferences
|
86
|
-
end
|
87
|
-
|
88
|
-
# @return [Hash{Symbol => Object}] Default for all preferences defined on this class
|
89
|
-
def default_preferences
|
90
|
-
Hash[
|
91
|
-
defined_preferences.map do |preference|
|
92
|
-
[preference, preference_default(preference)]
|
93
|
-
end
|
94
|
-
]
|
95
|
-
end
|
96
|
-
|
97
|
-
private
|
98
|
-
|
99
|
-
def convert_preference_value(value, type)
|
100
|
-
return nil if value.nil?
|
101
|
-
case type
|
102
|
-
when :string, :text
|
103
|
-
value.to_s
|
104
|
-
when :password
|
105
|
-
value.to_s
|
106
|
-
when :decimal
|
107
|
-
begin
|
108
|
-
value.to_s.to_d
|
109
|
-
rescue ArgumentError
|
110
|
-
BigDecimal.new(0)
|
111
|
-
end
|
112
|
-
when :integer
|
113
|
-
value.to_i
|
114
|
-
when :boolean
|
115
|
-
if !value ||
|
116
|
-
value == 0 ||
|
117
|
-
value =~ /\A(f|false|0)\Z/i ||
|
118
|
-
(value.respond_to?(:empty?) && value.empty?)
|
119
|
-
false
|
120
|
-
else
|
121
|
-
true
|
122
|
-
end
|
123
|
-
when :array
|
124
|
-
raise TypeError, "Array expected got #{value.inspect}" unless value.is_a?(Array)
|
125
|
-
value
|
126
|
-
when :hash
|
127
|
-
raise TypeError, "Hash expected got #{value.inspect}" unless value.is_a?(Hash)
|
128
|
-
value
|
129
|
-
else
|
130
|
-
value
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
# Used by Prioritizer to adjust item quantities.
|
4
|
-
#
|
5
|
-
# See spec/models/spree/stock/prioritizer_spec.rb for use cases.
|
6
|
-
class Adjuster
|
7
|
-
attr_accessor :inventory_unit, :status, :fulfilled
|
8
|
-
|
9
|
-
def initialize(inventory_unit, status)
|
10
|
-
@inventory_unit = inventory_unit
|
11
|
-
@status = status
|
12
|
-
@fulfilled = false
|
13
|
-
end
|
14
|
-
|
15
|
-
def adjust(package)
|
16
|
-
if fulfilled?
|
17
|
-
package.remove(inventory_unit)
|
18
|
-
else
|
19
|
-
self.fulfilled = true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def fulfilled?
|
24
|
-
fulfilled
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
class Coordinator
|
4
|
-
attr_reader :order, :inventory_units
|
5
|
-
|
6
|
-
def initialize(order, inventory_units = nil)
|
7
|
-
@order = order
|
8
|
-
@inventory_units = inventory_units || InventoryUnitBuilder.new(order).units
|
9
|
-
@preallocated_inventory_units = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def shipments
|
13
|
-
packages.map(&:shipment)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def packages
|
19
|
-
packages = build_location_configured_packages
|
20
|
-
packages = build_packages(packages)
|
21
|
-
packages = prioritize_packages(packages)
|
22
|
-
packages.each do |package|
|
23
|
-
package.shipment = package.to_shipment
|
24
|
-
end
|
25
|
-
packages = estimate_packages(packages)
|
26
|
-
validate_packages(packages)
|
27
|
-
packages
|
28
|
-
end
|
29
|
-
|
30
|
-
# Build packages for the inventory units that have preferred stock locations first
|
31
|
-
#
|
32
|
-
# Certain variants have been selected to be fulfilled from a particular stock
|
33
|
-
# location during the process of the order being created. The rest of the
|
34
|
-
# service objects the coordinator uses do a lot of automated logic to
|
35
|
-
# determine which stock location is best for the inventory unit to be
|
36
|
-
# fulfilled from, but for these special snowflakes we KNOW which stock
|
37
|
-
# location they should be fulfilled from. So rather than sending these units
|
38
|
-
# through the rest of the packing / prioritization, lets just put them
|
39
|
-
# in packages we know they should be in and deal with other automatically-
|
40
|
-
# handled inventory units otherwise.
|
41
|
-
def build_location_configured_packages(packages = [])
|
42
|
-
order.order_stock_locations.where(shipment_fulfilled: false).group_by(&:stock_location).each do |stock_location, stock_location_configurations|
|
43
|
-
units = stock_location_configurations.flat_map do |stock_location_configuration|
|
44
|
-
unallocated_inventory_units.select { |iu| iu.variant == stock_location_configuration.variant }.take(stock_location_configuration.quantity)
|
45
|
-
end
|
46
|
-
packer = build_packer(stock_location, units)
|
47
|
-
packages += packer.packages
|
48
|
-
@preallocated_inventory_units += units
|
49
|
-
end
|
50
|
-
packages
|
51
|
-
end
|
52
|
-
|
53
|
-
# Build packages as per stock location
|
54
|
-
#
|
55
|
-
# It needs to check whether each stock location holds at least one stock
|
56
|
-
# item for the order. In case none is found it wouldn't make any sense
|
57
|
-
# to build a package because it would be empty. Plus we avoid errors down
|
58
|
-
# the stack because it would assume the stock location has stock items
|
59
|
-
# for the given order
|
60
|
-
#
|
61
|
-
# Returns an array of Package instances
|
62
|
-
def build_packages(packages = [])
|
63
|
-
stock_location_variant_ids.each do |stock_location, variant_ids|
|
64
|
-
units_for_location = unallocated_inventory_units.select { |unit| variant_ids.include?(unit.variant_id) }
|
65
|
-
packer = build_packer(stock_location, units_for_location)
|
66
|
-
packages += packer.packages
|
67
|
-
end
|
68
|
-
packages
|
69
|
-
end
|
70
|
-
|
71
|
-
# This finds the variants we're looking for in each active stock location.
|
72
|
-
# It returns a hash like:
|
73
|
-
# {
|
74
|
-
# <stock location> => <set of variant ids>,
|
75
|
-
# <stock location> => <set of variant ids>,
|
76
|
-
# ...,
|
77
|
-
# }
|
78
|
-
# This is done in an awkward way for performance reasons. It uses two
|
79
|
-
# queries that are kept as performant as possible, and only loads the
|
80
|
-
# minimum required ActiveRecord objects.
|
81
|
-
def stock_location_variant_ids
|
82
|
-
# associate the variant ids we're interested in with stock location ids
|
83
|
-
location_variant_ids = Spree::StockItem.
|
84
|
-
where(variant_id: unallocated_variant_ids).
|
85
|
-
joins(:stock_location).
|
86
|
-
merge(Spree::StockLocation.active).
|
87
|
-
pluck(:stock_location_id, :variant_id)
|
88
|
-
|
89
|
-
# load activerecord objects for the stock location ids and turn them
|
90
|
-
# into a lookup hash like:
|
91
|
-
# {
|
92
|
-
# <stock location id> => <stock location>,
|
93
|
-
# ...,
|
94
|
-
# }
|
95
|
-
location_lookup = Spree::StockLocation.
|
96
|
-
where(id: location_variant_ids.map(&:first).uniq).
|
97
|
-
map { |l| [l.id, l] }.
|
98
|
-
to_h
|
99
|
-
|
100
|
-
# build the final lookup hash of
|
101
|
-
# {<stock location> => <set of variant ids>, ...}
|
102
|
-
# using the previous results
|
103
|
-
location_variant_ids.each_with_object({}) do |(location_id, variant_id), hash|
|
104
|
-
location = location_lookup[location_id]
|
105
|
-
hash[location] ||= Set.new
|
106
|
-
hash[location] << variant_id
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def unallocated_inventory_units
|
111
|
-
inventory_units - @preallocated_inventory_units
|
112
|
-
end
|
113
|
-
|
114
|
-
def unallocated_variant_ids
|
115
|
-
unallocated_inventory_units.map(&:variant_id).uniq
|
116
|
-
end
|
117
|
-
|
118
|
-
def prioritize_packages(packages)
|
119
|
-
prioritizer = Prioritizer.new(inventory_units, packages)
|
120
|
-
prioritizer.prioritized_packages
|
121
|
-
end
|
122
|
-
|
123
|
-
def estimate_packages(packages)
|
124
|
-
estimator = Spree::Config.stock.estimator_class.new
|
125
|
-
packages.each do |package|
|
126
|
-
package.shipment.shipping_rates = estimator.shipping_rates(package)
|
127
|
-
end
|
128
|
-
packages
|
129
|
-
end
|
130
|
-
|
131
|
-
def validate_packages(packages)
|
132
|
-
desired_quantity = inventory_units.size
|
133
|
-
packaged_quantity = packages.sum(&:quantity)
|
134
|
-
if packaged_quantity != desired_quantity
|
135
|
-
raise Spree::Order::InsufficientStock,
|
136
|
-
"Was only able to package #{packaged_quantity} inventory units of #{desired_quantity} requested"
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def build_packer(stock_location, inventory_units)
|
141
|
-
Packer.new(stock_location, inventory_units, splitters(stock_location))
|
142
|
-
end
|
143
|
-
|
144
|
-
def splitters(_stock_location)
|
145
|
-
# extension point to return custom splitters for a location
|
146
|
-
Rails.application.config.spree.stock_splitters
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
class Packer
|
4
|
-
attr_reader :stock_location, :inventory_units, :splitters
|
5
|
-
|
6
|
-
def initialize(stock_location, inventory_units, splitters = [Splitter::Base])
|
7
|
-
@stock_location = stock_location
|
8
|
-
@inventory_units = inventory_units
|
9
|
-
@splitters = splitters
|
10
|
-
end
|
11
|
-
|
12
|
-
def packages
|
13
|
-
if splitters.empty?
|
14
|
-
[default_package]
|
15
|
-
else
|
16
|
-
build_splitter.split [default_package]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def default_package
|
21
|
-
package = Package.new(stock_location)
|
22
|
-
inventory_units.group_by(&:variant).each do |variant, variant_inventory_units|
|
23
|
-
units = variant_inventory_units.clone
|
24
|
-
if variant.should_track_inventory?
|
25
|
-
stock_item = stock_item_for(variant.id)
|
26
|
-
next unless stock_item
|
27
|
-
|
28
|
-
on_hand, backordered = stock_item.fill_status(units.count)
|
29
|
-
package.add_multiple units.slice!(0, on_hand), :on_hand if on_hand > 0
|
30
|
-
package.add_multiple units.slice!(0, backordered), :backordered if backordered > 0
|
31
|
-
else
|
32
|
-
package.add_multiple units
|
33
|
-
end
|
34
|
-
end
|
35
|
-
package
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def stock_item_for(variant_id)
|
41
|
-
stock_item_lookup[variant_id]
|
42
|
-
end
|
43
|
-
|
44
|
-
# Returns a lookup table in the form of:
|
45
|
-
# {<variant_id> => <stock_item>, ...}
|
46
|
-
def stock_item_lookup
|
47
|
-
@stock_item_lookup ||= Spree::StockItem.
|
48
|
-
where(variant_id: inventory_units.map(&:variant_id).uniq).
|
49
|
-
where(stock_location_id: stock_location.id).
|
50
|
-
map { |stock_item| [stock_item.variant_id, stock_item] }.
|
51
|
-
to_h # there is only one stock item per variant in a stock location
|
52
|
-
end
|
53
|
-
|
54
|
-
def build_splitter
|
55
|
-
splitter = nil
|
56
|
-
splitters.reverse_each do |klass|
|
57
|
-
splitter = klass.new(self, splitter)
|
58
|
-
end
|
59
|
-
splitter
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module Stock
|
3
|
-
class Prioritizer
|
4
|
-
attr_reader :packages, :inventory_units
|
5
|
-
|
6
|
-
def initialize(inventory_units, packages, adjuster_class = Adjuster)
|
7
|
-
@inventory_units = inventory_units
|
8
|
-
@packages = packages
|
9
|
-
@adjuster_class = adjuster_class
|
10
|
-
end
|
11
|
-
|
12
|
-
def prioritized_packages
|
13
|
-
sort_packages
|
14
|
-
adjust_packages
|
15
|
-
prune_packages
|
16
|
-
packages
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def adjust_packages
|
22
|
-
inventory_units.each do |inventory_unit|
|
23
|
-
adjuster = @adjuster_class.new(inventory_unit, :on_hand)
|
24
|
-
|
25
|
-
visit_packages(adjuster)
|
26
|
-
|
27
|
-
adjuster.status = :backordered
|
28
|
-
visit_packages(adjuster)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def visit_packages(adjuster)
|
33
|
-
packages.each do |package|
|
34
|
-
item = package.find_item adjuster.inventory_unit, adjuster.status
|
35
|
-
adjuster.adjust(package) if item
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def sort_packages
|
40
|
-
# order packages by preferred stock_locations
|
41
|
-
end
|
42
|
-
|
43
|
-
def prune_packages
|
44
|
-
packages.reject!(&:empty?)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,473 +0,0 @@
|
|
1
|
-
class SpreeOneTwo < ActiveRecord::Migration[4.2]
|
2
|
-
def up
|
3
|
-
# This migration is just a compressed version of all the previous
|
4
|
-
# migrations for spree_core. Do not run it if one of the core tables
|
5
|
-
# already exists. Assume the best.
|
6
|
-
return if data_source_exists?(:spree_addresses)
|
7
|
-
|
8
|
-
create_table :spree_activators do |t|
|
9
|
-
t.string :description
|
10
|
-
t.datetime :expires_at
|
11
|
-
t.datetime :starts_at
|
12
|
-
t.string :name
|
13
|
-
t.string :event_name
|
14
|
-
t.string :type
|
15
|
-
t.integer :usage_limit
|
16
|
-
t.string :match_policy, default: 'all'
|
17
|
-
t.string :code
|
18
|
-
t.boolean :advertise, default: false
|
19
|
-
t.string :path
|
20
|
-
t.timestamps null: true
|
21
|
-
end
|
22
|
-
|
23
|
-
create_table :spree_addresses do |t|
|
24
|
-
t.string :firstname
|
25
|
-
t.string :lastname
|
26
|
-
t.string :address1
|
27
|
-
t.string :address2
|
28
|
-
t.string :city
|
29
|
-
t.string :zipcode
|
30
|
-
t.string :phone
|
31
|
-
t.string :state_name
|
32
|
-
t.string :alternative_phone
|
33
|
-
t.string :company
|
34
|
-
t.references :state
|
35
|
-
t.references :country
|
36
|
-
t.timestamps null: true
|
37
|
-
end
|
38
|
-
|
39
|
-
add_index :spree_addresses, [:firstname], name: 'index_addresses_on_firstname'
|
40
|
-
add_index :spree_addresses, [:lastname], name: 'index_addresses_on_lastname'
|
41
|
-
|
42
|
-
create_table :spree_adjustments do |t|
|
43
|
-
t.references :source, polymorphic: true
|
44
|
-
t.references :adjustable, polymorphic: true
|
45
|
-
t.references :originator, polymorphic: true
|
46
|
-
t.decimal :amount, precision: 8, scale: 2
|
47
|
-
t.string :label
|
48
|
-
t.boolean :mandatory
|
49
|
-
t.boolean :locked
|
50
|
-
t.boolean :eligible, default: true
|
51
|
-
t.timestamps null: true
|
52
|
-
end
|
53
|
-
|
54
|
-
add_index :spree_adjustments, [:adjustable_id], name: 'index_adjustments_on_order_id'
|
55
|
-
|
56
|
-
create_table :spree_assets do |t|
|
57
|
-
t.references :viewable, polymorphic: true
|
58
|
-
t.integer :attachment_width
|
59
|
-
t.integer :attachment_height
|
60
|
-
t.integer :attachment_file_size
|
61
|
-
t.integer :position
|
62
|
-
t.string :attachment_content_type
|
63
|
-
t.string :attachment_file_name
|
64
|
-
t.string :type, limit: 75
|
65
|
-
t.datetime :attachment_updated_at
|
66
|
-
t.text :alt
|
67
|
-
end
|
68
|
-
|
69
|
-
add_index :spree_assets, [:viewable_id], name: 'index_assets_on_viewable_id'
|
70
|
-
add_index :spree_assets, [:viewable_type, :type], name: 'index_assets_on_viewable_type_and_type'
|
71
|
-
|
72
|
-
create_table :spree_calculators do |t|
|
73
|
-
t.string :type
|
74
|
-
t.references :calculable, polymorphic: true
|
75
|
-
t.timestamps null: true
|
76
|
-
end
|
77
|
-
|
78
|
-
create_table :spree_configurations do |t|
|
79
|
-
t.string :name
|
80
|
-
t.string :type, limit: 50
|
81
|
-
t.timestamps null: true
|
82
|
-
end
|
83
|
-
|
84
|
-
add_index :spree_configurations, [:name, :type], name: 'index_spree_configurations_on_name_and_type'
|
85
|
-
|
86
|
-
create_table :spree_countries do |t|
|
87
|
-
t.string :iso_name
|
88
|
-
t.string :iso
|
89
|
-
t.string :iso3
|
90
|
-
t.string :name
|
91
|
-
t.integer :numcode
|
92
|
-
end
|
93
|
-
|
94
|
-
create_table :spree_credit_cards do |t|
|
95
|
-
t.string :month
|
96
|
-
t.string :year
|
97
|
-
t.string :cc_type
|
98
|
-
t.string :last_digits
|
99
|
-
t.string :first_name
|
100
|
-
t.string :last_name
|
101
|
-
t.string :start_month
|
102
|
-
t.string :start_year
|
103
|
-
t.string :issue_number
|
104
|
-
t.references :address
|
105
|
-
t.string :gateway_customer_profile_id
|
106
|
-
t.string :gateway_payment_profile_id
|
107
|
-
t.timestamps null: true
|
108
|
-
end
|
109
|
-
|
110
|
-
create_table :spree_gateways do |t|
|
111
|
-
t.string :type
|
112
|
-
t.string :name
|
113
|
-
t.text :description
|
114
|
-
t.boolean :active, default: true
|
115
|
-
t.string :environment, default: 'development'
|
116
|
-
t.string :server, default: 'test'
|
117
|
-
t.boolean :test_mode, default: true
|
118
|
-
t.timestamps null: true
|
119
|
-
end
|
120
|
-
|
121
|
-
create_table :spree_inventory_units do |t|
|
122
|
-
t.integer :lock_version, default: 0
|
123
|
-
t.string :state
|
124
|
-
t.references :variant
|
125
|
-
t.references :order
|
126
|
-
t.references :shipment
|
127
|
-
t.references :return_authorization
|
128
|
-
t.timestamps null: true
|
129
|
-
end
|
130
|
-
|
131
|
-
add_index :spree_inventory_units, [:order_id], name: 'index_inventory_units_on_order_id'
|
132
|
-
add_index :spree_inventory_units, [:shipment_id], name: 'index_inventory_units_on_shipment_id'
|
133
|
-
add_index :spree_inventory_units, [:variant_id], name: 'index_inventory_units_on_variant_id'
|
134
|
-
|
135
|
-
create_table :spree_line_items do |t|
|
136
|
-
t.references :variant
|
137
|
-
t.references :order
|
138
|
-
t.integer :quantity, null: false
|
139
|
-
t.decimal :price, precision: 8, scale: 2, null: false
|
140
|
-
t.timestamps null: true
|
141
|
-
end
|
142
|
-
|
143
|
-
add_index :spree_line_items, [:order_id], name: 'index_spree_line_items_on_order_id'
|
144
|
-
add_index :spree_line_items, [:variant_id], name: 'index_spree_line_items_on_variant_id'
|
145
|
-
|
146
|
-
create_table :spree_log_entries do |t|
|
147
|
-
t.references :source, polymorphic: true
|
148
|
-
t.text :details
|
149
|
-
t.timestamps null: true
|
150
|
-
end
|
151
|
-
|
152
|
-
create_table :spree_mail_methods do |t|
|
153
|
-
t.string :environment
|
154
|
-
t.boolean :active, default: true
|
155
|
-
t.timestamps null: true
|
156
|
-
end
|
157
|
-
|
158
|
-
create_table :spree_option_types do |t|
|
159
|
-
t.string :name, limit: 100
|
160
|
-
t.string :presentation, limit: 100
|
161
|
-
t.integer :position, default: 0, null: false
|
162
|
-
t.timestamps null: true
|
163
|
-
end
|
164
|
-
|
165
|
-
create_table :spree_option_types_prototypes, id: false do |t|
|
166
|
-
t.references :prototype
|
167
|
-
t.references :option_type
|
168
|
-
end
|
169
|
-
|
170
|
-
create_table :spree_option_values do |t|
|
171
|
-
t.integer :position
|
172
|
-
t.string :name
|
173
|
-
t.string :presentation
|
174
|
-
t.references :option_type
|
175
|
-
t.timestamps null: true
|
176
|
-
end
|
177
|
-
|
178
|
-
create_table :spree_option_values_variants, id: false do |t|
|
179
|
-
t.references :variant
|
180
|
-
t.references :option_value
|
181
|
-
end
|
182
|
-
|
183
|
-
add_index :spree_option_values_variants, [:variant_id, :option_value_id], name: 'index_option_values_variants_on_variant_id_and_option_value_id'
|
184
|
-
add_index :spree_option_values_variants, [:variant_id], name: 'index_spree_option_values_variants_on_variant_id'
|
185
|
-
|
186
|
-
create_table :spree_orders do |t|
|
187
|
-
t.string :number, limit: 15
|
188
|
-
t.decimal :item_total, precision: 8, scale: 2, default: 0.0, null: false
|
189
|
-
t.decimal :total, precision: 8, scale: 2, default: 0.0, null: false
|
190
|
-
t.string :state
|
191
|
-
t.decimal :adjustment_total, precision: 8, scale: 2, default: 0.0, null: false
|
192
|
-
t.references :user
|
193
|
-
t.datetime :completed_at
|
194
|
-
t.references :bill_address
|
195
|
-
t.references :ship_address
|
196
|
-
t.decimal :payment_total, precision: 8, scale: 2, default: 0.0
|
197
|
-
t.references :shipping_method
|
198
|
-
t.string :shipment_state
|
199
|
-
t.string :payment_state
|
200
|
-
t.string :email
|
201
|
-
t.text :special_instructions
|
202
|
-
t.timestamps null: true
|
203
|
-
end
|
204
|
-
|
205
|
-
add_index :spree_orders, [:number], name: 'index_spree_orders_on_number'
|
206
|
-
|
207
|
-
create_table :spree_payment_methods do |t|
|
208
|
-
t.string :type
|
209
|
-
t.string :name
|
210
|
-
t.text :description
|
211
|
-
t.boolean :active, default: true
|
212
|
-
t.string :environment, default: 'development'
|
213
|
-
t.datetime :deleted_at
|
214
|
-
t.string :display_on
|
215
|
-
t.timestamps null: true
|
216
|
-
end
|
217
|
-
|
218
|
-
create_table :spree_payments do |t|
|
219
|
-
t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false
|
220
|
-
t.references :order
|
221
|
-
t.references :source, polymorphic: true
|
222
|
-
t.references :payment_method
|
223
|
-
t.string :state
|
224
|
-
t.string :response_code
|
225
|
-
t.string :avs_response
|
226
|
-
t.timestamps null: true
|
227
|
-
end
|
228
|
-
|
229
|
-
create_table :spree_preferences do |t|
|
230
|
-
t.string :name, limit: 100
|
231
|
-
t.references :owner, polymorphic: true
|
232
|
-
t.text :value
|
233
|
-
t.string :key
|
234
|
-
t.string :value_type
|
235
|
-
t.timestamps null: true
|
236
|
-
end
|
237
|
-
|
238
|
-
add_index :spree_preferences, [:key], name: 'index_spree_preferences_on_key', unique: true
|
239
|
-
|
240
|
-
create_table :spree_product_option_types do |t|
|
241
|
-
t.integer :position
|
242
|
-
t.references :product
|
243
|
-
t.references :option_type
|
244
|
-
t.timestamps null: true
|
245
|
-
end
|
246
|
-
|
247
|
-
create_table :spree_product_properties do |t|
|
248
|
-
t.string :value
|
249
|
-
t.references :product
|
250
|
-
t.references :property
|
251
|
-
t.timestamps null: true
|
252
|
-
end
|
253
|
-
|
254
|
-
add_index :spree_product_properties, [:product_id], name: 'index_product_properties_on_product_id'
|
255
|
-
|
256
|
-
create_table :spree_products do |t|
|
257
|
-
t.string :name, default: '', null: false
|
258
|
-
t.text :description
|
259
|
-
t.datetime :available_on
|
260
|
-
t.datetime :deleted_at
|
261
|
-
t.string :permalink
|
262
|
-
t.string :meta_description
|
263
|
-
t.string :meta_keywords
|
264
|
-
t.references :tax_category
|
265
|
-
t.references :shipping_category
|
266
|
-
t.integer :count_on_hand, default: 0, null: false
|
267
|
-
t.timestamps null: true
|
268
|
-
end
|
269
|
-
|
270
|
-
add_index :spree_products, [:available_on], name: 'index_spree_products_on_available_on'
|
271
|
-
add_index :spree_products, [:deleted_at], name: 'index_spree_products_on_deleted_at'
|
272
|
-
add_index :spree_products, [:name], name: 'index_spree_products_on_name'
|
273
|
-
add_index :spree_products, [:permalink], name: 'index_spree_products_on_permalink'
|
274
|
-
|
275
|
-
create_table :spree_products_taxons, id: false do |t|
|
276
|
-
t.references :product
|
277
|
-
t.references :taxon
|
278
|
-
end
|
279
|
-
|
280
|
-
add_index :spree_products_taxons, [:product_id], name: 'index_spree_products_taxons_on_product_id'
|
281
|
-
add_index :spree_products_taxons, [:taxon_id], name: 'index_spree_products_taxons_on_taxon_id'
|
282
|
-
|
283
|
-
create_table :spree_properties do |t|
|
284
|
-
t.string :name
|
285
|
-
t.string :presentation, null: false
|
286
|
-
t.timestamps null: true
|
287
|
-
end
|
288
|
-
|
289
|
-
create_table :spree_properties_prototypes, id: false do |t|
|
290
|
-
t.references :prototype
|
291
|
-
t.references :property
|
292
|
-
end
|
293
|
-
|
294
|
-
create_table :spree_prototypes do |t|
|
295
|
-
t.string :name
|
296
|
-
t.timestamps null: true
|
297
|
-
end
|
298
|
-
|
299
|
-
create_table :spree_return_authorizations do |t|
|
300
|
-
t.string :number
|
301
|
-
t.string :state
|
302
|
-
t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false
|
303
|
-
t.references :order
|
304
|
-
t.text :reason
|
305
|
-
t.timestamps null: true
|
306
|
-
end
|
307
|
-
|
308
|
-
create_table :spree_roles do |t|
|
309
|
-
t.string :name
|
310
|
-
end
|
311
|
-
|
312
|
-
create_table :spree_roles_users, id: false do |t|
|
313
|
-
t.references :role
|
314
|
-
t.references :user
|
315
|
-
end
|
316
|
-
|
317
|
-
add_index :spree_roles_users, [:role_id], name: 'index_spree_roles_users_on_role_id'
|
318
|
-
add_index :spree_roles_users, [:user_id], name: 'index_spree_roles_users_on_user_id'
|
319
|
-
|
320
|
-
create_table :spree_shipments do |t|
|
321
|
-
t.string :tracking
|
322
|
-
t.string :number
|
323
|
-
t.decimal :cost, precision: 8, scale: 2
|
324
|
-
t.datetime :shipped_at
|
325
|
-
t.references :order
|
326
|
-
t.references :shipping_method
|
327
|
-
t.references :address
|
328
|
-
t.string :state
|
329
|
-
t.timestamps null: true
|
330
|
-
end
|
331
|
-
|
332
|
-
add_index :spree_shipments, [:number], name: 'index_shipments_on_number'
|
333
|
-
|
334
|
-
create_table :spree_shipping_categories do |t|
|
335
|
-
t.string :name
|
336
|
-
t.timestamps null: true
|
337
|
-
end
|
338
|
-
|
339
|
-
create_table :spree_shipping_methods do |t|
|
340
|
-
t.string :name
|
341
|
-
t.references :zone
|
342
|
-
t.string :display_on
|
343
|
-
t.references :shipping_category
|
344
|
-
t.boolean :match_none
|
345
|
-
t.boolean :match_all
|
346
|
-
t.boolean :match_one
|
347
|
-
t.datetime :deleted_at
|
348
|
-
t.timestamps null: true
|
349
|
-
end
|
350
|
-
|
351
|
-
create_table :spree_state_changes do |t|
|
352
|
-
t.string :name
|
353
|
-
t.string :previous_state
|
354
|
-
t.references :stateful
|
355
|
-
t.references :user
|
356
|
-
t.string :stateful_type
|
357
|
-
t.string :next_state
|
358
|
-
t.timestamps null: true
|
359
|
-
end
|
360
|
-
|
361
|
-
create_table :spree_states do |t|
|
362
|
-
t.string :name
|
363
|
-
t.string :abbr
|
364
|
-
t.references :country
|
365
|
-
end
|
366
|
-
|
367
|
-
create_table :spree_tax_categories do |t|
|
368
|
-
t.string :name
|
369
|
-
t.string :description
|
370
|
-
t.boolean :is_default, default: false
|
371
|
-
t.datetime :deleted_at
|
372
|
-
t.timestamps null: true
|
373
|
-
end
|
374
|
-
|
375
|
-
create_table :spree_tax_rates do |t|
|
376
|
-
t.decimal :amount, precision: 8, scale: 5
|
377
|
-
t.references :zone
|
378
|
-
t.references :tax_category
|
379
|
-
t.boolean :included_in_price, default: false
|
380
|
-
t.timestamps null: true
|
381
|
-
end
|
382
|
-
|
383
|
-
create_table :spree_taxonomies do |t|
|
384
|
-
t.string :name, null: false
|
385
|
-
t.timestamps null: true
|
386
|
-
end
|
387
|
-
|
388
|
-
create_table :spree_taxons do |t|
|
389
|
-
t.references :parent
|
390
|
-
t.integer :position, default: 0
|
391
|
-
t.string :name, null: false
|
392
|
-
t.string :permalink
|
393
|
-
t.references :taxonomy
|
394
|
-
t.integer :lft
|
395
|
-
t.integer :rgt
|
396
|
-
t.string :icon_file_name
|
397
|
-
t.string :icon_content_type
|
398
|
-
t.integer :icon_file_size
|
399
|
-
t.datetime :icon_updated_at
|
400
|
-
t.text :description
|
401
|
-
t.timestamps null: true
|
402
|
-
end
|
403
|
-
|
404
|
-
add_index :spree_taxons, [:parent_id], name: 'index_taxons_on_parent_id'
|
405
|
-
add_index :spree_taxons, [:permalink], name: 'index_taxons_on_permalink'
|
406
|
-
add_index :spree_taxons, [:taxonomy_id], name: 'index_taxons_on_taxonomy_id'
|
407
|
-
|
408
|
-
create_table :spree_tokenized_permissions, force: true do |t|
|
409
|
-
t.references :permissable, polymorphic: true
|
410
|
-
t.string :token
|
411
|
-
t.timestamps null: true
|
412
|
-
end
|
413
|
-
|
414
|
-
add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], name: 'index_tokenized_name_and_type'
|
415
|
-
|
416
|
-
create_table :spree_users do |t|
|
417
|
-
t.string :encrypted_password, limit: 128
|
418
|
-
t.string :password_salt, limit: 128
|
419
|
-
t.string :email
|
420
|
-
t.string :remember_token
|
421
|
-
t.string :persistence_token
|
422
|
-
t.string :reset_password_token
|
423
|
-
t.string :perishable_token
|
424
|
-
t.integer :sign_in_count, default: 0, null: false
|
425
|
-
t.integer :failed_attempts, default: 0, null: false
|
426
|
-
t.datetime :last_request_at
|
427
|
-
t.datetime :current_sign_in_at
|
428
|
-
t.datetime :last_sign_in_at
|
429
|
-
t.string :current_sign_in_ip
|
430
|
-
t.string :last_sign_in_ip
|
431
|
-
t.string :login
|
432
|
-
t.references :ship_address
|
433
|
-
t.references :bill_address
|
434
|
-
t.string :authentication_token
|
435
|
-
t.string :unlock_token
|
436
|
-
t.datetime :locked_at
|
437
|
-
t.datetime :remember_created_at
|
438
|
-
t.datetime :reset_password_sent_at
|
439
|
-
t.timestamps null: true
|
440
|
-
end
|
441
|
-
|
442
|
-
create_table :spree_variants do |t|
|
443
|
-
t.string :sku, default: '', null: false
|
444
|
-
t.decimal :price, precision: 8, scale: 2, null: false
|
445
|
-
t.decimal :weight, precision: 8, scale: 2
|
446
|
-
t.decimal :height, precision: 8, scale: 2
|
447
|
-
t.decimal :width, precision: 8, scale: 2
|
448
|
-
t.decimal :depth, precision: 8, scale: 2
|
449
|
-
t.datetime :deleted_at
|
450
|
-
t.boolean :is_master, default: false
|
451
|
-
t.references :product
|
452
|
-
t.integer :count_on_hand, default: 0, null: false
|
453
|
-
t.decimal :cost_price, precision: 8, scale: 2
|
454
|
-
t.integer :position
|
455
|
-
end
|
456
|
-
|
457
|
-
add_index :spree_variants, [:product_id], name: 'index_spree_variants_on_product_id'
|
458
|
-
|
459
|
-
create_table :spree_zone_members do |t|
|
460
|
-
t.references :zoneable, polymorphic: true
|
461
|
-
t.references :zone
|
462
|
-
t.timestamps null: true
|
463
|
-
end
|
464
|
-
|
465
|
-
create_table :spree_zones do |t|
|
466
|
-
t.string :name
|
467
|
-
t.string :description
|
468
|
-
t.boolean :default_tax, default: false
|
469
|
-
t.integer :zone_members_count, default: 0
|
470
|
-
t.timestamps null: true
|
471
|
-
end
|
472
|
-
end
|
473
|
-
end
|