erp_commerce 4.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -1
  3. data/app/models/accepted_credit_card.rb +10 -0
  4. data/app/models/bank_account.rb +13 -0
  5. data/app/models/bank_account_type.rb +9 -0
  6. data/app/models/credit_card.rb +54 -19
  7. data/app/models/credit_card_account.rb +31 -9
  8. data/app/models/credit_card_account_party_role.rb +17 -0
  9. data/app/models/credit_card_account_purpose.rb +24 -0
  10. data/app/models/extensions/financial_txn.rb +62 -1
  11. data/app/models/extensions/order_txn.rb +48 -0
  12. data/app/models/extensions/party.rb +26 -13
  13. data/app/models/extensions/simple_product_offer.rb +3 -0
  14. data/app/models/payment.rb +21 -0
  15. data/app/models/payment_gateway.rb +12 -0
  16. data/app/models/payment_gateway_action.rb +12 -0
  17. data/app/models/pricing_plan.rb +29 -1
  18. data/db/data_migrations/20150125202814_add_payment_transaction_types.rb +14 -0
  19. data/db/migrate/20100823174238_erp_commerce_base.rb +196 -192
  20. data/db/migrate/20160310163057_add_created_by_updated_by_to_erp_commerce.rb +35 -0
  21. data/lib/erp_commerce.rb +1 -2
  22. data/lib/erp_commerce/config.rb +2 -3
  23. data/lib/erp_commerce/engine.rb +1 -5
  24. data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +1 -2
  25. data/lib/erp_commerce/version.rb +1 -1
  26. metadata +12 -32
  27. data/app/mailers/checkout_mailer.rb +0 -9
  28. data/app/views/checkout_mailer/email_confirmation.html.erb +0 -15
  29. data/app/widgets/orders/base.rb +0 -36
  30. data/app/widgets/orders/javascript/orders.js +0 -12
  31. data/app/widgets/orders/views/index.html.erb +0 -63
  32. data/app/widgets/product_catalog/base.rb +0 -52
  33. data/app/widgets/product_catalog/javascript/product_catalog.js +0 -64
  34. data/app/widgets/product_catalog/views/add_to_cart.html.erb +0 -10
  35. data/app/widgets/product_catalog/views/index.html.erb +0 -69
  36. data/app/widgets/product_catalog/views/show.html.erb +0 -23
  37. data/app/widgets/shopping_cart/base.rb +0 -175
  38. data/app/widgets/shopping_cart/javascript/shopping_cart.js +0 -110
  39. data/app/widgets/shopping_cart/views/cart_items.html.erb +0 -83
  40. data/app/widgets/shopping_cart/views/confirmation.html.erb +0 -11
  41. data/app/widgets/shopping_cart/views/demographics.html.erb +0 -142
  42. data/app/widgets/shopping_cart/views/login.html.erb +0 -1
  43. data/app/widgets/shopping_cart/views/payment.html.erb +0 -81
  44. data/app/widgets/shopping_cart/views/price_summary.html.erb +0 -4
  45. data/lib/erp_commerce/active_merchant_wrappers.rb +0 -3
  46. data/lib/erp_commerce/active_merchant_wrappers/authorize_net_wrapper.rb +0 -66
  47. data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +0 -68
  48. data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +0 -34
  49. data/lib/erp_commerce/order_helper.rb +0 -245
@@ -0,0 +1,35 @@
1
+ class AddCreatedByUpdatedByToErpCommerce < ActiveRecord::Migration
2
+ def up
3
+ %w{credit_cards}.each do |table|
4
+
5
+ unless column_exists? table.to_sym, :created_by_party_id
6
+ add_column table.to_sym, :created_by_party_id, :integer
7
+
8
+ add_index table.to_sym, :created_by_party_id, name: "#{table}_created_by_pty_idx"
9
+ end
10
+
11
+ unless column_exists? table.to_sym, :updated_by_party_id
12
+ add_column table.to_sym, :updated_by_party_id, :integer
13
+
14
+ add_index table.to_sym, :updated_by_party_id, name: "#{table}_updated_by_pty_idx"
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ def down
22
+ %w{credit_cards}.each do |table|
23
+
24
+ if column_exists? table.to_sym, :created_by_party_id
25
+ remove_column table.to_sym, :created_by_party_id
26
+ end
27
+
28
+ if column_exists? table.to_sym, :updated_by_party_id
29
+ remove_column table.to_sym, :updated_by_party_id
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -10,11 +10,10 @@ require 'erp_products'
10
10
  require 'erp_orders'
11
11
 
12
12
  require "erp_commerce/version"
13
- require 'erp_commerce/active_merchant_wrappers'
14
13
  require 'erp_commerce/extensions'
