spree_core 0.30.0.beta1 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -12
- data/app/controllers/admin/adjustments_controller.rb +1 -17
- data/app/controllers/admin/base_controller.rb +12 -6
- data/app/controllers/admin/line_items_controller.rb +6 -29
- data/app/controllers/admin/mail_methods_controller.rb +13 -0
- data/app/controllers/admin/orders_controller.rb +32 -10
- data/app/controllers/admin/payments_controller.rb +15 -31
- data/app/controllers/admin/products_controller.rb +40 -41
- data/app/controllers/admin/reports_controller.rb +15 -14
- data/app/controllers/admin/return_authorizations_controller.rb +3 -16
- data/app/controllers/admin/shipments_controller.rb +8 -18
- data/app/controllers/admin/taxons_controller.rb +3 -3
- data/app/controllers/admin/users_controller.rb +5 -4
- data/app/controllers/checkout_controller.rb +26 -8
- data/app/controllers/orders_controller.rb +22 -10
- data/app/controllers/password_resets_controller.rb +0 -1
- data/app/controllers/products_controller.rb +2 -3
- data/app/controllers/spree/base_controller.rb +8 -0
- data/app/controllers/taxons_controller.rb +4 -4
- data/app/helpers/admin/navigation_helper.rb +4 -3
- data/app/helpers/checkout_helper.rb +1 -6
- data/app/helpers/spree/base_helper.rb +2 -0
- data/app/mailers/order_mailer.rb +19 -0
- data/app/mailers/shipment_mailer.rb +11 -0
- data/app/models/address.rb +3 -9
- data/app/models/adjustment.rb +3 -2
- data/app/models/app_configuration.rb +3 -16
- data/app/models/creditcard.rb +51 -45
- data/app/models/inventory_unit.rb +77 -80
- data/app/models/line_item.rb +33 -4
- data/app/models/log_entry.rb +3 -0
- data/app/models/mail_method.rb +23 -0
- data/app/models/order.rb +79 -177
- data/app/models/payment.rb +21 -18
- data/app/models/payment_method.rb +3 -3
- data/app/models/return_authorization.rb +11 -7
- data/app/models/shipment.rb +64 -40
- data/app/models/user.rb +1 -1
- data/app/models/variant.rb +6 -6
- data/app/views/admin/adjustments/index.html.erb +2 -32
- data/app/views/admin/configurations/index.html.erb +3 -3
- data/app/views/admin/mail_methods/_form.html.erb +96 -0
- data/app/views/admin/mail_methods/edit.html.erb +9 -0
- data/app/views/admin/mail_methods/index.html.erb +41 -0
- data/app/views/admin/mail_methods/new.html.erb +9 -0
- data/app/views/admin/orders/_form.html.erb +3 -4
- data/app/views/admin/{checkouts/_form.html.erb → orders/_user_form.html.erb} +10 -10
- data/app/views/admin/orders/edit.html.erb +1 -0
- data/app/views/admin/orders/index.html.erb +10 -6
- data/app/views/admin/orders/new.html.erb +1 -0
- data/app/views/admin/orders/show.html.erb +3 -2
- data/app/views/admin/{checkouts/edit.html.erb → orders/user.html.erb} +8 -5
- data/app/views/admin/payments/_list.html.erb +5 -7
- data/app/views/admin/payments/index.html.erb +3 -8
- data/app/views/admin/payments/new.html.erb +1 -1
- data/app/views/admin/payments/source_views/_gateway.html.erb +0 -1
- data/app/views/admin/reports/sales_total.html.erb +2 -6
- data/app/views/admin/return_authorizations/_form.html.erb +24 -12
- data/app/views/admin/return_authorizations/edit.html.erb +1 -1
- data/app/views/admin/return_authorizations/index.html.erb +6 -4
- data/app/views/admin/shared/_address_form.html.erb +20 -17
- data/app/views/admin/shared/_adjustments_table.html.erb +21 -0
- data/app/views/admin/shared/_configuration_menu.html.erb +1 -1
- data/app/views/admin/shared/_destroy.js.erb +3 -0
- data/app/views/admin/shared/_new_adjustment_button.html.erb +8 -0
- data/app/views/admin/shared/_order_tabs.html.erb +26 -22
- data/app/views/admin/shared/_report_criteria.html.erb +2 -2
- data/app/views/admin/shared/_update_order_state.js +6 -0
- data/app/views/admin/shipments/_form.html.erb +5 -11
- data/app/views/admin/shipments/edit.html.erb +4 -4
- data/app/views/admin/taxons/_form.html.erb +2 -2
- data/app/views/admin/taxons/_taxon_table.html.erb +3 -8
- data/app/views/admin/taxons/available.js.erb +4 -7
- data/app/views/admin/taxons/select.js.erb +2 -0
- data/app/views/admin/variants/index.html.erb +1 -1
- data/app/views/checkout/_address.html.erb +2 -0
- data/app/views/checkout/_delivery.html.erb +3 -3
- data/app/views/checkout/_payment.html.erb +23 -18
- data/app/views/checkout/_summary.html.erb +0 -10
- data/app/views/checkout/payment/_gateway.html.erb +1 -1
- data/app/views/checkout/registration.html.erb +20 -0
- data/app/views/layouts/admin.html.erb +2 -2
- data/app/views/order_mailer/{cancel.html.erb → cancel_email.text.erb} +4 -4
- data/app/views/order_mailer/{confirm.html.erb → confirm_email.text.erb} +3 -3
- data/app/views/orders/_line_item.html.erb +1 -3
- data/app/views/orders/edit.html.erb +1 -1
- data/app/views/shared/_basic_layout.html.erb +44 -0
- data/app/views/shared/_google_analytics.html.erb +23 -22
- data/app/views/shared/_head.html.erb +1 -1
- data/app/views/shared/_products.html.erb +1 -1
- data/app/views/shipment_mailer/shipped_email.text.erb +15 -0
- data/app/views/taxons/_taxon.html.erb +2 -2
- data/config/initializers/spree.rb +6 -2
- data/config/locales/{en_spree.yml → en.yml} +47 -17
- data/config/routes.rb +15 -8
- data/{lib/generators/templates/db → db}/default/countries.yml +0 -0
- data/{lib/generators/templates/db → db}/default/roles.yml +0 -0
- data/{lib/generators/templates/db → db}/default/states.yml +0 -0
- data/{lib/generators/templates/db → db}/default/zone_members.yml +0 -0
- data/{lib/generators/templates/db → db}/default/zones.yml +0 -0
- data/{lib/generators/templates/db → db}/migrate/20090823005402_spree_zero_nine_zero.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20090904192342_create_indexes_for_inventory_units.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20090923100315_add_count_on_hand_to_variants_and_products.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091007134354_change_taxons_to_nested_set.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091008091614_move_to_configurable_gateways.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091012120519_product_groups_and_scopes.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091015110842_add_open_id_authentication_tables.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091015153048_add_openid_field_to_users.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091016174634_change_preference_value_type.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091017175558_create_billing_integrations.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091021133257_charge_refactoring.rb +7 -4
- data/{lib/generators/templates/db → db}/migrate/20091104151730_add_some_indexes.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091126190904_checkout_state_machine.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091209153045_state_for_shipments.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091209202200_make_state_events_polymorphic.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091211203813_ship_address_id_for_checkouts.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091212161118_shipping_method_id_for_checkouts.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091213222815_creditcard_last_four_digits.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20091214183826_populate_legacy_shipment_state.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100105090147_add_cost_price.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100105132138_shipment_id_for_inventory_units.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100111205525_cim_fields_for_creditcards.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100112151511_create_return_authorizations.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100113090919_add_return_authorization_to_inventory_units.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100113203104_create_trackers.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100121160010_creditcard_id_for_creditcard_txns.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100121183934_original_creditcard_txn_id_for_creditcard_txns.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100125145351_add_test_mode_to_billing_integration.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100126103714_create_products_product_groups.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100209025806_create_payment_methods.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100209144531_polymorphic_payments.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100213103131_change_payments_payment_method_to_belongs_to.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100223170312_sti_for_transactions.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100223183812_drop_billing_integrations.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100224153127_deleted_at_for_payment_methods.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100301163454_add_adjustments_index.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100306153445_fix_by_popularity.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100317120946_add_alt_text_to_images.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100427121301_add_display_to_payment_methods.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100504142133_add_addresses_checkouts_indexes.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100506180619_add_icon_to_taxons.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100506185838_add_description_to_taxons.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100528155333_index_for_shipments_number.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100528185820_add_index_on_users_persistence_token.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100605152042_add_default_to_tax_categories.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100624110730_add_display_to_shipping_methods.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100624123336_rename_payment_method_display.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100624175547_rename_preferences_field.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100811163637_add_guest_flag.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100811205836_drop_order_token.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100812162326_payments_state_and_assigned_to_order_only.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100813023502_create_address_keys_for_order.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100813185745_payment_total_for_orders.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100816212146_shipping_method_id_for_orders.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100817152723_add_shipment_and_payment_state.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100819170125_refactor_adjustments.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100820135707_response_code_and_avs_response_for_payments.rb +0 -0
- data/{lib/generators/templates/db → db}/migrate/20100901171814_change_guest_flag_to_anonymous.rb +0 -0
- data/db/migrate/20100903203949_email_for_orders.rb +9 -0
- data/db/migrate/20100908170204_remove_unique_index_on_users_email.rb +9 -0
- data/db/migrate/20100923162011_create_mail_methods.rb +12 -0
- data/db/migrate/20100929151905_rename_frozen_to_locked.rb +8 -0
- data/db/migrate/20101008190536_move_special_instructions_to_orders.rb +11 -0
- data/db/migrate/20101026184700_create_log_entries.rb +15 -0
- data/db/migrate/20101026184714_migrate_transactions_to_payment_state.rb +94 -0
- data/db/migrate/20101026184746_delete_in_progress_orders.rb +18 -0
- data/db/migrate/20101026184808_migrate_checkout_to_orders.rb +27 -0
- data/db/migrate/20101026184833_migrate_adjustments.rb +9 -0
- data/db/migrate/20101026184855_remove_shipped_state.rb +14 -0
- data/db/migrate/20101026184916_prevent_nil_payment_total.rb +8 -0
- data/db/migrate/20101026184932_prevent_nil_email.rb +9 -0
- data/db/migrate/20101026184959_generate_anonymous_users.rb +14 -0
- data/db/migrate/20101026185022_update_order_state.rb +8 -0
- data/db/migrate/20101026192225_cleanup_legacy_tables.rb +11 -0
- data/db/migrate/20101028151745_remove_number_and_cvv_from_credicard.rb +9 -0
- data/db/migrate/20101103212716_drop_anonymous_field_for_user.rb +8 -0
- data/{lib/generators/templates/db → db}/sample/users.rb +0 -0
- data/db/seeds.rb +3 -0
- data/lib/generators/spree_core/upgrade_generator.rb +23 -0
- data/lib/scopes/product.rb +0 -5
- data/lib/spree/config.rb +4 -4
- data/lib/spree/current_order.rb +11 -3
- data/lib/spree/i18n_utils.rb +47 -0
- data/lib/spree/mail_interceptor.rb +23 -0
- data/lib/spree/mail_settings.rb +34 -0
- data/lib/spree/search/base.rb +50 -6
- data/lib/spree_core.rb +9 -8
- data/lib/{active_merchant/billing/authorize_net_cim.rb → spree_core/authorize_net_cim_hack.rb} +0 -0
- data/lib/spree_core/ext/active_record.rb +2 -0
- data/lib/spree_core/ssl_requirement.rb +9 -15
- data/lib/tasks/core.rake +1 -8
- data/lib/tasks/install.rake +27 -0
- data/{lib/generators/templates/public → public}/images/add-to-cart.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/active-tab.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/admin_tab_back.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/admin_tab_selected_back.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/content-back-blue.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/content-back-green.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/content-back.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/flash-error.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/flash-notice.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/green-stripes.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/green-stripes.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/grid_header_back.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/grid_header_back_green.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/header-bg.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/header.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/header_bg.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/menu-current.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/red-stripes.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/red-stripes.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/spree_50.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/subnav-divider.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/subnav.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/bg/tab-back.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/blue/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/blue/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/drag-handle-green.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/green/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/green/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/left_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/orange/left_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/orange/right_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/buttons/right_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/1.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/10.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/2.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/3.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/4.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/5.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/6.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/7.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/8.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/16x16/9.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/1.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/10.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/11.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/2.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/3.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/4.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/5.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/6.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/7.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/8.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/32x32/9.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/accept.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/add.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/add.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/arrow-down.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/cross.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/delete.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/delete.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/drag.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/edit.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/edit.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/email.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/error.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/exclamation.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/feed.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/pdf.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/reorder.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/search.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/send-email.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/stop.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/tick.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/up.gif +0 -0
- data/{lib/generators/templates/public → public}/images/admin/icons/xls.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/tabs/off-left.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/tabs/off-right.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/tabs/on-left.png +0 -0
- data/{lib/generators/templates/public → public}/images/admin/tabs/on-right.png +0 -0
- data/{lib/generators/templates/public → public}/images/ajax_loader.gif +0 -0
- data/{lib/generators/templates/public → public}/images/amex_cid.gif +0 -0
- data/{lib/generators/templates/public → public}/images/bg-button-hover.png +0 -0
- data/{lib/generators/templates/public → public}/images/bg-button-pressed.png +0 -0
- data/{lib/generators/templates/public → public}/images/bg-button.gif +0 -0
- data/{lib/generators/templates/public → public}/images/bg-button.png +0 -0
- data/{lib/generators/templates/public → public}/images/blue/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/blue/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/body-back.png +0 -0
- data/{lib/generators/templates/public → public}/images/bottom_shine.png +0 -0
- data/{lib/generators/templates/public → public}/images/breadcrumb.gif +0 -0
- data/{lib/generators/templates/public → public}/images/button-dark-hover.png +0 -0
- data/{lib/generators/templates/public → public}/images/button-dark.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/bg-button-hover.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/bg-button-pressed.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/bg-button.gif +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/bg-button.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/blue/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/blue/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/button-dark-hover.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/button-dark.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/drag-handle-green.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/green/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/green/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/left_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/orange/left_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/orange/right_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/right_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/sxsw-ribbon-v1.png +0 -0
- data/{lib/generators/templates/public → public}/images/buttons/top-shine.png +0 -0
- data/{lib/generators/templates/public → public}/images/calendar_date_select/calendar.gif +0 -0
- data/{lib/generators/templates/public → public}/images/cart-empty.png +0 -0
- data/{lib/generators/templates/public → public}/images/cart-empty_x32.png +0 -0
- data/{lib/generators/templates/public → public}/images/cart-full.png +0 -0
- data/{lib/generators/templates/public → public}/images/cart-full_x32.png +0 -0
- data/{lib/generators/templates/public → public}/images/checkout.png +0 -0
- data/{lib/generators/templates/public → public}/images/creditcard.gif +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/backstripes.gif +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/bg_header.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/bullet1.gif +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/bullet2.gif +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/cal.gif +0 -0
- data/{lib/generators/templates/public → public}/images/datepicker/gradient-e5e5e5-ffffff.gif +0 -0
- data/{lib/generators/templates/public → public}/images/discover_cid.gif +0 -0
- data/{lib/generators/templates/public → public}/images/drag-handle-green.png +0 -0
- data/{lib/generators/templates/public → public}/images/favicon.ico +0 -0
- data/{lib/generators/templates/public → public}/images/green/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/green/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/grid.png +0 -0
- data/{lib/generators/templates/public → public}/images/left_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/left_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/master_cid.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/menu-current.png +0 -0
- data/{lib/generators/templates/public → public}/images/menu-hover.png +0 -0
- data/{lib/generators/templates/public → public}/images/noimage/mini.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/noimage/product.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/noimage/small.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/openid-inputicon.gif +0 -0
- data/{lib/generators/templates/public → public}/images/orange/left_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/orange/right_03.png +0 -0
- data/{lib/generators/templates/public → public}/images/progress.gif +0 -0
- data/{lib/generators/templates/public → public}/images/right_01.png +0 -0
- data/{lib/generators/templates/public → public}/images/right_01_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/separator.png +0 -0
- data/{lib/generators/templates/public → public}/images/shadow-top.png +0 -0
- data/{lib/generators/templates/public → public}/images/shadow_top.png +0 -0
- data/{lib/generators/templates/public → public}/images/spinner.gif +0 -0
- data/{lib/generators/templates/public → public}/images/spree.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/spree/progress.gif +0 -0
- data/{lib/generators/templates/public → public}/images/spree/spinner.gif +0 -0
- data/{lib/generators/templates/public → public}/images/spree/spree.jpg +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/completed-completed.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/completed-current.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/completed-first.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/current-first.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/current-incomplete.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/current-right.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/incomplete-incomplete.gif +0 -0
- data/{lib/generators/templates/public → public}/images/step-progress/incomplete-right.gif +0 -0
- data/{lib/generators/templates/public → public}/images/steps/1.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/1_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/2.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/2_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/3.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/3_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/4.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/4_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/5.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/5_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/6.png +0 -0
- data/{lib/generators/templates/public → public}/images/steps/6_small.png +0 -0
- data/{lib/generators/templates/public → public}/images/sxsw-ribbon-v1.png +0 -0
- data/{lib/generators/templates/public → public}/images/tab_bottom.gif +0 -0
- data/{lib/generators/templates/public → public}/images/tile-header.png +0 -0
- data/{lib/generators/templates/public → public}/images/tile-slider.png +0 -0
- data/{lib/generators/templates/public → public}/images/top-shine.png +0 -0
- data/{lib/generators/templates/public → public}/images/tree-nav-icons/bullet.gif +0 -0
- data/{lib/generators/templates/public → public}/images/tree-nav-icons/minus.gif +0 -0
- data/{lib/generators/templates/public → public}/images/tree-nav-icons/plus.gif +0 -0
- data/{lib/generators/templates/public → public}/images/tree-nav-icons/treeview-loading.gif +0 -0
- data/{lib/generators/templates/public → public}/images/tree-nav-icons/treeview-sprite.gif +0 -0
- data/{lib/generators/templates/public → public}/images/update.png +0 -0
- data/{lib/generators/templates/public → public}/images/visa_cid.gif +0 -0
- data/{lib/generators/templates/public → public}/images/wrapper-back-2.png +0 -0
- data/{lib/generators/templates/public → public}/images/wrapper-back.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menubaritem_submenuindicator.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menubaritem_submenuindicator_disabled.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menuitem_checkbox.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menuitem_checkbox_disabled.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menuitem_submenuindicator.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-menuitem_submenuindicator_disabled.png +0 -0
- data/{lib/generators/templates/public → public}/images/yui-sprite.png +0 -0
- data/{lib/generators/templates/public → public}/javascripts/additional-methods.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/admin.js +11 -11
- data/{lib/generators/templates/public → public}/javascripts/admin/address_states.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/admin/checkouts/edit.js +1 -1
- data/{lib/generators/templates/public → public}/javascripts/admin/orders/edit.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/admin/orders/edit_form.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/admin/payments/new.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/admin/unobtrusive_handlers.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/application.js +3 -3
- data/{lib/generators/templates/public → public}/javascripts/calculator.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/checkout.js +26 -15
- data/{lib/generators/templates/public → public}/javascripts/datepicker.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/gateway.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery-1.4.2.min.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery-ui.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/images/help.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/images/important.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/images/info.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/images/title.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/jquery.alerts.css +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/jquery.alerts.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.alerts/jquery.alerts.spree.css +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.autocomplete.min.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.suggest.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.template.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.tokeninput.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jquery.validate.min.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jrails.autocomplete.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jrails.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/jquery.tree.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/plugins/jquery.tree.contextmenu.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/themes/apple/bg.jpg +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/themes/apple/dot_for_ie.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/themes/apple/icons.png +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/themes/apple/style.css +0 -0
- data/{lib/generators/templates/public → public}/javascripts/jsTree/themes/apple/throbber.gif +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/af.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/ar.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/de.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/du.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/en.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/es.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/fi.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/fr.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/gr.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/he.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/it.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/nl.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/no.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/pt.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/ro.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/ru.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/sp.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/sv.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/lang/ua.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_cn.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_cs.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_da.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_de.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_es.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_fr.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_hu.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_it.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_kk.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_nl.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_no.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_pl.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_ptbr.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_ro.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_ru.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_se.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_sk.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_tr.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_tw.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/localization/messages_ua.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/nested-attribute.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/open_id.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/product.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/rails.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/taxonomy.js +0 -0
- data/{lib/generators/templates/public → public}/javascripts/zone.js +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/admin-forms.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/admin-reset.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/admin-tables.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/admin-typography.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/admin.css +21 -18
- data/{lib/generators/templates/public → public}/stylesheets/admin/autocomplete.css +0 -1
- data/{lib/generators/templates/public → public}/stylesheets/admin/dashboard.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/edit_checkouts.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/grids.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/reset-fonts-grids-2-6-0.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/token-input.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/admin/yui-includes.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/datepicker.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/jquery.autocomplete.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/scaffold.css +0 -0
- data/{lib/generators/templates/public → public}/stylesheets/screen.css +0 -0
- metadata +475 -402
- data/app/controllers/admin/checkouts_controller.rb +0 -58
- data/app/models/checkout.rb +0 -141
- data/app/models/order_mailer.rb +0 -24
- data/app/views/admin/checkouts/show.html.erb +0 -131
- data/app/views/admin/mail_settings/edit.html.erb +0 -114
- data/app/views/admin/mail_settings/show.html.erb +0 -59
- data/app/views/admin/taxons/select.html.erb +0 -1
- data/app/views/checkout/_complete.html.erb +0 -1
- data/app/views/password_resets/edit.html.erb +0 -12
- data/app/views/password_resets/new.html.erb +0 -12
- data/config/initializers/touch.rb +0 -14
- data/lib/generators/spree_core/extension_generator.rb +0 -57
- data/lib/generators/spree_core/install_generator.rb +0 -59
- data/lib/generators/templates/LICENSE +0 -23
- data/lib/generators/templates/README.md +0 -13
- data/lib/generators/templates/Rakefile +0 -1
- data/lib/generators/templates/application_controller.rb +0 -4
- data/lib/generators/templates/extension.gemspec.tt +0 -21
- data/lib/generators/templates/extension/engine.rb.tt +0 -14
- data/lib/generators/templates/extension/extension.rb.tt +0 -1
- data/lib/generators/templates/lib/tasks/%file_name%.rake.tt +0 -1
- data/lib/generators/templates/public/javascripts/jquery-1.3.2.min.js +0 -19
- data/lib/generators/templates/public/javascripts/jquery-and-plugins.js +0 -36
- data/lib/generators/templates/spree_site.rb +0 -8
- data/lib/spree/search.rb +0 -47
- data/lib/spree_core/preferences/mail_settings.rb +0 -57
data/app/models/adjustment.rb
CHANGED
@@ -22,6 +22,7 @@ class Adjustment < ActiveRecord::Base
|
|
22
22
|
|
23
23
|
scope :tax, lambda { where(:label => I18n.t(:tax)) }
|
24
24
|
scope :shipping, lambda { where(:label => I18n.t(:shipping)) }
|
25
|
+
scope :optional, where(:mandatory => false)
|
25
26
|
|
26
27
|
# update the order totals, etc.
|
27
28
|
after_save {order.update!}
|
@@ -35,12 +36,12 @@ class Adjustment < ActiveRecord::Base
|
|
35
36
|
end
|
36
37
|
|
37
38
|
# Tells the adjustment that its time to update itself. Adjustments will delegate this request to their Originator
|
38
|
-
# when present, but only if +
|
39
|
+
# when present, but only if +locked+ is false. Adjustments that are +locked+ will never change their amount.
|
39
40
|
# The new adjustment amount will be set by by the +originator+ and is not automatically saved. This makes it save
|
40
41
|
# to use this method in an after_save hook for other models without causing an infinite recursion problem. If there
|
41
42
|
# is no +originator+ then this method will have no effect.
|
42
43
|
def update!
|
43
|
-
return if
|
44
|
+
return if locked? or originator.nil?
|
44
45
|
originator.update_adjustment(self, source)
|
45
46
|
end
|
46
47
|
end
|
@@ -1,22 +1,7 @@
|
|
1
1
|
class AppConfiguration < Configuration
|
2
2
|
|
3
|
-
MAIL_AUTH = ['none', 'plain', 'login', 'cram_md5']
|
4
|
-
SECURE_CONNECTION_TYPES = ['None','SSL','TLS']
|
5
|
-
|
6
3
|
preference :site_name, :string, :default => 'Spree Demo Site'
|
7
4
|
preference :site_url, :string, :default => 'demo.spreecommerce.com'
|
8
|
-
preference :enable_mail_delivery, :boolean, :default => false
|
9
|
-
preference :mail_host, :string, :default => 'localhost'
|
10
|
-
preference :mail_domain, :string, :default => 'localhost'
|
11
|
-
preference :mail_port, :integer, :default => 25
|
12
|
-
preference :mail_auth_type, :string, :default => MAIL_AUTH[0]
|
13
|
-
preference :smtp_username, :string
|
14
|
-
preference :smtp_password, :string
|
15
|
-
preference :secure_connection_type, :string, :default => SECURE_CONNECTION_TYPES[0]
|
16
|
-
preference :mails_from, :string
|
17
|
-
preference :mail_bcc, :string
|
18
|
-
preference :order_from, :string, :default => "orders@example.com"
|
19
|
-
preference :order_bcc, :string
|
20
5
|
preference :store_cc, :boolean, :default => false
|
21
6
|
preference :store_cvv, :boolean, :default => false
|
22
7
|
preference :default_locale, :string, :default => 'en'
|
@@ -24,7 +9,8 @@ class AppConfiguration < Configuration
|
|
24
9
|
preference :default_country_id, :integer, :default => 214
|
25
10
|
preference :allow_backorders, :boolean, :default => true
|
26
11
|
preference :allow_backorder_shipping, :boolean, :default => false # should only be true if you don't need to track inventory
|
27
|
-
preference :track_inventory_levels, :boolean, :default => true #
|
12
|
+
preference :track_inventory_levels, :boolean, :default => true # will not track on_hand values for variants /products
|
13
|
+
preference :create_inventory_units, :boolean, :default => true # should only be false when track_inventory_levels is false, also disables RMA's
|
28
14
|
preference :show_descendents, :boolean, :default => true
|
29
15
|
preference :show_zero_stock_products, :boolean, :default => true
|
30
16
|
preference :orders_per_page, :integer, :default => 15
|
@@ -48,6 +34,7 @@ class AppConfiguration < Configuration
|
|
48
34
|
preference :always_put_site_name_in_title, :boolean, :default => true
|
49
35
|
preference :cache_static_content, :boolean, :default => true
|
50
36
|
preference :use_content_controller, :boolean, :default => true
|
37
|
+
preference :allow_checkout_on_gateway_error, :boolean, :default => false
|
51
38
|
|
52
39
|
validates :name, :presence => true, :uniqueness => true
|
53
40
|
|
data/app/models/creditcard.rb
CHANGED
@@ -3,6 +3,8 @@ class Creditcard < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
before_save :set_last_digits
|
5
5
|
|
6
|
+
attr_accessor :number, :verification_value
|
7
|
+
|
6
8
|
validates :month, :year, :numericality => { :only_integer => true }
|
7
9
|
validates :number, :presence => true, :unless => :has_payment_profile?, :on => :create
|
8
10
|
validates :verification_value, :presence => true, :unless => :has_payment_profile?, :on => :create
|
@@ -57,15 +59,13 @@ class Creditcard < ActiveRecord::Base
|
|
57
59
|
cc_type
|
58
60
|
end
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
#RAILS3 TODO
|
64
|
-
# scope :with_payment_profile, where("gateway_customer_profile_id IS NOT NULL")
|
62
|
+
scope :with_payment_profile, where("gateway_customer_profile_id IS NOT NULL")
|
65
63
|
|
66
64
|
def authorize(amount, payment)
|
67
65
|
# ActiveMerchant is configured to use cents so we need to multiply order total by 100
|
68
66
|
response = payment_gateway.authorize((amount * 100).round, self, gateway_options(payment))
|
67
|
+
record_log payment, response
|
68
|
+
|
69
69
|
if response.success?
|
70
70
|
payment.response_code = response.authorization
|
71
71
|
payment.avs_response = response.avs_result['code']
|
@@ -81,6 +81,8 @@ class Creditcard < ActiveRecord::Base
|
|
81
81
|
def purchase(amount, payment)
|
82
82
|
#combined Authorize and Capture that gets processed by the ActiveMerchant gateway as one single transaction.
|
83
83
|
response = payment_gateway.purchase((amount * 100).round, self, gateway_options(payment))
|
84
|
+
record_log payment, response
|
85
|
+
|
84
86
|
if response.success?
|
85
87
|
payment.response_code = response.authorization
|
86
88
|
payment.avs_response = response.avs_result['code']
|
@@ -103,6 +105,9 @@ class Creditcard < ActiveRecord::Base
|
|
103
105
|
# Standard ActiveMerchant capture usage
|
104
106
|
response = payment_gateway.capture((payment.amount * 100).round, payment.response_code, minimal_gateway_options(payment))
|
105
107
|
end
|
108
|
+
|
109
|
+
record_log payment, response
|
110
|
+
|
106
111
|
if response.success?
|
107
112
|
payment.response_code = response.authorization
|
108
113
|
payment.complete
|
@@ -116,6 +121,8 @@ class Creditcard < ActiveRecord::Base
|
|
116
121
|
|
117
122
|
def void(payment)
|
118
123
|
response = payment_gateway.void(payment.response_code, self, minimal_gateway_options(payment))
|
124
|
+
record_log payment, response
|
125
|
+
|
119
126
|
if response.success?
|
120
127
|
payment.response_code = response.authorization
|
121
128
|
payment.void
|
@@ -126,14 +133,24 @@ class Creditcard < ActiveRecord::Base
|
|
126
133
|
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
127
134
|
end
|
128
135
|
|
129
|
-
def credit(payment
|
136
|
+
def credit(payment)
|
137
|
+
amount = payment.credit_allowed >= payment.order.outstanding_balance.abs ? payment.order.outstanding_balance : payment.credit_allowed
|
138
|
+
|
130
139
|
if payment_gateway.payment_profiles_supported?
|
131
140
|
response = payment_gateway.credit((amount * 100).round, self, payment.response_code, minimal_gateway_options(payment))
|
132
141
|
else
|
133
142
|
response = payment_gateway.credit((amount * 100).round, payment.response_code, minimal_gateway_options(payment))
|
134
143
|
end
|
144
|
+
|
145
|
+
record_log payment, response
|
146
|
+
|
135
147
|
if response.success?
|
136
|
-
Payment.create(:
|
148
|
+
Payment.create(:order => payment.order,
|
149
|
+
:source => payment,
|
150
|
+
:payment_method => payment.payment_method,
|
151
|
+
:amount => amount.abs * -1,
|
152
|
+
:response_code => response.authorization,
|
153
|
+
:state => 'completed')
|
137
154
|
else
|
138
155
|
gateway_error(response)
|
139
156
|
end
|
@@ -142,30 +159,44 @@ class Creditcard < ActiveRecord::Base
|
|
142
159
|
end
|
143
160
|
|
144
161
|
|
162
|
+
|
163
|
+
|
145
164
|
def actions
|
146
165
|
%w{capture void credit}
|
147
166
|
end
|
148
167
|
|
149
|
-
#
|
150
|
-
|
151
|
-
|
152
|
-
|
168
|
+
# Indicates whether its possible to capture the payment
|
169
|
+
def can_capture?(payment)
|
170
|
+
payment.state == "pending"
|
171
|
+
end
|
153
172
|
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
#
|
173
|
+
# Indicates whether its possible to void the payment. Most gateways require that the payment has not been
|
174
|
+
# settled yet when performing a void (which generally happens within 12-24 hours of the transaction.) For
|
175
|
+
# this reason, the default behavior of Spree is to only allow void operations within the first 12 hours of
|
176
|
+
# the payment creation time.
|
177
|
+
def can_void?(payment)
|
178
|
+
return false unless (Time.now - 12.hours) < payment.created_at
|
179
|
+
%w{completed pending}.include? payment.state
|
180
|
+
end
|
158
181
|
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
|
163
|
-
|
182
|
+
# Indicates whether its possible to credit the payment. Most gateways require that the payment be settled
|
183
|
+
# first which generally happens within 12-24 hours of the transaction. For this reason, the default
|
184
|
+
# behavior of Spree is to disallow credit operations until the payment is at least 12 hours old.
|
185
|
+
def can_credit?(payment)
|
186
|
+
return false unless (Time.now - 12.hours) > payment.created_at
|
187
|
+
return false unless payment.state == "completed"
|
188
|
+
return false unless payment.order.payment_state == "credit_owed"
|
189
|
+
payment.credit_allowed > 0
|
190
|
+
end
|
164
191
|
|
165
192
|
def has_payment_profile?
|
166
193
|
gateway_customer_profile_id.present?
|
167
194
|
end
|
168
195
|
|
196
|
+
def record_log(payment, response)
|
197
|
+
payment.log_entries.create(:details => response.to_yaml)
|
198
|
+
end
|
199
|
+
|
169
200
|
def gateway_error(error)
|
170
201
|
if error.is_a? ActiveMerchant::Billing::Response
|
171
202
|
text = error.params['message'] || error.params['response_reason_text'] || error.message
|
@@ -212,29 +243,4 @@ class Creditcard < ActiveRecord::Base
|
|
212
243
|
@payment_gateway ||= Gateway.current
|
213
244
|
end
|
214
245
|
|
215
|
-
private
|
216
|
-
|
217
|
-
def has_transaction_of_types?(payment, *types)
|
218
|
-
(payment.txns.map(&:txn_type) & types).any?
|
219
|
-
end
|
220
|
-
|
221
|
-
def has_no_transaction_of_types?(payment, *types)
|
222
|
-
(payment.txns.map(&:txn_type) & types).none?
|
223
|
-
end
|
224
|
-
|
225
|
-
#RAILS 3 TODO
|
226
|
-
# # Override default behavior of Rails attr_readonly so that its never written to the database (not even on create)
|
227
|
-
# def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys)
|
228
|
-
# attributes_with_quotes_default(include_primary_key, false, attribute_names)
|
229
|
-
# end
|
230
|
-
|
231
|
-
def remove_readonly_attributes(attributes)
|
232
|
-
if self.class.readonly_attributes.present?
|
233
|
-
attributes.delete_if { |key, value| self.class.readonly_attributes.include?(key.gsub(/\(.+/,"")) }
|
234
|
-
end
|
235
|
-
# extra logic for sanitizing the number and verification value based on preferences
|
236
|
-
attributes.delete_if { |key, value| key == "number" and !Spree::Config[:store_cc] }
|
237
|
-
attributes.delete_if { |key, value| key == "verification_value" and !Spree::Config[:store_cvv] }
|
238
|
-
end
|
239
|
-
|
240
246
|
end
|
@@ -5,7 +5,6 @@ class InventoryUnit < ActiveRecord::Base
|
|
5
5
|
belongs_to :return_authorization
|
6
6
|
|
7
7
|
scope :backorder, where(:state => 'backordered')
|
8
|
-
scope :retrieve_on_hand, lambda {|variant, quantity| {:conditions => ["state = 'on_hand' AND variant_id = ?", variant], :limit => quantity}}
|
9
8
|
|
10
9
|
# state machine (see http://github.com/pluginaweek/state_machine/tree/master for details)
|
11
10
|
state_machine :initial => 'on_hand' do
|
@@ -13,72 +12,74 @@ class InventoryUnit < ActiveRecord::Base
|
|
13
12
|
transition :to => 'sold', :from => 'backordered'
|
14
13
|
end
|
15
14
|
event :ship do
|
16
|
-
transition :to => 'shipped', :if => :allow_ship?
|
15
|
+
transition :to => 'shipped', :if => :allow_ship?
|
17
16
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# destroy the specified number of on hand inventory units
|
22
|
-
def self.destroy_on_hand(variant, quantity)
|
23
|
-
inventory = self.retrieve_on_hand(variant, quantity)
|
24
|
-
inventory.each do |unit|
|
25
|
-
unit.destroy
|
17
|
+
event :return do
|
18
|
+
transition :to => 'returned', :from => 'shipped'
|
26
19
|
end
|
27
|
-
end
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
quantity.times do
|
32
|
-
self.create(:variant => variant, :state => 'on_hand')
|
33
|
-
end
|
21
|
+
after_transition :on => :fill_backorder, :do => :update_order
|
22
|
+
after_transition :to => 'returned', :do => :restock_variant
|
34
23
|
end
|
35
24
|
|
36
|
-
#
|
25
|
+
# method deprecated in favour of adjust_units (which creates & destroys units as needed).
|
37
26
|
def self.sell_units(order)
|
38
|
-
|
39
|
-
order
|
40
|
-
create_units(order, line_item, line_item.quantity)
|
41
|
-
end.flatten
|
27
|
+
warn "[DEPRECATION] `InventoryUnits#sell_units` is deprecated. Please use `InventoryUnits#assign_opening_inventory` instead. (called from #{caller[0]})"
|
28
|
+
self.adjust_units(order)
|
42
29
|
end
|
43
30
|
|
44
|
-
|
45
|
-
|
31
|
+
# Assigns inventory to a newly completed order.
|
32
|
+
# Should only be called once during the life-cycle of an order, on transition to completed.
|
33
|
+
#
|
34
|
+
def self.assign_opening_inventory(order)
|
35
|
+
return [] unless order.completed?
|
36
|
+
|
46
37
|
out_of_stock_items = []
|
47
38
|
|
48
|
-
#
|
39
|
+
#increase inventory to meet initial requirements
|
49
40
|
order.line_items.each do |line_item|
|
50
|
-
|
51
|
-
quantity = line_item.quantity
|
52
|
-
unit_count = units_by_variant.key?(variant.id) ? units_by_variant[variant.id].size : 0
|
53
|
-
|
54
|
-
if unit_count < quantity
|
55
|
-
out_of_stock_items.concat create_units(order, line_item, (quantity - unit_count))
|
56
|
-
elsif unit_count > quantity
|
57
|
-
(unit_count - quantity).times do
|
58
|
-
inventory_unit = units_by_variant[variant.id].pop
|
59
|
-
inventory_unit.restock!
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
#remove it from hash as it's up-to-date
|
64
|
-
units_by_variant.delete(variant.id)
|
41
|
+
out_of_stock_items.concat increase(order, line_item.variant, line_item.quantity)
|
65
42
|
end
|
66
43
|
|
67
|
-
|
68
|
-
|
69
|
-
|
44
|
+
out_of_stock_items
|
45
|
+
end
|
46
|
+
|
47
|
+
# manages both variant.count_on_hand and inventory unit creation
|
48
|
+
#
|
49
|
+
def self.increase(order, variant, quantity)
|
50
|
+
# calculate number of sold vs. backordered units
|
51
|
+
if variant.count_on_hand == 0
|
52
|
+
back_order = quantity
|
53
|
+
sold = 0
|
54
|
+
elsif variant.count_on_hand < quantity
|
55
|
+
back_order = quantity - (variant.count_on_hand < 0 ? 0 : variant.count_on_hand)
|
56
|
+
sold = quantity - back_order
|
57
|
+
else
|
58
|
+
back_order = 0
|
59
|
+
sold = quantity
|
60
|
+
end
|
61
|
+
|
62
|
+
#set on_hand if configured
|
63
|
+
if Spree::Config[:track_inventory_levels]
|
64
|
+
variant.decrement!(:count_on_hand, quantity)
|
70
65
|
end
|
71
66
|
|
67
|
+
#create units if configured, returning any backorderd variants with count
|
68
|
+
out_of_stock_items = []
|
69
|
+
if Spree::Config[:create_inventory_units]
|
70
|
+
out_of_stock_items = create_units(order, variant, sold, back_order)
|
71
|
+
end
|
72
72
|
out_of_stock_items
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
75
|
+
def self.decrease(order, variant, quantity)
|
76
|
+
if Spree::Config[:track_inventory_levels]
|
77
|
+
variant.increment!(:count_on_hand, quantity)
|
78
|
+
end
|
78
79
|
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
if Spree::Config[:create_inventory_units]
|
81
|
+
destroy_units(order, variant, quantity)
|
82
|
+
end
|
82
83
|
end
|
83
84
|
|
84
85
|
# find the specified quantity of units with the specified status
|
@@ -90,43 +91,39 @@ class InventoryUnit < ActiveRecord::Base
|
|
90
91
|
|
91
92
|
private
|
92
93
|
def allow_ship?
|
93
|
-
Spree::Config[:allow_backorder_shipping] ||
|
94
|
+
Spree::Config[:allow_backorder_shipping] || self.sold?
|
94
95
|
end
|
95
96
|
|
96
|
-
def self.
|
97
|
-
|
97
|
+
def self.destroy_units(order, variant, quantity)
|
98
|
+
variant_units = order.inventory_units.group_by(&:variant_id)[variant.id].sort_by(&:state)
|
98
99
|
|
99
|
-
|
100
|
+
quantity.times do
|
101
|
+
inventory_unit = variant_units.shift
|
102
|
+
inventory_unit.destroy
|
103
|
+
end
|
104
|
+
end
|
100
105
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
order.inventory_units.create(:variant => variant, :state => "sold")
|
107
|
-
end
|
108
|
-
variant.update_attribute(:count_on_hand, remaining_quantity)
|
109
|
-
else
|
110
|
-
(quantity + remaining_quantity).times do
|
111
|
-
order.inventory_units.create(:variant => variant, :state => "sold")
|
112
|
-
end
|
113
|
-
if Spree::Config[:allow_backorders]
|
114
|
-
(-remaining_quantity).times do
|
115
|
-
order.inventory_units.create(:variant => variant, :state => "backordered")
|
116
|
-
end
|
117
|
-
else
|
118
|
-
# line_item.update_attribute(:quantity, quantity + remaining_quantity)
|
119
|
-
out_of_stock_items << {:line_item => line_item, :count => -remaining_quantity}
|
120
|
-
end
|
121
|
-
variant.update_attribute(:count_on_hand, 0)
|
122
|
-
end
|
123
|
-
else
|
124
|
-
# not tracking stock levels, so just create all inventory_units as sold (for shipping purposes)
|
125
|
-
quantity.times do
|
126
|
-
order.inventory_units.create(:variant => variant, :state => "sold")
|
127
|
-
end
|
106
|
+
def self.create_units(order, variant, sold, back_order)
|
107
|
+
shipment = order.shipments.detect {|shipment| !shipment.shipped? }
|
108
|
+
|
109
|
+
sold.times do
|
110
|
+
order.inventory_units.create(:variant => variant, :state => "sold", :shipment => shipment)
|
128
111
|
end
|
129
|
-
|
112
|
+
|
113
|
+
if Spree::Config[:allow_backorders]
|
114
|
+
back_order.times { order.inventory_units.create(:variant => variant, :state => "backordered", :shipment => shipment) }
|
115
|
+
end
|
116
|
+
|
117
|
+
back_order == 0 ? [] : [{:variant => variant, :count => back_order}]
|
118
|
+
end
|
119
|
+
|
120
|
+
def update_order
|
121
|
+
self.order.update!
|
122
|
+
end
|
123
|
+
|
124
|
+
def restock_variant
|
125
|
+
self.variant.on_hand = (self.variant.on_hand + 1)
|
126
|
+
self.variant.save
|
130
127
|
end
|
131
128
|
|
132
129
|
end
|
data/app/models/line_item.rb
CHANGED
@@ -13,10 +13,13 @@ class LineItem < ActiveRecord::Base
|
|
13
13
|
validates :price, :numericality => true
|
14
14
|
# validate :meta_validation_of_quantities
|
15
15
|
|
16
|
-
attr_accessible :quantity
|
16
|
+
attr_accessible :quantity
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
before_save :update_inventory
|
19
|
+
before_destroy :remove_inventory
|
20
|
+
|
21
|
+
after_save :update_order
|
22
|
+
after_destroy :update_order
|
20
23
|
|
21
24
|
def copy_price
|
22
25
|
self.price = variant.price if variant && self.price.nil?
|
@@ -56,7 +59,33 @@ class LineItem < ActiveRecord::Base
|
|
56
59
|
self.quantity = 0 if self.quantity.nil? || self.quantity < 0
|
57
60
|
end
|
58
61
|
|
59
|
-
|
62
|
+
private
|
63
|
+
def update_inventory
|
64
|
+
return true unless self.order.completed?
|
65
|
+
|
66
|
+
if self.new_record?
|
67
|
+
InventoryUnit.increase(self.order, self.variant, self.quantity)
|
68
|
+
elsif old_quantity = self.changed_attributes["quantity"]
|
69
|
+
if old_quantity < self.quantity
|
70
|
+
InventoryUnit.increase(self.order, self.variant, (self.quantity - old_quantity))
|
71
|
+
elsif old_quantity > self.quantity
|
72
|
+
InventoryUnit.decrease(self.order, self.variant, (old_quantity - self.quantity))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def remove_inventory
|
79
|
+
return true unless self.order.completed?
|
80
|
+
|
81
|
+
InventoryUnit.decrease(self.order, self.variant, self.quantity)
|
82
|
+
end
|
83
|
+
|
84
|
+
def update_order
|
85
|
+
# update the order totals, etc.
|
86
|
+
order.update!
|
87
|
+
end
|
88
|
+
|
60
89
|
# def ensure_not_shipped
|
61
90
|
# if shipped_count = order.shipped_units.nil? ? nil : order.shipped_units[variant]
|
62
91
|
# errors.add_to_base I18n.t("cannot_destory_line_item_as_inventory_units_have_shipped")
|