spree_purchase_order 2.3.0.beta → 2.3.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 +26 -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/app/views/spree/checkout/payment/_purchaseorder.html.erb +9 -15
- 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 +26 -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 +75 -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: 687aa8d8212fd254800cacddc3ca0da7bf832365
|
4
|
+
data.tar.gz: 91ea5e93eef1934ba81f1138778995c229cc866d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d7e9d600d525734270379f784a48044741f0933499b9fc509695bc46012538b1ec5cbde62365dfe8b71aa0261577847011a39e29fba5563fb052a005a8d074
|
7
|
+
data.tar.gz: 3e554dd76ec313c1bae0137154258f856fd5f1a2b7ef0d12ca3d2eb5d3e712faed1270da63591c369bac2edbd232658860670f0fa8c5642dcb2288717a59ced5
|
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,29 @@
|
|
1
1
|
/*
|
2
2
|
*= require spree/backend
|
3
3
|
*/
|
4
|
+
table th.actions .fa-complete:hover, table td.actions .fa-complete:hover{
|
5
|
+
background-color: #9FC820;
|
6
|
+
color: #FFFFFF;
|
7
|
+
}
|
8
|
+
table tbody tr.before-highlight.action-complete td {
|
9
|
+
border-bottom-color: #e0f1a9;
|
10
|
+
}
|
11
|
+
table tbody tr.highlight.action-complete td {
|
12
|
+
background-color: #f8fceb;
|
13
|
+
border-color: #e0f1a9;
|
14
|
+
}
|
15
|
+
.fa-complete:before {
|
16
|
+
content: "\f00c";
|
17
|
+
}
|
18
|
+
#powerTip.complete {
|
19
|
+
background-color: #9FC820;
|
20
|
+
}
|
21
|
+
#powerTip.complete.n:before, #powerTip.complete.ne:before, #powerTip.complete.nw:before {
|
22
|
+
border-top-color: #9FC820;
|
23
|
+
}
|
24
|
+
#powerTip.complete.s:before, #powerTip.complete.se:before, #powerTip.complete.sw:before {
|
25
|
+
border-bottom-color: #9FC820;
|
26
|
+
}
|
27
|
+
#powerTip.complete.w:before {
|
28
|
+
border-left-color: #9FC820;
|
29
|
+
}
|
@@ -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
|
@@ -1,15 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<%= label_tag :organization_name do %>
|
11
|
-
Organization Name<abbr class='required' title='required'>*</abbr>
|
12
|
-
<% end %>
|
13
|
-
<%= text_field_tag "#{param_prefix}[organization_name]", '', id: :organization_name, class: 'form-control required'%>
|
14
|
-
</p>
|
15
|
-
</div>
|
1
|
+
<% param_prefix = "payment_source[#{payment_method.id}]" %>
|
2
|
+
<p class='field'>
|
3
|
+
<%= label_tag :po_number, "PO Number" %><span class="required">*</span><br />
|
4
|
+
<%= text_field_tag "#{param_prefix}[po_number]", '', id: :po_number, size: 10, maxlength: 10, autocomplete: "off" %>
|
5
|
+
</p>
|
6
|
+
<p class='field'>
|
7
|
+
<%= label_tag :organization_name, "Organization Name" %><span class="required">*</span><br />
|
8
|
+
<%= text_field_tag "#{param_prefix}[organization_name]", '', id: :organization_name, class: 'form-control required'%>
|
9
|
+
</p>
|
@@ -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,26 @@
|
|
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
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -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,75 @@
|
|
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
|
+
|
16
|
+
factory :payment, class: Spree::Payment do
|
17
|
+
amount 45.75
|
18
|
+
association(:source, factory: :purchase_order)
|
19
|
+
association(:payment_method, factory: :purchase_order_payment_method)
|
20
|
+
order
|
21
|
+
state 'checkout'
|
22
|
+
response_code '12345'
|
23
|
+
end
|
24
|
+
|
25
|
+
factory :order, class: Spree::Order do
|
26
|
+
bill_address
|
27
|
+
completed_at nil
|
28
|
+
email { 'email@example.com' }
|
29
|
+
|
30
|
+
transient do
|
31
|
+
line_items_price BigDecimal.new(10)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
factory :state, class: Spree::State do
|
36
|
+
sequence(:name) { |n| "STATE_NAME_#{n}" }
|
37
|
+
sequence(:abbr) { |n| "STATE_ABBR_#{n}" }
|
38
|
+
country do |country|
|
39
|
+
if usa = Spree::Country.find_by_numcode(840)
|
40
|
+
country = usa
|
41
|
+
else
|
42
|
+
country.association(:country)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
factory :country, class: Spree::Country do
|
48
|
+
sequence(:iso_name) { |n| "ISO_NAME_#{n}" }
|
49
|
+
sequence(:name) { |n| "NAME_#{n}" }
|
50
|
+
iso 'US'
|
51
|
+
iso3 'USA'
|
52
|
+
numcode 840
|
53
|
+
end
|
54
|
+
|
55
|
+
factory :address, aliases: [:bill_address, :ship_address], class: Spree::Address do
|
56
|
+
firstname 'John'
|
57
|
+
lastname 'Doe'
|
58
|
+
company 'Company'
|
59
|
+
address1 '10 Lovely Street'
|
60
|
+
address2 'Northwest'
|
61
|
+
city 'Herndon'
|
62
|
+
zipcode '35005'
|
63
|
+
phone '555-555-0199'
|
64
|
+
alternative_phone '555-555-0199'
|
65
|
+
|
66
|
+
state { |address| address.association(:state) || Spree::State.last }
|
67
|
+
country do |address|
|
68
|
+
if address.state
|
69
|
+
address.state.country
|
70
|
+
else
|
71
|
+
address.association(:country)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
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: 2.3.0
|
4
|
+
version: 2.3.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: 2.3.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
|