Giter Site home page Giter Site logo

spree-contrib / spree_store_credits Goto Github PK

View Code? Open in Web Editor NEW
71.0 13.0 136.0 163 KB

This Spree extension allows admins to issue arbitrary amounts of store credit to users.

Home Page: http://guides.spreecommerce.org

License: BSD 3-Clause "New" or "Revised" License

Ruby 89.56% JavaScript 0.14% CSS 0.16% HTML 10.15%

spree_store_credits's Introduction

⚠️ Deprecation notice ⚠️

Since Spree 3.1 this extension is deprecated and not needed. Store Credits were merged into Spree core.

Spree Store Credits

Build Status

This Spree extension allows admins to issue arbitrary amounts of store credit to users.

Users can redeem store credit during checkout, as part or full payment for an order.

Also extends My Account page to display outstanding credit balance, and orders that used store credit.

Installation

  1. Add the following to your applications Gemfile

    gem 'spree_store_credits'

  2. Run bundler

    bundle install

  3. Copy and execute migrations:

    rails g spree_store_credits:install

Configuration

By default Spree Store Credits does not require your order total to be above an amount to apply store credits.

To change this, use the :use_store_credit_minimum preference. For information on setting Spree preferences visit http://guides.spreecommerce.com/developer/preferences.html

One possible implementation looks like this:

# app/model/spree/store_credit_decorator.rb

Spree::StoreCredit.class_eval do
  Spree::Config[:use_store_credit_minimum] = 0.01
end

spree_store_credits's People

Contributors

bdq avatar christoph-buente avatar damianlegawiec avatar geekoncoffee avatar geermc4 avatar giubueno avatar jdutil avatar jfields avatar jsqu99 avatar jtwalters avatar mzahir avatar paultyng avatar petergoldstein avatar radar avatar romul avatar sbounmy avatar schof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree_store_credits's Issues

Issue when running rails g spree_store_credits:install

/Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/spree_store_credits-1.0.2/app/models/promotion/actions/give_store_credit.rb:1:in <top (required)>': uninitialized constant PromotionAction (NameError) from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/spree_store_credits-1.0.2/lib/spree_store_credits.rb:16:inblock in class:Engine'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/initializable.rb:30:in instance_exec' from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/initializable.rb:30:inrun'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/initializable.rb:55:in block in run_initializers' from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/initializable.rb:54:ineach'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/initializable.rb:54:in run_initializers' from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/application.rb:136:ininitialize!'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in method_missing' from /Users/sleepyxivo/sites/jlclighting.com/config/environment.rb:5:in<top (required)>'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/polyglot-0.3.3/lib/polyglot.rb:63:in require' from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/polyglot-0.3.3/lib/polyglot.rb:63:inrequire'
from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/application.rb:103:in require_environment!' from /Users/sleepyxivo/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/commands.rb:25:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

uninitialized constant PromotionAction

When running bundle exec rails g spree_store_credits:install

/Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/spree_store_credits-1.0.2/app/models/promotion/actions/give_store_credit.rb:1:in <top (required)>': uninitialized constant PromotionAction (NameError) from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/spree_store_credits-1.0.2/lib/spree_store_credits.rb:16:inblock in class:Engine'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/initializable.rb:30:in instance_exec' from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/initializable.rb:30:inrun'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/initializable.rb:55:in block in run_initializers' from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/initializable.rb:54:ineach'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/initializable.rb:54:in run_initializers' from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/application.rb:96:ininitialize!'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in method_missing' from /Users/me/Sites/klanten/ladress/config/environment.rb:5:in<top (required)>'
from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/application.rb:83:in require_environment!' from /Users/me/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/commands.rb:22:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

It does work for me when I prefix all the models in the gem with Spree::

How is this possible? Other gems work OOTB.

process_store_credit callback

In order_decorator.rb :

before_save :process_store_credit, :if => "self.user.present? && @store_credit_amount"