15
14
  require 'erp_commerce/config'
16
15
  require "erp_commerce/engine"
17
- require 'erp_commerce/order_helper'
16
+
18
17
 
19
18
  module ErpCommerce
20
19
  end
@@ -1,12 +1,11 @@
1
1
  module ErpCommerce
2
2
  module Config
3
3
  class << self
4
- attr_accessor :encryption_key, :active_merchant_gateway_wrapper
4
+ attr_accessor :encryption_key
5
5
 
6
6
  def init!
7
7
  @defaults = {
8
- :@encryption_key => 'my_secret_code',
9
- :@active_merchant_gateway_wrapper => ErpCommerce::ActiveMerchantWrappers::BrainTreeGatewayWrapper
8
+ :@encryption_key => 'cd6fae94-9c2f-11e4-89d3-123b93f75cba'
10
9
  }
11
10
  end
12
11
 
@@ -3,11 +3,7 @@ module ErpCommerce
3
3
  isolate_namespace ErpCommerce
4
4
 
5
5
  config.erp_commerce = ErpCommerce::Config
6
-
7
- initializer "erp_commerce.merge_public" do |app|
8
- app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
9
- end
10
-
6
+
11
7
  ActiveSupport.on_load(:active_record) do
12
8
  include ErpCommerce::Extensions::ActiveRecord::ActsAsFee
13
9
  include ErpCommerce::Extensions::ActiveRecord::ActsAsPriceable
@@ -37,8 +37,7 @@ module ErpCommerce
37
37
  end
38
38
 
39
39
  def get_current_simple_plan
40
- self.pricing_plans.find(:first,
41
- :conditions => ['is_simple_amount = ? and from_date <= ? and thru_date >= ?', true, Date.today, Date.today])
40
+ self.pricing_plans.where('is_simple_amount = ? and (from_date <= ? and thru_date >= ? or (from_date is null and thru_date is null))', true, Date.today, Date.today).first
42
41
  end
43
42
 
44
43
  class Helper
@@ -1,7 +1,7 @@
1
1
  module ErpCommerce
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 4
4
- MINOR = 0
4
+ MINOR = 2
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_commerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Koloski, Russell Holmes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.29.3
19
+ version: 1.49.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.29.3
26
+ version: 1.49.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: erp_orders
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erp_dev_svcs
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.0'
47
+ version: '4.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.0'
54
+ version: '4.2'
55
55
  description: The CompassAE Commerce Engine uses the engines that implement Parties,
56
56
  Products and Orders, and adds the ability to conduct commerce. It implements a pricing
57
57
  engine, fees, payment gateways.
@@ -64,7 +64,6 @@ files:
64
64
  - GPL-3-LICENSE
65
65
  - README.md
66
66
  - Rakefile
67
- - app/mailers/checkout_mailer.rb
68
67
  - app/models/accepted_credit_card.rb
69
68
  - app/models/bank_account.rb
70
69
  - app/models/bank_account_type.rb
@@ -81,6 +80,7 @@ files:
81
80
  - app/models/extensions/party.rb
82
81
  - app/models/extensions/product_instance.rb
83
82
  - app/models/extensions/product_type.rb
83
+ - app/models/extensions/simple_product_offer.rb
84
84
  - app/models/fee.rb
85
85
  - app/models/fee_type.rb
86
86
  - app/models/payment.rb
@@ -93,38 +93,18 @@ files:
93
93
  - app/models/pricing_plan_assignment.rb
94
94
  - app/models/pricing_plan_component.rb
95
95
  - app/models/valid_price_plan_component.rb
96
- - app/views/checkout_mailer/email_confirmation.html.erb
97
- - app/widgets/orders/base.rb
98
- - app/widgets/orders/javascript/orders.js
99
- - app/widgets/orders/views/index.html.erb
100
- - app/widgets/product_catalog/base.rb
101
- - app/widgets/product_catalog/javascript/product_catalog.js
102
- - app/widgets/product_catalog/views/add_to_cart.html.erb
103
- - app/widgets/product_catalog/views/index.html.erb
104
- - app/widgets/product_catalog/views/show.html.erb
105
- - app/widgets/shopping_cart/base.rb
106
- - app/widgets/shopping_cart/javascript/shopping_cart.js
107
- - app/widgets/shopping_cart/views/cart_items.html.erb
108
- - app/widgets/shopping_cart/views/confirmation.html.erb
109
- - app/widgets/shopping_cart/views/demographics.html.erb
110
- - app/widgets/shopping_cart/views/login.html.erb
111
- - app/widgets/shopping_cart/views/payment.html.erb
112
- - app/widgets/shopping_cart/views/price_summary.html.erb
113
96
  - config/routes.rb
