spree_wallet 2.0.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 [name of plugin creator]
1
+ Copyright (c) 2014 Vinsol
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- SpreeWallet
1
+ SpreeWallet [![Code Climate](https://codeclimate.com/github/vinsol/spree_wallet.png)](https://codeclimate.com/github/vinsol/spree_wallet) [![Build Status](https://travis-ci.org/vinsol/spree_wallet.png?branch=master)](https://travis-ci.org/vinsol/spree_wallet)
2
2
  ===========
3
3
 
4
4
  Installation
@@ -7,7 +7,13 @@ Installation
7
7
  Add spree_wallet to your Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'spree_wallet', '2.0.9'
10
+ gem 'spree_wallet', '~> 2.1.0'
11
+ ```
12
+
13
+ But if you are using 2.0.x version of spree
14
+
15
+ ```ruby
16
+ gem 'spree_wallet', '2.0.6'
11
17
  ```
12
18
 
13
19
  Bundle your dependencies and run the installation generator:
@@ -25,29 +31,18 @@ From Admin end, create a payment method of Wallet type. From User end, user can
25
31
 
26
32
  While from admin end, Admin can select any amount from wallet, but it should be less than amount present in user's balance.
27
33
 
28
- ## Testing
34
+ Testing
35
+ -------
29
36
 
30
37
  You need to do a quick one-time creation of a test application and then you can use it to run the tests.
31
38
 
32
- ```
33
- bundle exec rake test_app
34
- ````
39
+ bundle exec rake test_app
40
+
35
41
  Then run the rspec tests with mysql.
36
42
 
37
- ```
38
- bundle exec rspec .
39
- ```
43
+ bundle exec rspec .
40
44
 
41
- Contributing
42
- ------------
43
45
 
44
- 1. Fork the repo.
45
- 2. Clone your repo.
46
- 3. Run `bundle install`.
47
- 4. Run `bundle exec rake test_app` to create the test application in `spec/test_app`.
48
- 5. Make your changes.
49
- 6. Ensure specs pass by running `bundle exec rspec spec`.
50
- 7. Submit your pull request.
51
46
 
52
47
  Credits
53
48
  -------
@@ -8,8 +8,8 @@ Spree::Payment.class_eval do
8
8
  delegate :remaining_total, :user_or_by_email, :to => :order, :prefix => true, :allow_nil => true
9
9
 
10
10
  fsm = self.state_machines[:state]
11
- fsm.after_transition :from => fsm.states.map(&:name) - ['completed'], :to => ['completed'], :do => :consume_user_credits, :if => :wallet?
12
- fsm.after_transition :from => ['completed'], :to => fsm.states.map(&:name) - ['completed'] , :do => :release_user_credits, :if => :wallet?
11
+ fsm.after_transition :from => fsm.states.map(&:name) - [:completed], :to => :completed, :do => :consume_user_credits, :if => :wallet?
12
+ fsm.after_transition :from => :completed, :to => fsm.states.map(&:name) - [:completed] , :do => :release_user_credits, :if => :wallet?
13
13
 
14
14
  def wallet?
15
15
  payment_method.is_a? Spree::PaymentMethod::Wallet
@@ -1,6 +1,5 @@
1
1
  module Spree
2
2
  class StoreCredit < ActiveRecord::Base
3
- attr_accessible :amount, :reason, :payment_mode
4
3
  attr_accessor :disable_negative_payment_mode
5
4
 
6
5
  belongs_to :transactioner, :class_name => Spree.user_class
@@ -14,7 +13,7 @@ module Spree
14
13
  before_validation :generate_transaction_id, :on => :create
15
14
  before_create :update_user_wallet
16
15
 
17
- scope :order_created_at_desc, order('created_at desc')
16
+ scope :order_created_at_desc, -> { order('created_at desc') }
18
17
 
19
18
  private
20
19
  def update_user_wallet
@@ -1,21 +1,21 @@
1
1
  <fieldset id="payment" data-hook>
2
2
  <legend align="center"><%= Spree.t(:payment_information) %></legend>
3
3
  <div data-hook="checkout_payment_step">
4
-
5
-
6
- <% if spree_current_user && @order.available_wallet_payment_method && !spree_current_user.store_credits_total.to_f.zero? %>
7
- <%= check_box_tag "order[payments_attributes][][payment_method_id]", @order.available_wallet_payment_method.id %>
8
- <%= Spree.t(@order.available_wallet_payment_method.name, :scope => :payment_methods, :default => @order.available_wallet_payment_method.name) %>( <%= spree_current_user.store_credits_total %> )
9
- <% end %>
10
-
11
- <% @order.available_payment_methods_without_wallet.each do |method| %>
12
- <p>
13
- <label>
14
- <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id %>
15
- <%= Spree.t(method.name, :scope => :payment_methods, :default => method.name) %>
16
- </label>
17
- </p>
18
- <% end %>
4
+ <div id="payment-method-fields" data-hook>
5
+ <% if spree_current_user && @order.available_wallet_payment_method && !spree_current_user.store_credits_total.to_f.zero? %>
6
+ <%= check_box_tag "order[payments_attributes][][payment_method_id]", @order.available_wallet_payment_method.id %>
7
+ <%= Spree.t(@order.available_wallet_payment_method.name, :scope => :payment_methods, :default => @order.available_wallet_payment_method.name) %>( <%= spree_current_user.store_credits_total %> )
8
+ <% end %>
9
+
10
+ <% @order.available_payment_methods_without_wallet.each do |method| %>
11
+ <p>
12
+ <label>
13
+ <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id %>
14
+ <%= Spree.t(method.name, :scope => :payment_methods, :default => method.name) %>
15
+ </label>
16
+ </p>
17
+ <% end %>
18
+ </div>
19
19
 
20
20
  <ul id="payment-methods" data-hook>
21
21
  <% @order.available_payment_methods_without_wallet.each do |method| %>
@@ -1,7 +1,5 @@
1
1
  class AddLockVersionToSpreeUsers < ActiveRecord::Migration
2
2
  def change
3
- unless Spree::User.column_names.include? "lock_version"
4
- add_column :spree_users, :lock_version, :integer, :default => 0
5
- end
3
+ add_column :spree_users, :lock_version, :integer, :default => 0
6
4
  end
7
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_wallet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 9
10
- version: 2.0.9
10
+ version: 2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nishant 'CyRo' Tuteja
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-03-27 00:00:00 Z
18
+ date: 2014-03-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: spree_core
@@ -25,11 +25,12 @@ dependencies:
25
25
  requirements:
26
26
  - - ~>
27
27
  - !ruby/object:Gem::Version
28
- hash: 3
28
+ hash: 11
29
29
  segments:
30
30
  - 2
31
+ - 1
31
32
  - 0
32
- version: "2.0"
33
+ version: 2.1.0
33
34
  type: :runtime
34
35
  version_requirements: *id001
35
36
  description: Add wallet payment method functionality to spree