Scenario :
Given order is left at the checkout confirmation step
And the Spree::Config[:use_store_credit_minimum] changes to a greater value than the order line item total.
Then the order is not valid
And the user should be able to not use his store credit.

In this scenario, the user won't have a chance to set his store_credit_amount to 0 because his order is not valid.

Changing this to

before_validation :process_store_credit, :if => "self.user.present? && @store_credit_amount"

would fix the issue but I am not sure about the possible regression.

Any idea ?

exception when store_credits >= total_price

When you use a store credit equal to the total amount of the price the following exception is raised:
NoMethodError in CheckoutController#update

versions
rails 3.0.3
spree edge
spree/spree_paypal_express (master)
spree/spree_store_credits
Payment methodpaypal_express

"You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.first"

/Users/leigh/.rvm/gems/ruby-1.9.2-p136/bundler/gems/spree_paypal_express-fbda45404806/app/controllers/checkout_controller_decorator.rb:186:in redirect_to_paypal_express_form_if_needed' activesupport (3.0.3) lib/active_support/callbacks.rb:481:in_run__3699436363602999251__process_action__1246387347323800035__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in _run_process_action_callbacks' activesupport (3.0.3) lib/active_support/callbacks.rb:93:inrun_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:inblock in process_action'

Store credit adjustments being deleted on completed order

If a completed order is saved, any store credit adjustments are being deleted due to ensure_sufficient_credit - the user's credit has been consumed at this point so they no longer have enough to cover those adjustments. I think the correct behavior is for ensure_sufficient_credit to only be called on not-completed orders. Could I be overlooking some reason why it isn't already like that?

davidnorth@c49a9d2

Users credit never consumed after purchasing using store credit

trying to set up the store_credits gem on a Spree 1.2 install, and running into an issue - the adjustment for the store credit is generated correctly, but consume_users_credit is never called, the user's store credit is never actually reduced after they make a purchase.

Looking at the code, lines 57-58 in app/models/spree/order_decorator.rb look suspicious - it seems those two lines ought to be inside process_store_credit for one, but the logic also doesn't work, as the code can't seem to find the state_machine on my Order model instance. (Could be an issue with rails not handling multiple overrides correctly? Our setup has the original order.rb in spree_core, and, at least, 3 overrides on top of it - in our app, spree_gift_card, and spree_store_credits.)

Solution, so far, has been to add

state_machine do
after_transition :to => :complete, :do => :consume_users_credit
end

to order_decorator.rb in our app.

Template missing

When tried to access admin/general_settings/edit, I encountered the following error. I am using 1-3-stable


Template is missing

Missing partial spree/admin/store_credits/limit with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :rabl], :versions=>[:v1]}.


undefined method

undefined object.orders, modified to @user.orders and works ok

UsersController.class_eval do
before_filter :find_orders_with_store_credit, :only => :show

private

def find_orders_with_store_credit
@orders_with_store_credit = object.orders.joins(:adjustments).where(:adjustments => {:source_type => 'StoreCredit'})
end
end

Spree 0.70.0.rc2 error

Trying to use extensions with edge spree. Got this error:

/usr/lib/ruby/gems/1.8/gems/activerecord-3.1.1.rc2/lib/active_record/base.rb:1088:in method_missing': undefined methodregister' for #Class:0xb2bce384 (NoMethodError)
from /home/fodoj/Rails/engrave/vendor/gems/spree_store_credits/lib/spree_store_credits.rb:15:in `activate'

Issue with partial credit cart payment and :auto_capture => true

There is a terrible issue with your plugin - if Spree credit card setting :auto_capture is set to true:
Spree::Config.set(:auto_capture => true)
#preference :auto_capture, :boolean, :default => false # automatically capture the creditcard (as opposed to just authorize and capture later)

and someone places an order paying partly with their store credit and partly with a credit card,
that order's payment_state is set to 'balance_due' instead of 'paid' and there's no way to change it in the admin. It happens because order's payment_total is not updated and is always 0 in this case, when it must be equal to the amount paid with the credit card. update_payment_state method in order.rb sets payment_state to 'balance_due' when payment_total is less than total:

  # Updates the +payment_state+ attribute according to the following logic:
  #
  # paid          when +payment_total+ is equal to +total+
  # balance_due   when +payment_total+ is less than +total+
  # credit_owed   when +payment_total+ is greater than +total+
  # failed        when most recent payment is in the failed state
  #
  # The +payment_state+ value helps with reporting, etc. since it provides a quick and easy way to locate Orders needing attention.
  def update_payment_state
    if payment_total < total
      self.payment_state = "balance_due"
      self.payment_state = "failed" if payments.present? and payments.last.state == "failed"
    elsif payment_total > total
      self.payment_state = "credit_owed"
    else
      self.payment_state = "paid"
    end
  end

We moved our store into production and now half of our orders are a mess. Please fix this as soon as possible.

Thanks

NameError in UsersController#show

I am trying to install spree_affiliate, which requires store_credits. However, upon installing store_credits, the Account page for users throws the following error when rendering:

undefined local variable or method `object' for #UsersController:0x0000010bd8c898

Here is the full trace:
spree_store_credits (1.0.1) app/controllers/users_controller_decorator.rb:7:in find_orders_with_store_credit' activesupport (3.1.3) lib/active_support/callbacks.rb:457:in_run__313994170230185625__process_action__175903687477218981__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in _run_process_action_callbacks' activesupport (3.1.3) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:inprocess_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in block in process_action' activesupport (3.1.3) lib/active_support/notifications.rb:53:inblock in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in instrument' activesupport (3.1.3) lib/active_support/notifications.rb:53:ininstrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:inprocess_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (3.1.3) lib/abstract_controller/base.rb:121:inprocess'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in process' actionpack (3.1.3) lib/action_controller/metal.rb:193:indispatch'
actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.1.3) lib/action_controller/metal.rb:236:inblock in action'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in call' actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:indispatch'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in call' rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:inblock in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in block in recognize' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:inoptimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in recognize' rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:incall'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in call' spree_core (0.70.3) lib/redirect_legacy_product_url.rb:10:incall'
spree_core (0.70.3) lib/middleware/seo_assist.rb:23:in call' warden (1.0.6) lib/warden/manager.rb:35:inblock in call'
warden (1.0.6) lib/warden/manager.rb:34:in catch' warden (1.0.6) lib/warden/manager.rb:34:incall'
actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' rack (1.3.5) lib/rack/etag.rb:23:incall'
rack (1.3.5) lib/rack/conditionalget.rb:25:in call' actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:incall'
actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in call' actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:incall'
rack (1.3.5) lib/rack/session/abstract/id.rb:195:in context' rack (1.3.5) lib/rack/session/abstract/id.rb:190:incall'
actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in call' activerecord (3.1.3) lib/active_record/query_cache.rb:64:incall'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in call' actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:inblock in call'
activesupport (3.1.3) lib/active_support/callbacks.rb:392:in _run_call_callbacks' activesupport (3.1.3) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in call' actionpack (3.1.3) lib/action_dispatch/middleware/reloader.rb:68:incall'
rack (1.3.5) lib/rack/sendfile.rb:101:in call' actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:incall'
actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in call' railties (3.1.3) lib/rails/rack/logger.rb:13:incall'
rack (1.3.5) lib/rack/methodoverride.rb:24:in call' rack (1.3.5) lib/rack/runtime.rb:17:incall'
activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.3.5) lib/rack/lock.rb:15:incall'
actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in call' actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:incall'
railties (3.1.3) lib/rails/engine.rb:456:in call' rack (1.3.5) lib/rack/content_length.rb:14:incall'
railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in call' rack (1.3.5) lib/rack/handler/webrick.rb:59:inservice'