114
97
  - db/data_migrations/20101011152441_payment_gateway_actions.rb
115
98
  - db/data_migrations/20130408200643_add_credit_card_biz_txn_acct_types.rb
99
+ - db/data_migrations/20150125202814_add_payment_transaction_types.rb
116
100
  - db/migrate/20100823174238_erp_commerce_base.rb
101
+ - db/migrate/20160310163057_add_created_by_updated_by_to_erp_commerce.rb
117
102
  - lib/erp_commerce.rb
118
- - lib/erp_commerce/active_merchant_wrappers.rb
119
- - lib/erp_commerce/active_merchant_wrappers/authorize_net_wrapper.rb
120
- - lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb
121
- - lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb
122
103
  - lib/erp_commerce/config.rb
123
104
  - lib/erp_commerce/engine.rb
124
105
  - lib/erp_commerce/extensions.rb
125
106
  - lib/erp_commerce/extensions/active_record/acts_as_fee.rb
126
107
  - lib/erp_commerce/extensions/active_record/acts_as_priceable.rb
127
- - lib/erp_commerce/order_helper.rb
128
108
  - lib/erp_commerce/version.rb
129
109
  - lib/tasks/erp_commerce_tasks.rake
130
110
  - spec/dummy/Rakefile
@@ -190,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
170
  version: '0'
191
171
  requirements: []
192
172
  rubyforge_project:
193
- rubygems_version: 2.2.2
173
+ rubygems_version: 2.4.8
194
174
  signing_key:
195
175
  specification_version: 4
196
176
  summary: The CompassAE Commerce Engine uses the engines that implement Parties, Products
