erp_commerce 3.0.9 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/app/models/accepted_credit_card.rb +2 -0
  2. data/app/models/bank_account.rb +2 -0
  3. data/app/models/bank_account_type.rb +2 -0
  4. data/app/models/credit_card.rb +2 -1
  5. data/app/models/credit_card_account.rb +2 -0
  6. data/app/models/credit_card_account_party_role.rb +2 -0
  7. data/app/models/credit_card_account_purpose.rb +5 -3
  8. data/app/models/fee.rb +1 -0
  9. data/app/models/fee_type.rb +2 -0
  10. data/app/models/payment.rb +2 -0
  11. data/app/models/payment_gateway.rb +4 -2
  12. data/app/models/payment_gateway_action.rb +1 -0
  13. data/app/models/price.rb +2 -1
  14. data/app/models/price_component.rb +2 -1
  15. data/app/models/price_component_type.rb +2 -0
  16. data/app/models/pricing_plan.rb +1 -0
  17. data/app/models/pricing_plan_assignment.rb +2 -1
  18. data/app/models/pricing_plan_component.rb +1 -0
  19. data/app/models/valid_price_plan_component.rb +1 -0
  20. data/db/migrate/20100823174238_erp_commerce_base.rb +243 -1
  21. data/lib/erp_commerce/version.rb +2 -2
  22. data/lib/erp_commerce.rb +7 -1
  23. data/spec/dummy/config/application.rb +6 -0
  24. data/spec/dummy/config/environments/spec.rb +3 -0
  25. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +28 -0
  26. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +16 -0
  27. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  28. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +24 -0
  29. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  30. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +27 -0
  31. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +24 -0
  32. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  33. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
  34. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +26 -0
  35. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +26 -0
  36. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +15 -0
  37. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
  38. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  39. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
  40. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
  41. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  42. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
  43. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
  44. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  45. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
  46. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
  47. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
  48. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
  49. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
  50. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
  51. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  52. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
  53. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  54. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
  55. data/spec/dummy/db/migrate/20130107214952_base_erp_services.erp_base_erp_svcs.rb +461 -0
  56. data/spec/dummy/db/migrate/20130107214953_base_tech_services.erp_tech_svcs.rb +271 -0
  57. data/spec/dummy/db/migrate/20130107214954_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  58. data/spec/dummy/db/migrate/20130107214955_create_groups.erp_tech_svcs.rb +19 -0
  59. data/spec/dummy/db/migrate/20130107214956_upgrade_security.erp_tech_svcs.rb +54 -0
  60. data/spec/dummy/db/migrate/20130107214957_upgrade_security2.erp_tech_svcs.rb +270 -0
  61. data/spec/dummy/db/migrate/20130107214958_base_app_framework.erp_app.rb +276 -0
  62. data/spec/dummy/db/migrate/20130107214959_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
  63. data/spec/dummy/db/migrate/20130107214960_agreements_services.erp_agreements.rb +160 -0
  64. data/spec/dummy/db/migrate/20130107214961_agreements_services_indexes.erp_agreements.rb +52 -0
  65. data/spec/dummy/db/migrate/20130107214962_base_products.erp_products.rb +234 -0
  66. data/spec/dummy/db/migrate/20130107214963_base_products_indexes.erp_products.rb +59 -0
  67. data/spec/dummy/db/migrate/20130107214964_base_orders.erp_orders.rb +178 -0
  68. data/spec/dummy/db/migrate/20130107214965_erp_commerce_base.erp_commerce.rb +442 -0
  69. data/spec/dummy/db/schema.rb +1821 -0
  70. data/spec/dummy/db/spec.sqlite3 +0 -0
  71. data/spec/dummy/log/spec.log +16021 -0
  72. data/spec/models/credit_card_spec.rb +7 -1
  73. data/spec/spec_helper.rb +12 -3
  74. metadata +110 -37
  75. data/db/data_migrations/20130408200643_add_credit_card_biz_txn_acct_types.rb +0 -57
  76. data/db/migrate/20100913154134_setup_payments.rb +0 -57
  77. data/db/migrate/20101103132342_pricing_migrations.rb +0 -169
  78. data/db/migrate/20110921150854_create_fees.rb +0 -50
  79. data/db/migrate/20120308220606_add_external_identifier_to_payments.rb +0 -5
  80. data/db/migrate/20120618144337_create_accepted_credit_cards.rb +0 -11
  81. data/db/migrate/upgrade/20120117170037_add_bank_account.rb +0 -34
  82. data/db/migrate/upgrade/20120117190924_add_credit_card_to_account_roles.rb +0 -7
  83. data/lib/erp_commerce/active_merchant_wrappers/bank_wrapper.rb +0 -17
  84. data/lib/erp_commerce/active_merchant_wrappers/prismpay_wrapper.rb +0 -106
  85. data/public/javascripts/extensions/compass_ae/erp_app/desktop/applications/product_manager/product_pricing_panel.js +0 -329