How do I resolve this?

Error running generator

I have spree 2.0.0 installed. I added gem 'spree_store_credits' to my gemfile, and then run rails g spree_store_credits:install. The error I receive is the following:

/Users/keiljr/.rvm/gems/ruby-1.9.3-p194@smgracing/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require': cannot load such file -- spree_promo (LoadError)

Any ideas? I thought maybe the gem 'spree_promo` was missing, but when I add it to my gemfile and run the bundle command, bundler pinches a loaf with an incompatibility error of some sort.

Spree 2.2 + Rails 4.0.2 compatibility

Hi,

I'm trying to use this gem with spree 2.2 and rails 4.0.2. After installing and running the generator I noticed some of the spree boiler plate tests were failing. Is spree_store_credits compatible with spree 2.2 and rails 4.0.2? Any pointers on getting it working? Below is the backtrace of one of the failing tests, and also my Gemfile.

4) Spree::CheckoutController#update_registration does not check registration
     Failure/Error: spree_put :update_registration, { order: { } }
     AbstractController::ActionNotFound:
       The action 'update_registration' could not be found for Spree::CheckoutController
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:131:in 'process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.3/lib/abstract_controller/rendering.rb:44:in 'process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.3/lib/action_controller/test_case.rb:569:in 'process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/actionpack-4.0.3/lib/action_controller/test_case.rb:64:in 'process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/devise-3.2.3/lib/devise/test_helpers.rb:19:in 'block in process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/devise-3.2.3/lib/devise/test_helpers.rb:72:in 'catch'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/devise-3.2.3/lib/devise/test_helpers.rb:72:in '_catch_warden'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/devise-3.2.3/lib/devise/test_helpers.rb:19:in 'process'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/spree-205813af2eac/core/lib/spree/testing_support/controller_requests.rb:68:in 'process_spree_action'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/bundler/gems/spree-205813af2eac/core/lib/spree/testing_support/controller_requests.rb:40:in 'spree_put'
     # ./spec/controllers/spree/checkout_controller_spec.rb:123:in 'block (3 levels) in <top (required)>'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in 'instance_eval'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:114:in 'block in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in 'instance_exec'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in 'instance_eval_with_args'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:247:in 'instance_eval_with_args'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/hooks.rb:106:in 'block (2 levels) in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:179:in 'call'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:179:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in 'instance_exec'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in 'instance_eval_with_args'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:247:in 'instance_eval_with_args'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/hooks.rb:106:in 'block (2 levels) in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/hooks.rb:108:in 'call'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/hooks.rb:108:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/hooks.rb:446:in 'run_hook'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:340:in 'run_around_each_hooks'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:256:in 'with_around_each_hooks'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example.rb:111:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:390:in 'block in run_examples'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in 'map'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:386:in 'run_examples'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:371:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in 'block in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in 'map'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/example_group.rb:372:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in 'block (2 levels) in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in 'map'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:28:in 'block in run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/reporter.rb:58:in 'report'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:25:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in 'run'
     # /home/james/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in 'block in autorun'
source "https://rubygems.org"

ruby "2.1.1"

gem "rails", "~> 4.0.0"

