erp_txns_and_accts 3.0.0
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/GPL-3-LICENSE +674 -0
- data/README.rdoc +2 -0
- data/Rakefile +30 -0
- data/app/assets/javascripts/erp_txns_and_accts/application.js +9 -0
- data/app/assets/stylesheets/erp_txns_and_accts/application.css +7 -0
- data/app/controllers/erp_txns_and_accts/application_controller.rb +4 -0
- data/app/helpers/erp_txns_and_accts/application_helper.rb +4 -0
- data/app/models/base_txn_context.rb +6 -0
- data/app/models/biz_acct_txn_task.rb +3 -0
- data/app/models/biz_txn_acct_party_role.rb +23 -0
- data/app/models/biz_txn_acct_pty_rtype.rb +3 -0
- data/app/models/biz_txn_acct_rel_type.rb +3 -0
- data/app/models/biz_txn_acct_relationship.rb +8 -0
- data/app/models/biz_txn_acct_root.rb +21 -0
- data/app/models/biz_txn_acct_status.rb +3 -0
- data/app/models/biz_txn_acct_status_type.rb +3 -0
- data/app/models/biz_txn_acct_type.rb +4 -0
- data/app/models/biz_txn_agreement_role.rb +7 -0
- data/app/models/biz_txn_agreement_role_type.rb +4 -0
- data/app/models/biz_txn_event.rb +61 -0
- data/app/models/biz_txn_event_desc.rb +5 -0
- data/app/models/biz_txn_party_role.rb +7 -0
- data/app/models/biz_txn_party_role_type.rb +4 -0
- data/app/models/biz_txn_rel_type.rb +4 -0
- data/app/models/biz_txn_relationship.rb +8 -0
- data/app/models/biz_txn_status.rb +3 -0
- data/app/models/biz_txn_task.rb +3 -0
- data/app/models/biz_txn_task_type.rb +3 -0
- data/app/models/biz_txn_type.rb +36 -0
- data/app/models/extensions/charge_line.rb +8 -0
- data/app/models/extensions/charge_line_payment_txn.rb +3 -0
- data/app/models/extensions/money.rb +6 -0
- data/app/models/extensions/party.rb +27 -0
- data/app/models/financial_txn.rb +71 -0
- data/app/models/financial_txn_account.rb +71 -0
- data/app/views/layouts/erp_txns_and_accts/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/db/data_migrations/20101014142230_financial_txn_types.rb +15 -0
- data/db/migrate/20080805000030_base_txns_and_accts.rb +360 -0
- data/db/migrate/20110609230152_update_financial_txns.rb +21 -0
- data/lib/erp_txns_and_accts.rb +6 -0
- data/lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb +24 -0
- data/lib/erp_txns_and_accts/engine.rb +12 -0
- data/lib/erp_txns_and_accts/extensions.rb +3 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_account.rb +63 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb +72 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_financial_txn_account.rb +70 -0
- data/lib/erp_txns_and_accts/version.rb +3 -0
- data/lib/tasks/erp_txns_and_accts_tasks.rake +4 -0
- metadata +144 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class UpdateFinancialTxns < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
if columns(:financial_txns).collect {|c| c.name}.include?('payment_type')
|
4
|
+
remove_column :financial_txns, :payment_type
|
5
|
+
end
|
6
|
+
|
7
|
+
if columns(:financial_txns).collect {|c| c.name}.include?('amount_id')
|
8
|
+
rename_column :financial_txns, :amount_id, :money_id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
unless columns(:financial_txns).collect {|c| c.name}.include?('payment_type')
|
14
|
+
add_column :financial_txns, :payment_type, :string
|
15
|
+
end
|
16
|
+
|
17
|
+
if columns(:financial_txns).collect {|c| c.name}.include?('money_id')
|
18
|
+
rename_column :financial_txns, :money_id, :amount_id
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module ErpTxnsAndAccts
|
2
|
+
module DelayedJobs
|
3
|
+
class PaymentGatewayJob
|
4
|
+
def self.start(financial_txn, gateway, gateway_action, gateway_options, credit_card)
|
5
|
+
job_object = ErpTxnsAndAccts::DelayedJobs::PaymentGatewayJob.new(financial_txn.id, gateway.name.to_s, gateway_action, gateway_options, credit_card)
|
6
|
+
Delayed::Job.enqueue(job_object, 50, 1.seconds.from_now)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(financial_txn_id, gateway_klass, gateway_action, gateway_options, credit_card)
|
10
|
+
@financial_txn_id = financial_txn_id
|
11
|
+
@gateway_klass = gateway_klass
|
12
|
+
@gateway_action = gateway_action
|
13
|
+
@gateway_options = gateway_options
|
14
|
+
@credit_card = credit_card
|
15
|
+
end
|
16
|
+
|
17
|
+
def perform
|
18
|
+
gateway = @gateway_klass.constantize
|
19
|
+
financial_txn = FinancialTxn.find(@financial_txn_id)
|
20
|
+
financial_txn.send(@gateway_action, @credit_card, gateway, @gateway_options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ErpTxnsAndAccts
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
isolate_namespace ErpTxnsAndAccts
|
4
|
+
|
5
|
+
ActiveSupport.on_load(:active_record) do
|
6
|
+
include ErpTxnsAndAccts::Extensions::ActiveRecord::ActsAsBizTxnAccount
|
7
|
+
include ErpTxnsAndAccts::Extensions::ActiveRecord::ActsAsBizTxnEvent
|
8
|
+
include ErpTxnsAndAccts::Extensions::ActiveRecord::ActsAsFinancialTxnAccount
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module ErpTxnsAndAccts
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsBizTxnAccount
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_biz_txn_account
|
12
|
+
extend ActsAsBizTxnAccount::SingletonMethods
|
13
|
+
include ActsAsBizTxnAccount::InstanceMethods
|
14
|
+
|
15
|
+
after_initialize :initialize_biz_txn_account
|
16
|
+
after_create :save_biz_txn_account
|
17
|
+
after_update :save_biz_txn_account
|
18
|
+
after_destroy :destroy_biz_txn_account
|
19
|
+
|
20
|
+
has_one :biz_txn_acct_root, :as => :biz_txn_acct
|
21
|
+
|
22
|
+
[
|
23
|
+
:biz_txn_acct_type,
|
24
|
+
:biz_txn_events,
|
25
|
+
:biz_txn_acct_party_roles,
|
26
|
+
:txn_events,
|
27
|
+
:description,:description=,
|
28
|
+
:txns,
|
29
|
+
:account_type
|
30
|
+
].each do |m| delegate m, :to => :biz_txn_acct_root end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module InstanceMethods
|
36
|
+
def account_root
|
37
|
+
biz_txn_acct_root
|
38
|
+
end
|
39
|
+
|
40
|
+
def initialize_biz_txn_account
|
41
|
+
if (self.biz_txn_acct_root.nil?)
|
42
|
+
t = BizTxnAcctRoot.new
|
43
|
+
self.biz_txn_acct_root = t
|
44
|
+
t.biz_txn_acct = self
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def save_biz_txn_account
|
49
|
+
self.biz_txn_acct_root.save
|
50
|
+
end
|
51
|
+
|
52
|
+
def destroy_biz_txn_account
|
53
|
+
self.biz_txn_acct_root.destroy if (self.biz_txn_acct_root && !self.biz_txn_acct_root.frozen?)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module SingletonMethods
|
58
|
+
end
|
59
|
+
|
60
|
+
end#ActsAsBizTxnAccount
|
61
|
+
end#ActiveRecord
|
62
|
+
end#Extensions
|
63
|
+
end#ErpTxnsAndAccts
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module ErpTxnsAndAccts
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsBizTxnEvent
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_biz_txn_event
|
12
|
+
extend ActsAsBizTxnEvent::SingletonMethods
|
13
|
+
include ActsAsBizTxnEvent::InstanceMethods
|
14
|
+
|
15
|
+
after_initialize :initialize_biz_txn_event
|
16
|
+
after_create :save_biz_txn_event
|
17
|
+
after_update :save_biz_txn_event
|
18
|
+
after_destroy :destroy_biz_txn_event
|
19
|
+
|
20
|
+
has_one :biz_txn_event, :as => :biz_txn_record
|
21
|
+
belongs_to :biz_txn_acct_root
|
22
|
+
|
23
|
+
#from BizTxnEvent
|
24
|
+
[:txn_type,:txn_type=,
|
25
|
+
:txn_type_iid,:txn_type_iid=,
|
26
|
+
:description,:description=,
|
27
|
+
:post_date,:post_date=,
|
28
|
+
:created_at,:created_at=,
|
29
|
+
:updated_at,:updated_at=,
|
30
|
+
:create_dependent_txns,:account].each { |m| delegate m, :to => :biz_txn_event }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module SingletonMethods
|
35
|
+
end
|
36
|
+
|
37
|
+
module InstanceMethods
|
38
|
+
def root_txn
|
39
|
+
self.biz_txn_event
|
40
|
+
end
|
41
|
+
|
42
|
+
#allow for a client to pass either an account root or a polymorphic subclass of
|
43
|
+
#account root, but always set the account to the root
|
44
|
+
def account=(acct)
|
45
|
+
if acct.instance_of?(BizTxnAcctRoot)
|
46
|
+
self.biz_txn_event.biz_txn_acct_root = (acct)
|
47
|
+
else
|
48
|
+
self.biz_txn_event.biz_txn_acct_root = (acct.biz_txn_acct_root)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def save_biz_txn_event
|
53
|
+
self.biz_txn_event.save
|
54
|
+
end
|
55
|
+
|
56
|
+
def initialize_biz_txn_event
|
57
|
+
if (self.biz_txn_event.nil?)
|
58
|
+
t = BizTxnEvent.new
|
59
|
+
self.biz_txn_event = t
|
60
|
+
t.biz_txn_record = self
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def destroy_biz_txn_account
|
65
|
+
self.biz_txn_event.destroy if (self.biz_txn_event && !self.biz_txn_event.frozen?)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module ErpTxnsAndAccts
|
2
|
+
module Extensions
|
3
|
+
module ActiveRecord
|
4
|
+
module ActsAsFinancialTxnAccount
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
base.extend(ClassMethods)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def acts_as_financial_txn_account
|
12
|
+
extend ActsAsBizTxnAccount::SingletonMethods
|
13
|
+
include ActsAsBizTxnAccount::InstanceMethods
|
14
|
+
|
15
|
+
after_initialize :initialize_financial_txn_account
|
16
|
+
after_create :save_financial_txn_account
|
17
|
+
after_update :save_financial_txn_account
|
18
|
+
after_destroy :destroy_financial_txn_account
|
19
|
+
|
20
|
+
has_one :financial_txn_account, :as => :financial_account
|
21
|
+
|
22
|
+
[
|
23
|
+
:biz_txn_acct_type,
|
24
|
+
:biz_txn_events,
|
25
|
+
:biz_txn_acct_party_roles,
|
26
|
+
:txn_events,
|
27
|
+
:txns,
|
28
|
+
:biz_txn_acct_root,:biz_txn_acct_root=,
|
29
|
+
:account_type,
|
30
|
+
:agreement,:agreement=,
|
31
|
+
:balance,:balance=,
|
32
|
+
:account_number,:account_number=,
|
33
|
+
:due_date,:due_date=,
|
34
|
+
:created_at,:updated_at,
|
35
|
+
:payment_due,:payment_due=,
|
36
|
+
:description,:description=,
|
37
|
+
:account_delinquent?,:financial_txns,
|
38
|
+
:authorize_payment_txn,:finalize_payment_txn,:rollback_last_txn,
|
39
|
+
:financial_txns,:financial_txns=
|
40
|
+
].each do |m| delegate m, :to => :financial_txn_account end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module InstanceMethods
|
45
|
+
|
46
|
+
def initialize_financial_txn_account
|
47
|
+
if (self.financial_txn_account.nil?)
|
48
|
+
f = FinancialTxnAccount.new
|
49
|
+
self.financial_txn_account = f
|
50
|
+
f.financial_account = self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def save_financial_txn_account
|
55
|
+
self.financial_txn_account.save
|
56
|
+
end
|
57
|
+
|
58
|
+
def destroy_financial_txn_account
|
59
|
+
self.financial_txn_account.destroy if (self.financial_txn_account && !self.financial_txn_account.frozen?)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
module SingletonMethods
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erp_txns_and_accts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rick Koloski, Russell Holmes
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: erp_app
|
16
|
+
requirement: &2157012800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157012800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: erp_agreements
|
27
|
+
requirement: &2157012260 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157012260
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: erp_orders
|
38
|
+
requirement: &2157011580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157011580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: erp_dev_svcs
|
49
|
+
requirement: &2157010900 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2157010900
|
58
|
+
description: ! 'The Transactions and Accounts Engine implements the root classes for
|
59
|
+
adding business transactions and accounts to parties. The key marker interface classes
|
60
|
+
here are BizTxnEvent, which represents a common interface for all manner of management
|
61
|
+
accounting transactions, and BixTxnAcctRoot, which is the root class for the accounting
|
62
|
+
of transactions. CompassAE uses separate structures for management and financial
|
63
|
+
accounting. '
|
64
|
+
email:
|
65
|
+
- russonrails@gmail.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- app/assets/javascripts/erp_txns_and_accts/application.js
|
71
|
+
- app/assets/stylesheets/erp_txns_and_accts/application.css
|
72
|
+
- app/controllers/erp_txns_and_accts/application_controller.rb
|
73
|
+
- app/helpers/erp_txns_and_accts/application_helper.rb
|
74
|
+
- app/models/base_txn_context.rb
|
75
|
+
- app/models/biz_acct_txn_task.rb
|
76
|
+
- app/models/biz_txn_acct_party_role.rb
|
77
|
+
- app/models/biz_txn_acct_pty_rtype.rb
|
78
|
+
- app/models/biz_txn_acct_rel_type.rb
|
79
|
+
- app/models/biz_txn_acct_relationship.rb
|
80
|
+
- app/models/biz_txn_acct_root.rb
|
81
|
+
- app/models/biz_txn_acct_status.rb
|
82
|
+
- app/models/biz_txn_acct_status_type.rb
|
83
|
+
- app/models/biz_txn_acct_type.rb
|
84
|
+
- app/models/biz_txn_agreement_role.rb
|
85
|
+
- app/models/biz_txn_agreement_role_type.rb
|
86
|
+
- app/models/biz_txn_event.rb
|
87
|
+
- app/models/biz_txn_event_desc.rb
|
88
|
+
- app/models/biz_txn_party_role.rb
|
89
|
+
- app/models/biz_txn_party_role_type.rb
|
90
|
+
- app/models/biz_txn_rel_type.rb
|
91
|
+
- app/models/biz_txn_relationship.rb
|
92
|
+
- app/models/biz_txn_status.rb
|
93
|
+
- app/models/biz_txn_task.rb
|
94
|
+
- app/models/biz_txn_task_type.rb
|
95
|
+
- app/models/biz_txn_type.rb
|
96
|
+
- app/models/extensions/charge_line.rb
|
97
|
+
- app/models/extensions/charge_line_payment_txn.rb
|
98
|
+
- app/models/extensions/money.rb
|
99
|
+
- app/models/extensions/party.rb
|
100
|
+
- app/models/financial_txn.rb
|
101
|
+
- app/models/financial_txn_account.rb
|
102
|
+
- app/views/layouts/erp_txns_and_accts/application.html.erb
|
103
|
+
- config/routes.rb
|
104
|
+
- db/data_migrations/20101014142230_financial_txn_types.rb
|
105
|
+
- db/migrate/20080805000030_base_txns_and_accts.rb
|
106
|
+
- db/migrate/20110609230152_update_financial_txns.rb
|
107
|
+
- lib/erp_txns_and_accts/delayed_jobs/payment_gateway_job.rb
|
108
|
+
- lib/erp_txns_and_accts/engine.rb
|
109
|
+
- lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_account.rb
|
110
|
+
- lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_event.rb
|
111
|
+
- lib/erp_txns_and_accts/extensions/active_record/acts_as_financial_txn_account.rb
|
112
|
+
- lib/erp_txns_and_accts/extensions.rb
|
113
|
+
- lib/erp_txns_and_accts/version.rb
|
114
|
+
- lib/erp_txns_and_accts.rb
|
115
|
+
- lib/tasks/erp_txns_and_accts_tasks.rake
|
116
|
+
- GPL-3-LICENSE
|
117
|
+
- Rakefile
|
118
|
+
- README.rdoc
|
119
|
+
homepage: http://development.compassagile.com
|
120
|
+
licenses: []
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ! '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 1.8.10
|
140
|
+
signing_key:
|
141
|
+
specification_version: 3
|
142
|
+
summary: The Transactions and Accounts Engine implements the root classes for adding
|
143
|
+
business transactions and accounts to parties.
|
144
|
+
test_files: []
|