solidus_print_invoice 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fee82c5484c94ebee0ac539549ef47a2dcd3e99e
4
- data.tar.gz: 5a34dc84b8ae8c7310cd7153a6be887ce1c9692e
3
+ metadata.gz: b0efac47fbe5deb8b20609cdf6a748a17a77dd59
4
+ data.tar.gz: 5cf6bdb63c870299e86e3bab44c33d134999397a
5
5
  SHA512:
6
- metadata.gz: 957b1b0f786d47874657600709ade7f44bafbe00023f14ca2c4b96eb9076568fb3abd28d45f23e7539f573f9fc4eea08773e3f2c641a93d2e3e7ed8a0a1ce44c
7
- data.tar.gz: 4b2201e0535a28617745db27572b01c59418515a9215c9a2a80c32089891ce8bff85c93d432c1148764f19f74046666dd3bb5b4973130ce4e81bfcd2cc788f1e
6
+ metadata.gz: 2e0031aaf90b0e2617c86de1f9d09506ac2d4a5611137295e27932691eabc95d7e02398460db084a17bed032463f879b1db452065eb74820671fe1991fb7a986
7
+ data.tar.gz: 79ac861977a962db6f7bc76f8ba239eea7363de41a4e940477443784d574b992478689c9f11c04615a2d1781618ca68da9a23d20e96cf8b74d4d2b38e04a5060
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ spec/dummy
@@ -0,0 +1,11 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.1.8
5
+ env:
6
+ matrix:
7
+ - SOLIDUS_BRANCH=v1.0
8
+ - SOLIDUS_BRANCH=v1.1
9
+ - SOLIDUS_BRANCH=v1.2
10
+ - SOLIDUS_BRANCH=v1.3
11
+ - SOLIDUS_BRANCH=master
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ branch = ENV.fetch("SOLIDUS_BRANCH", "master")
4
+ gem 'solidus', github: "solidusio/solidus", branch: branch
5
+ gem 'solidus_auth_devise'
6
+
7
+ gemspec
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/solidusio-contrib/solidus_print_invoice.svg?branch=master)](https://travis-ci.org/solidusio-contrib/solidus_print_invoice)
2
+
1
3
  SUMMARY
2
4
  =======
3
5
 
@@ -0,0 +1,37 @@
1
+ # Prawn-handler
2
+
3
+ A Rails template handler for PDF library [Prawn](http://prawn.majesticseacreature.com/). You can find a more detailed description in its [introduction article](http://roman.flucti.com/alternative-prawn-handler-for-rails).
4
+
5
+ There already exists [prawnto](http://cracklabs.com/prawnto) but it's too bloated for my taste. Prawn-handler is lightweight, simple, and less of a hassle to use.
6
+
7
+ ## Usage
8
+
9
+ 3. Name PDF view files like `foo.pdf.prawn`. Inside, use the `pdf` method to access a `Prawn::Document` object. In addition, this handler allows for lazy method calls: you don't have to specify the receiver explicitely, which cleans up the resulting view code.
10
+
11
+ For example, the following code with formal calls:
12
+
13
+ pdf.bounding_box [100, 600], :width => 200 do
14
+ pdf.text "The rain in spain falls mainly on the plains " * 5
15
+ pdf.stroke do
16
+ pdf.line pdf.bounds.top_left, pdf.bounds.top_right
17
+ pdf.line pdf.bounds.bottom_left, pdf.bounds.bottom_right
18
+ end
19
+ end
20
+
21
+ Is equivalent to this one with lazy calls:
22
+
23
+ bounding_box [100, 600], :width => 200 do
24
+ text "The rain in spain falls mainly on the plains " * 5
25
+ stroke do
26
+ line bounds.top_left, bounds.top_right
27
+ line bounds.bottom_left, bounds.bottom_right
28
+ end
29
+ end
30
+
31
+ This is accomplished without `instance_eval`, so that access to instance variables set by the controller is retained.
32
+
33
+ ## Credits
34
+
35
+ Initially written by [Roman Le Négrate](http://roman.flucti.com) ([contact](mailto:roman.lenegrate@gmail.com)).
36
+ Released under the MIT-license: see the `LICENSE` file.
37
+ Adopted to Rails 3 by [Torsten Rüger](http://github.com/dancinglightning)
@@ -0,0 +1,22 @@
1
+
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ require 'rspec/core/rake_task'
6
+ require 'spree/testing_support/common_rake'
7
+
8
+ RSpec::Core::RakeTask.new
9
+
10
+ task :default do
11
+ if Dir["spec/dummy"].empty?
12
+ Rake::Task[:test_app].invoke
13
+ Dir.chdir("../../")
14
+ end
15
+ Rake::Task[:spec].invoke
16
+ end
17
+
18
+ desc 'Generates a dummy app for testing'
19
+ task :test_app do
20
+ ENV['LIB_NAME'] = 'solidus_print_invoice'
21
+ Rake::Task['common:test_app'].invoke("Spree::User")
22
+ end
@@ -0,0 +1,17 @@
1
+ de:
2
+ spree:
3
+ customer_invoice: Kundenrechnung
4
+ footer_left: "Andere Informationen"
5
+ footer_left2: " 14 Tage oder nie"
6
+
7
+ footer_right: "Firma Telefon www "
8
+ footer_right2: "Meine Firma 040 146 1222 www.gohereoften.com"
9
+
10
+ print_note: Dies ist keine echte Rechnung (NICH AN KUNDEN SENDEN!)
11
+
12
+ invoice_print: Rechnung drucken
13
+ packaging_slip_print: Warenbegleitschein drucken
14
+ packaging_slip: Packzettel drucken
15
+
16
+ invoice_number: Rechnungsnummer
17
+ invoice_date: Rechnungsdatum
@@ -0,0 +1,22 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+
3
+ en:
4
+ spree:
5
+ customer_invoice: Customer Invoice
6
+ footer_left: "Return in Other info"
7
+ footer_left2: " 14 days or never"
8
+
9
+ footer_right: "Company Phone www "
10
+ footer_right2: " My great company 040 146 1222 www.gohereoften.com"
11
+
12
+ print_note: This is not an original invoice (DO NOT SEND THIS TO CUSTOMER)
13
+
14
+ invoice_print: Print Invoice
15
+ packaging_slip_print: Print Slip
16
+ packaging_slip: Packaging Slip
17
+
18
+ invoice_font_face: Invoice Font Face
19
+ invoice_logo_scale: Invoice Logo Scale
20
+
21
+ invoice_number: Invoice Number
22
+ invoice_date: Invoice issued on
@@ -0,0 +1,17 @@
1
+ es:
2
+ spree:
3
+ customer_invoice: "Factura del cliente"
4
+ footer_left: "Devolver en Otro"
5
+ footer_left2: " 14 días o nunca"
6
+
7
+ footer_right: "Empresa Teléfono Web "
8
+ footer_right2: " My Genial Empresa 040 146 1222 www.visitanosamenudo.com"
9
+
10
+ print_note: "Esta no es la factura original (NO ENVIAR AL CLIENTE)"
11
+
12
+ invoice_print: "Imprimir Factura"
13
+ packaging_slip_print: "Imprimir Recibo para el Embalaje"
14
+ packaging_slip: "Recibo para el Embalaje"
15
+
16
+ invoice_number: Número Factura
17
+ invoice_date: Expedida el
@@ -0,0 +1,12 @@
1
+ fi:
2
+ spree:
3
+ footer_left: "Maksuehto Viivästyskorko IBAN BIC "
4
+ footer_left2: " 14 päivää netto 15 % FI1017 4530 0013 2474 NDEAFIHH (Nordea)"
5
+
6
+ footer_right: "Sähköposti Puhelin Nettikauppa Y-Tunnus"
7
+ footer_right2: " tukku@auringostaitaan.fi 040 146 1222 tukku.auringostaitaan.fi 2380478-1"
8
+ customer_invoice: Lasku
9
+ thanks: Kiitos tilauksesta.
10
+ packaging_slip_print: Kuormakirja
11
+ invoice_print: Tulosta Lasku
12
+ packaging_slip: Kuormakirja
@@ -0,0 +1,6 @@
1
+ class AddInvoiceDetailsToSpreeOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :invoice_number, :integer
4
+ add_column :spree_orders, :invoice_date, :date
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  module PrintInvoice
3
- VERSION = "1.0.0".freeze
3
+ VERSION = "1.0.1".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path('../lib/', __FILE__)
2
+ $:.unshift lib unless $:.include?(lib)
3
+
4
+ require 'solidus_print_invoice/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.platform = Gem::Platform::RUBY
8
+ s.name = 'solidus_print_invoice'
9
+ s.version = Spree::PrintInvoice::VERSION
10
+ s.summary = 'Print invoices from a spree order'
11
+ s.homepage = 'https://github.com/solidusio-contrib/solidus_print_invoice'
12
+
13
+ s.required_ruby_version = '>= 1.9.3'
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- spec/*`.split("\n")
17
+ s.require_path = 'lib'
18
+ s.authors = 'Spree & Solidus Community'
19
+
20
+ s.add_dependency('prawn', '1.0.0')
21
+ s.add_dependency('solidus', '~> 1.0')
22
+ s.add_dependency 'deface'
23
+
24
+ s.add_development_dependency 'rspec-rails', '~> 3.4'
25
+ s.add_development_dependency 'capybara'
26
+ s.add_development_dependency 'selenium-webdriver'
27
+ s.add_development_dependency 'poltergeist'
28
+ s.add_development_dependency 'database_cleaner'
29
+ s.add_development_dependency 'pry'
30
+ s.add_development_dependency 'factory_girl_rails'
31
+ s.add_development_dependency 'sqlite3'
32
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.feature "Print Invoice Settings", js: true do
4
+ given!(:order) { FactoryGirl.create(:completed_order_with_totals) }
5
+ given(:user) { FactoryGirl.create(:admin_user, password: "boxen1011") }
6
+
7
+ scenario "It allows for the update of print invoice settings" do
8
+ visit spree.admin_path
9
+
10
+ fill_in "Email", with: user.email
11
+ fill_in "Password", with: "boxen1011"
12
+ click_button "Login"
13
+
14
+ click_link "Settings"
15
+ click_link "General"
16
+
17
+ select "Times Roman", from: "print_invoice_font_face"
18
+ fill_in "print_invoice_next_number", with: "150"
19
+ fill_in "print_invoice_logo_scale", with: "60"
20
+
21
+ click_button "Update"
22
+ visit current_path
23
+
24
+ expect(find("#print_invoice_font_face").value).to eql("Times-Roman")
25
+ expect(find("#print_invoice_next_number").value).to eql("150")
26
+ expect(find("#print_invoice_logo_scale").value).to eql("60")
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.feature "Print Invoice button", js: true do
4
+ given!(:order) { FactoryGirl.create(:completed_order_with_totals) }
5
+ given(:user) { FactoryGirl.create(:admin_user, password: "boxen1011") }
6
+
7
+ scenario "it displays a print invoice button on order pages" do
8
+ visit spree.admin_path
9
+
10
+ fill_in "Email", with: user.email
11
+ fill_in "Password", with: "boxen1011"
12
+ click_button "Login"
13
+
14
+ click_link order.number
15
+
16
+ within(".page-actions") do
17
+ print_button = find("a", text: /Print Invoice/i)
18
+ expect(URI(print_button[:href]).path).to eql(spree.admin_order_path(order, :pdf))
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe "Order Invoice Generation" do
4
+ describe "GET show" do
5
+ let(:order) { FactoryGirl.create(:completed_order_with_totals) }
6
+ let(:user) { FactoryGirl.create(:admin_user, password: "testing123") }
7
+ let(:headers) {{ "X-Spree-Token" => user.spree_api_key }}
8
+
9
+ it "returns a pdf" do
10
+ # The invoice generation feature is restricted to admins
11
+ post(spree.login_path, 'spree_user[email]' => user.email, 'spree_user[password]' => 'testing123')
12
+ get(spree.admin_order_path(order.number, :pdf))
13
+
14
+ aggregate_failures "pdf response is successful" do
15
+ expect(response).to be_success
16
+ expect(response.headers["Content-Type"]).to eql("application/pdf; charset=utf-8")
17
+ expect(response.body).to start_with('%PDF')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,50 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+
5
+ require "rspec/rails"
6
+ require 'capybara/poltergeist'
7
+ require 'database_cleaner'
8
+ require 'factory_girl_rails'
9
+ require 'ffaker'
10
+ require 'pry'
11
+
12
+ require 'spree/testing_support/factories'
13
+
14
+ unless ENV['USE_SELENIUM']
15
+ Capybara.register_driver :poltergeist do |app|
16
+ Capybara::Poltergeist::Driver.new(app, timeout: 60)
17
+ end
18
+ Capybara.javascript_driver = :poltergeist
19
+ end
20
+
21
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
22
+
23
+ RSpec.configure do |config|
24
+ config.include Capybara::DSL, type: :feature
25
+ config.infer_spec_type_from_file_location!
26
+
27
+ config.filter_run :focus
28
+ config.run_all_when_everything_filtered = true
29
+ config.use_transactional_fixtures = false
30
+ config.example_status_persistence_file_path = "tmp/failed_examples.txt"
31
+ config.disable_monkey_patching!
32
+
33
+ config.before(:suite) do
34
+ DatabaseCleaner.clean_with(:truncation)
35
+ end
36
+
37
+ config.before(:each) do
38
+ if RSpec.current_example.metadata[:js]
39
+ DatabaseCleaner.strategy = :truncation
40
+ else
41
+ DatabaseCleaner.strategy = :transaction
42
+ end
43
+
44
+ DatabaseCleaner.start
45
+ end
46
+
47
+ config.after(:each) do
48
+ DatabaseCleaner.clean
49
+ end
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_print_invoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spree & Solidus Community
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn
@@ -170,7 +170,12 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
+ - ".gitignore"
174
+ - ".travis.yml"
175
+ - Gemfile
173
176
  - README.md
177
+ - README_prawn.md
178
+ - Rakefile
174
179
  - app/assets/javascripts/spree/backend/solidus_print_invoice.js
175
180
  - app/assets/javascripts/spree/frontend/solidus_print_invoice.js
176
181
  - app/assets/stylesheets/spree/backend/solidus_print_invoice.css
@@ -192,12 +197,22 @@ files:
192
197
  - app/views/spree/admin/orders/_totals.pdf.prawn
193
198
  - app/views/spree/admin/orders/invoice.pdf.prawn
194
199
  - app/views/spree/admin/orders/packaging_slip.pdf.prawn
200
+ - config/locales/de.yml
201
+ - config/locales/en.yml
202
+ - config/locales/es.yml
203
+ - config/locales/fi.yml
195
204
  - config/routes.rb
205
+ - db/migrate/20140123094547_add_invoice_details_to_spree_orders.rb
196
206
  - lib/generators/solidus_print_invoice/install/install_generator.rb
197
207
  - lib/prawn_handler.rb
198
208
  - lib/solidus_print_invoice.rb
199
209
  - lib/solidus_print_invoice/engine.rb
200
210
  - lib/solidus_print_invoice/version.rb
211
+ - solidus_print_invoice.gemspec
212
+ - spec/features/admin_invoice_settings_spec.rb
213
+ - spec/features/admin_order_spec.rb
214
+ - spec/requests/admin_orders_controller_spec.rb
215
+ - spec/spec_helper.rb
201
216
  homepage: https://github.com/solidusio-contrib/solidus_print_invoice
202
217
  licenses: []
203
218
  metadata: {}
@@ -217,8 +232,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
232
  version: '0'
218
233
  requirements: []
219
234
  rubyforge_project:
220
- rubygems_version: 2.2.3
235
+ rubygems_version: 2.5.1
221
236
  signing_key:
222
237
  specification_version: 4
223
238
  summary: Print invoices from a spree order
224
- test_files: []
239
+ test_files:
240
+ - spec/features/admin_invoice_settings_spec.rb
241
+ - spec/features/admin_order_spec.rb
242
+ - spec/requests/admin_orders_controller_spec.rb
243
+ - spec/spec_helper.rb