gem "activerecord-session_store", "~> 0.1.0" # We store our sessions in the database
gem "airbrake", "~> 3.1.15" # For exception reporting
gem "attr_encrypted", "~> 1.3.2" # Encrypt potentially sensitive information in the DB
gem "bourbon", "~> 3.1.8" # Make writing SCSS nicer
gem "carrierwave", "~> 0.10.0" # Handle asset uploads outside of Spree
gem "ckeditor", "~> 4.0.10"
gem "coffee-rails", "~> 4.0.1" # We use CoffeeScript
gem "dalli", "~> 2.7.0" # Used memcached for cachin
gem "desk", "~> 1.0.0" # For creating customers in Desk
gem "devise", "~> 3.2.0" # Authentication for users
gem "devise-encryptable", "~> 0.1.2" # Encryption for devise properties
gem "fog", "~> 1.20.0" # Connect to S3 for asset storage
gem "foreman", "~> 0.63.0" # Environment and process manager
gem "friendly_id", "~> 5.0.3" # For managing slugs as ids
gem "jquery-rails", "~> 3.1.0" # We're using jQuery
gem "memcachier", "~> 0.0.2" # Using memcachier ENV vars on Heroku
gem "neat", "~> 1.5.0" # For building a grid in the admin panel
gem "omniauth", "~> 1.2.1" # For authing through Facebook
gem "oauth2", "~> 0.9.3" # For authing through Facebook
gem "omniauth-facebook", "~> 1.6.0" # For authing through Facebook
gem "mini_magick", "~> 3.7.0" # CKEditor requires this for processing
gem "puma", "~> 2.7.1" # Serve our Rack application with Puma
gem "pg", "~> 0.17.1" # For ActiveRecord with Postgres
gem "RedCloth", "~> 4.2.9" # Parsing Markdown
gem "redis", "~> 3.0.7"
gem "resque", "~> 1.25.1"
gem "resque-timeout", "~> 1.0.0"
gem "rmagick", "~> 2.13.2", require: false # Process images uploaded via Carrierwave for Paperclip
gem "sass-rails", "~> 4.0.1" # Using SCSS to write CSS
gem "slim", "~> 2.0.2" # Fast Ruby templating language
gem "simple_form", "~> 3.0.1" # Build forms easily
gem "uglifier", "~> 2.4.0" # Minify assets in production

group :production do
  gem "rails_12factor", "~> 0.0.2"
  gem "newrelic_rpm", "~> 3.7.2.195"
end

group :development do
  gem "quiet_assets", "~> 1.0.2"
  gem "letter_opener", "~> 1.2.0"
end

group :test do
  gem "database_cleaner", "~> 1.2.0"
  gem "timecop", "~> 0.7.1"
  gem "rspec-pride", require: false
end

group :development, :test do
  gem "capybara", "~> 2.2.1"
  gem "email_spec", "~> 1.5.0"
  gem "ffaker", "~> 1.23.0"
  gem "factory_girl_rails", "~> 4.4.1"
  gem "poltergeist", "~> 1.5.0"
  gem "rspec-rails", "~> 2.14.1"
  gem "selenium-webdriver", "~> 2.40.0"
  gem "simplecov", "~> 0.7.1" # Output test coverage data, keep at 0.7 until https://github.com/colszowka/simplecov/issues/281
  gem "shoulda-matchers", "~> 2.5.0"
  gem "spork", "~> 0.9.2"
end

gem 'spree', '~> 2.2.0', :git => 'https://github.com/spree/spree.git', :branch => '2-2-stable'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth', :path => 'extensions/spree_auth'
gem "spree_store_credits", :path => 'extensions/spree_store_credits'

References to current_user in '1-3-stable' should be changed to spree_current_user?

Hi,

I was planning to customize the store_credits gem, but noticed that the current_user function call is no longer working.

