spree 0.10.2 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/CHANGELOG +81 -4
- data/CONTRIBUTORS +18 -10
- data/Rakefile +5 -4
- data/app/controllers/admin/adjustments_controller.rb +17 -3
- data/app/controllers/admin/base_controller.rb +2 -2
- data/app/controllers/admin/checkouts_controller.rb +43 -34
- data/app/controllers/admin/line_items_controller.rb +32 -18
- data/app/controllers/admin/option_types_controller.rb +1 -1
- data/app/controllers/admin/orders_controller.rb +28 -7
- data/app/controllers/admin/payments_controller.rb +7 -7
- data/app/controllers/admin/products_controller.rb +12 -23
- data/app/controllers/admin/reports_controller.rb +19 -7
- data/app/controllers/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/admin/shipments_controller.rb +9 -9
- data/app/controllers/admin/users_controller.rb +3 -1
- data/app/controllers/admin/variants_controller.rb +2 -2
- data/app/controllers/checkouts_controller.rb +29 -18
- data/app/controllers/content_controller.rb +1 -1
- data/{vendor/extensions/localization/app → app}/controllers/locale_controller.rb +1 -1
- data/app/controllers/orders_controller.rb +33 -30
- data/app/controllers/password_resets_controller.rb +4 -4
- data/app/controllers/products_controller.rb +0 -6
- data/app/controllers/spree/base_controller.rb +9 -2
- data/app/controllers/user_sessions_controller.rb +18 -18
- data/app/controllers/users_controller.rb +2 -2
- data/app/helpers/admin/base_helper.rb +5 -2
- data/app/helpers/admin/navigation_helper.rb +1 -1
- data/app/helpers/admin/orders_helper.rb +0 -13
- data/app/helpers/admin/products_helper.rb +0 -8
- data/app/helpers/checkouts_helper.rb +5 -5
- data/app/helpers/products_helper.rb +0 -12
- data/app/helpers/spree/base_helper.rb +10 -39
- data/app/helpers/taxons_helper.rb +1 -0
- data/app/models/address.rb +6 -1
- data/app/models/app_configuration.rb +15 -14
- data/app/models/calculator/flexi_rate.rb +2 -1
- data/app/models/calculator/vat.rb +1 -1
- data/app/models/checkout.rb +1 -1
- data/app/models/creditcard.rb +26 -20
- data/app/models/inventory_unit.rb +70 -21
- data/app/models/line_item.rb +25 -11
- data/app/models/order.rb +16 -10
- data/app/models/payment.rb +4 -1
- data/app/models/payment_method.rb +14 -5
- data/app/models/product.rb +12 -4
- data/app/models/role.rb +2 -2
- data/app/models/shipment.rb +21 -2
- data/app/models/tax_category.rb +8 -0
- data/app/models/taxon.rb +8 -0
- data/app/models/user.rb +2 -3
- data/app/models/variant.rb +18 -13
- data/config/boot.rb +1 -5
- data/config/cucumber.yml +7 -0
- data/config/database.yml +20 -37
- data/config/database.yml.example +5 -6
- data/config/environment.rb +6 -5
- data/config/environments/cucumber.rb +30 -0
- data/config/environments/production.rb +1 -4
- data/config/environments/staging.rb +3 -0
- data/config/environments/test.rb +1 -1
- data/config/initializers/cookie_verification_secret.rb +7 -0
- data/config/initializers/locales.rb +4 -2
- data/config/initializers/new_rails_defaults.rb +2 -0
- data/config/initializers/spree.rb +1 -0
- data/config/initializers/workarounds_for_ruby19.rb +0 -25
- data/config/locales/{en-US.yml → en_spree.yml} +18 -4
- data/config/routes.rb +2 -1
- data/db/migrate/20100317120946_add_alt_text_to_images.rb +9 -0
- data/db/migrate/20100427121301_add_display_to_payment_methods.rb +9 -0
- data/db/migrate/20100504142133_add_addresses_checkouts_indexes.rb +16 -0
- data/db/migrate/20100506180619_add_icon_to_taxons.rb +18 -0
- data/db/migrate/20100506185838_add_description_to_taxons.rb +11 -0
- data/db/migrate/20100528155333_index_for_shipments_number.rb +9 -0
- data/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +9 -0
- data/db/migrate/20100605152042_add_default_to_tax_categories.rb +9 -0
- data/db/sample/payment_methods.yml +8 -1
- data/db/sample/shipments.yml +2 -2
- data/db/schema.rb +54 -21
- data/features/checkout.feature +98 -0
- data/features/create_admin_user.feature +18 -0
- data/features/search.feature +35 -0
- data/features/sign_in.feature +25 -0
- data/features/sign_out.feature +12 -0
- data/features/sign_up.feature +20 -0
- data/features/step_definitions/error_steps.rb +3 -0
- data/features/step_definitions/model_steps.rb +3 -0
- data/features/step_definitions/pickle_steps.rb +73 -0
- data/features/step_definitions/role_steps.rb +8 -0
- data/features/step_definitions/session_steps.rb +14 -0
- data/features/step_definitions/user_steps.rb +67 -0
- data/features/step_definitions/web_steps.rb +197 -0
- data/features/support/create_admin_user.rb +6 -0
- data/features/support/env.rb +89 -0
- data/features/support/paths.rb +32 -0
- data/features/support/pickle.rb +24 -0
- data/features/work_with_cart.feature +41 -0
- data/lib/generators/extension_model/extension_model_generator.rb +10 -10
- data/lib/generators/instance/templates/databases/mysql.yml +11 -0
- data/lib/scopes/variant.rb +10 -0
- data/lib/spree.rb +3 -3
- data/lib/spree/extensions.rb +1 -1
- data/lib/tasks/cucumber.rake +47 -0
- data/lib/tasks/database.rake +29 -29
- data/public/images/admin/bg/spree_50.png +0 -0
- data/public/images/tile-header.png +0 -0
- data/public/images/tile-slider.png +0 -0
- data/public/javascripts/admin/checkouts/edit.js +33 -0
- data/public/javascripts/dashboard.js +2 -2
- data/public/javascripts/taxonomy.js +2 -2
- data/public/stylesheets/admin/admin-tables.css +4 -0
- data/public/stylesheets/admin/admin.css +31 -16
- data/public/stylesheets/screen.css +16 -3
- data/script/about +3 -2
- data/script/console +2 -2
- data/script/cucumber +10 -0
- data/script/dbconsole +1 -1
- data/script/destroy +2 -2
- data/script/generate +2 -2
- data/script/performance/benchmarker +1 -1
- data/script/performance/profiler +1 -1
- data/script/plugin +2 -2
- data/script/runner +2 -2
- data/script/server +2 -2
- data/test/fixtures/payment_methods.yml +12 -0
- data/test/functional/admin/checkouts_controller_test.rb +0 -2
- data/test/functional/admin/line_items_controller_test.rb +78 -39
- data/test/functional/admin/products_controller_test.rb +4 -5
- data/test/integration/checkout_test.rb +1 -0
- data/test/test_helper.rb +114 -86
- data/test/unit/creditcard_test.rb +28 -7
- data/test/unit/flexi_rate_calculator_test.rb +75 -0
- data/test/unit/helpers/products_helper_test.rb +4 -4
- data/test/unit/inventory_unit_test.rb +39 -5
- data/test/unit/line_item_test.rb +60 -1
- data/test/unit/order_state_test.rb +85 -58
- data/test/unit/order_test.rb +144 -123
- data/test/unit/product_test.rb +21 -0
- data/test/unit/return_authorization_test.rb +22 -28
- data/test/unit/shipment_test.rb +19 -7
- data/test/unit/variant_test.rb +100 -24
- data/vendor/extensions/api/api_extension.rb +2 -2
- data/vendor/extensions/api/app/controllers/api/base_controller.rb +14 -6
- data/vendor/extensions/api/app/controllers/api/countries_controller.rb +4 -0
- data/vendor/extensions/api/app/controllers/api/orders_controller.rb +4 -4
- data/vendor/extensions/api/app/controllers/api/products_controller.rb +5 -1
- data/vendor/extensions/api/app/controllers/api/shipments_controller.rb +7 -7
- data/vendor/extensions/api/app/controllers/api/states_controller.rb +5 -0
- data/vendor/extensions/api/config/locales/{en-US.yml → en.yml} +2 -2
- data/vendor/extensions/api/config/routes.rb +5 -0
- data/vendor/extensions/api/test/integration/orders_api_test.rb +4 -4
- data/vendor/extensions/overview_dashboard/app/views/admin/overview/index.html.erb +1 -1
- data/vendor/extensions/payment_gateway/app/models/gateway.rb +1 -1
- data/vendor/extensions/payment_gateway/app/models/gateway/authorize_net_cim.rb +41 -29
- data/vendor/extensions/payment_gateway/app/models/gateway/bogus.rb +3 -3
- data/vendor/extensions/payment_gateway/app/models/gateway/eway.rb +11 -0
- data/vendor/extensions/payment_gateway/app/models/gateway/sage_pay.rb +9 -0
- data/vendor/extensions/payment_gateway/config/locales/{en-US.yml → en.yml} +1 -1
- data/vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb +46 -56
- data/vendor/extensions/payment_gateway/payment_gateway_extension.rb +9 -10
- data/vendor/extensions/payment_gateway/test/unit/authorize_net_cim_test.rb +7 -6
- data/vendor/extensions/theme_default/app/stylesheets/_checkout.less +10 -3
- data/vendor/extensions/theme_default/app/views/admin/adjustments/index.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/checkouts/_form.html.erb +31 -5
- data/vendor/extensions/theme_default/app/views/admin/checkouts/show.html.erb +27 -16
- data/vendor/extensions/theme_default/app/views/admin/images/_form.html.erb +4 -0
- data/vendor/extensions/theme_default/app/views/admin/images/index.html.erb +16 -13
- data/vendor/extensions/theme_default/app/views/admin/orders/_add_product.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/orders/_form.html.erb +7 -0
- data/vendor/extensions/theme_default/app/views/admin/orders/index.html.erb +5 -5
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/_form.html.erb +12 -6
- data/vendor/extensions/theme_default/app/views/admin/payment_methods/index.html.erb +22 -11
- data/vendor/extensions/theme_default/app/views/admin/product_groups/update.js.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/products/_form.html.erb +6 -4
- data/vendor/extensions/theme_default/app/views/admin/shared/_address_form.html.erb +64 -55
- data/vendor/extensions/theme_default/app/views/admin/shared/_configuration_menu.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shared/_order_tabs.html.erb +11 -3
- data/vendor/extensions/theme_default/app/views/admin/shared/_product_tabs.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/shipments/_form.html.erb +32 -29
- data/vendor/extensions/theme_default/app/views/admin/shipments/index.html.erb +2 -1
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/_form.html.erb +6 -3
- data/vendor/extensions/theme_default/app/views/admin/tax_categories/index.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_taxon.html.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/taxons/_form.html.erb +11 -1
- data/vendor/extensions/theme_default/app/views/admin/taxons/edit.html.erb +2 -2
- data/vendor/extensions/theme_default/app/views/admin/users/_form.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/admin/variants/_form.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/checkouts/_confirm.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/checkouts/_delivery.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/checkouts/_summary.html.erb +6 -6
- data/vendor/extensions/theme_default/app/views/checkouts/edit.html.erb +3 -3
- data/vendor/extensions/theme_default/app/views/layouts/admin.html.erb +7 -5
- data/vendor/extensions/theme_default/app/views/layouts/spree_application.html.erb +8 -4
- data/vendor/extensions/theme_default/app/views/orders/_line_item.html.erb +1 -1
- data/vendor/extensions/theme_default/app/views/products/index.html.erb +0 -1
- data/vendor/extensions/theme_default/app/views/shared/_footer.html.erb +4 -2
- data/vendor/extensions/theme_default/app/views/shared/_products.html.erb +3 -1
- data/vendor/extensions/theme_default/app/views/shared/_user_form.html.erb +1 -1
- data/vendor/extensions/theme_default/public/images/admin/bg/spree_50.png +0 -0
- data/vendor/extensions/theme_default/public/images/tile-header.png +0 -0
- data/vendor/extensions/theme_default/public/images/tile-slider.png +0 -0
- data/vendor/extensions/theme_default/public/javascripts/admin/checkouts/edit.js +50 -0
- data/vendor/extensions/theme_default/public/javascripts/taxonomy.js +2 -2
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin-tables.css +8 -0
- data/vendor/extensions/theme_default/public/stylesheets/admin/admin.css +31 -16
- data/vendor/extensions/theme_default/public/stylesheets/screen.css +16 -3
- data/vendor/plugins/attribute_fu/{tasks → lib/tasks}/attribute_fu_tasks.rake +0 -0
- data/vendor/plugins/enumerable_constants/{tasks → lib/tasks}/enumerable_constants_tasks.rake +0 -0
- data/vendor/plugins/find_by_param/lib/find_by_param.rb +9 -5
- data/vendor/plugins/find_by_param/{tasks → lib/tasks}/find_by_param_tasks.rake +0 -0
- data/vendor/plugins/jrails/{tasks → lib/tasks}/jrails.rake +0 -0
- data/vendor/plugins/jrails_auto_complete/{tasks → lib/tasks}/jrails_auto_complete_tasks.rake +0 -0
- data/vendor/plugins/mail_queue/{tasks → lib/tasks}/mailer_queue_tasks.rake +0 -0
- data/vendor/plugins/open_id_authentication/{tasks → lib/tasks}/open_id_authentication_tasks.rake +0 -0
- data/vendor/plugins/resource_controller/lib/resource_controller/helpers/internal.rb +2 -2
- data/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +7 -7
- data/vendor/plugins/unobtrusive_date_picker/{tasks → lib/tasks}/datepicker_tasks.rake +0 -0
- metadata +82 -342
- data/app/helpers/admin/adjustments_helper.rb +0 -2
- data/app/helpers/admin/checkouts_helper.rb +0 -2
- data/app/helpers/admin/line_items_helper.rb +0 -2
- data/app/helpers/admin/properties_helper.rb +0 -9
- data/app/helpers/admin/prototypes_helper.rb +0 -18
- data/app/helpers/admin/return_authorizations_helper.rb +0 -2
- data/config/locales/cs-CZ.yml +0 -924
- data/config/locales/cs-CZ_rails.yml +0 -202
- data/config/locales/da.yml +0 -924
- data/config/locales/da_rails.yml +0 -197
- data/config/locales/de-CH.yml +0 -924
- data/config/locales/de-CH_rails.yml +0 -142
- data/config/locales/de.yml +0 -924
- data/config/locales/de_rails.yml +0 -140
- data/config/locales/en-AU.yml +0 -924
- data/config/locales/en-AU_rails.yml +0 -202
- data/config/locales/en-GB.yml +0 -924
- data/config/locales/en-GB_rails.yml +0 -196
- data/config/locales/en-US_rails.yml +0 -200
- data/config/locales/es.yml +0 -924
- data/config/locales/es_rails.yml +0 -173
- data/config/locales/fi.yml +0 -924
- data/config/locales/fi_rails.yml +0 -143
- data/config/locales/fr-FR.yml +0 -924
- data/config/locales/fr-FR_rails.yml +0 -123
- data/config/locales/il.yml +0 -924
- data/config/locales/il_rails.yml +0 -103
- data/config/locales/it.yml +0 -924
- data/config/locales/it_rails.yml +0 -146
- data/config/locales/jp.yml +0 -924
- data/config/locales/jp_rails.yml +0 -135
- data/config/locales/mx.yml +0 -924
- data/config/locales/mx_rails.yml +0 -181
- data/config/locales/nb-NO.yml +0 -924
- data/config/locales/nb-NO_rails.yml +0 -105
- data/config/locales/nl-BE.yml +0 -924
- data/config/locales/nl-BE_rails.yml +0 -155
- data/config/locales/nl-NL.yml +0 -924
- data/config/locales/nl-NL_rails.yml +0 -172
- data/config/locales/pl.yml +0 -924
- data/config/locales/pl_rails.yml +0 -118
- data/config/locales/pt-BR.yml +0 -924
- data/config/locales/pt-BR_rails.yml +0 -138
- data/config/locales/pt-PT.yml +0 -924
- data/config/locales/pt-PT_rails.yml +0 -133
- data/config/locales/ru-RU.yml +0 -924
- data/config/locales/ru-RU_rails.yml +0 -206
- data/config/locales/th.yml +0 -924
- data/config/locales/th_rails.yml +0 -195
- data/config/locales/vn.yml +0 -924
- data/config/locales/vn_rails.yml +0 -202
- data/lib/tasks/translation.rake +0 -102
- data/vendor/extensions/localization/README.rdoc +0 -5
- data/vendor/extensions/localization/Rakefile +0 -120
- data/vendor/extensions/localization/app/controllers/admin/localization_controller.rb +0 -2
- data/vendor/extensions/localization/app/helpers/locale_helper.rb +0 -2
- data/vendor/extensions/localization/app/helpers/localization_helper.rb +0 -2
- data/vendor/extensions/localization/app/views/shared/_language_bar.html.erb +0 -8
- data/vendor/extensions/localization/config/routes.rb +0 -4
- data/vendor/extensions/localization/lib/localization/user_preferences.rb +0 -9
- data/vendor/extensions/localization/lib/tasks/localization_extension_tasks.rake +0 -17
- data/vendor/extensions/localization/localization_extension.rb +0 -21
- data/vendor/extensions/localization/public/images/flags/ad.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ae.png +0 -0
- data/vendor/extensions/localization/public/images/flags/af.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ag.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ai.png +0 -0
- data/vendor/extensions/localization/public/images/flags/al.png +0 -0
- data/vendor/extensions/localization/public/images/flags/am.png +0 -0
- data/vendor/extensions/localization/public/images/flags/an.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ao.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ar.png +0 -0
- data/vendor/extensions/localization/public/images/flags/as.png +0 -0
- data/vendor/extensions/localization/public/images/flags/at.png +0 -0
- data/vendor/extensions/localization/public/images/flags/au.png +0 -0
- data/vendor/extensions/localization/public/images/flags/aw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ax.png +0 -0
- data/vendor/extensions/localization/public/images/flags/az.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ba.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/be.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/br.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/by.png +0 -0
- data/vendor/extensions/localization/public/images/flags/bz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ca.png +0 -0
- data/vendor/extensions/localization/public/images/flags/catalonia.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ch.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ci.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ck.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/co.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cx.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/cz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/da.png +0 -0
- data/vendor/extensions/localization/public/images/flags/de.png +0 -0
- data/vendor/extensions/localization/public/images/flags/de_CH.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/do.png +0 -0
- data/vendor/extensions/localization/public/images/flags/dz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ec.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ee.png +0 -0
- data/vendor/extensions/localization/public/images/flags/eg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/eh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/england.png +0 -0
- data/vendor/extensions/localization/public/images/flags/er.png +0 -0
- data/vendor/extensions/localization/public/images/flags/es.png +0 -0
- data/vendor/extensions/localization/public/images/flags/et.png +0 -0
- data/vendor/extensions/localization/public/images/flags/europeanunion.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fam.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/fr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ga.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ge.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/gy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ht.png +0 -0
- data/vendor/extensions/localization/public/images/flags/hu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/id.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ie.png +0 -0
- data/vendor/extensions/localization/public/images/flags/il.png +0 -0
- data/vendor/extensions/localization/public/images/flags/in.png +0 -0
- data/vendor/extensions/localization/public/images/flags/io.png +0 -0
- data/vendor/extensions/localization/public/images/flags/iq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ir.png +0 -0
- data/vendor/extensions/localization/public/images/flags/is.png +0 -0
- data/vendor/extensions/localization/public/images/flags/it.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/jp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ke.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ki.png +0 -0
- data/vendor/extensions/localization/public/images/flags/km.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ky.png +0 -0
- data/vendor/extensions/localization/public/images/flags/kz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/la.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/li.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ls.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/lv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ly.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ma.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/md.png +0 -0
- data/vendor/extensions/localization/public/images/flags/me.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ml.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mo.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mp.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mq.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ms.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mx.png +0 -0
- data/vendor/extensions/localization/public/images/flags/my.png +0 -0
- data/vendor/extensions/localization/public/images/flags/mz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/na.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ne.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ng.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ni.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/no.png +0 -0
- data/vendor/extensions/localization/public/images/flags/np.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/nz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/om.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pe.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ph.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ps.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/pw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/py.png +0 -0
- data/vendor/extensions/localization/public/images/flags/qa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/re.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ro.png +0 -0
- data/vendor/extensions/localization/public/images/flags/rs.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ru.png +0 -0
- data/vendor/extensions/localization/public/images/flags/rw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sa.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sb.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/scotland.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sd.png +0 -0
- data/vendor/extensions/localization/public/images/flags/se.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sh.png +0 -0
- data/vendor/extensions/localization/public/images/flags/si.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/so.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/st.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/sz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/td.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/th.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tj.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tk.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tl.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/to.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tr.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tv.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tw.png +0 -0
- data/vendor/extensions/localization/public/images/flags/tz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ua.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ug.png +0 -0
- data/vendor/extensions/localization/public/images/flags/um.png +0 -0
- data/vendor/extensions/localization/public/images/flags/us.png +0 -0
- data/vendor/extensions/localization/public/images/flags/uy.png +0 -0
- data/vendor/extensions/localization/public/images/flags/uz.png +0 -0
- data/vendor/extensions/localization/public/images/flags/va.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vc.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ve.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vg.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vi.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vn.png +0 -0
- data/vendor/extensions/localization/public/images/flags/vu.png +0 -0
- data/vendor/extensions/localization/public/images/flags/wales.png +0 -0
- data/vendor/extensions/localization/public/images/flags/wf.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ws.png +0 -0
- data/vendor/extensions/localization/public/images/flags/ye.png +0 -0
- data/vendor/extensions/localization/public/images/flags/yt.png +0 -0
- data/vendor/extensions/localization/public/images/flags/za.png +0 -0
- data/vendor/extensions/localization/public/images/flags/zm.png +0 -0
- data/vendor/extensions/localization/public/images/flags/zw.png +0 -0
- data/vendor/extensions/localization/spec/controllers/admin/localization_controller_spec.rb +0 -10
- data/vendor/extensions/localization/spec/controllers/locale_controller_spec.rb +0 -35
- data/vendor/extensions/localization/spec/helpers/locale_helper_spec.rb +0 -5
- data/vendor/extensions/localization/spec/helpers/localization_helper_spec.rb +0 -5
- data/vendor/extensions/localization/spec/spec.opts +0 -6
- data/vendor/extensions/localization/spec/spec_helper.rb +0 -37
- data/vendor/extensions/payment_gateway/app/models/gateway/protx.rb +0 -9
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_manage_products.rhtml +0 -31
- data/vendor/extensions/theme_default/app/views/admin/taxonomies/_success.rhtml +0 -1
@@ -6,11 +6,11 @@ class Api::OrdersController < Api::BaseController
|
|
6
6
|
|
7
7
|
def object_serialization_options
|
8
8
|
{ :include => {
|
9
|
-
:bill_address => {},
|
10
|
-
:ship_address => {},
|
11
|
-
:shipments => {:include => [:shipping_method, :address]},
|
9
|
+
:bill_address => {:include => [:country, :state]},
|
10
|
+
:ship_address => {:include => [:country, :state]},
|
11
|
+
:shipments => {:include => [:shipping_method, :address]},
|
12
12
|
:line_items => {:include => [:variant]}
|
13
|
-
}
|
13
|
+
}
|
14
14
|
}
|
15
15
|
end
|
16
16
|
|
@@ -1,8 +1,12 @@
|
|
1
1
|
class Api::ProductsController < Api::BaseController
|
2
2
|
resource_controller_for_api
|
3
|
-
actions :index, :show
|
3
|
+
actions :index, :show, :create, :update
|
4
|
+
include Spree::Search
|
4
5
|
|
5
6
|
private
|
7
|
+
define_method :collection do
|
8
|
+
@collection = retrieve_products
|
9
|
+
end
|
6
10
|
|
7
11
|
def object_serialization_options
|
8
12
|
{ :include => [:master, :variants, :taxons] }
|
@@ -12,24 +12,24 @@ class Api::ShipmentsController < Api::BaseController
|
|
12
12
|
|
13
13
|
def object_serialization_options
|
14
14
|
{ :include => {
|
15
|
-
:shipping_method => {},
|
16
|
-
:address => {},
|
15
|
+
:shipping_method => {},
|
16
|
+
:address => {:include => [:country, :state]},
|
17
17
|
:inventory_units => {
|
18
18
|
:include => {
|
19
19
|
:variant => {
|
20
20
|
:include => {
|
21
21
|
:product => {:only => [:name]}
|
22
|
-
}
|
22
|
+
}
|
23
23
|
}
|
24
24
|
}
|
25
25
|
}
|
26
26
|
},
|
27
|
-
:except => [:shipping_method_id, :address_id]
|
27
|
+
:except => [:shipping_method_id, :address_id]
|
28
28
|
}
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def eager_load_associations
|
32
|
-
[:shipping_method, :address, {:inventory_units => [:variant]}]
|
32
|
+
[:shipping_method, {:shipping_charge => :order}, :address, {:inventory_units => [:variant]}]
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
end
|
@@ -12,4 +12,9 @@ map.namespace :api do |api|
|
|
12
12
|
end
|
13
13
|
api.resources :inventory_units, :except => [:new,:edit], :member => {:event => :put}
|
14
14
|
api.resources :products, :except => [:new,:edit]
|
15
|
+
|
16
|
+
api.resources :countries, :except => [:new,:edit] do |countries|
|
17
|
+
countries.resources :states, :except => [:new,:edit]
|
18
|
+
end
|
19
|
+
api.resources :states, :except => [:new,:edit]
|
15
20
|
end
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
3
3
|
class OrdersApiTest < ActionController::IntegrationTest
|
4
4
|
include ApiIntegrationHelper
|
5
5
|
fixtures :payment_methods
|
6
|
-
|
6
|
+
|
7
7
|
context "orders" do
|
8
8
|
setup do
|
9
9
|
setup_user
|
@@ -45,7 +45,7 @@ class OrdersApiTest < ActionController::IntegrationTest
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
context "create" do
|
48
|
-
setup do
|
48
|
+
setup do
|
49
49
|
@attributes = {
|
50
50
|
:shipment => {
|
51
51
|
:shipping_method_id => @order.shipment.shipping_method_id,
|
@@ -65,7 +65,7 @@ class OrdersApiTest < ActionController::IntegrationTest
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
context "line_items" do
|
70
70
|
context "list" do
|
71
71
|
setup do
|
@@ -119,7 +119,7 @@ class OrdersApiTest < ActionController::IntegrationTest
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
end
|
124
124
|
|
125
125
|
end
|
@@ -79,7 +79,7 @@
|
|
79
79
|
<%= select_tag "orders_by_day_reports", options_for_select([[t('last_7_days'), "7_days"], [t('last_14_days'), "14_days"], [t('this_month'), "this_month"],
|
80
80
|
[t('last_month'), "last_month"], [t('this_year'), "this_year"], [t('last_year'), "last_year"] ], "7_days") %>
|
81
81
|
<label><%= t('value') %>:</label>
|
82
|
-
<%= select_tag "orders_by_day_value", options_for_select(
|
82
|
+
<%= select_tag "orders_by_day_value", options_for_select({t('count') => 'Count', t('value') => 'Value'}, 'Count') %>
|
83
83
|
</div>
|
84
84
|
</div>
|
85
85
|
</div>
|
@@ -12,7 +12,7 @@ class Gateway < PaymentMethod
|
|
12
12
|
|
13
13
|
# instantiates the selected gateway and configures with the options stored in the database
|
14
14
|
def self.current
|
15
|
-
|
15
|
+
super
|
16
16
|
end
|
17
17
|
|
18
18
|
def provider
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Gateway::AuthorizeNetCim < Gateway
|
2
|
-
|
3
|
-
|
2
|
+
preference :login, :string
|
3
|
+
preference :password, :string
|
4
4
|
preference :test_mode, :boolean, :default => false
|
5
5
|
|
6
6
|
ActiveMerchant::Billing::Response.class_eval do
|
@@ -9,12 +9,12 @@ class Gateway::AuthorizeNetCim < Gateway
|
|
9
9
|
|
10
10
|
def provider_class
|
11
11
|
self.class
|
12
|
-
end
|
12
|
+
end
|
13
13
|
|
14
14
|
def authorize(amount, creditcard, gateway_options)
|
15
15
|
create_transaction(amount, creditcard, :auth_only)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def purchase(amount, creditcard, gateway_options)
|
19
19
|
create_transaction(amount, creditcard, :auth_capture)
|
20
20
|
end
|
@@ -22,24 +22,32 @@ class Gateway::AuthorizeNetCim < Gateway
|
|
22
22
|
def capture(authorization, creditcard, gateway_options)
|
23
23
|
create_transaction((authorization.amount * 100).round, creditcard, :prior_auth_capture, :trans_id => authorization.response_code)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def credit(amount, creditcard, response_code, gateway_options)
|
27
27
|
create_transaction(amount, creditcard, :refund, :trans_id => response_code)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def void(response_code, creditcard, gateway_options)
|
31
31
|
create_transaction(nil, creditcard, :void, :trans_id => response_code)
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def payment_profiles_supported?
|
35
|
-
|
35
|
+
true
|
36
36
|
end
|
37
37
|
|
38
38
|
# Create a new CIM customer profile ready to accept a payment
|
39
|
-
def create_profile(
|
40
|
-
if
|
41
|
-
profile_hash = create_customer_profile(
|
42
|
-
|
39
|
+
def create_profile(payment)
|
40
|
+
if payment.source.gateway_customer_profile_id.nil?
|
41
|
+
profile_hash = create_customer_profile(payment)
|
42
|
+
payment.source.update_attributes(:gateway_customer_profile_id => profile_hash[:customer_profile_id], :gateway_payment_profile_id => profile_hash[:customer_payment_profile_id])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# simpler form
|
47
|
+
def create_profile_from_card(card)
|
48
|
+
if card.gateway_customer_profile_id.nil?
|
49
|
+
profile_hash = create_customer_profile(card)
|
50
|
+
card.update_attributes(:gateway_customer_profile_id => profile_hash[:customer_profile_id], :gateway_payment_profile_id => profile_hash[:customer_payment_profile_id])
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -56,7 +64,7 @@ class Gateway::AuthorizeNetCim < Gateway
|
|
56
64
|
amount = "%.2f" % (amount/100.0) # This gateway requires formated decimal, not cents
|
57
65
|
end
|
58
66
|
transaction_options = {
|
59
|
-
:type => transaction_type,
|
67
|
+
:type => transaction_type,
|
60
68
|
:amount => amount,
|
61
69
|
:customer_profile_id => creditcard.gateway_customer_profile_id,
|
62
70
|
:customer_payment_profile_id => creditcard.gateway_payment_profile_id,
|
@@ -67,27 +75,31 @@ class Gateway::AuthorizeNetCim < Gateway
|
|
67
75
|
logger.debug(" response: #{t.inspect}\n")
|
68
76
|
t
|
69
77
|
end
|
70
|
-
|
78
|
+
|
71
79
|
# Create a new CIM customer profile ready to accept a payment
|
72
|
-
def create_customer_profile(
|
73
|
-
options = options_for_create_customer_profile(
|
80
|
+
def create_customer_profile(payment)
|
81
|
+
options = options_for_create_customer_profile(payment)
|
74
82
|
response = cim_gateway.create_customer_profile(options)
|
75
83
|
if response.success?
|
76
|
-
{ :customer_profile_id => response.params["customer_profile_id"],
|
84
|
+
{ :customer_profile_id => response.params["customer_profile_id"],
|
77
85
|
:customer_payment_profile_id => response.params["customer_payment_profile_id_list"].values.first }
|
78
86
|
else
|
79
|
-
|
87
|
+
payment.gateway_error(response) if payment.respond_to? :gateway_error
|
88
|
+
payment.source.gateway_error(response)
|
80
89
|
end
|
81
90
|
end
|
82
91
|
|
83
|
-
def options_for_create_customer_profile(
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
92
|
+
def options_for_create_customer_profile(payment)
|
93
|
+
if payment.is_a? Creditcard
|
94
|
+
info = { :bill_to => generate_address_hash(payment.address), :payment => { :credit_card => payment } }
|
95
|
+
else
|
96
|
+
info = { :bill_to => generate_address_hash(payment.order.bill_address),
|
97
|
+
:payment => { :credit_card => payment.source } }
|
98
|
+
end
|
99
|
+
{ :profile => { :merchant_customer_id => "#{Time.now.to_f}",
|
100
|
+
#:ship_to_list => generate_address_hash(creditcard.checkout.ship_address),
|
101
|
+
:payment_profiles => info }
|
102
|
+
}
|
91
103
|
end
|
92
104
|
|
93
105
|
# As in PaymentGateway but with separate name fields
|
@@ -100,7 +112,7 @@ class Gateway::AuthorizeNetCim < Gateway
|
|
100
112
|
def cim_gateway
|
101
113
|
ActiveMerchant::Billing::Base.gateway_mode = preferred_server.to_sym
|
102
114
|
gateway_options = options
|
103
|
-
|
104
|
-
end
|
105
|
-
|
115
|
+
ActiveMerchant::Billing::AuthorizeNetCimGateway.new(gateway_options)
|
116
|
+
end
|
117
|
+
|
106
118
|
end
|
@@ -16,10 +16,10 @@ class Gateway::Bogus < Gateway
|
|
16
16
|
{}
|
17
17
|
end
|
18
18
|
|
19
|
-
def create_profile(
|
19
|
+
def create_profile(payment)
|
20
20
|
# simulate the storage of credit card profile using remote service
|
21
|
-
success = VALID_CCS.include?
|
22
|
-
|
21
|
+
success = VALID_CCS.include? payment.source.number
|
22
|
+
payment.source.update_attributes(:gateway_customer_profile_id => generate_profile_id(success))
|
23
23
|
end
|
24
24
|
|
25
25
|
def authorize(money, creditcard, options = {})
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Gateway::Eway < Gateway
|
2
|
+
preference :login, :string
|
3
|
+
|
4
|
+
# Note: EWay supports purchase method only (no authorize method).
|
5
|
+
# Ensure Spree::Config[:auto_capture] is set to true
|
6
|
+
|
7
|
+
def provider_class
|
8
|
+
ActiveMerchant::Billing::EwayGateway
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Spree
|
2
|
-
module PaymentGateway
|
3
|
-
|
2
|
+
module PaymentGateway
|
3
|
+
|
4
4
|
def self.included(base)
|
5
5
|
base.named_scope :with_payment_profile, :conditions => "gateway_customer_profile_id IS NOT NULL"
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def authorize(amount, payment)
|
9
9
|
# ActiveMerchant is configured to use cents so we need to multiply order total by 100
|
10
|
-
response = payment_gateway.authorize((amount * 100).round, self, gateway_options(payment))
|
11
|
-
|
12
|
-
|
10
|
+
response = payment_gateway.authorize((amount * 100).round, self, gateway_options(payment))
|
11
|
+
gateway_error(response) unless response.success?
|
12
|
+
|
13
13
|
# create a transaction to reflect the authorization
|
14
14
|
save
|
15
15
|
payment.txns << CreditcardTxn.create(
|
@@ -19,7 +19,7 @@ module Spree
|
|
19
19
|
:avs_response => response.avs_result['code']
|
20
20
|
)
|
21
21
|
rescue ActiveMerchant::ConnectionError => e
|
22
|
-
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
22
|
+
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
23
23
|
end
|
24
24
|
|
25
25
|
def capture(payment)
|
@@ -32,7 +32,7 @@ module Spree
|
|
32
32
|
# Standard ActiveMerchant capture usage
|
33
33
|
response = payment_gateway.capture((transaction.amount * 100).round, transaction.response_code, minimal_gateway_options(payment))
|
34
34
|
end
|
35
|
-
|
35
|
+
gateway_error(response) unless response.success?
|
36
36
|
|
37
37
|
# create a transaction to reflect the capture
|
38
38
|
save
|
@@ -43,14 +43,14 @@ module Spree
|
|
43
43
|
)
|
44
44
|
payment.finalize!
|
45
45
|
rescue ActiveMerchant::ConnectionError => e
|
46
|
-
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
46
|
+
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
47
47
|
end
|
48
48
|
|
49
49
|
def purchase(amount, payment)
|
50
50
|
#combined Authorize and Capture that gets processed by the ActiveMerchant gateway as one single transaction.
|
51
|
-
response = payment_gateway.purchase((amount * 100).round, self, gateway_options(payment))
|
52
|
-
|
53
|
-
|
51
|
+
response = payment_gateway.purchase((amount * 100).round, self, gateway_options(payment))
|
52
|
+
|
53
|
+
gateway_error(response) unless response.success?
|
54
54
|
|
55
55
|
# create a transaction to reflect the purchase
|
56
56
|
save
|
@@ -63,12 +63,12 @@ module Spree
|
|
63
63
|
rescue ActiveMerchant::ConnectionError => e
|
64
64
|
gateway_error t(:unable_to_connect_to_gateway)
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def void(payment)
|
68
68
|
return unless transaction = purchase_or_authorize_transaction_for_payment(payment)
|
69
69
|
|
70
70
|
response = payment_gateway.void(transaction.response_code, self, minimal_gateway_options(payment))
|
71
|
-
|
71
|
+
gateway_error(response) unless response.success?
|
72
72
|
|
73
73
|
# create a transaction to reflect the void
|
74
74
|
save
|
@@ -82,17 +82,17 @@ module Spree
|
|
82
82
|
payment.finalize!
|
83
83
|
end
|
84
84
|
|
85
|
-
def credit(payment, amount=nil)
|
85
|
+
def credit(payment, amount=nil)
|
86
86
|
return unless transaction = purchase_or_authorize_transaction_for_payment(payment)
|
87
87
|
|
88
88
|
amount ||= payment.order.outstanding_credit
|
89
|
-
|
89
|
+
|
90
90
|
if payment_gateway.payment_profiles_supported?
|
91
91
|
response = payment_gateway.credit((amount * 100).round, self, transaction.response_code, minimal_gateway_options(payment))
|
92
92
|
else
|
93
93
|
response = payment_gateway.credit((amount * 100).round, transaction.response_code, minimal_gateway_options(payment))
|
94
94
|
end
|
95
|
-
|
95
|
+
gateway_error(response) unless response.success?
|
96
96
|
|
97
97
|
# create a transaction to reflect the purchase
|
98
98
|
save
|
@@ -104,7 +104,7 @@ module Spree
|
|
104
104
|
payment.update_attribute(:amount, payment.amount - amount)
|
105
105
|
payment.order.update_totals!
|
106
106
|
rescue ActiveMerchant::ConnectionError => e
|
107
|
-
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
107
|
+
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
108
108
|
end
|
109
109
|
|
110
110
|
# find the transaction associated with the original authorization/capture
|
@@ -135,71 +135,61 @@ module Spree
|
|
135
135
|
|
136
136
|
# Can only refund a captured transaction but if transaction hasn't been cleared by merchant, refund may still fail
|
137
137
|
def can_credit?(payment)
|
138
|
-
has_transaction_of_types?(payment, CreditcardTxn::TxnType::PURCHASE, CreditcardTxn::TxnType::CAPTURE) &&
|
139
|
-
has_no_transaction_of_types?(payment, CreditcardTxn::TxnType::VOID) and payment.order.
|
138
|
+
has_transaction_of_types?(payment, CreditcardTxn::TxnType::PURCHASE, CreditcardTxn::TxnType::CAPTURE) &&
|
139
|
+
has_no_transaction_of_types?(payment, CreditcardTxn::TxnType::VOID) and payment.order.outstanding_credit?
|
140
140
|
end
|
141
141
|
|
142
142
|
def has_payment_profile?
|
143
143
|
gateway_customer_profile_id.present?
|
144
144
|
end
|
145
145
|
|
146
|
+
def gateway_error(error)
|
147
|
+
if error.is_a? ActiveMerchant::Billing::Response
|
148
|
+
text = error.params['message'] ||
|
149
|
+
error.params['response_reason_text'] ||
|
150
|
+
error.message
|
151
|
+
else
|
152
|
+
text = error.to_s
|
153
|
+
end
|
146
154
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
response.params['response_reason_text'] ||
|
151
|
-
response.message
|
152
|
-
gateway_error(text)
|
153
|
-
end
|
154
|
-
|
155
|
-
def gateway_error(text)
|
156
|
-
msg = "#{I18n.t('gateway_error')} ... #{text}"
|
157
|
-
logger.error(msg)
|
158
|
-
raise Spree::GatewayError.new(msg)
|
155
|
+
logger.error(I18n.t('gateway_error'))
|
156
|
+
logger.error(" #{error.to_yaml}")
|
157
|
+
raise Spree::GatewayError.new(text)
|
159
158
|
end
|
160
|
-
|
159
|
+
|
161
160
|
def gateway_options(payment)
|
162
|
-
options = {:billing_address => generate_address_hash(payment.order.bill_address),
|
161
|
+
options = {:billing_address => generate_address_hash(payment.order.bill_address),
|
163
162
|
:shipping_address => generate_address_hash(payment.order.shipment.address)}
|
164
163
|
options.merge minimal_gateway_options(payment)
|
165
|
-
end
|
166
|
-
|
164
|
+
end
|
165
|
+
|
167
166
|
# Generates an ActiveMerchant compatible address hash from one of Spree's address objects
|
168
167
|
def generate_address_hash(address)
|
169
168
|
return {} if address.nil?
|
170
169
|
{:name => address.full_name, :address1 => address.address1, :address2 => address.address2, :city => address.city,
|
171
170
|
:state => address.state_text, :zip => address.zipcode, :country => address.country.iso, :phone => address.phone}
|
172
171
|
end
|
173
|
-
|
174
|
-
# Generates a minimal set of gateway options. There appears to be some issues with passing in
|
175
|
-
# a billing address when authorizing/voiding a previously captured transaction. So omits these
|
176
|
-
# options in this case since they aren't necessary.
|
172
|
+
|
173
|
+
# Generates a minimal set of gateway options. There appears to be some issues with passing in
|
174
|
+
# a billing address when authorizing/voiding a previously captured transaction. So omits these
|
175
|
+
# options in this case since they aren't necessary.
|
177
176
|
def minimal_gateway_options(payment)
|
178
|
-
{:email => payment.order.email,
|
179
|
-
:customer => payment.order.email,
|
180
|
-
:ip => payment.order.ip_address,
|
177
|
+
{:email => payment.order.email,
|
178
|
+
:customer => payment.order.email,
|
179
|
+
:ip => payment.order.ip_address,
|
181
180
|
:order_id => payment.order.number,
|
182
181
|
:shipping => payment.order.ship_total * 100,
|
183
|
-
:tax => payment.order.tax_total * 100,
|
184
|
-
:subtotal => payment.order.item_total * 100}
|
182
|
+
:tax => payment.order.tax_total * 100,
|
183
|
+
:subtotal => payment.order.item_total * 100}
|
185
184
|
end
|
186
|
-
|
185
|
+
|
187
186
|
def spree_cc_type
|
188
|
-
return "visa" if ENV['RAILS_ENV'] == "development"
|
187
|
+
return "visa" if ENV['RAILS_ENV'] == "development"
|
189
188
|
self.class.type?(number)
|
190
189
|
end
|
191
190
|
|
192
191
|
def payment_gateway
|
193
192
|
@payment_gateway ||= Gateway.current
|
194
|
-
end
|
195
|
-
|
196
|
-
# TODO: Want to do this after_save but there is a possible danger of infinite loop which number_changed? check is intended to prevent.
|
197
|
-
# Removed the check to number_changed? and relying on the !has_payment_profile? to not re-create if we have a profile
|
198
|
-
def create_payment_profile
|
199
|
-
return unless payment_gateway.payment_profiles_supported? and number and !has_payment_profile?
|
200
|
-
payment_gateway.create_profile(self, {})
|
201
|
-
rescue ActiveMerchant::ConnectionError => e
|
202
|
-
gateway_error I18n.t(:unable_to_connect_to_gateway)
|
203
193
|
end
|
204
194
|
|
205
195
|
private
|