solidus_core 1.0.7 → 1.1.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 +1 -2
- data/app/helpers/spree/base_helper.rb +4 -5
- data/app/helpers/spree/products_helper.rb +0 -8
- data/app/mailers/spree/carton_mailer.rb +17 -5
- data/app/mailers/spree/order_mailer.rb +12 -4
- data/app/models/concerns/spree/adjustment_source.rb +7 -8
- data/app/models/concerns/spree/default_price.rb +8 -2
- data/app/models/concerns/spree/named_type.rb +1 -1
- data/app/models/concerns/spree/ordered_property_value_list.rb +28 -0
- data/app/models/concerns/spree/user_address_book.rb +125 -0
- data/app/models/concerns/spree/user_api_authentication.rb +6 -2
- data/app/models/concerns/spree/user_methods.rb +5 -6
- data/app/models/spree/ability.rb +1 -38
- data/app/models/spree/address.rb +79 -36
- data/app/models/spree/adjustment.rb +74 -25
- data/app/models/spree/adjustment_reason.rb +1 -1
- data/app/models/spree/app_configuration.rb +35 -0
- data/app/models/spree/carton.rb +3 -3
- data/app/models/spree/country.rb +7 -1
- data/app/models/spree/credit_card.rb +5 -1
- data/app/models/spree/gateway.rb +0 -8
- data/app/models/spree/inventory_unit.rb +1 -1
- data/app/models/spree/item_adjustments.rb +1 -1
- data/app/models/spree/line_item_action.rb +1 -1
- data/app/models/spree/option_type.rb +3 -2
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/option_values_variant.rb +1 -1
- data/app/models/spree/order.rb +28 -56
- data/app/models/spree/order/checkout.rb +18 -20
- data/app/models/spree/order_mutex.rb +1 -1
- data/app/models/spree/order_promotion.rb +1 -1
- data/app/models/spree/order_shipping.rb +6 -12
- data/app/models/spree/order_stock_location.rb +1 -1
- data/app/models/spree/payment.rb +3 -14
- data/app/models/spree/payment/processing.rb +7 -14
- data/app/models/spree/payment_method.rb +5 -5
- data/app/models/spree/permission_sets/default_customer.rb +31 -0
- data/app/models/spree/permission_sets/order_display.rb +4 -0
- data/app/models/spree/permission_sets/order_management.rb +3 -0
- data/app/models/spree/permission_sets/promotion_display.rb +2 -1
- data/app/models/spree/permission_sets/restricted_stock_display.rb +16 -0
- data/app/models/spree/permission_sets/restricted_stock_management.rb +16 -0
- data/app/models/spree/permission_sets/restricted_stock_transfer_display.rb +17 -0
- data/app/models/spree/permission_sets/restricted_stock_transfer_management.rb +51 -0
- data/app/models/spree/permission_sets/stock_display.rb +1 -1
- data/app/models/spree/permission_sets/stock_management.rb +1 -2
- data/app/models/spree/permission_sets/stock_transfer_display.rb +10 -0
- data/app/models/spree/permission_sets/stock_transfer_management.rb +11 -0
- data/app/models/spree/permission_sets/super_user.rb +9 -0
- data/app/models/spree/product.rb +66 -28
- data/app/models/spree/product/scopes.rb +7 -22
- data/app/models/spree/product_option_type.rb +1 -1
- data/app/models/spree/product_promotion_rule.rb +6 -0
- data/app/models/spree/product_property.rb +2 -20
- data/app/models/spree/promotion/rules/product.rb +2 -1
- data/app/models/spree/refund.rb +0 -10
- data/app/models/spree/reimbursement.rb +1 -1
- data/app/models/spree/return_item.rb +5 -3
- data/app/models/spree/return_item/exchange_variant_eligibility/same_option_value.rb +13 -4
- data/app/models/spree/return_item/exchange_variant_eligibility/same_product.rb +2 -2
- data/app/models/spree/return_reason.rb +1 -1
- data/app/models/spree/role.rb +1 -1
- data/app/models/spree/role_user.rb +1 -1
- data/app/models/spree/shipment.rb +13 -4
- data/app/models/spree/shipping_manifest.rb +9 -3
- data/app/models/spree/shipping_method.rb +2 -3
- data/app/models/spree/shipping_method_zone.rb +6 -0
- data/app/models/spree/state.rb +1 -1
- data/app/models/spree/stock_item.rb +15 -3
- data/app/models/spree/stock_movement.rb +1 -1
- data/app/models/spree/store.rb +3 -0
- data/app/models/spree/store_credit.rb +1 -1
- data/app/models/spree/store_credit_category.rb +1 -1
- data/app/models/spree/store_credit_event.rb +1 -1
- data/app/models/spree/store_credit_type.rb +1 -1
- data/app/models/spree/store_credit_update_reason.rb +1 -1
- data/app/models/spree/store_payment_method.rb +6 -0
- data/app/models/spree/tax_rate.rb +3 -10
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/transfer_item.rb +1 -1
- data/app/models/spree/unit_cancel.rb +2 -2
- data/app/models/spree/user_address.rb +21 -0
- data/app/models/spree/user_stock_location.rb +1 -1
- data/app/models/spree/variant.rb +28 -13
- data/app/models/spree/variant_property_rule.rb +42 -0
- data/app/models/spree/variant_property_rule_condition.rb +8 -0
- data/app/models/spree/variant_property_rule_value.rb +8 -0
- data/app/models/spree/zone.rb +4 -2
- data/app/views/spree/carton_mailer/shipped_email.text.erb +1 -1
- data/config/locales/en.yml +13 -0
- data/db/default/spree/store_credit.rb +0 -1
- data/db/default/spree/zones.rb +1 -1
- data/db/migrate/20130228210442_create_shipping_method_zone.rb +1 -1
- data/db/migrate/20150121022521_remove_environment_from_payment_method.rb +6 -0
- data/db/migrate/20150506181611_create_spree_store_credit_payment_method.rb +9 -5
- data/db/migrate/20150731201146_add_spree_user_addresses.rb +16 -0
- data/db/migrate/20150811210350_remove_mandatory_from_adjustments.rb +5 -0
- data/db/migrate/20150811211025_add_finalized_to_spree_adjustments.rb +11 -0
- data/db/migrate/20150820160821_add_store_payment_methods.rb +10 -0
- data/db/migrate/20150824213633_convert_habtm_to_hmt_for_shipping_methods_zones.rb +17 -0
- data/db/migrate/20150824214129_convert_habtm_to_hmt_for_products_promotion_rules.rb +17 -0
- data/db/migrate/20150825204216_drop_spree_gateways.rb +20 -0
- data/db/migrate/20150909123605_create_variant_properties_and_rules.rb +28 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +1 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +4 -3
- data/lib/spree/core.rb +4 -0
- data/lib/spree/core/controller_helpers/payment_parameters.rb +67 -0
- data/lib/spree/core/delegate_belongs_to.rb +1 -0
- data/lib/spree/core/engine.rb +9 -1
- data/lib/spree/core/importer/order.rb +1 -1
- data/lib/spree/core/role_configuration.rb +1 -1
- data/lib/spree/core/search/variant.rb +20 -2
- data/lib/spree/core/unreturned_item_charger.rb +21 -16
- data/lib/spree/i18n.rb +6 -24
- data/lib/spree/mailer_previews/carton_preview.rb +10 -0
- data/lib/spree/mailer_previews/order_preview.rb +18 -0
- data/lib/spree/permitted_attributes.rb +4 -1
- data/lib/spree/testing_support/capybara_ext.rb +2 -1
- data/lib/spree/testing_support/factories/address_factory.rb +9 -1
- data/lib/spree/testing_support/factories/credit_card_factory.rb +1 -0
- data/lib/spree/testing_support/factories/image_factory.rb +5 -0
- data/lib/spree/testing_support/factories/payment_method_factory.rb +4 -8
- data/lib/spree/testing_support/factories/user_factory.rb +8 -2
- data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +6 -0
- data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +16 -0
- data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +6 -0
- data/lib/tasks/migrations/migrate_user_addresses.rake +29 -0
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
- metadata +40 -238
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -3
- data/Rakefile +0 -16
- data/app/models/concerns/spree/user_address.rb +0 -30
- data/app/models/spree/permission_sets/restricted_transfer_management.rb +0 -35
- data/app/views/spree/admin/orders/customer_details/_autocomplete.js.erb +0 -19
- data/lib/spree/i18n/base.rb +0 -17
- data/lib/spree/i18n/initializer.rb +0 -1
- data/lib/spree/testing_support/mail.rb +0 -20
- data/script/rails +0 -9
- data/solidus_core.gemspec +0 -48
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/helpers/base_helper_spec.rb +0 -173
- data/spec/helpers/order_helper_spec.rb +0 -12
- data/spec/helpers/products_helper_spec.rb +0 -220
- data/spec/helpers/taxons_helper_spec.rb +0 -17
- data/spec/lib/calculated_adjustments_spec.rb +0 -7
- data/spec/lib/i18n_spec.rb +0 -123
- data/spec/lib/search/base_spec.rb +0 -86
- data/spec/lib/search/variant_spec.rb +0 -92
- data/spec/lib/spree/core/controller_helpers/auth_spec.rb +0 -66
- data/spec/lib/spree/core/controller_helpers/order_spec.rb +0 -92
- data/spec/lib/spree/core/controller_helpers/search_spec.rb +0 -17
- data/spec/lib/spree/core/controller_helpers/store_spec.rb +0 -16
- data/spec/lib/spree/core/controller_helpers/strong_parameters_spec.rb +0 -39
- data/spec/lib/spree/core/current_store_spec.rb +0 -36
- data/spec/lib/spree/core/delegate_belongs_to_spec.rb +0 -22
- data/spec/lib/spree/core/importer/order_spec.rb +0 -431
- data/spec/lib/spree/core/role_configuration_spec.rb +0 -138
- data/spec/lib/spree/core/validators/email_spec.rb +0 -48
- data/spec/lib/spree/localized_number_spec.rb +0 -38
- data/spec/lib/spree/migrations_spec.rb +0 -36
- data/spec/lib/spree/money_spec.rb +0 -127
- data/spec/lib/tasks/exchanges_spec.rb +0 -231
- data/spec/lib/tasks/migrations/copy_shipped_shipments_to_cartons_spec.rb +0 -115
- data/spec/lib/tasks/order_capturing_spec.rb +0 -56
- data/spec/mailers/carton_mailer_spec.rb +0 -43
- data/spec/mailers/order_mailer_spec.rb +0 -122
- data/spec/mailers/reimbursement_mailer_spec.rb +0 -40
- data/spec/mailers/test_mailer_spec.rb +0 -15
- data/spec/models/spree/ability_spec.rb +0 -276
- data/spec/models/spree/address_spec.rb +0 -250
- data/spec/models/spree/adjustment_reason_spec.rb +0 -13
- data/spec/models/spree/adjustment_spec.rb +0 -177
- data/spec/models/spree/app_configuration_spec.rb +0 -20
- data/spec/models/spree/asset_spec.rb +0 -24
- data/spec/models/spree/calculator/default_tax_spec.rb +0 -127
- data/spec/models/spree/calculator/flat_percent_item_total_spec.rb +0 -25
- data/spec/models/spree/calculator/flat_rate_spec.rb +0 -47
- data/spec/models/spree/calculator/flexi_rate_spec.rb +0 -41
- data/spec/models/spree/calculator/percent_on_line_item_spec.rb +0 -15
- data/spec/models/spree/calculator/price_sack_spec.rb +0 -30
- data/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb +0 -51
- data/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +0 -23
- data/spec/models/spree/calculator/shipping/flat_rate_spec.rb +0 -13
- data/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +0 -52
- data/spec/models/spree/calculator/shipping/per_item_spec.rb +0 -20
- data/spec/models/spree/calculator/shipping/price_sack_spec.rb +0 -30
- data/spec/models/spree/calculator/tiered_flat_rate_spec.rb +0 -36
- data/spec/models/spree/calculator/tiered_percent_spec.rb +0 -47
- data/spec/models/spree/calculator_spec.rb +0 -36
- data/spec/models/spree/carton_spec.rb +0 -133
- data/spec/models/spree/classification_spec.rb +0 -15
- data/spec/models/spree/concerns/display_money_spec.rb +0 -43
- data/spec/models/spree/concerns/user_methods_spec.rb +0 -41
- data/spec/models/spree/credit_card_spec.rb +0 -334
- data/spec/models/spree/customer_return_spec.rb +0 -276
- data/spec/models/spree/exchange_spec.rb +0 -79
- data/spec/models/spree/gateway/bogus_simple.rb +0 -20
- data/spec/models/spree/gateway/bogus_spec.rb +0 -13
- data/spec/models/spree/gateway_spec.rb +0 -82
- data/spec/models/spree/inventory_unit_spec.rb +0 -307
- data/spec/models/spree/item_adjustments_spec.rb +0 -256
- data/spec/models/spree/line_item_spec.rb +0 -191
- data/spec/models/spree/option_type_spec.rb +0 -14
- data/spec/models/spree/option_value_spec.rb +0 -22
- data/spec/models/spree/order/address_spec.rb +0 -50
- data/spec/models/spree/order/adjustments_spec.rb +0 -39
- data/spec/models/spree/order/callbacks_spec.rb +0 -42
- data/spec/models/spree/order/checkout_spec.rb +0 -902
- data/spec/models/spree/order/currency_updater_spec.rb +0 -32
- data/spec/models/spree/order/finalizing_spec.rb +0 -111
- data/spec/models/spree/order/payment_spec.rb +0 -210
- data/spec/models/spree/order/risk_assessment_spec.rb +0 -68
- data/spec/models/spree/order/state_machine_spec.rb +0 -221
- data/spec/models/spree/order/tax_spec.rb +0 -84
- data/spec/models/spree/order/totals_spec.rb +0 -24
- data/spec/models/spree/order/updating_spec.rb +0 -18
- data/spec/models/spree/order/validations_spec.rb +0 -15
- data/spec/models/spree/order_cancellations_spec.rb +0 -120
- data/spec/models/spree/order_capturing_spec.rb +0 -116
- data/spec/models/spree/order_contents_spec.rb +0 -265
- data/spec/models/spree/order_inventory_spec.rb +0 -228
- data/spec/models/spree/order_mutex_spec.rb +0 -85
- data/spec/models/spree/order_promotion_spec.rb +0 -31
- data/spec/models/spree/order_shipping_spec.rb +0 -247
- data/spec/models/spree/order_spec.rb +0 -1464
- data/spec/models/spree/order_stock_location_spec.rb +0 -18
- data/spec/models/spree/order_updater_spec.rb +0 -299
- data/spec/models/spree/payment_method/store_credit_spec.rb +0 -294
- data/spec/models/spree/payment_method_spec.rb +0 -96
- data/spec/models/spree/payment_spec.rb +0 -1045
- data/spec/models/spree/permission_sets/base_spec.rb +0 -12
- data/spec/models/spree/permission_sets/configuration_display.rb +0 -82
- data/spec/models/spree/permission_sets/configuration_management_spec.rb +0 -50
- data/spec/models/spree/permission_sets/dashboard_display_spec.rb +0 -22
- data/spec/models/spree/permission_sets/order_display_spec.rb +0 -49
- data/spec/models/spree/permission_sets/order_management_spec.rb +0 -36
- data/spec/models/spree/permission_sets/product_display_spec.rb +0 -60
- data/spec/models/spree/permission_sets/product_management_spec.rb +0 -40
- data/spec/models/spree/permission_sets/promotion_display_spec.rb +0 -34
- data/spec/models/spree/permission_sets/promotion_management_spec.rb +0 -26
- data/spec/models/spree/permission_sets/report_display_spec.rb +0 -24
- data/spec/models/spree/permission_sets/restricted_transfer_management_spec.rb +0 -132
- data/spec/models/spree/permission_sets/stock_display_spec.rb +0 -26
- data/spec/models/spree/permission_sets/stock_management_spec.rb +0 -24
- data/spec/models/spree/permission_sets/user_display_spec.rb +0 -36
- data/spec/models/spree/permission_sets/user_management_spec.rb +0 -28
- data/spec/models/spree/preference_spec.rb +0 -80
- data/spec/models/spree/preferences/configuration_spec.rb +0 -30
- data/spec/models/spree/preferences/preferable_spec.rb +0 -294
- data/spec/models/spree/preferences/scoped_store_spec.rb +0 -58
- data/spec/models/spree/preferences/static_model_preferences_spec.rb +0 -78
- data/spec/models/spree/preferences/statically_configurable_spec.rb +0 -60
- data/spec/models/spree/preferences/store_spec.rb +0 -39
- data/spec/models/spree/price_spec.rb +0 -42
- data/spec/models/spree/product/scopes_spec.rb +0 -148
- data/spec/models/spree/product_duplicator_spec.rb +0 -103
- data/spec/models/spree/product_filter_spec.rb +0 -26
- data/spec/models/spree/product_property_spec.rb +0 -20
- data/spec/models/spree/product_spec.rb +0 -437
- data/spec/models/spree/promotion/actions/create_adjustment_spec.rb +0 -96
- data/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +0 -165
- data/spec/models/spree/promotion/actions/create_quantity_adjustments_spec.rb +0 -115
- data/spec/models/spree/promotion/actions/free_shipping_spec.rb +0 -40
- data/spec/models/spree/promotion/rules/first_order_spec.rb +0 -75
- data/spec/models/spree/promotion/rules/item_total_spec.rb +0 -67
- data/spec/models/spree/promotion/rules/nth_order_spec.rb +0 -70
- data/spec/models/spree/promotion/rules/one_use_per_user_spec.rb +0 -42
- data/spec/models/spree/promotion/rules/option_value_spec.rb +0 -94
- data/spec/models/spree/promotion/rules/product_spec.rb +0 -143
- data/spec/models/spree/promotion/rules/taxon_spec.rb +0 -102
- data/spec/models/spree/promotion/rules/user_logged_in_spec.rb +0 -27
- data/spec/models/spree/promotion/rules/user_spec.rb +0 -37
- data/spec/models/spree/promotion_builder_spec.rb +0 -118
- data/spec/models/spree/promotion_category_spec.rb +0 -17
- data/spec/models/spree/promotion_code/code_builder_spec.rb +0 -79
- data/spec/models/spree/promotion_code_spec.rb +0 -187
- data/spec/models/spree/promotion_handler/cart_spec.rb +0 -114
- data/spec/models/spree/promotion_handler/coupon_spec.rb +0 -335
- data/spec/models/spree/promotion_handler/free_shipping_spec.rb +0 -47
- data/spec/models/spree/promotion_handler/page_spec.rb +0 -44
- data/spec/models/spree/promotion_rule_spec.rb +0 -28
- data/spec/models/spree/promotion_spec.rb +0 -767
- data/spec/models/spree/refund_spec.rb +0 -204
- data/spec/models/spree/reimbursement/credit_spec.rb +0 -36
- data/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb +0 -140
- data/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb +0 -83
- data/spec/models/spree/reimbursement_performer_spec.rb +0 -30
- data/spec/models/spree/reimbursement_spec.rb +0 -231
- data/spec/models/spree/reimbursement_tax_calculator_spec.rb +0 -51
- data/spec/models/spree/reimbursement_type/credit_spec.rb +0 -53
- data/spec/models/spree/reimbursement_type/exchange_spec.rb +0 -46
- data/spec/models/spree/reimbursement_type/original_payment_spec.rb +0 -107
- data/spec/models/spree/reimbursement_type/store_credit_spec.rb +0 -97
- data/spec/models/spree/return_authorization_spec.rb +0 -290
- data/spec/models/spree/return_item/eligibility_validator/default_spec.rb +0 -77
- data/spec/models/spree/return_item/eligibility_validator/inventory_shipped_spec.rb +0 -58
- data/spec/models/spree/return_item/eligibility_validator/no_reimbursements_spec.rb +0 -85
- data/spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb +0 -32
- data/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb +0 -29
- data/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb +0 -35
- data/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb +0 -65
- data/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +0 -43
- data/spec/models/spree/return_item_spec.rb +0 -775
- data/spec/models/spree/returns_calculator_spec.rb +0 -14
- data/spec/models/spree/shipment_spec.rb +0 -709
- data/spec/models/spree/shipping_calculator_spec.rb +0 -45
- data/spec/models/spree/shipping_method_spec.rb +0 -88
- data/spec/models/spree/shipping_rate_spec.rb +0 -142
- data/spec/models/spree/state_spec.rb +0 -14
- data/spec/models/spree/stock/availability_validator_spec.rb +0 -83
- data/spec/models/spree/stock/coordinator_spec.rb +0 -116
- data/spec/models/spree/stock/differentiator_spec.rb +0 -39
- data/spec/models/spree/stock/estimator_spec.rb +0 -146
- data/spec/models/spree/stock/inventory_unit_builder_spec.rb +0 -38
- data/spec/models/spree/stock/package_spec.rb +0 -163
- data/spec/models/spree/stock/packer_spec.rb +0 -91
- data/spec/models/spree/stock/prioritizer_spec.rb +0 -125
- data/spec/models/spree/stock/quantifier_spec.rb +0 -115
- data/spec/models/spree/stock/splitter/backordered_spec.rb +0 -29
- data/spec/models/spree/stock/splitter/base_spec.rb +0 -21
- data/spec/models/spree/stock/splitter/shipping_category_spec.rb +0 -50
- data/spec/models/spree/stock/splitter/weight_spec.rb +0 -29
- data/spec/models/spree/stock_item_spec.rb +0 -426
- data/spec/models/spree/stock_location_spec.rb +0 -279
- data/spec/models/spree/stock_movement_spec.rb +0 -56
- data/spec/models/spree/stock_transfer_spec.rb +0 -290
- data/spec/models/spree/store_credit_category_spec.rb +0 -17
- data/spec/models/spree/store_credit_event_spec.rb +0 -314
- data/spec/models/spree/store_credit_spec.rb +0 -876
- data/spec/models/spree/store_spec.rb +0 -55
- data/spec/models/spree/tax_category_spec.rb +0 -27
- data/spec/models/spree/tax_rate_spec.rb +0 -378
- data/spec/models/spree/taxon_spec.rb +0 -74
- data/spec/models/spree/taxonomy_spec.rb +0 -18
- data/spec/models/spree/tracker_spec.rb +0 -21
- data/spec/models/spree/transfer_item_spec.rb +0 -264
- data/spec/models/spree/unit_cancel_spec.rb +0 -148
- data/spec/models/spree/user_spec.rb +0 -223
- data/spec/models/spree/validations/db_maximum_length_validator_spec.rb +0 -23
- data/spec/models/spree/variant/scopes_spec.rb +0 -55
- data/spec/models/spree/variant_spec.rb +0 -546
- data/spec/models/spree/zone_spec.rb +0 -305
- data/spec/spec_helper.rb +0 -78
- data/spec/support/big_decimal.rb +0 -5
- data/spec/support/concerns/default_price.rb +0 -34
- data/spec/support/dummy_ability.rb +0 -4
- data/spec/support/test_gateway.rb +0 -2
@@ -9,24 +9,6 @@ module Spree
|
|
9
9
|
search_scopes << name.to_sym
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.simple_scopes
|
13
|
-
[
|
14
|
-
:ascend_by_updated_at,
|
15
|
-
:descend_by_updated_at,
|
16
|
-
:ascend_by_name,
|
17
|
-
:descend_by_name
|
18
|
-
]
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.add_simple_scopes(scopes)
|
22
|
-
scopes.each do |name|
|
23
|
-
# We should not define price scopes here, as they require something slightly different
|
24
|
-
next if name.to_s.include?("master_price")
|
25
|
-
parts = name.to_s.match(/(.*)_by_(.*)/)
|
26
|
-
self.scope(name.to_s, -> { order("#{Product.quoted_table_name}.#{parts[2]} #{parts[1] == 'ascend' ? "ASC" : "DESC"}") })
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
12
|
def self.property_conditions(property)
|
31
13
|
properties = Property.table_name
|
32
14
|
conditions = case property
|
@@ -36,14 +18,17 @@ module Spree
|
|
36
18
|
end
|
37
19
|
end
|
38
20
|
|
39
|
-
|
21
|
+
scope :ascend_by_updated_at, -> { order(updated_at: :asc) }
|
22
|
+
scope :descend_by_updated_at, -> { order(updated_at: :desc) }
|
23
|
+
scope :ascend_by_name, -> { order(name: :asc) }
|
24
|
+
scope :descend_by_name, -> { order(name: :desc) }
|
40
25
|
|
41
26
|
add_search_scope :ascend_by_master_price do
|
42
|
-
joins(:master => :default_price).order(
|
27
|
+
joins(:master => :default_price).order(Spree::Price.arel_table[:amount].asc)
|
43
28
|
end
|
44
29
|
|
45
30
|
add_search_scope :descend_by_master_price do
|
46
|
-
joins(:master => :default_price).order(
|
31
|
+
joins(:master => :default_price).order(Spree::Price.arel_table[:amount].desc)
|
47
32
|
end
|
48
33
|
|
49
34
|
add_search_scope :price_between do |low, high|
|
@@ -78,7 +63,7 @@ module Spree
|
|
78
63
|
add_search_scope :in_taxon do |taxon|
|
79
64
|
includes(:classifications).
|
80
65
|
where("spree_products_taxons.taxon_id" => taxon.self_and_descendants.pluck(:id)).
|
81
|
-
order(
|
66
|
+
order(Spree::Classification.arel_table[:position].asc)
|
82
67
|
end
|
83
68
|
|
84
69
|
# This scope selects products in all taxons AND all its descendants
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Spree
|
2
2
|
class ProductOptionType < Spree::Base
|
3
|
-
belongs_to :product, class_name: 'Spree::Product', inverse_of: :product_option_types
|
3
|
+
belongs_to :product, class_name: 'Spree::Product', inverse_of: :product_option_types, touch: true
|
4
4
|
belongs_to :option_type, class_name: 'Spree::OptionType', inverse_of: :product_option_types
|
5
5
|
acts_as_list scope: :product
|
6
6
|
end
|
@@ -1,28 +1,10 @@
|
|
1
1
|
module Spree
|
2
2
|
class ProductProperty < Spree::Base
|
3
|
-
|
3
|
+
include Spree::OrderedPropertyValueList
|
4
|
+
|
4
5
|
belongs_to :product, touch: true, class_name: 'Spree::Product', inverse_of: :product_properties
|
5
6
|
belongs_to :property, class_name: 'Spree::Property', inverse_of: :product_properties
|
6
7
|
|
7
|
-
validates :property, presence: true
|
8
|
-
validates :value, length: { maximum: 255 }
|
9
|
-
|
10
|
-
default_scope -> { order("#{self.table_name}.position") }
|
11
|
-
|
12
8
|
self.whitelisted_ransackable_attributes = ['value']
|
13
|
-
|
14
|
-
# virtual attributes for use with AJAX completion stuff
|
15
|
-
def property_name
|
16
|
-
property.name if property
|
17
|
-
end
|
18
|
-
|
19
|
-
def property_name=(name)
|
20
|
-
unless name.blank?
|
21
|
-
unless property = Property.find_by(name: name)
|
22
|
-
property = Property.create(name: name, presentation: name)
|
23
|
-
end
|
24
|
-
self.property = property
|
25
|
-
end
|
26
|
-
end
|
27
9
|
end
|
28
10
|
end
|
@@ -6,7 +6,8 @@ module Spree
|
|
6
6
|
# either come from assigned product group or are assingned directly to
|
7
7
|
# the rule.
|
8
8
|
class Product < PromotionRule
|
9
|
-
|
9
|
+
has_many :product_promotion_rules, class_name: 'Spree::ProductPromotionRule', foreign_key: :promotion_rule_id
|
10
|
+
has_many :products, class_name: 'Spree::Product', through: :product_promotion_rules
|
10
11
|
|
11
12
|
MATCH_POLICIES = %w(any all none)
|
12
13
|
preference :match_policy, :string, default: MATCH_POLICIES.first
|
data/app/models/spree/refund.rb
CHANGED
@@ -11,7 +11,6 @@ module Spree
|
|
11
11
|
validates :transaction_id, presence: true, on: :update # can't require this on create because the before_create needs to run first
|
12
12
|
validates :amount, presence: true, numericality: {greater_than: 0}
|
13
13
|
|
14
|
-
validate :check_payment_environment, on: :create, if: :payment
|
15
14
|
validate :amount_is_less_than_or_equal_to_allowed_amount, on: :create
|
16
15
|
|
17
16
|
after_create :perform!
|
@@ -70,15 +69,6 @@ module Spree
|
|
70
69
|
raise Core::GatewayError.new(Spree.t(:unable_to_connect_to_gateway))
|
71
70
|
end
|
72
71
|
|
73
|
-
# Saftey check to make sure we're not accidentally performing operations on a live gateway.
|
74
|
-
# Ex. When testing in staging environment with a copy of production data.
|
75
|
-
def check_payment_environment
|
76
|
-
if payment.payment_method.environment != Rails.env
|
77
|
-
message = Spree.t(:gateway_config_unavailable) + " - #{Rails.env}"
|
78
|
-
errors.add(:base, message)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
72
|
def create_log_entry
|
83
73
|
log_entries.create!(details: @response.to_yaml)
|
84
74
|
end
|
@@ -152,7 +152,7 @@ module Spree
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def send_reimbursement_email
|
155
|
-
Spree::ReimbursementMailer.reimbursement_email(self.id).
|
155
|
+
Spree::ReimbursementMailer.reimbursement_email(self.id).deliver_later
|
156
156
|
end
|
157
157
|
|
158
158
|
# If there are multiple different reimbursement types for a single
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Spree
|
2
|
-
class ReturnItem <
|
2
|
+
class ReturnItem < Spree::Base
|
3
3
|
|
4
4
|
INTERMEDIATE_RECEPTION_STATUSES = %i(given_to_customer lost_in_transit shipped_wrong_item short_shipped in_transit)
|
5
5
|
COMPLETED_RECEPTION_STATUSES = INTERMEDIATE_RECEPTION_STATUSES + [:received]
|
@@ -89,6 +89,7 @@ module Spree
|
|
89
89
|
event(:lost) { transition to: :lost_in_transit, from: :awaiting }
|
90
90
|
event(:wrong_item_shipped) { transition to: :shipped_wrong_item, from: :awaiting }
|
91
91
|
event(:short_shipped) { transition to: :short_shipped, from: :awaiting }
|
92
|
+
event(:in_transit) { transition to: :in_transit, from: :awaiting }
|
92
93
|
event(:expired) { transition to: :expired, from: :awaiting }
|
93
94
|
end
|
94
95
|
|
@@ -161,10 +162,11 @@ module Spree
|
|
161
162
|
end
|
162
163
|
|
163
164
|
# @note This uses the exchange_variant_engine configured on the class.
|
165
|
+
# @param stock_locations [Array<Spree::StockLocation>] the stock locations to check
|
164
166
|
# @return [ActiveRecord::Relation<Spree::Variant>] the variants eligible
|
165
167
|
# for exchange for this return item
|
166
|
-
def eligible_exchange_variants
|
167
|
-
exchange_variant_engine.eligible_variants(variant)
|
168
|
+
def eligible_exchange_variants(stock_locations = nil)
|
169
|
+
exchange_variant_engine.eligible_variants(variant, stock_locations: stock_locations)
|
168
170
|
end
|
169
171
|
|
170
172
|
# Builds the exchange inventory unit for this return item, only if an
|
@@ -19,12 +19,21 @@ module Spree
|
|
19
19
|
# green pants with 32 waist and 30 inseam
|
20
20
|
# blue pants with 34 waist and 32 inseam
|
21
21
|
|
22
|
-
def self.eligible_variants(variant)
|
23
|
-
product_variants = SameProduct.eligible_variants(variant).includes(option_values: :option_type)
|
24
|
-
|
22
|
+
def self.eligible_variants(variant, options = {})
|
23
|
+
product_variants = SameProduct.eligible_variants(variant, options).includes(option_values: :option_type)
|
25
24
|
relevant_option_values = variant.option_values.select { |ov| option_type_restrictions.include? ov.option_type.name }
|
25
|
+
|
26
26
|
if relevant_option_values.present?
|
27
|
-
|
27
|
+
# Finds all the OptionValueVariants that have any of the
|
28
|
+
# relevant option values, groups by variant and ensures the variant
|
29
|
+
# has ALL of the relevant option values.
|
30
|
+
variant_ids = Spree::OptionValuesVariant.
|
31
|
+
where(variant_id: product_variants.distinct.pluck(:id)).
|
32
|
+
where(option_value: relevant_option_values).
|
33
|
+
group(:variant_id).
|
34
|
+
having('COUNT(*) = ?', relevant_option_values.size).
|
35
|
+
pluck(:variant_id)
|
36
|
+
product_variants.where(id: variant_ids)
|
28
37
|
else
|
29
38
|
product_variants
|
30
39
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
module ReturnItem::ExchangeVariantEligibility
|
3
3
|
class SameProduct
|
4
|
-
def self.eligible_variants(variant)
|
5
|
-
Spree::Variant.where(product_id: variant.product_id, is_master: variant.is_master?).in_stock
|
4
|
+
def self.eligible_variants(variant, stock_locations: nil)
|
5
|
+
Spree::Variant.where(product_id: variant.product_id, is_master: variant.is_master?).in_stock(stock_locations)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/app/models/spree/role.rb
CHANGED
@@ -3,12 +3,12 @@ require 'ostruct'
|
|
3
3
|
module Spree
|
4
4
|
class Shipment < Spree::Base
|
5
5
|
belongs_to :order, class_name: 'Spree::Order', touch: true, inverse_of: :shipments
|
6
|
-
belongs_to :address, class_name: 'Spree::Address'
|
6
|
+
belongs_to :address, class_name: 'Spree::Address'
|
7
7
|
belongs_to :stock_location, class_name: 'Spree::StockLocation'
|
8
8
|
|
9
9
|
has_many :adjustments, as: :adjustable, inverse_of: :adjustable, dependent: :delete_all
|
10
10
|
has_many :inventory_units, dependent: :destroy, inverse_of: :shipment
|
11
|
-
has_many :shipping_rates, -> { order(
|
11
|
+
has_many :shipping_rates, -> { order(:cost) }, dependent: :delete_all
|
12
12
|
has_many :shipping_methods, through: :shipping_rates
|
13
13
|
has_many :state_changes, as: :stateful
|
14
14
|
has_many :cartons, -> { uniq }, through: :inventory_units
|
@@ -72,6 +72,7 @@ module Spree
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
self.whitelisted_ransackable_associations = ['order']
|
75
76
|
self.whitelisted_ransackable_attributes = ['number']
|
76
77
|
|
77
78
|
def can_transition_from_pending_to_shipped?
|
@@ -129,9 +130,17 @@ module Spree
|
|
129
130
|
item_cost + final_price
|
130
131
|
end
|
131
132
|
|
133
|
+
# Decrement the stock counts for all pending inventory units in this
|
134
|
+
# shipment and mark.
|
135
|
+
# Any previous non-pending inventory units are skipped as their stock had
|
136
|
+
# already been allocated.
|
132
137
|
def finalize!
|
133
|
-
|
134
|
-
|
138
|
+
transaction do
|
139
|
+
pending_units = inventory_units.select(&:pending?)
|
140
|
+
pending_manifest = ShippingManifest.new(inventory_units: pending_units)
|
141
|
+
pending_manifest.items.each { |item| manifest_unstock(item) }
|
142
|
+
InventoryUnit.finalize_units!(pending_units)
|
143
|
+
end
|
135
144
|
end
|
136
145
|
|
137
146
|
def include?(variant)
|
@@ -2,14 +2,20 @@ class Spree::ShippingManifest
|
|
2
2
|
ManifestItem = Struct.new(:line_item, :variant, :quantity, :states)
|
3
3
|
|
4
4
|
def initialize(inventory_units:)
|
5
|
-
@inventory_units = inventory_units
|
5
|
+
@inventory_units = inventory_units.to_a
|
6
|
+
end
|
7
|
+
|
8
|
+
def for_order(order)
|
9
|
+
Spree::ShippingManifest.new(
|
10
|
+
inventory_units: @inventory_units.select {|iu| iu.order_id == order.id }
|
11
|
+
)
|
6
12
|
end
|
7
13
|
|
8
14
|
def items
|
9
15
|
# Grouping by the ID means that we don't have to call out to the association accessor
|
10
16
|
# This makes the grouping by faster because it results in less SQL cache hits.
|
11
|
-
@inventory_units.group_by(&:variant_id).map do |variant_id,
|
12
|
-
|
17
|
+
@inventory_units.group_by(&:variant_id).map do |variant_id, variant_units|
|
18
|
+
variant_units.group_by(&:line_item_id).map do |line_item_id, units|
|
13
19
|
|
14
20
|
states = {}
|
15
21
|
units.group_by(&:state).each { |state, iu| states[state] = iu.count }
|
@@ -12,9 +12,8 @@ module Spree
|
|
12
12
|
has_many :shipments, :through => :shipping_rates
|
13
13
|
has_many :cartons, inverse_of: :shipping_method
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
:foreign_key => 'shipping_method_id'
|
15
|
+
has_many :shipping_method_zones
|
16
|
+
has_many :zones, through: :shipping_method_zones
|
18
17
|
|
19
18
|
belongs_to :tax_category, :class_name => 'Spree::TaxCategory'
|
20
19
|
|
data/app/models/spree/state.rb
CHANGED
@@ -13,7 +13,7 @@ module Spree
|
|
13
13
|
# blank is added elsewhere, if needed
|
14
14
|
def self.states_group_by_country_id
|
15
15
|
state_info = Hash.new { |h, k| h[k] = [] }
|
16
|
-
self.order(
|
16
|
+
self.order(:name).each { |state|
|
17
17
|
state_info[state.country_id.to_s].push [state.id, state.name]
|
18
18
|
}
|
19
19
|
state_info
|
@@ -98,11 +98,23 @@ module Spree
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def conditional_variant_touch
|
101
|
+
variant.touch if inventory_cache_threshold.nil? || should_touch_variant?
|
102
|
+
end
|
103
|
+
|
104
|
+
def should_touch_variant?
|
101
105
|
# the variant_id changes from nil when a new stock location is added
|
102
|
-
|
106
|
+
inventory_cache_threshold &&
|
107
|
+
(count_on_hand_changed? && count_on_hand_change.any? { |c| c < inventory_cache_threshold }) ||
|
108
|
+
variant_id_changed?
|
109
|
+
end
|
103
110
|
|
104
|
-
|
105
|
-
|
111
|
+
def inventory_cache_threshold
|
112
|
+
# only warn if store is setting binary_inventory_cache (default = false)
|
113
|
+
@cache_threshold ||= if Spree::Config.binary_inventory_cache
|
114
|
+
ActiveSupport::Deprecation.warn "Spree::Config.binary_inventory_cache=true is DEPRECATED. Instead use Spree::Config.inventory_cache_threshold=1"
|
115
|
+
1
|
116
|
+
else
|
117
|
+
Spree::Config.inventory_cache_threshold
|
106
118
|
end
|
107
119
|
end
|
108
120
|
end
|
data/app/models/spree/store.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
class Store < Spree::Base
|
3
|
+
has_many :store_payment_methods, inverse_of: :store
|
4
|
+
has_many :payment_methods, through: :store_payment_methods
|
5
|
+
|
3
6
|
validates :code, presence: true, uniqueness: { allow_blank: true }
|
4
7
|
validates :name, presence: true
|
5
8
|
validates :url, presence: true
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class Spree::StoreCreditUpdateReason <
|
1
|
+
class Spree::StoreCreditUpdateReason < Spree::Base
|
2
2
|
end
|
@@ -51,17 +51,10 @@ module Spree
|
|
51
51
|
# This little bit of code at the end stops the Spanish refund from appearing.
|
52
52
|
#
|
53
53
|
# For further discussion, see #4397 and #4327.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if rate.included_in_price?
|
58
|
-
if remaining_rates.any?{|r| r != rate && r.tax_category == rate.tax_category }
|
59
|
-
remaining_rates.delete(rate)
|
60
|
-
end
|
61
|
-
end
|
54
|
+
rates.delete_if do |rate|
|
55
|
+
rate.included_in_price? &&
|
56
|
+
(rates - [rate]).map(&:tax_category).include?(rate.tax_category)
|
62
57
|
end
|
63
|
-
|
64
|
-
remaining_rates
|
65
58
|
end
|
66
59
|
|
67
60
|
# Pre-tax amounts must be stored so that we can calculate
|