Spree Loyalty Points Code Climate Build Status

This extension adds Loyalty Points for users in Spree.

Installation

In your Gemfile, add:

gem 'spree_loyalty_points'

For Spree 2.1.x:

gem 'spree_loyalty_points', '1.0.3'

At present this extention is not compatible with Spree 2.0.x

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_loyalty_points:install

Usage

From Admin end, create a payment method of LoyaltyPoints type for payment with Loyalty Points.

Go to the Admin end of the website and open the Configurations Tab. Set up the values for the following Loyalty Points Settings under General Settings:

  • Minimum Amount to be spent per Order(Item Total, excluding Shipping and any other Charges) to award Loyalty Points : This is the minimum amount the user has to spend on an order to receive Loyalty Points for that order
  • Number of Loyalty Points to be awarded per Unit Amount Spent : Loyalty Points to be awarded against Unit Amount spent on Order
  • Minimum Loyalty Points Balance Required for Redeeming : Minimum Loyalty Points Balance a user should have for spending Loyalty Points
  • Loyalty Point to Amount Conversion Rate : Conversion Rate for getting Amount equivalent value of Loyalty Points
  • Time(in hours) after payment to award Loyalty Points : Time period to wait from the time payment is received for the order to award Loyalty Points

After an order's payment is received, Loyalty Points will be awarded (only after the Time period specified in the above setting) when you run the rake task. Add a Cron Job to run the following Rake Task to Award Loyalty Points to Users:

bundle exec rake spree:loyalty_points:award

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_loyalty_points/factories'

Credits

vinsol.com: Ruby on Rails, iOS and Android developers

Copyright (c) 2014 vinsol.com, released under the New MIT License