spree_purchase_order 3.0.0.beta → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/Rakefile +10 -12
- data/app/assets/stylesheets/spree/backend/spree_purchase_order.css +13 -0
- data/app/models/spree/payment_decorator.rb +2 -2
- data/app/models/spree/payment_method/purchase_order.rb +8 -18
- data/app/models/spree/purchase_order.rb +17 -2
- data/config/locales/en.yml +10 -0
- data/lib/spree_purchase_order/engine.rb +4 -1
- data/lib/spree_purchase_order/version.rb +1 -1
- data/spec/dummy/Rakefile +3 -0
- data/spec/dummy/app/assets/javascripts/application.js +1 -0
- data/spec/dummy/app/assets/stylesheets/application.css +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +22 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +3 -0
- data/spec/dummy/config/environments/test.rb +13 -0
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +1 -0
- data/spec/dummy/config/initializers/session_store.rb +1 -0
- data/spec/dummy/config/initializers/spree.rb +2 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +3 -0
- data/spec/dummy/config/locales/en.yml +2 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/config/secrets.yml +8 -0
- data/spec/dummy/config.ru +2 -0
- data/spec/factories/purchase_orders.rb +87 -0
- data/spec/models/spree/purchase_order_spec.rb +61 -0
- data/spec/spec_helper.rb +20 -0
- metadata +104 -7
- data/app/models/spree/order_decorator.rb +0 -15
- data/db/migrate/20160111163926_add_po_number_to_spree_payments.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ec9cf439397e3828c8254aae264e545cbd98aa
|
4
|
+
data.tar.gz: 1ebdd87551815993c1d1a2ae415de051f7dc91a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d155654354a493568137ac9817e99e741f4eb3ac7a591083dd08ff1fedb58c069450357777ec4fda1902a7be22b19cff35f64ab4ca701b8217ace725e8f1764
|
7
|
+
data.tar.gz: 0918ab5b1c2acd0a78577a73e8397713adc9b3574e694e184151073af268bab93843648277478212899bc22a2f4464d5f2a7e2ac3d6b876f9148c51a38021730
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/deepakmahakale/spree_purchase_order.svg?branch=master)](https://travis-ci.org/deepakmahakale/spree_purchase_order)
|
2
|
+
|
1
3
|
# Spree Purchase Order
|
2
4
|
|
3
5
|
Add Purchase Order payment method in Spree
|
@@ -5,15 +7,18 @@ Add Purchase Order payment method in Spree
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
1. Add this line to your Gemfile:
|
8
|
-
|
9
|
-
|
10
|
+
```ruby
|
11
|
+
gem 'spree_purchase_order'
|
12
|
+
```
|
10
13
|
|
11
14
|
2. Install the gem using Bundler:
|
12
|
-
|
13
|
-
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
14
18
|
|
15
19
|
3. Copy & run migrations
|
20
|
+
```bash
|
21
|
+
bundle exec rails g spree_purchase_order:install
|
22
|
+
```
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
3. Restart your server
|
24
|
+
4. Restart your server
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
#!/usr/bin/env rake
|
1
2
|
begin
|
2
3
|
require 'bundler/setup'
|
3
4
|
rescue LoadError
|
@@ -10,24 +11,21 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
11
|
rdoc.rdoc_dir = 'rdoc'
|
11
12
|
rdoc.title = 'SpreePurchaseOrder'
|
12
13
|
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.
|
14
|
+
rdoc.rdoc_files.include('README.md')
|
14
15
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
16
|
end
|
16
17
|
|
17
|
-
APP_RAKEFILE = File.expand_path("../
|
18
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
19
|
load 'rails/tasks/engine.rake'
|
19
20
|
|
20
|
-
load 'rails/tasks/statistics.rake'
|
21
|
-
|
22
21
|
Bundler::GemHelper.install_tasks
|
23
22
|
|
24
|
-
|
23
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
25
|
+
require 'rspec/core'
|
26
|
+
require 'rspec/core/rake_task'
|
27
|
+
|
28
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
29
|
+
RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
|
32
30
|
|
33
|
-
task default: :
|
31
|
+
task default: :spec
|
@@ -1,3 +1,16 @@
|
|
1
1
|
/*
|
2
2
|
*= require spree/backend
|
3
3
|
*/
|
4
|
+
.btn.action-complete {
|
5
|
+
color: #fff;
|
6
|
+
background-color: #7DB942;
|
7
|
+
border-color: #70a63b;
|
8
|
+
}
|
9
|
+
.btn.action-complete:hover {
|
10
|
+
color: #fff;
|
11
|
+
background-color: #649335;
|
12
|
+
border-color: #52792b;
|
13
|
+
}
|
14
|
+
.icon.icon-complete:before{
|
15
|
+
content: "\e013";
|
16
|
+
}
|
@@ -4,28 +4,12 @@ module Spree
|
|
4
4
|
Spree::PurchaseOrder
|
5
5
|
end
|
6
6
|
|
7
|
-
def actions
|
8
|
-
%w(complete void)
|
9
|
-
end
|
10
|
-
|
11
|
-
def can_complete?(payment)
|
12
|
-
%w(checkout pending).include?(payment.state)
|
13
|
-
end
|
14
|
-
|
15
|
-
def can_void?(payment)
|
16
|
-
payment.state != 'void'
|
17
|
-
end
|
18
|
-
|
19
7
|
def authorize(*args)
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
def complete(*)
|
24
|
-
ActiveMerchant::Billing::Response.new(true, 'Purchase Order: Success', {}, {})
|
8
|
+
simulated_successful_billing_response('Purchase Order: Success')
|
25
9
|
end
|
26
10
|
|
27
11
|
def void(*args)
|
28
|
-
|
12
|
+
simulated_successful_billing_response
|
29
13
|
end
|
30
14
|
|
31
15
|
def source_required?
|
@@ -35,5 +19,11 @@ module Spree
|
|
35
19
|
def auto_capture?
|
36
20
|
false
|
37
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def simulated_successful_billing_response(message = "")
|
26
|
+
ActiveMerchant::Billing::Response.new(true, message, {}, {})
|
27
|
+
end
|
38
28
|
end
|
39
29
|
end
|
@@ -1,7 +1,22 @@
|
|
1
1
|
module Spree
|
2
|
-
class PurchaseOrder <
|
3
|
-
|
2
|
+
class PurchaseOrder < Spree::Base
|
3
|
+
belongs_to :payment_method
|
4
|
+
has_many :payments, as: :source
|
4
5
|
|
5
6
|
validates_presence_of :po_number, :organization_name
|
7
|
+
|
8
|
+
def actions
|
9
|
+
%w(complete void)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Indicates whether its possible to complete the payment
|
13
|
+
def can_complete?(payment)
|
14
|
+
payment.pending? || payment.checkout?
|
15
|
+
end
|
16
|
+
|
17
|
+
# Indicates whether its possible to void the payment.
|
18
|
+
def can_void?(payment)
|
19
|
+
!payment.failed? && !payment.void?
|
20
|
+
end
|
6
21
|
end
|
7
22
|
end
|
@@ -7,7 +7,10 @@ module SpreePurchaseOrder
|
|
7
7
|
config.autoload_paths << "#{config.root}/lib"
|
8
8
|
|
9
9
|
config.generators do |g|
|
10
|
-
g.test_framework :rspec
|
10
|
+
g.test_framework :rspec, fixture: false
|
11
|
+
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
12
|
+
g.assets false
|
13
|
+
g.helper false
|
11
14
|
end
|
12
15
|
|
13
16
|
def self.activate
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
|
9
|
+
puts "== Installing dependencies =="
|
10
|
+
system "gem install bundler --conservative"
|
11
|
+
system "bundle check || bundle install"
|
12
|
+
|
13
|
+
puts "\n== Preparing database =="
|
14
|
+
system "bin/rake db:setup"
|
15
|
+
|
16
|
+
puts "\n== Removing old logs and tempfiles =="
|
17
|
+
system "rm -f log/*"
|
18
|
+
system "rm -rf tmp/cache"
|
19
|
+
|
20
|
+
puts "\n== Restarting application server =="
|
21
|
+
system "touch tmp/restart.txt"
|
22
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_record/railtie"
|
4
|
+
require "action_controller/railtie"
|
5
|
+
require "action_mailer/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "sprockets/railtie"
|
8
|
+
|
9
|
+
Bundler.require(*Rails.groups)
|
10
|
+
require "spree_purchase_order"
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
|
15
|
+
config.to_prepare do
|
16
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
17
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
18
|
+
end
|
19
|
+
|
20
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
|
21
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
config.active_record.raise_in_transactional_callbacks = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config.cache_classes = true
|
3
|
+
config.eager_load = false
|
4
|
+
config.serve_static_files = true
|
5
|
+
config.static_cache_control = 'public, max-age=3600'
|
6
|
+
config.consider_all_requests_local = true
|
7
|
+
config.action_controller.perform_caching = false
|
8
|
+
config.action_dispatch.show_exceptions = false
|
9
|
+
config.action_controller.allow_forgery_protection = false
|
10
|
+
config.action_mailer.delivery_method = :test
|
11
|
+
config.active_support.test_order = :random
|
12
|
+
config.active_support.deprecation = :stderr
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.version = '1.0'
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.action_dispatch.cookies_serializer = :json
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.filter_parameters += [:password]
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
development:
|
2
|
+
secret_key_base: a21ce77d12504975623f2bc74d70b7cb4973f7495a5d4b1df2759dab2aa684a99a9391c4d2c0e2cf7e82409ffe37bb29ca978622a9c234b2aa25309fd1ee0404
|
3
|
+
|
4
|
+
test:
|
5
|
+
secret_key_base: 26cf60e63c4cf25d010087eff97d56793bddce5a85e63a1966c8922d2b2fa790a25d2ef5581d6e9ebfcfc69cd67d9a5d15c28c091231cd5029bfe00d357beaa1
|
6
|
+
|
7
|
+
production:
|
8
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
sequence :user_authentication_token do |n|
|
3
|
+
"xxxx#{Time.current.to_i}#{rand(1000)}#{n}xxxxxxxxxxxxx"
|
4
|
+
end
|
5
|
+
|
6
|
+
factory :purchase_order, class: Spree::PurchaseOrder do
|
7
|
+
po_number 'PO-123'
|
8
|
+
organization_name 'Spree Commerce'
|
9
|
+
association(:payment_method, factory: :purchase_order_payment_method)
|
10
|
+
end
|
11
|
+
|
12
|
+
factory :purchase_order_payment_method, class: Spree::PaymentMethod::PurchaseOrder do
|
13
|
+
name 'Purchase Order'
|
14
|
+
end
|
15
|
+
factory :payment, class: Spree::Payment do
|
16
|
+
amount 45.75
|
17
|
+
association(:source, factory: :purchase_order)
|
18
|
+
association(:payment_method, factory: :purchase_order_payment_method)
|
19
|
+
order
|
20
|
+
state 'checkout'
|
21
|
+
response_code '12345'
|
22
|
+
end
|
23
|
+
factory :order, class: Spree::Order do
|
24
|
+
|
25
|
+
bill_address
|
26
|
+
completed_at nil
|
27
|
+
email { 'email@example.com' }
|
28
|
+
store
|
29
|
+
|
30
|
+
transient do
|
31
|
+
line_items_price BigDecimal.new(10)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
factory :store, class: Spree::Store do
|
36
|
+
sequence(:code) { |i| "spree_#{i}" }
|
37
|
+
name 'Spree Test Store'
|
38
|
+
url 'www.example.com'
|
39
|
+
mail_from_address 'spree@example.org'
|
40
|
+
end
|
41
|
+
|
42
|
+
# factory :user, class: Spree.user_class do
|
43
|
+
# email { generate(:random_email) }
|
44
|
+
# login { email }
|
45
|
+
# password 'secret'
|
46
|
+
# password_confirmation { password }
|
47
|
+
# authentication_token { generate(:user_authentication_token) } if Spree.user_class.attribute_method? :authentication_token
|
48
|
+
# end
|
49
|
+
factory :state, class: Spree::State do
|
50
|
+
sequence(:name) { |n| "STATE_NAME_#{n}" }
|
51
|
+
sequence(:abbr) { |n| "STATE_ABBR_#{n}" }
|
52
|
+
country do |country|
|
53
|
+
if usa = Spree::Country.find_by_numcode(840)
|
54
|
+
country = usa
|
55
|
+
else
|
56
|
+
country.association(:country)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
factory :country, class: Spree::Country do
|
61
|
+
sequence(:iso_name) { |n| "ISO_NAME_#{n}" }
|
62
|
+
sequence(:name) { |n| "NAME_#{n}" }
|
63
|
+
iso 'US'
|
64
|
+
iso3 'USA'
|
65
|
+
numcode 840
|
66
|
+
end
|
67
|
+
factory :address, aliases: [:bill_address, :ship_address], class: Spree::Address do
|
68
|
+
firstname 'John'
|
69
|
+
lastname 'Doe'
|
70
|
+
company 'Company'
|
71
|
+
address1 '10 Lovely Street'
|
72
|
+
address2 'Northwest'
|
73
|
+
city 'Herndon'
|
74
|
+
zipcode '35005'
|
75
|
+
phone '555-555-0199'
|
76
|
+
alternative_phone '555-555-0199'
|
77
|
+
|
78
|
+
state { |address| address.association(:state) || Spree::State.last }
|
79
|
+
country do |address|
|
80
|
+
if address.state
|
81
|
+
address.state.country
|
82
|
+
else
|
83
|
+
address.association(:country)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spree::PurchaseOrder, type: :model do
|
4
|
+
let(:valid_purchase_order_attributes) do
|
5
|
+
{
|
6
|
+
po_number: 'PO-123',
|
7
|
+
organization_name: 'Spree Commerce'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.payment_states
|
12
|
+
Spree::Payment.state_machine.states.keys
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:purchase_order) { Spree::PurchaseOrder.new }
|
16
|
+
|
17
|
+
context "#can_complete?" do
|
18
|
+
it "should be true if payment is pending" do
|
19
|
+
payment = create(:payment, state: 'pending')
|
20
|
+
expect(purchase_order.can_complete?(payment)).to be true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be true if payment is checkout" do
|
24
|
+
payment = create(:payment, state: 'checkout')
|
25
|
+
expect(purchase_order.can_complete?(payment)).to be true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "#can_void?" do
|
30
|
+
it "should be true if payment is not void" do
|
31
|
+
payment = create(:payment, state: 'checkout')
|
32
|
+
expect(purchase_order.can_void?(payment)).to be true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "#valid?" do
|
37
|
+
it "should validate presence of po number" do
|
38
|
+
purchase_order.attributes = valid_purchase_order_attributes.except(:po_number)
|
39
|
+
expect(purchase_order).not_to be_valid
|
40
|
+
expect(purchase_order.errors[:po_number]).to eq(["can't be blank"])
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should validate presence of organization name" do
|
44
|
+
purchase_order.attributes = valid_purchase_order_attributes.except(:organization_name)
|
45
|
+
expect(purchase_order).not_to be_valid
|
46
|
+
expect(purchase_order.errors[:organization_name]).to eq(["can't be blank"])
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should only validate on create" do
|
50
|
+
purchase_order.attributes = valid_purchase_order_attributes
|
51
|
+
purchase_order.save
|
52
|
+
expect(purchase_order).to be_valid
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "#associations" do
|
57
|
+
it "should be able to access its payments" do
|
58
|
+
expect { purchase_order.payments.to_a }.not_to raise_error
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
ENV['RAILS_ENV'] ||= 'test'
|
2
|
+
|
3
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
require 'factory_girl_rails'
|
7
|
+
|
8
|
+
Rails.backtrace_cleaner.remove_silencers!
|
9
|
+
|
10
|
+
# Load support files
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.mock_with :rspec
|
15
|
+
config.use_transactional_fixtures = true
|
16
|
+
config.infer_base_class_for_anonymous_controllers = false
|
17
|
+
config.order = "random"
|
18
|
+
|
19
|
+
config.include FactoryGirl::Syntax::Methods
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_purchase_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepak Mahakale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -24,6 +24,48 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: factory_girl_rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
27
69
|
description: Adds Purchase Order as a Payment Method to Spree Commerce
|
28
70
|
email: deepakmahakale@gmail.com
|
29
71
|
executables: []
|
@@ -37,20 +79,47 @@ files:
|
|
37
79
|
- app/assets/javascripts/spree/frontend/spree_purchase_order.js
|
38
80
|
- app/assets/stylesheets/spree/backend/spree_purchase_order.css
|
39
81
|
- app/assets/stylesheets/spree/frontend/spree_purchase_order.css
|
40
|
-
- app/models/spree/order_decorator.rb
|
41
82
|
- app/models/spree/payment_decorator.rb
|
42
83
|
- app/models/spree/payment_method/purchase_order.rb
|
43
84
|
- app/models/spree/purchase_order.rb
|
44
85
|
- app/views/spree/checkout/payment/_purchaseorder.html.erb
|
86
|
+
- config/locales/en.yml
|
45
87
|
- config/routes.rb
|
46
88
|
- db/migrate/20160111123141_create_spree_purchase_orders.rb
|
47
|
-
- db/migrate/20160111163926_add_po_number_to_spree_payments.rb
|
48
89
|
- db/migrate/20161214190805_add_payment_method_id_to_spree_purchase_orders.rb
|
49
90
|
- db/migrate/20161214191512_add_user_id_to_spree_purchase_orders.rb
|
50
91
|
- lib/generators/spree_purchase_order/install/install_generator.rb
|
51
92
|
- lib/spree_purchase_order.rb
|
52
93
|
- lib/spree_purchase_order/engine.rb
|
53
94
|
- lib/spree_purchase_order/version.rb
|
95
|
+
- spec/dummy/Rakefile
|
96
|
+
- spec/dummy/app/assets/javascripts/application.js
|
97
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
98
|
+
- spec/dummy/app/controllers/application_controller.rb
|
99
|
+
- spec/dummy/app/helpers/application_helper.rb
|
100
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
101
|
+
- spec/dummy/bin/bundle
|
102
|
+
- spec/dummy/bin/rails
|
103
|
+
- spec/dummy/bin/rake
|
104
|
+
- spec/dummy/bin/setup
|
105
|
+
- spec/dummy/config.ru
|
106
|
+
- spec/dummy/config/application.rb
|
107
|
+
- spec/dummy/config/boot.rb
|
108
|
+
- spec/dummy/config/database.yml
|
109
|
+
- spec/dummy/config/environment.rb
|
110
|
+
- spec/dummy/config/environments/test.rb
|
111
|
+
- spec/dummy/config/initializers/assets.rb
|
112
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
113
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
114
|
+
- spec/dummy/config/initializers/session_store.rb
|
115
|
+
- spec/dummy/config/initializers/spree.rb
|
116
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
117
|
+
- spec/dummy/config/locales/en.yml
|
118
|
+
- spec/dummy/config/routes.rb
|
119
|
+
- spec/dummy/config/secrets.yml
|
120
|
+
- spec/factories/purchase_orders.rb
|
121
|
+
- spec/models/spree/purchase_order_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
54
123
|
homepage: https://github.com/deepakmahakale/spree_purchase_order
|
55
124
|
licenses:
|
56
125
|
- MIT
|
@@ -66,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
135
|
version: 1.9.3
|
67
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
137
|
requirements:
|
69
|
-
- - "
|
138
|
+
- - ">="
|
70
139
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
140
|
+
version: '0'
|
72
141
|
requirements:
|
73
142
|
- none
|
74
143
|
rubyforge_project:
|
@@ -76,4 +145,32 @@ rubygems_version: 2.5.1
|
|
76
145
|
signing_key:
|
77
146
|
specification_version: 4
|
78
147
|
summary: Adds Purchase Order as a Payment Method to Spree Commerce
|
79
|
-
test_files:
|
148
|
+
test_files:
|
149
|
+
- spec/dummy/Rakefile
|
150
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
151
|
+
- spec/dummy/config/initializers/assets.rb
|
152
|
+
- spec/dummy/config/initializers/spree.rb
|
153
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
154
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
155
|
+
- spec/dummy/config/initializers/session_store.rb
|
156
|
+
- spec/dummy/config/application.rb
|
157
|
+
- spec/dummy/config/database.yml
|
158
|
+
- spec/dummy/config/boot.rb
|
159
|
+
- spec/dummy/config/environments/test.rb
|
160
|
+
- spec/dummy/config/secrets.yml
|
161
|
+
- spec/dummy/config/environment.rb
|
162
|
+
- spec/dummy/config/routes.rb
|
163
|
+
- spec/dummy/config/locales/en.yml
|
164
|
+
- spec/dummy/config.ru
|
165
|
+
- spec/dummy/bin/rake
|
166
|
+
- spec/dummy/bin/bundle
|
167
|
+
- spec/dummy/bin/rails
|
168
|
+
- spec/dummy/bin/setup
|
169
|
+
- spec/dummy/app/assets/javascripts/application.js
|
170
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
171
|
+
- spec/dummy/app/controllers/application_controller.rb
|
172
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
173
|
+
- spec/dummy/app/helpers/application_helper.rb
|
174
|
+
- spec/spec_helper.rb
|
175
|
+
- spec/models/spree/purchase_order_spec.rb
|
176
|
+
- spec/factories/purchase_orders.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Spree::Order.class_eval do
|
2
|
-
def authorize_digital?
|
3
|
-
return true if paid?
|
4
|
-
if pay_with_po?
|
5
|
-
payments.each do |payment|
|
6
|
-
return true if payment.po? && payment.source.attachment_file_name
|
7
|
-
end
|
8
|
-
return false
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def pay_with_po?
|
13
|
-
payments.collect(&:po?).include?(true)
|
14
|
-
end
|
15
|
-
end
|