@@ -1,9 +0,0 @@
1
- class CheckoutMailer < ActionMailer::Base
2
- default :from => ErpTechSvcs::Config.email_notifications_from
3
-
4
- def email_confirmation(to_email, order, payment)
5
- @order = order
6
- @payment = payment
7
- mail(:to => to_email, :subject => 'Your Confirmation')
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
- </head>
6
- <body>
7
- <h1>This is your confirmation</h1>
8
- <p>Your order is complete.
9
- <br/>Confirmation Number <%=@payment.authorization_code%>
10
- <br/>Your order number is <%=@order.order_number%>
11
- <br/>Your order status is <%=@order.status%>
12
- <br/>Total for this order was <%=number_to_currency(@order.get_total_charges.sum{|money| money.amount})%>
13
- </p>
14
- </body>
15
- </html>
@@ -1,36 +0,0 @@
1
- module Widgets
2
- module Orders
3
- class Base < ErpApp::Widgets::Base
4
- def index
5
- @orders = OrderTxn.find_by_party_role('payor', current_user.party)
6
- @orders = @orders.select{|order| order.status != "Initialized"}
7
- render
8
- end
9
-
10
- #should not be modified
11
- #modify at your own risk
12
- def locate
13
- File.dirname(__FILE__)
14
- end
15
-
16
- class << self
17
- def title
18
- "Orders"
19
- end
20
-
21
- def widget_name
22
- File.basename(File.dirname(__FILE__))
23
- end
24
-
25
- def base_layout
26
- begin
27
- file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
28
- IO.read(file)
29
- rescue
30
- return nil
31
- end
32
- end
33
- end
34
- end#Base
35
- end#Orders
36
- end#Widgets
@@ -1,12 +0,0 @@
1
- Compass.ErpApp.Widgets.Orders = {
2
- template: new Ext.Template("<%= render_widget :orders %>"),
3
- add:function(){
4
- Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.Orders.template.apply());
5
- }
6
- }
7
-
8
- Compass.ErpApp.Widgets.AvailableWidgets.push({
9
- name:'Orders',
10
- iconUrl:'/images/icons/package/package_48x48.png',
11
- onClick:Compass.ErpApp.Widgets.Orders.add
12
- });
@@ -1,63 +0,0 @@
1
- <style type="text/css">
2
- #products-view {
3
- font-family:'Lucida Grande','Lucida Sans Unicode',sans-serif;
4
- text-align:center;
5
- font-size:14px;
6
- width:100%;
7
- border-collapse: collapse;
8
- border: 2px solid #CCCCCC;
9
- }
10
-
11
- #products-view a {
12
- text-decoration:none;
13
- }
14
-
15
- #products-view img {
16
- height:60px;
17
- width:65px;
18
- padding-right:15px;
19
- }
20
-
21
- #products-view div
22
- {
23
- float:left;
24
- text-align:left;
25
- }
26
-
27
- #products-view th {
28
- padding: 0 0.5em;
29
- height:30px;
30
- text-align:center;
31
- background:url("/images/knitkit/footer.png") repeat-x scroll 0 0 #29425E;
32
- }
33
-
34
- .highlight:hover
35
- {
36
- background-color:#FFFFEE;
37
- }
38
-
39
- #products-view td+td {
40
- border-left: 1px solid #CCC;
41
- text-align: center;
42
- }
43
- </style>
44
- <table id="products-view">
45
- <thead>
46
- <tr>
47
- <th>Order Number</th>
48
- <th>Order At</th>
49
- <th>Status</th>
50
- <th>Amount</th>
51
- </tr>
52
- </thead>
53
- <tbody>
54
- <% @orders.each do |order| %>
55
- <tr>
56
- <td><%=order.order_number%></td>
57
- <td><%=order.created_at.to_time.strftime("%m/%d/%Y %I:%M%p")%></td>
58
- <td><%=order.status%></td>
59
- <td><%=number_to_currency(order.get_total_charges.sum{|money| money.amount})%></td>
60
- </tr>
61
- <% end %>
62
- </tbody>
63
- </table>
@@ -1,52 +0,0 @@
1
- module Widgets
2
- module ProductCatalog
3
- class Base < ErpApp::Widgets::Base
4
- def index
5
- render
6
- end
7
-
8
- def back_to_catalog
9
- render :update => {:id => "#{@uuid}_result", :view => 'index'}
10
- end
11
-
12
- def show
13
- @product_type = ProductType.find(params[:id])
14
- render :update => {:id => "#{@uuid}_result", :view => 'show'}
15
- end
16
-
17
- def add_to_cart
18
- @product_type = ProductType.find(params[:id])
19
- @cart_items_url = params[:cart_items_url]
20
- ErpCommerce::OrderHelper.new(self).add_to_cart(@product_type)
21
-
22
- render :update => {:id => "#{@uuid}_result", :view => 'add_to_cart'}
23
- end
24
-
25
- #should not be modified
26
- #modify at your own risk
27
- def locate
28
- File.dirname(__FILE__)
29
- end
30
-
31
- class << self
32
- def title
33
- "Product Catalog"
34
- end
35
-
36
- def widget_name
37
- File.basename(File.dirname(__FILE__))
38
- end
39
-
40
- def base_layout
41
- begin
42
- file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
43
- IO.read(file)
44
- rescue
45
- return nil
46
- end
47
- end
48
- end
49
- end#Base
50
- end#ProductCatalog
51
- end#Widgets
52
-
@@ -1,64 +0,0 @@
1
- Compass.ErpApp.Widgets.ProductCatalog = {
2
- template: new Ext.XTemplate("<%= render_widget :product_catalog,\n",
3
- " :action => :index,\n",
4
- " :params => {:cart_items_url => '{cartItemsUrl}'} %>"),
5
-
6
- add: function () {
7
- var addProductCatalogWidgetWindow = Ext.create("Ext.window.Window", {
8
- layout: 'fit',
9
- width: 300,
10
- title: 'Add Product Catalog Widget',
11
- height: 100,
12
- buttonAlign: 'center',
13
- items: Ext.create("Ext.form.Panel", {
14
- labelWidth: 100,
15
- frame: false,
16
- bodyStyle: 'padding:5px 5px 0',
17
- defaults: {
18
- width: 225
19
- },
20
- items: [
21
- {
22
- xtype: 'textfield',
23
- fieldLabel: 'Cart Items Url',
24
- name: 'cartItemsUrl',
25
- hidden: false,
26
- value: '/cart-items'
27
- }
28
- ]
29
- }),
30
- buttons: [
31
- {
32
- text: 'Submit',
33
- handler: function (button) {
34
- var window = button.findParentByType('window');
35
- var formPanel = window.query('form')[0];
36
- var basicForm = formPanel.getForm();
37
- var cartItemsUrl = basicForm.findField('cartItemsUrl').getValue();
38
- var data = {
39
- cartItemsUrl: cartItemsUrl
40
- };
41
-
42
- //add rendered template to center region editor
43
- Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.ProductCatalog.template.apply(data));
44
- addProductCatalogWidgetWindow.close();
45
- }
46
- },
47
- {
48
- text: 'Close',
49
- handler: function () {
50
- addProductCatalogWidgetWindow.close();
51
- }
52
- }
53
- ]
54
-
55
- });
56
- addProductCatalogWidgetWindow.show();
57
- }
58
- }
59
-
60
- Compass.ErpApp.Widgets.AvailableWidgets.push({
61
- name: 'Product Catalog',
62
- iconUrl: '/images/icons/product/product_48x48.png',
63
- onClick: Compass.ErpApp.Widgets.ProductCatalog.add
64
- });