@@ -1,34 +0,0 @@
1
- class AddBankAccount < ActiveRecord::Migration
2
- def up
3
- unless table_exists?(:bank_account_types)
4
- create_table :bank_account_types do |t|
5
- t.string :description
6
- t.string :internal_identifier
7
-
8
- t.timestamps
9
- end
10
- end
11
-
12
- unless table_exists?(:bank_accounts)
13
- create_table :bank_accounts do |t|
14
- t.string :routing_number
15
- t.string :crypted_private_account_number
16
- t.string :name_on_account
17
- t.references :bank_account_type
18
-
19
- t.timestamps
20
- end
21
-
22
- add_index :bank_accounts, :bank_account_type_id, :name => 'bank_accounts_account_type_idx'
23
- end
24
-
25
- end
26
-
27
- def down
28
- [:bank_account_types, :bank_accounts].each do |tbl|
29
- if table_exists?(tbl)
30
- drop_table tbl
31
- end
32
- end
33
- end
34
- end
@@ -1,7 +0,0 @@
1
- class AddCreditCardToAccountRoles < ActiveRecord::Migration
2
- def change
3
- unless columns(:credit_card_account_party_roles).collect {|c| c.name}.include?('credit_card_id')
4
- add_column :credit_card_account_party_roles, :credit_card_id, :integer
5
- end
6
- end
7
- end
@@ -1,17 +0,0 @@
1
- module ErpCommerce
2
- module ActiveMerchantWrappers
3
- class BankWrapper
4
- def self.purchase(account_number, routing_number, amount)
5
- result = {}
6
-
7
- result[:message] = "Payment applied"
8
- result[:payment] = Payment.create
9
- result[:payment].authorization_code = '123456789'
10
- result[:payment].success = true
11
- #result[:payment].purchase
12
-
13
- result
14
- end
15
- end
16
- end
17
- end
@@ -1,106 +0,0 @@
1
- require 'prismpay'
2
-
3
- module ErpCommerce
4
- module ActiveMerchantWrappers
5
- class PrismPayWrapper
6
-
7
- def self.authorize(credit_card, amount, cvv, gateway_options ={})
8
- # same as purchase
9
- end
10
-
11
- def self.capture(credit_card, payment, cvv, gw_options ={})
12
- # payment.external_identifier
13
- # payment.financial_txn.money.amount
14
- # payment.authorization_code
15
- end
16
-
17
- def self.void()
18
- # payment.external_identifier
19
- # payment.financial_txn.money.amount
20
- # payment.authorization_code
21
- end
22
-
23
- def self.refund()
24
- # payment.external_identifier
25
- # payment.financial_txn.money.amount
26
- # payment.authorization_code
27
- end
28
-
29
- def self.profile_sale(profile_id, amount, last_four, gw_options = {})
30
- # conducts a profile_sale transaction
31
-
32
- result = {}
33
-
34
- gw_options.merge!({:login => 'TEST0'}) unless gw_options[:login]
35
-
36
- # ActiveMerchant::Billing:Base.mode = :test
37
-
38
- gatway = ActiveMerchant::Billing::PrismPayAM.new(gw_options)
39
-
40
-
41
- end
42
-
43
- def self.purchase(credit_card, amount, cvv, gateway_options={})
44
- # returns a hash with the possible parameters of :message and
45
- # :payment ... if a credit card error occurs it returns with
46
- # just :message set
47
- result = {}
48
-
49
- #this needs config options
50
- gateway_options.merge!({:login => 'TEST0'}) unless gateway_options
51
-
52
- # ActiveMerchant::Billing::Base.mode = :test
53
-
54
- #setup gateway
55
- gateway = ActiveMerchant::Billing::PrismPayAM.new(gateway_options)
56
-
57
- #set credit card info
58
- credit_card_result = ActiveMerchant::Billing::CreditCard.new({
59
- :first_name => credit_card.first_name_on_card,
60
- :last_name => credit_card.last_name_on_card,
61
- :number => credit_card.private_card_number,
62
- :month => credit_card.expiration_month,
63
- :year => credit_card.expiration_year,
64
- :verification_value => cvv,
65
- :type => ErpCommerce::ActiveMerchantWrappers::CreditCardValidation.get_card_type(credit_card.private_card_number)
66
- })
67
-
68
- if credit_card_result.valid?
69
- response = gateway.purchase(amount, credit_card_result)
70
-
71
- if response.success?
72
- result[:message] = response.message
73
- result[:payment] = Payment.new
74
- result[:payment].authorization_code = response.authorization
75
- result[:payment].success = true
76
- result[:payment].purchase
77
- else
78
- result[:message] = response.message
79
- result[:payment] = Payment.new
80
- result[:payment].success = false
81
- result[:payment].decline
82
- end
83
-
84
- gateway = PaymentGateway.create(
85
- :response => response.message,
86
- :payment_gateway_action => PaymentGatewayAction.find_by_internal_identifier('authorize')
87
- )
88
-
89
- result[:payment].payment_gateways << gateway
90
- result[:payment].save
91
- else
92
- result[:message] = "<ul>"
93
- credit_card_result.errors.full_messages.each do |current_notice_msg|
94
- result[:message] << "<li>"
95
- result[:message] << current_notice_msg
96
- result[:message] << "</li>"
97
- end
98
- result[:message] << "<ul>"
99
- end
100
-
101
- result
102
- end
103
-
104
- end#PrismPayWrapper
105
- end#ActiveMerchantWrappers
106
- end#ErpCommerce
@@ -1,329 +0,0 @@
1
- //
2
- //form to manage pricing
3
- //
4
-
5
- Ext.define("Compass.ErpApp.Desktop.Applications.ProductManager.ProductPricingPanel",{
6
- extend:"Ext.panel.Panel",
7
- alias:'widget.productmanager_productpricingpanel',
8
- updatePrice : function(rec){
9
- this.addEditPriceBtn.setText('Update Price');
10
- this.cancelBtn.show();
11
- this.addPriceFormPanel.getForm().setValues(rec.data);
12
- },
13
-
14
- deletePrice : function(rec){
15
- var self = this;
16
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this price?', function(btn){
17
- if(btn == 'no'){
18
- return false;
19
- }
20
- else
21
- {
22
- Ext.Ajax.request({
23
- url: '/erp_products/erp_app/desktop/product_manager/delete_price/'+rec.get('pricing_plan_id'),
24
- success: function(response) {
25
- var obj = Ext.decode(response.responseText);
26
- if(obj.success){
27
- Ext.getCmp('productListPanel').loadProducts();
28
- self.pricesGridPanel.getStore().load();
29
- }
30
- else{
31
- Ext.Msg.alert('Error', 'Error deleting price.');
32
- }
33
- },
34
- failure: function(response) {
35
- Ext.Msg.alert('Error', 'Error deleting price.');
36
- }
37
- });
38
- }
39
- });
40
- },
41
-
42
- constructor : function(config) {
43
- var self = this;
44
- var productTypeId = Compass.ErpApp.Desktop.Applications.ProductManager.selectedProductTypeId;
45
-
46
- this.pricesGridPanel = Ext.create("Ext.grid.Panel",{
47
- layout:'fit',
48
- region:'center',
49
- split:true,
50
- columns: [
51
- {
52
- header:'Description',
53
- width:310,
54
- sortable: false,
55
- dataIndex: 'description'
56
- },
57
- {
58
- header: 'Price',
59
- width: 75,
60
- sortable: true,
61
- dataIndex: 'price',
62
- renderer:function(v){
63
- return v.toFixed(2);
64
- }
65
- },
66
- {
67
- header: 'Currency',
68
- width: 75,
69
- sortable: true,
70
- dataIndex: 'currency_display'
71
- },
72
- {
73
- header: 'From Date',
74
- width: 90,
75
- sortable: true,
76
- dataIndex: 'from_date',
77
- renderer: Ext.util.Format.dateRenderer('m/d/Y')
78
- },
79
- {
80
- header: 'Thru Date',
81
- width: 90,
82
- sortable: true,
83
- dataIndex: 'thru_date',
84
- renderer: Ext.util.Format.dateRenderer('m/d/Y')
85
- },
86
- {
87
- menuDisabled:true,
88
- resizable:false,
89
- xtype:'actioncolumn',
90
- header:'Update',
91
- align:'center',
92
- width:60,
93
- items:[{
94
- icon:'/images/icons/edit/edit_16x16.png',
95
- tooltip:'Update',
96
- handler :function(grid, rowIndex, colIndex){
97
- var rec = grid.getStore().getAt(rowIndex);
98
- self.updatePrice(rec);
99
- }
100
- }]
101
- },
102
- {
103
- menuDisabled:true,
104
- resizable:false,
105
- xtype:'actioncolumn',
106
- header:'Delete',
107
- align:'center',
108
- width:60,
109
- items:[{
110
- icon:'/images/icons/delete/delete_16x16.png',
111
- tooltip:'Delete',
112
- handler :function(grid, rowIndex, colIndex){
113
- var rec = grid.getStore().getAt(rowIndex);
114
- self.deletePrice(rec);
115
- }
116
- }]
117
- },
118
- {
119
- menuDisabled:true,
120
- resizable:false,
121
- xtype:'actioncolumn',
122
- header:'Comment',
123
- align:'center',
124
- width:60,
125
- items:[{
126
- getClass: function(v, meta, rec) { // Or return a class from a function
127
- this.items[0].tooltip = rec.get('comments');
128
- return 'info-col';
129
- },
130
- handler: function(grid, rowIndex, colIndex) {
131
- return false;
132
- }
133
- }]
134
- }
135
- ],
136
- loadMask: true,
137
- stripeRows: true,
138
- store: Ext.create("Ext.data.Store",{
139
- autoLoad: true,
140
- proxy:{
141
- type:'ajax',
142
- url: '/erp_products/erp_app/desktop/product_manager/prices/'+productTypeId,
143
- reader:{
144
- root: 'prices',
145
- type:'json'
146
- }
147
- },
148
- fields:[{
149
- name:'price',
150
- type:'decimal'
151
- }, 'currency', 'currency_display', 'from_date', 'thru_date', 'description','comments','pricing_plan_id']
152
- })
153
- });
154
-
155
- this.addEditPriceBtn = Ext.create("Ext.button.Button",{
156
- scope:this,
157
- text:'Add Price',
158
- handler:function(btn){
159
- var formPanel = btn.findParentByType('form');
160
- var basicForm = formPanel.getForm();
161
-
162
- basicForm.submit({
163
- reset:true,
164
- success:function(form, action){
165
- var obj = Ext.decode(action.response.responseText);
166
- if(obj.success){
167
- self.addEditPriceBtn.setText('Add Price');
168
- self.cancelBtn.hide();
169
- Ext.getCmp('productListPanel').loadProducts();
170
- self.pricesGridPanel.getStore().load();
171
- }
172
- else{
173
- Ext.Msg.alert("Error", 'Error creating price');
174
- }
175
- },
176
- failure:function(form, action){
177
- Ext.Msg.alert("Error", 'Error creating price');
178
- }
179
- });
180
- }
181
- });
182
-
183
- this.cancelBtn = Ext.create("Ext.button.Button",{
184
- text:'Cancel',
185
- hidden:true,
186
- handler:function(btn){
187
- var formPanel = btn.findParentByType('form');
188
- var basicForm = formPanel.getForm();
189
- basicForm.reset();
190
- self.addEditPriceBtn.setText('Add Price');
191
- self.cancelBtn.hide();
192
- }
193
- });
194
-
195
- this.addPriceFormPanel = Ext.create("Ext.form.Panel",{
196
- layout:'anchor',
197
- collapsible:true,
198
- split:true,
199
- height:175,
200
- frame:true,
201
- region:'south',
202
- buttonAlign:'center',
203
- bodyStyle:'padding:5px 5px 0',
204
- url:'/erp_products/erp_app/desktop/product_manager/new_and_update_price',
205
- items: [
206
- {
207
- xtype:'textfield',
208
- width:400,
209
- name:'description',
210
- fieldLabel:'Description'
211
- },
212
- {
213
- layout:'column',
214
- xtype:'container',
215
- frame:false,
216
- border:false,
217
- defaults:{
218
- columnWidth:0.25,
219
- border:false,
220
- frame:false,
221
- xtype:'container',
222
- bodyStyle:'padding:0 18px 0 0'
223
- },
224
- items:[{
225
- items:[
226
- {
227
- fieldLabel:'Price',
228
- xtype:'numberfield',
229
- width:200,
230
- layout:'anchor',
231
- allowBlank:false,
232
- name:'price'
233
- }
234
- ]
235
- },
236
- {
237
- items:[
238
- {
239
- fieldLabel:'Currency',
240
- xtype:'combo',
241
- width:200,
242
- id : 'call_center_party_country',
243
- allowBlank : false,
244
- store :Ext.create("Ext.data.Store",{
245
- autoLoad: true,
246
- proxy:{
247
- type:'ajax',
248
- url: '/erp_products/erp_app/desktop/product_manager/currencies',
249
- reader:{
250
- root: 'currencies',
251
- type:'json'
252
- }
253
- },
254
- fields: [
255
- {
256
- name:'internal_identifier'
257
- },
258
- {
259
- name:'id'
260
- }
261
- ]
262
- }),
263
- hiddenName: 'currency',
264
- hiddenField: 'currency',
265
- valueField: 'id',
266
- displayField: 'internal_identifier',
267
- forceSelection : true,
268
- triggerAction : 'all',
269
- name:'currency'
270
- }
271
- ]
272
- },
273
- {
274
- items:[
275
- {
276
- fieldLabel:'From Date',
277
- xtype:'datefield',
278
- width:200,
279
- allowBlank:false,
280
- name:'from_date'
281
- }
282
- ]
283
- },
284
- {
285
- items:[
286
- {
287
- fieldLabel:'Thru Date',
288
- xtype:'datefield',
289
- width:200,
290
- allowBlank:false,
291
- name:'thru_date'
292
- }
293
- ]
294
- }]
295
- },
296
- {
297
- xtype:'textarea',
298
- height:50,
299
- width:400,
300
- name:'comments',
301
- fieldLabel:'Comments'
302
- },
303
- {
304
- xtype:'hidden',
305
- name:'product_type_id',
306
- value:productTypeId
307
- },
308
- {
309
- xtype:'hidden',
310
- name:'pricing_plan_id'
311
- }
312
- ],
313
- buttons:[
314
- this.addEditPriceBtn,
315
- this.cancelBtn
316
- ]
317
- });
318
-
319
- config = Ext.apply({
320
- title:'Pricing',
321
- layout:'border',
322
- items:[this.pricesGridPanel,this.addPriceFormPanel]
323
- }, config);
324
-
325
- this.callParent([config]);
326
- }
327
- });
328
-
329
- Compass.ErpApp.Desktop.Applications.ProductManager.widgets.push({xtype:'productmanager_productpricingpanel'});