opensteam 0.9.2 → 0.9.3
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/CHANGELOG +53 -0
- data/README.rdoc +19 -10
- data/generators/opensteam/opensteam_generator.rb +27 -3
- data/generators/opensteam/templates/app/controllers/admin/configurations_controller.rb +85 -0
- data/generators/opensteam/templates/app/controllers/admin/inventories_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/admin/invoices_controller.rb +35 -4
- data/generators/opensteam/templates/app/controllers/admin/orders_controller.rb +5 -4
- data/generators/opensteam/templates/app/controllers/admin/shipments_controller.rb +6 -3
- data/generators/opensteam/templates/app/controllers/admin/shipping_rate_groups_controller.rb +76 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_groups_controller.rb +124 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_rules_controller.rb +19 -0
- data/generators/opensteam/templates/app/controllers/admin/tax_zones_controller.rb +118 -0
- data/generators/opensteam/templates/app/controllers/admin/users_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/admin_controller.rb +20 -0
- data/generators/opensteam/templates/app/controllers/carts_controller.rb +118 -0
- data/generators/opensteam/templates/app/controllers/checkout_controller.rb +119 -79
- data/generators/opensteam/templates/app/controllers/profile_controller.rb +2 -4
- data/generators/opensteam/templates/app/controllers/searches_controller.rb +1 -1
- data/generators/opensteam/templates/app/controllers/user_sessions_controller.rb +2 -1
- data/generators/opensteam/templates/app/controllers/users_controller.rb +10 -3
- data/generators/opensteam/templates/app/helpers/admin_helper.rb +15 -1
- data/generators/opensteam/templates/app/helpers/checkout_helper.rb +38 -0
- data/generators/opensteam/templates/app/helpers/webshop_helper.rb +6 -1
- data/generators/opensteam/templates/app/models/zone.rb +18 -0
- data/generators/opensteam/templates/app/views/admin/_menu.html.erb +18 -0
- data/generators/opensteam/templates/app/views/admin/catalog.html.erb +2 -3
- data/generators/opensteam/templates/app/views/admin/configurations/edit.html.erb +20 -0
- data/generators/opensteam/templates/app/views/admin/configurations/index.html.erb +22 -0
- data/generators/opensteam/templates/app/views/admin/configurations/new.html.erb +19 -0
- data/generators/opensteam/templates/app/views/admin/configurations/show.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/filters/_filter.html.erb +1 -1
- data/generators/opensteam/templates/app/views/admin/index.html.erb +0 -19
- data/generators/opensteam/templates/app/views/admin/inventories/edit.html.erb +10 -6
- data/generators/opensteam/templates/app/views/admin/inventories/new.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/inventories/show.html.erb +10 -6
- data/generators/opensteam/templates/app/views/admin/invoices/_invoice.html.erb +1 -0
- data/generators/opensteam/templates/app/views/admin/invoices/_invoice_fields.html.erb +52 -0
- data/generators/opensteam/templates/app/views/admin/invoices/new.html.erb +9 -37
- data/generators/opensteam/templates/app/views/admin/invoices/show.html.erb +10 -36
- data/generators/opensteam/templates/app/views/admin/invoices/show.pdf.prawn +59 -0
- data/generators/opensteam/templates/app/views/admin/order_config.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/order_items/_item_entry.html.erb +9 -0
- data/generators/opensteam/templates/app/views/admin/order_items/_items_table.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/orders/_order.html.erb +9 -9
- data/generators/opensteam/templates/app/views/admin/orders/_orders.html.erb +1 -1
- data/generators/opensteam/templates/app/views/admin/orders/show.html.erb +25 -9
- data/generators/opensteam/templates/app/views/admin/payment_types.html.erb +27 -0
- data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment.html.erb +26 -0
- data/generators/opensteam/templates/app/views/admin/payments/_credit_card_payment_info.html.erb +15 -0
- data/generators/opensteam/templates/app/views/admin/payments/_direct_debit_payment.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/shipments/new.html.erb +45 -30
- data/generators/opensteam/templates/app/views/admin/shipments/show.html.erb +3 -3
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_payment_addition.html.erb +12 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/_rate.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/edit.html.erb +63 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/index.html.erb +28 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/new.html.erb +60 -0
- data/generators/opensteam/templates/app/views/admin/shipping_rate_groups/show.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/system.html.erb +5 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_attributes.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups.html.erb +17 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_groups_row.html.erb +12 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/_tax_rule.html.erb +14 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/edit.html.erb +26 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/index.html.erb +8 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/new.html.erb +27 -0
- data/generators/opensteam/templates/app/views/admin/tax_groups/show.html.erb +28 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_attributes.html.erb +18 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zone_row.html.erb +13 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/_tax_zones.html.erb +11 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/edit.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/index.html.erb +16 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/new.html.erb +14 -0
- data/generators/opensteam/templates/app/views/admin/tax_zones/show.html.erb +15 -0
- data/generators/opensteam/templates/app/views/admin/users.html.erb +0 -1
- data/generators/opensteam/templates/app/views/admin/users/show.html.erb +10 -0
- data/generators/opensteam/templates/app/views/administration_mailer/order_customer.erb +1 -1
- data/generators/opensteam/templates/app/views/carts/_cart.html.erb +7 -0
- data/generators/opensteam/templates/app/views/carts/_cart_content.html.erb +45 -0
- data/generators/opensteam/templates/app/views/carts/create.rjs +3 -0
- data/generators/opensteam/templates/app/views/{cart → carts}/index.html.erb +0 -0
- data/generators/opensteam/templates/app/views/carts/update.rjs +11 -0
- data/generators/opensteam/templates/app/views/checkout/_address.html.erb +42 -0
- data/generators/opensteam/templates/app/views/checkout/_customer.html.erb +31 -0
- data/generators/opensteam/templates/app/views/checkout/_edit_checkout.html.erb +42 -0
- data/generators/opensteam/templates/app/views/checkout/_new_checkout.html.erb +44 -0
- data/generators/opensteam/templates/app/views/checkout/_shipping_buttons.html.erb +8 -0
- data/generators/opensteam/templates/app/views/checkout/edit.html.erb +7 -0
- data/generators/opensteam/templates/app/views/checkout/new.html.erb +11 -0
- data/generators/opensteam/templates/app/views/checkout/outro.html.erb +1 -4
- data/generators/opensteam/templates/app/views/checkout/show.html.erb +63 -0
- data/generators/opensteam/templates/app/views/common/_header_admin.html.erb +5 -0
- data/generators/opensteam/templates/app/views/layouts/admin.html.erb +28 -12
- data/generators/opensteam/templates/app/views/layouts/profile.html.erb +2 -2
- data/generators/opensteam/templates/app/views/layouts/webshop.html.erb +5 -4
- data/generators/opensteam/templates/app/views/payment/_advance_payment_payment.html.erb +1 -0
- data/generators/opensteam/templates/app/views/payment/_credit_card_payment.html.erb +37 -0
- data/generators/opensteam/templates/app/views/payment/_credit_card_payment_confirmation.html.erb +20 -0
- data/generators/opensteam/templates/app/views/payment/_direct_debit_payment.html.erb +5 -0
- data/generators/opensteam/templates/app/views/payment/_direct_debit_payment_confirmation.html.erb +5 -0
- data/generators/opensteam/templates/app/views/profile/index.html.erb +1 -1
- data/generators/opensteam/templates/app/views/profile/infos/edit.html.erb +20 -12
- data/generators/opensteam/templates/app/views/profile/infos/edit_password.html.erb +16 -12
- data/generators/opensteam/templates/app/views/profile/orders/_order.html.erb +1 -1
- data/generators/opensteam/templates/app/views/profile/orders/show.html.erb +10 -7
- data/generators/opensteam/templates/app/views/webshop/_inventory_content.html.erb +1 -0
- data/generators/opensteam/templates/app/views/webshop/show.html.erb +3 -1
- data/generators/opensteam/templates/config/initializers/init_states.rb +13 -24
- data/generators/opensteam/templates/config/initializers/opensteam.rb +41 -0
- data/generators/opensteam/templates/config/initializers/opensteam_model_tables.rb +49 -10
- data/generators/opensteam/templates/config/initializers/opensteam_security.rb +8 -0
- data/generators/opensteam/templates/config/initializers/payment_process.rb +37 -0
- data/generators/opensteam/templates/db/migrate/20080609095723_create_addresses.rb +8 -2
- data/generators/opensteam/templates/db/migrate/20080609095726_create_inventories.rb +6 -3
- data/generators/opensteam/templates/db/migrate/20080609095728_create_order_items.rb +12 -1
- data/generators/opensteam/templates/db/migrate/20080609095729_create_orders.rb +8 -12
- data/generators/opensteam/templates/db/migrate/20080609095730_create_payment_types.rb +2 -0
- data/generators/opensteam/templates/db/migrate/20080714131513_create_invoices.rb +2 -1
- data/generators/opensteam/templates/db/migrate/20080714131650_create_shipments.rb +3 -1
- data/generators/opensteam/templates/db/migrate/20080808075247_create_containers.rb +30 -0
- data/generators/opensteam/templates/db/migrate/20080808083011_create_container_items.rb +25 -0
- data/generators/opensteam/templates/db/migrate/20080812102727_create_tax_zones.rb +16 -0
- data/generators/opensteam/templates/db/migrate/20080812102858_create_tax_rules.rb +15 -0
- data/generators/opensteam/templates/db/migrate/20080812102956_create_tax_groups.rb +14 -0
- data/generators/opensteam/templates/db/migrate/20080831181436_create_configurations.rb +15 -0
- data/generators/opensteam/templates/db/migrate/20080903131506_create_payments.rb +22 -0
- data/generators/opensteam/templates/db/migrate/20080904133625_create_payment_transactions.rb +24 -0
- data/generators/opensteam/templates/db/migrate/20080916102341_create_zones.rb +19 -0
- data/generators/opensteam/templates/db/migrate/20080916134340_create_region_shipping_rates.rb +18 -0
- data/generators/opensteam/templates/db/migrate/20080916134523_create_shipping_rate_groups.rb +18 -0
- data/generators/opensteam/templates/db/migrate/20080916135226_create_shipping_payment_additions.rb +20 -0
- data/generators/opensteam/templates/db/migrate/20080916135228_init_opensteam_config.rb +60 -0
- data/generators/opensteam/templates/public/images/opensteam_black.jpg +0 -0
- data/generators/opensteam/templates/public/images/pdf.png +0 -0
- data/generators/opensteam/templates/public/images/shader.png +0 -0
- data/generators/opensteam/templates/public/index.html +1 -0
- data/generators/opensteam/templates/public/javascripts/opensteam.js +21 -21
- data/generators/opensteam/templates/public/stylesheets/opensteam_admin.css +291 -0
- data/generators/opensteam/templates/public/stylesheets/opensteam_white.css +47 -11
- data/generators/opensteam/templates/tasks/opensteam.rake +2 -12
- data/generators/opensteam/templates/test/fixtures/addresses.yml +26 -0
- data/generators/opensteam/templates/test/fixtures/configurations.yml +29 -0
- data/generators/opensteam/templates/test/fixtures/inventories.yml +32 -15
- data/generators/opensteam/templates/test/fixtures/profiles.yml +21 -0
- data/generators/opensteam/templates/test/fixtures/region_shipping_rates.yml +33 -0
- data/generators/opensteam/templates/test/fixtures/shipping_payment_additions.yml +91 -0
- data/generators/opensteam/templates/test/fixtures/shipping_rate_groups.yml +25 -0
- data/generators/opensteam/templates/test/fixtures/tax_groups.yml +13 -0
- data/generators/opensteam/templates/test/fixtures/tax_rules.yml +29 -0
- data/generators/opensteam/templates/test/fixtures/tax_zones.yml +33 -0
- data/generators/opensteam/templates/test/fixtures/users.yml +26 -0
- data/generators/opensteam/templates/test/fixtures/zones.yml +2707 -0
- data/generators/opensteam/templates/test/functional/carts_controller_test.rb +103 -0
- data/generators/opensteam/templates/test/test_helper.rb +38 -0
- data/generators/opensteam/templates/test/unit/container_test.rb +71 -0
- data/generators/opensteam/templates/test/unit/order_test.rb +93 -0
- data/generators/opensteam/templates/test/unit/payment_test.rb +220 -0
- data/generators/opensteam/templates/test/unit/product_test.rb +158 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/.gitignore +3 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/MIT-LICENSE +20 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/README +12 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/Rakefile +22 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/init.rb +6 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto.rb +13 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/action_controller.rb +47 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/base.rb +75 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/lib/prawnto/template_handler/raw.rb +54 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/tasks/prawnto_tasks.rake +4 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/action_controller_test.rb +36 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/base_template_handler_test.rb +58 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/raw_template_handler_test.rb +163 -0
- data/generators/opensteam/templates/vendor/plugins/prawnto/test/template_handler_test_mocks.rb +83 -0
- data/generators/opensteam_product/templates/views/admin/_attributes.html.erb +8 -3
- data/generators/opensteam_product/templates/views/admin/_inventories.html.erb +2 -0
- data/lib/opensteam.rb +0 -1
- data/lib/opensteam/base.rb +2 -1
- data/lib/opensteam/checkout.rb +3 -12
- data/lib/opensteam/config.rb +50 -2
- data/lib/opensteam/container.rb +196 -0
- data/lib/opensteam/extension_base.rb +19 -1
- data/lib/opensteam/finder.rb +1 -1
- data/lib/opensteam/helpers/config_table_helper.rb +18 -6
- data/lib/opensteam/initializer.rb +24 -4
- data/lib/opensteam/inventory_base.rb +6 -1
- data/lib/opensteam/invoice_base.rb +12 -13
- data/lib/opensteam/money.rb +230 -0
- data/lib/opensteam/order_base.rb +122 -48
- data/lib/opensteam/payment.rb +225 -0
- data/lib/opensteam/payment/advance_payment.rb +34 -0
- data/lib/opensteam/payment/credit_card_payment.rb +217 -0
- data/lib/opensteam/payment/direct_debit_payment.rb +53 -0
- data/lib/opensteam/product_base.rb +48 -12
- data/lib/opensteam/security.rb +54 -0
- data/lib/opensteam/shipment_base.rb +214 -6
- data/lib/opensteam/shopping_cart.rb +20 -300
- data/lib/opensteam/state_logic.rb +5 -3
- data/lib/opensteam/state_machine.rb +8 -3
- data/lib/opensteam/user_base.rb +48 -6
- data/lib/opensteam/version.rb +1 -1
- metadata +122 -16
- data/generators/opensteam/templates/app/controllers/cart_controller.rb +0 -94
- data/generators/opensteam/templates/app/views/admin/orders/_event.html.erb +0 -5
- data/generators/opensteam/templates/app/views/admin/orders/_order_item.html.erb +0 -10
- data/generators/opensteam/templates/app/views/cart/_cart.html.erb +0 -8
- data/generators/opensteam/templates/app/views/cart/_cart_content.html.erb +0 -20
- data/generators/opensteam/templates/app/views/cart/update.rjs +0 -1
- data/generators/opensteam/templates/app/views/checkout/payment.html.erb +0 -8
- data/generators/opensteam/templates/app/views/checkout/shipping.html.erb +0 -45
- data/generators/opensteam/templates/app/views/checkout/show_cart.html.erb +0 -13
- data/generators/opensteam/templates/app/views/checkout/update_cart_content.rjs +0 -2
- data/generators/opensteam/templates/app/views/profile/orders/_order_item.html.erb +0 -10
- data/generators/opensteam/templates/db/migrate/20080609095725_create_dummy_users.rb +0 -21
- data/lib/opensteam/cart_base.rb +0 -227
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Opensteam::Payment::CreditCardPayment.class_eval do
|
|
2
|
+
|
|
3
|
+
self.gateway_class = ActiveMerchant::Billing::BogusGateway
|
|
4
|
+
|
|
5
|
+
def execute_payment
|
|
6
|
+
authorization = self.authorize
|
|
7
|
+
|
|
8
|
+
if authorization.success?
|
|
9
|
+
self.state = :payment_authorized
|
|
10
|
+
else
|
|
11
|
+
self.state = :payment_declined
|
|
12
|
+
return authorization
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
capt = self.capture( nil, authorization.reference )
|
|
16
|
+
|
|
17
|
+
if capt.success?
|
|
18
|
+
self.state = :payment_captured
|
|
19
|
+
else
|
|
20
|
+
self.state = :payment_failed
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
return true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
after_create :execute_payment
|
|
29
|
+
private :execute_payment
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Opensteam::Container::Base.class_eval do
|
|
36
|
+
include Opensteam::ShipmentBase::ShippingCalculation
|
|
37
|
+
end
|
|
@@ -2,10 +2,16 @@ class CreateAddresses < ActiveRecord::Migration
|
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :addresses do |t|
|
|
4
4
|
t.references :user
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
t.string :country
|
|
7
|
+
t.string :state
|
|
6
8
|
t.string :postal
|
|
7
9
|
t.string :city
|
|
8
|
-
t.string :
|
|
10
|
+
t.string :street
|
|
11
|
+
|
|
12
|
+
t.string :firstname
|
|
13
|
+
t.string :lastname
|
|
14
|
+
|
|
9
15
|
|
|
10
16
|
t.timestamps
|
|
11
17
|
end
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
class CreateInventories < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :inventories do |t|
|
|
4
|
-
t.decimal :price, :precision => 9, :scale => 2
|
|
5
4
|
t.text :description
|
|
6
5
|
t.string :version
|
|
6
|
+
t.string :shipping_rate_group
|
|
7
|
+
t.float :price, :default => 0.0, :null => false, :limit => 10
|
|
8
|
+
t.integer :storage, :default => 0
|
|
7
9
|
t.integer :active, :default => 0
|
|
8
10
|
t.integer :back_ordered
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
t.references :tax_group
|
|
11
13
|
t.references :product, :polymorphic => true
|
|
12
14
|
|
|
13
15
|
t.timestamps
|
|
16
|
+
|
|
14
17
|
end
|
|
15
18
|
end
|
|
16
19
|
|
|
@@ -3,14 +3,25 @@ class CreateOrderItems < ActiveRecord::Migration
|
|
|
3
3
|
create_table :order_items do |t|
|
|
4
4
|
t.references :order
|
|
5
5
|
|
|
6
|
+
t.integer :quantity
|
|
7
|
+
t.references :inventory
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
t.float :price, :default => 0.0, :null => false, :limit => 10
|
|
11
|
+
t.float :tax, :default => 0.0, :null => false, :limit => 10
|
|
12
|
+
t.float :total_price, :default => 0.0, :null => false, :limit => 10
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
t.integer :quantity
|
|
7
16
|
t.string :itemid
|
|
8
17
|
t.references :inventory
|
|
9
18
|
|
|
10
|
-
|
|
11
19
|
t.references :shipment
|
|
12
20
|
t.references :invoice
|
|
13
21
|
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
14
25
|
|
|
15
26
|
t.timestamps
|
|
16
27
|
end
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
class CreateOrders < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :orders, :force => true do |t|
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
t.references :customer
|
|
6
|
-
|
|
7
6
|
t.references :payment_type
|
|
8
|
-
|
|
9
7
|
t.references :shipping_address
|
|
10
8
|
t.references :payment_address
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#t.references :state
|
|
9
|
+
|
|
14
10
|
t.string :state
|
|
15
11
|
|
|
16
12
|
t.integer :workflow_id
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
# t.references :fulfillment_state
|
|
21
|
-
# t.references :payment_state
|
|
22
13
|
|
|
23
14
|
t.text :description
|
|
24
|
-
|
|
15
|
+
|
|
16
|
+
t.float :total_netto_price, :default => 0.0, :null => false, :limit => 10
|
|
17
|
+
t.float :total_price, :default => 0.0, :null => false, :limit => 10
|
|
18
|
+
t.float :total_tax, :default => 0.0, :null => false, :limit => 10
|
|
19
|
+
|
|
25
20
|
t.timestamps
|
|
21
|
+
|
|
26
22
|
end
|
|
27
23
|
end
|
|
28
24
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
class CreateInvoices < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
|
3
3
|
create_table :invoices do |t|
|
|
4
|
-
t.float :price
|
|
4
|
+
t.float :price, :limit => 10, :default => 0.0, :null => false
|
|
5
|
+
t.float :discount, :limit => 10, :default => 0.0, :null => false
|
|
5
6
|
t.text :comment
|
|
6
7
|
|
|
7
8
|
t.references :customer
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class CreateContainers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :containers do |t|
|
|
4
|
+
t.string :type
|
|
5
|
+
|
|
6
|
+
t.float :total_netto_price, :default => 0.0, :null => false, :limit => 10
|
|
7
|
+
t.float :total_price, :default => 0.0, :null => false, :limit => 10
|
|
8
|
+
t.float :total_tax, :default => 0.0, :null => false, :limit => 10
|
|
9
|
+
|
|
10
|
+
t.references :user
|
|
11
|
+
|
|
12
|
+
t.references :shipping_address
|
|
13
|
+
t.references :payment_address
|
|
14
|
+
|
|
15
|
+
t.string :state
|
|
16
|
+
t.integer :workflow_id
|
|
17
|
+
t.string :payment_type
|
|
18
|
+
t.integer :items_count, :default => 0, :null => false
|
|
19
|
+
t.string :shipping_type
|
|
20
|
+
t.decimal :shipping_rate, :scale => 2, :precision => 8
|
|
21
|
+
t.text :description
|
|
22
|
+
|
|
23
|
+
t.timestamps
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.down
|
|
28
|
+
drop_table :containers
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class CreateContainerItems < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :container_items do |t|
|
|
4
|
+
|
|
5
|
+
t.references :item, :polymorphic => true
|
|
6
|
+
t.references :container
|
|
7
|
+
|
|
8
|
+
t.integer :quantity, :default => 1, :null => false
|
|
9
|
+
|
|
10
|
+
t.float :price, :default => 0.0, :null => false, :limit => 10
|
|
11
|
+
t.float :tax, :default => 0.0, :null => false, :limit => 10
|
|
12
|
+
t.float :total_price, :default => 0.0, :null => false, :limit => 10
|
|
13
|
+
|
|
14
|
+
t.references :shipment
|
|
15
|
+
t.references :invoice
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
t.timestamps
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.down
|
|
23
|
+
drop_table :container_items
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateTaxZones < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :tax_zones do |t|
|
|
4
|
+
t.string :country, :null => false
|
|
5
|
+
t.string :state, :default => "*"
|
|
6
|
+
t.string :postal, :default => "*"
|
|
7
|
+
t.float :rate, :default => 0.0, :limit => 10
|
|
8
|
+
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
drop_table :tax_zones
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateTaxRules < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :tax_rules do |t|
|
|
4
|
+
t.references :tax_zone
|
|
5
|
+
t.references :customer_tax_group
|
|
6
|
+
t.references :product_tax_group
|
|
7
|
+
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.down
|
|
13
|
+
drop_table :tax_rules
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class CreatePayments < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :payments do |t|
|
|
4
|
+
t.references :order
|
|
5
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0
|
|
6
|
+
|
|
7
|
+
t.string :description
|
|
8
|
+
t.string :message
|
|
9
|
+
t.string :data
|
|
10
|
+
t.string :state
|
|
11
|
+
t.string :type
|
|
12
|
+
|
|
13
|
+
t.boolean :test
|
|
14
|
+
|
|
15
|
+
t.timestamps
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.down
|
|
20
|
+
drop_table :payments
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class CreatePaymentTransactions < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :payment_transactions do |t|
|
|
4
|
+
t.references :payment
|
|
5
|
+
|
|
6
|
+
t.boolean :success
|
|
7
|
+
t.boolean :test
|
|
8
|
+
|
|
9
|
+
t.string :message
|
|
10
|
+
t.string :reference
|
|
11
|
+
t.string :action
|
|
12
|
+
|
|
13
|
+
t.integer :amount
|
|
14
|
+
|
|
15
|
+
t.text :params
|
|
16
|
+
|
|
17
|
+
t.timestamps
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.down
|
|
22
|
+
drop_table :payment_transactions
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class CreateZones < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :zones do |t|
|
|
4
|
+
t.string :country_name, :null => false
|
|
5
|
+
t.integer :country_numeric
|
|
6
|
+
t.string :country_a2
|
|
7
|
+
t.string :country_a3
|
|
8
|
+
t.string :state
|
|
9
|
+
t.string :postal
|
|
10
|
+
t.string :city
|
|
11
|
+
|
|
12
|
+
t.timestamps
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
drop_table :zones
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreateRegionShippingRates < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :region_shipping_rates do |t|
|
|
4
|
+
t.references :zone
|
|
5
|
+
t.references :shipping_rate_group
|
|
6
|
+
|
|
7
|
+
t.string :shipping_method
|
|
8
|
+
|
|
9
|
+
t.decimal :rate, :precision => 8, :scale => 2, :default => 0.0
|
|
10
|
+
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.down
|
|
16
|
+
drop_table :region_shipping_rates
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreateShippingRateGroups < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :shipping_rate_groups do |t|
|
|
4
|
+
t.string :name
|
|
5
|
+
|
|
6
|
+
t.decimal :master_rate
|
|
7
|
+
|
|
8
|
+
t.boolean :active
|
|
9
|
+
t.boolean :shipping_disabled
|
|
10
|
+
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.down
|
|
16
|
+
drop_table :shipping_rate_groups
|
|
17
|
+
end
|
|
18
|
+
end
|
data/generators/opensteam/templates/db/migrate/20080916135226_create_shipping_payment_additions.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class CreateShippingPaymentAdditions < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :shipping_payment_additions do |t|
|
|
4
|
+
t.references :shipping_rate_group
|
|
5
|
+
|
|
6
|
+
t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0
|
|
7
|
+
|
|
8
|
+
t.string :payment_type
|
|
9
|
+
t.string :operator, :default => "+"
|
|
10
|
+
|
|
11
|
+
t.boolean :fix_value
|
|
12
|
+
|
|
13
|
+
t.timestamps
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.down
|
|
18
|
+
drop_table :shipping_payment_additions
|
|
19
|
+
end
|
|
20
|
+
end
|