undefined local variable or method `current_user' for #<Spree::CheckoutController:0x007fe33b6aaa88>

in the views and the controller.

My fix was to change all occurrences of 'current_user' to 'spree_current_user', is this a correct fix?

My Gemfile is as below

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'spree', '1.3.2'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '1-3-stable'
gem 'spree_static_content', :github => 'spree/spree_static_content', :branch => '1-3-stable'
gem 'spree_store_credits', :github => 'spree/spree_store_credits', :branch => '1-3-stable'

Support for spree 2.4

Is there a chance this extensions gets a version bump to 2.4? It would be really appreciated.

checkout without payment method

Hi,

it seems that I always have to select a payment method during checkout even if a user has enough store credit to pay the order completely.
Is there a way around this?

thanks in advance,
Volker

Deface looking for missing _limit partial

Deface appears to be looking for a missing partial called 'limit':

app /overrides /views_decorator.rb

Deface::Override.new(:virtual_path => "spree/admin/general_settings/edit",
:name => "admin_general_settings_edit_for_sc",
:insert_before => "[data-hook='buttons']",
:partial => "spree/admin/store_credits/limit",
:disabled => false)

Please could you include it.

Regards,

Ryan

Store Credits subtract twice in non-production and non-development env for 1.3 stable branch.

This is an issue we met in our project when using this store credits extension. On our development env, all things worked fine. But when we run the app on QA envs. things goes mad. We always get store credits subtract twice. That means if u use $30 sc, it will subtract $60 from your remaining store credits.

After check the source code of sc extension, we find this is caused of the configuration inside spree_store_credits.rb. Inside the file, we have a condition statement use Rails env to configure the extension:

 def self.activate
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.env == "production" ? require(c) : load(c)
      end
  end

We can change the condition statement to follow to fix this issue:

 def self.activate
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
  end

Seems the require/load setting must be same as its host app of this extension.

User can check off "Remove Store Credits" in confirmation and place order

Actual

When placing an order, if you choose to pay fully with store credits, in the confirmation step the user if presented with a checkbox Remove Store Credits, if the user checks it off and clicks Place Order the credits are removed and the order is placed into Completed state and the payment is in Paid state

Expected

If the user provided a payment method: The payment method should be used to make the payment
If the user no payment method: The user should receive an error message, just like they would if they tried to checkout an order with no payment method

Nasty "Stack level too deep" when moving Order from Confirm -> Complete (on 2-0-stable branch)

I have isolated a nasty ("80% problem") little infinite recursion in my Spree app (recently upgraded from 1.3 to 2.0) when using the 2-0-stable branch of this gem. I have isolated the bug to this gem itself, although I have not ruled out some kind of problem with my own app's code.

This problem only appears when RAILS_ENV is "staging" or "qa", it DOES NOT appear in development. (I have not tested in production). (That, combined with the fact that it is a SystemStackError so it shows no stack trace, makes this one of the nastiest little bugs I've ever found in my whole career.)

I'm going to dig into it a little more, using this Issue to take notes for the benefit of others. Please leave this issue open until I have exhausted all notes about the issue.

Issue with order concurrency refactor in 2-1-stable

Using latest spree/spree@bf68120 and bc2bc75

Getting the error below. I imagine its related to this somehow: spree/spree#4334

undefined local variable or method `load_order' for #Spree::CheckoutController:0x00000007a86270

I guess it was renamed to load_order_with_lock? I can submit a quick PR if that is the case.

/usr/local/rvm/gems/ruby-2.0.0-p353/bundler/gems/spree_store_credits-3589755b7230/app/controllers/spree/checkout_controller_decorator.rb:11:in `remove_payments_attributes_if_total_is_zero'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:58:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

This gem requires old spree_promo gem

Spree 2.1
Add gem to Gemfile and make bundle install. Ok.

Run generator and get error:

$ rails g spree_store_credits:install
...gems/ruby-2.0.0-p451/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require': cannot load such file -- spree_promo (LoadError)
    ...gems/ruby-2.0.0-p451/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
    ...gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
    ...gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
    ...gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
    ...gems/ruby-2.0.0-p451/gems/spree_store_credits-1.0.2/lib/spree_store_credits.rb:2:in `<top (required)>'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
    ...gems/ruby-2.0.0-p451@global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
    ...cts/grocerymarket/config/application.rb:7:in `<top (required)>'
    ...gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands.rb:43:in `require'
    ...gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands.rb:43:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Add spree_promo gem to Gemfile and bundle do not work because spree_promo requires

spree_core (= 0.30.0) ruby

Not displaying default store curency

The spree_store_credits extension displays only USD everywhere. Instead it should automatically take the store currency or there should be an option to define the currency to be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.