erp_commerce 3.0.0 → 3.0.1

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.
Files changed (109) hide show
  1. data/GPL-3-LICENSE +0 -0
  2. data/README.md +13 -0
  3. data/app/mailers/checkout_mailer.rb +9 -0
  4. data/app/models/bank_account.rb +87 -0
  5. data/app/models/bank_account_type.rb +3 -0
  6. data/app/models/credit_card.rb +21 -6
  7. data/app/models/credit_card_account.rb +119 -0
  8. data/app/models/credit_card_account_party_role.rb +2 -4
  9. data/app/models/credit_card_account_purpose.rb +0 -0
  10. data/app/models/credit_card_token.rb +0 -0
  11. data/app/models/extensions/charge_line.rb +0 -0
  12. data/app/models/extensions/currency.rb +0 -0
  13. data/app/models/extensions/financial_txn.rb +2 -1
  14. data/app/models/extensions/order_txn.rb +0 -0
  15. data/app/models/extensions/party.rb +37 -3
  16. data/app/models/extensions/product_instance.rb +0 -0
  17. data/app/models/extensions/product_type.rb +0 -0
  18. data/app/models/fee.rb +0 -0
  19. data/app/models/fee_type.rb +0 -0
  20. data/app/models/payment.rb +8 -5
  21. data/app/models/payment_gateway.rb +0 -0
  22. data/app/models/payment_gateway_action.rb +0 -0
  23. data/app/models/price.rb +0 -0
  24. data/app/models/price_component.rb +0 -0
  25. data/app/models/price_component_type.rb +0 -0
  26. data/app/models/pricing_plan.rb +0 -0
  27. data/app/models/pricing_plan_assignment.rb +0 -0
  28. data/app/models/pricing_plan_component.rb +0 -0
  29. data/app/models/valid_price_plan_component.rb +0 -0
  30. data/app/views/checkout_mailer/email_confirmation.html.erb +15 -0
  31. data/app/widgets/orders/base.rb +2 -6
  32. data/app/widgets/orders/javascript/orders.js +0 -0
  33. data/app/widgets/orders/views/index.html.erb +0 -0
  34. data/app/widgets/product_catalog/base.rb +0 -4
  35. data/app/widgets/product_catalog/javascript/product_catalog.js +0 -0
  36. data/app/widgets/product_catalog/views/add_to_cart.html.erb +0 -0
  37. data/app/widgets/product_catalog/views/index.html.erb +0 -0
  38. data/app/widgets/product_catalog/views/show.html.erb +0 -0
  39. data/app/widgets/shopping_cart/base.rb +2 -5
  40. data/app/widgets/shopping_cart/javascript/shopping_cart.js +0 -0
  41. data/app/widgets/shopping_cart/views/cart_items.html.erb +0 -0
  42. data/app/widgets/shopping_cart/views/confirmation.html.erb +1 -0
  43. data/app/widgets/shopping_cart/views/demographics.html.erb +0 -0
  44. data/app/widgets/shopping_cart/views/login.html.erb +0 -0
  45. data/app/widgets/shopping_cart/views/payment.html.erb +0 -0
  46. data/app/widgets/shopping_cart/views/price_summary.html.erb +0 -0
  47. data/db/data_migrations/20101011152441_payment_gateway_actions.rb +0 -0
  48. data/db/migrate/20100823174238_erp_commerce_base.rb +50 -25
  49. data/db/migrate/20100913154134_setup_payments.rb +0 -0
  50. data/db/migrate/20101103132342_pricing_migrations.rb +0 -0
  51. data/db/migrate/20120308220606_add_external_identifier_to_payments.rb +5 -0
  52. data/db/migrate/upgrade/20120117170037_add_bank_account.rb +34 -0
  53. data/db/migrate/upgrade/20120117190924_add_credit_card_to_account_roles.rb +7 -0
  54. data/lib/erp_commerce/active_merchant_wrappers/bank_wrapper.rb +17 -0
  55. data/lib/erp_commerce/active_merchant_wrappers/brain_tree_gateway_wrapper.rb +20 -18
  56. data/lib/erp_commerce/active_merchant_wrappers/credit_card_validation.rb +0 -0
  57. data/lib/erp_commerce/active_merchant_wrappers/prismpay_wrapper.rb +108 -0
  58. data/lib/erp_commerce/active_merchant_wrappers.rb +3 -2
  59. data/lib/erp_commerce/config.rb +30 -0
  60. data/lib/erp_commerce/engine.rb +10 -0
  61. data/lib/erp_commerce/extensions/active_record/acts_as_fee.rb +0 -0
  62. data/lib/erp_commerce/extensions/active_record/acts_as_priceable.rb +0 -0
  63. data/lib/erp_commerce/order_helper.rb +10 -19
  64. data/lib/erp_commerce/version.rb +7 -1
  65. data/lib/erp_commerce.rb +2 -0
  66. data/spec/dummy/Rakefile +0 -0
  67. data/spec/dummy/app/assets/javascripts/application.js +0 -0
  68. data/spec/dummy/app/assets/stylesheets/application.css +0 -0
  69. data/spec/dummy/app/controllers/application_controller.rb +0 -0
  70. data/spec/dummy/app/helpers/application_helper.rb +0 -0
  71. data/spec/dummy/app/views/layouts/application.html.erb +0 -0
  72. data/spec/dummy/config/application.rb +0 -0
  73. data/spec/dummy/config/boot.rb +0 -0
  74. data/spec/dummy/config/database.yml +0 -0
  75. data/spec/dummy/config/environment.rb +0 -0
  76. data/spec/dummy/config/environments/spec.rb +0 -0
  77. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -0
  78. data/spec/dummy/config/initializers/inflections.rb +0 -0
  79. data/spec/dummy/config/initializers/mime_types.rb +0 -0
  80. data/spec/dummy/config/initializers/secret_token.rb +0 -0
  81. data/spec/dummy/config/initializers/session_store.rb +0 -0
  82. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
  83. data/spec/dummy/config/locales/en.yml +0 -0
  84. data/spec/dummy/config/routes.rb +0 -0
  85. data/spec/dummy/config.ru +0 -0
  86. data/spec/dummy/public/404.html +0 -0
  87. data/spec/dummy/public/422.html +0 -0
  88. data/spec/dummy/public/500.html +0 -0
  89. data/spec/dummy/public/favicon.ico +0 -0
  90. data/spec/dummy/script/rails +0 -0
  91. data/spec/factories/basic.rb +5 -0
  92. data/spec/models/credit_card_account_party_role_spec.rb +0 -0
  93. data/spec/models/credit_card_account_purpose_spec.rb +0 -0
  94. data/spec/models/credit_card_account_spec.rb +0 -0
  95. data/spec/models/credit_card_spec.rb +0 -0
  96. data/spec/models/fee_spec.rb +0 -0
  97. data/spec/models/fee_type_spec.rb +0 -0
  98. data/spec/models/payment_gateway_action_spec.rb +0 -0
  99. data/spec/models/payment_gateway_spec.rb +0 -0
  100. data/spec/models/payment_spec.rb +0 -0
  101. data/spec/models/price_component_spec.rb +0 -0
  102. data/spec/models/price_component_type_spec.rb +0 -0
  103. data/spec/models/price_spec.rb +0 -0
  104. data/spec/models/pricing_plan_assignment_spec.rb +0 -0
  105. data/spec/models/pricing_plan_component_spec.rb +0 -0
  106. data/spec/models/pricing_plan_spec.rb +0 -0
  107. data/spec/models/valid_price_plan_component_spec.rb +0 -0
  108. metadata +164 -141
  109. data/README.rdoc +0 -2
data/GPL-3-LICENSE CHANGED
File without changes
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ #ErpCommerce
2
+
3
+ The CompassAE Commerce Engine uses the engines that implement Parties, Products and Orders, and adds the ability to conduct commerce. It implements a pricing engine, fees, payment gateways.
4
+
5
+ ### Override Initializer
6
+
7
+ To override these settings simple create a erp_commerce.rb file in your initializers and override the config options you want
8
+
9
+ Rails.application.config.erp_commerce.configure do |config|
10
+ config.encryption_key = 'my_secret_code'
11
+ config.active_merchant_gateway_wrapper = ErpCommerce::ActiveMerchantWrappers::BrainTreeGatewayWrapper
12
+ end
13
+ Rails.application.config.erp_commerce.configure!
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,87 @@
1
+ class BankAccount < ActiveRecord::Base
2
+ require 'attr_encrypted'
3
+
4
+ acts_as_biz_txn_account
5
+
6
+ belongs_to :bank_account_type
7
+
8
+ validates :routing_number, :presence => {:message => 'Routing number cannot be blank.'}
9
+ validates :name_on_account, :presence => {:message => 'Name on account cannot be blank.'}
10
+ validates :crypted_private_account_number, :presence => {:message => 'Account number cannot be blank.'}
11
+
12
+ alias :account_type :bank_account_type
13
+
14
+ #the function EncryptionKey.get_key is meant to be overridden to provide a means for implementations to specify their
15
+ #own encryption schemes and locations. It will default to a simple string for development and testing
16
+ attr_encrypted :private_account_number, :key => Rails.application.config.erp_commerce.encryption_key, :marshall => true, :attribute => :crypted_private_account_number
17
+
18
+ # These methods are exposed for the purposes of displaying a version of the account number
19
+ # string containing the last four digits of the account number. The idea is to make it
20
+ # painfully obvious when any coder is using the private_account_number, which should
21
+ # be used only in limited circumstances.
22
+
23
+ def account_number
24
+ if self.private_account_number
25
+ BankAccount.mask_number(self.private_account_number)
26
+ else
27
+ ''
28
+ end
29
+ end
30
+
31
+ # Note that the setter method allows the same variable to be set, and delegates through
32
+ # the encryption process
33
+
34
+ def account_number=(num)
35
+ self.private_account_number=num
36
+ end
37
+
38
+ def financial_txns
39
+ self.biz_txn_events.where('biz_txn_record_type = ?', 'FinancialTxn').collect(&:biz_txn_record)
40
+ end
41
+
42
+ def successful_payments
43
+ payments = []
44
+ self.financial_txns.each do |financial_txn|
45
+ payments << financial_txn.payments.last if financial_txn.has_captured_payment?
46
+ end
47
+ payments
48
+ end
49
+
50
+ def purchase(financial_txn, gateway_wrapper, gateway_options={}, gateway_account_number=nil, gateway_routing_number=nil)
51
+ gateway_account_number = self.private_account_number unless gateway_account_number
52
+ gateway_routing_number = self.routing_number unless gateway_routing_number
53
+
54
+ #call some service to pay via bank accounts
55
+ result = gateway_wrapper.purchase(gateway_account_number, gateway_routing_number, financial_txn.money.amount)
56
+
57
+ unless result[:payment].nil?
58
+ result[:payment].financial_txn = financial_txn
59
+ result[:payment].save
60
+ financial_txn.payments << result[:payment]
61
+ financial_txn.save
62
+ end
63
+
64
+ result
65
+ end
66
+
67
+ class << self
68
+
69
+ def mask_number(number)
70
+ total_chars = number.length
71
+ total_chars -= 4
72
+ result = ''
73
+ result.tap do |str|
74
+ total_chars.times do
75
+ str << 'X'
76
+ end
77
+ end
78
+ result + number[number.length-4..number.length]
79
+ end
80
+
81
+ end
82
+
83
+ def refund
84
+ # implement a refund on an account
85
+ end
86
+
87
+ end
@@ -0,0 +1,3 @@
1
+ class BankAccountType < ActiveRecord::Base
2
+ has_many :bank_accounts
3
+ end
@@ -3,12 +3,18 @@ class CreditCard < ActiveRecord::Base
3
3
  require 'attr_encrypted'
4
4
 
5
5
  belongs_to :postal_address
6
- has_many :payments
7
- belongs_to :credit_card_account_party_role
6
+ has_one :credit_card_account_party_role, :dependent => :destroy
7
+
8
+ validates :first_name_on_card, :presence => {:message => 'First name on card cannot be blank.'}
9
+ validates :last_name_on_card, :presence => {:message => 'Last name on card cannot be blank.'}
10
+ #validates :card_type, :presence => {:message => 'Card type cannot be blank.'}
11
+ validates :expiration_month, :presence => {:message => 'Expiration month cannot be blank.'}
12
+ validates :expiration_year, :presence => {:message => 'Expiration year cannot be blank.'}
13
+ validates :crypted_private_card_number, :presence => {:message => 'Card number cannot be blank.'}
8
14
 
9
15
  #the function EncryptionKey.get_key is meant to be overridden to provide a means for implementations to specify their
10
16
  #own encryption schemes and locations. It will default to a simple string for development and testing
11
- attr_encrypted :private_card_number, :key => EncryptionKey.get_key, :marshall => true, :attribute => :crypted_private_card_number
17
+ attr_encrypted :private_card_number, :key => Rails.application.config.erp_commerce.encryption_key, :marshall => true, :attribute => :crypted_private_card_number
12
18
 
13
19
  # These methods are exposed for the purposes of displaying a version of the card number
14
20
  # string containing the last four digits of the card number. The idea is to make it
@@ -17,8 +23,7 @@ class CreditCard < ActiveRecord::Base
17
23
 
18
24
  def card_number
19
25
  if self.private_card_number
20
- n = self.private_card_number
21
- 'xxxx-xxxx-xxxx-' + n[n.length-4..n.length]
26
+ CreditCard.mask_number(self.private_card_number)
22
27
  else
23
28
  ''
24
29
  end
@@ -38,6 +43,10 @@ class CreditCard < ActiveRecord::Base
38
43
  def to_s
39
44
  "#{card_type}: #{card_number}"
40
45
  end
46
+
47
+ def add_party_with_role(party, role_type)
48
+
49
+ end
41
50
 
42
51
  def cardholder
43
52
  return self.credit_card_account_party_role.party
@@ -46,7 +55,13 @@ class CreditCard < ActiveRecord::Base
46
55
  def before_create
47
56
  token = CreditCardToken.new
48
57
  self.credit_card_token = token.cc_token.strip
49
- end
58
+ end
59
+
60
+ class << self
61
+ def mask_number(number)
62
+ 'XXXX-XXXX-XXXX-' + number[number.length-4..number.length]
63
+ end
64
+ end
50
65
 
51
66
  end
52
67
 
@@ -1,4 +1,123 @@
1
1
  class CreditCardAccount < ActiveRecord::Base
2
2
  acts_as_biz_txn_account
3
+
3
4
  belongs_to :credit_card_account_purpose
5
+ has_one :credit_card_account_party_role, :dependent => :destroy
6
+ has_one :credit_card, :through => :credit_card_account_party_role
7
+
8
+ def account_number
9
+ self.credit_card.card_number
10
+ end
11
+
12
+ def financial_txns
13
+ self.biz_txn_events.where('biz_txn_record_type = ?', 'FinancialTxn').collect(&:biz_txn_record)
14
+ end
15
+
16
+ def successful_payments
17
+ payments = []
18
+ self.financial_txns.each do |financial_txn|
19
+ payments << financial_txn.payments.last if financial_txn.has_captured_payment?
20
+ end
21
+ payments
22
+ end
23
+
24
+ #params
25
+ #financial_txn
26
+ #cvv
27
+ #gateway_wrapper
28
+ #
29
+ #Optional
30
+ #gateway_options
31
+ #credit_card_to_use
32
+ def authorize(financial_txn, cvv, gateway_wrapper, gateway_options={}, credit_card_to_use=nil)
33
+ credit_card_to_use = self.credit_card unless credit_card_to_use
34
+
35
+ gateway_options[:debug] = true
36
+ result = gateway_wrapper.authorize(credit_card_to_use, financial_txn.money.amount, cvv, gateway_options)
37
+
38
+ unless result[:payment].nil?
39
+ result[:payment].financial_txn = financial_txn
40
+ result[:payment].save
41
+ financial_txn.payments << result[:payment]
42
+ financial_txn.save
43
+ end
44
+
45
+ result
46
+ end
47
+
48
+ #params
49
+ #financial_txn
50
+ #cvv
51
+ #gateway_wrapper
52
+ #
53
+ #Optional
54
+ #gateway_options
55
+ #credit_card_to_use
56
+ def purchase(financial_txn, cvv, gateway_wrapper, gateway_options={}, credit_card_to_use=nil)
57
+ credit_card_to_use = self.credit_card unless credit_card_to_use
58
+
59
+ gateway_options[:debug] = true
60
+ result = gateway_wrapper.purchase(credit_card_to_use, financial_txn.money.amount, cvv, gateway_options)
61
+
62
+ unless result[:payment].nil?
63
+ result[:payment].financial_txn = financial_txn
64
+ result[:payment].save
65
+ financial_txn.payments << result[:payment]
66
+ financial_txn.save
67
+ end
68
+
69
+ result
70
+ end
71
+
72
+ #params
73
+ #financial_txn
74
+ #cvv
75
+ #gateway_wrapper
76
+ #
77
+ #Optional
78
+ #gateway_options
79
+ #credit_card_to_use
80
+ def capture(financial_txn, cvv, gateway_wrapper, gateway_options={}, credit_card_to_use=nil)
81
+ credit_card_to_use = self.credit_card unless credit_card_to_use
82
+
83
+ result = {:success => true}
84
+ payment = Payment.find(:first, :order => 'created_at desc', :conditions => ["current_state = ? and success = ? and financial_txn_id = ?",'authorized', 1, financial_txn.id])
85
+ #only capture this payment if it was authorized
86
+ if !payment.nil? && payment.current_state.to_sym == :authorized
87
+ gateway_options[:debug] = true
88
+ result = gateway_wrapper.capture(credit_card_to_use, payment, cvv,gateway_options)
89
+ end
90
+ result
91
+ end
92
+
93
+ #params
94
+ #financial_txn
95
+ #cvv
96
+ #gateway_wrapper
97
+ #
98
+ #Optional
99
+ #gateway_options
100
+ #credit_card_to_use
101
+ def reverse_authorization(financial_txn, cvv, gateway_wrapper, gateway_options={}, credit_card_to_use=nil)
102
+ credit_card_to_use = self.credit_card unless credit_card_to_use
103
+
104
+ result = {:success => true}
105
+ payment = Payment.find(:first, :order => 'created_at desc', :conditions => ["current_state = ? and success = ? and financial_txn_id = ?",'authorized', 1, financial_txn.id])
106
+ #only reverse this payment if it was authorized
107
+ if !payment.nil? && payment.current_state.to_sym == :authorized
108
+ gateway_options[:debug] = true
109
+
110
+ result = gateway_wrapper.full_reverse_of_authorization(credit_card_to_use, payment, cvv, gateway_options)
111
+ end
112
+ result
113
+ end
114
+
115
+ def void
116
+ # implement a void transaction of a transaction
117
+ end
118
+
119
+ def refund
120
+ # implement a refund on a card
121
+ end
122
+
4
123
  end
@@ -1,8 +1,6 @@
1
1
  class CreditCardAccountPartyRole < ActiveRecord::Base
2
-
3
- belongs_to :credit_card_account, :class_name => "CreditCardAccount"
2
+ belongs_to :credit_card_account
4
3
  belongs_to :role_type
5
4
  belongs_to :party
6
- has_one :credit_card, :class_name => "CreditCard", :dependent => :destroy
7
-
5
+ belongs_to :credit_card
8
6
  end
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
1
  FinancialTxn.class_eval do
2
- has_many :payments
2
+ has_many :payments
3
+ has_many :payment_applications, :dependent => :destroy
3
4
  end
File without changes
@@ -1,7 +1,7 @@
1
1
  Party.class_eval do
2
2
 
3
3
  #credit cards
4
- has_many :credit_card_account_party_roles
4
+ has_many :credit_card_account_party_roles, :dependent => :destroy
5
5
 
6
6
  # return primary credit card
7
7
  def primary_credit_card
@@ -17,5 +17,39 @@ Party.class_eval do
17
17
  end
18
18
  return nil
19
19
  end
20
-
21
- end
20
+
21
+ def credit_card_accounts
22
+ self.accounts.where('biz_txn_acct_type = ?', 'CreditCardAccount').all.collect(&:account)
23
+ end
24
+
25
+ def bank_accounts
26
+ self.accounts.where('biz_txn_acct_type = ?', 'BankAccount').all.collect(&:account)
27
+ end
28
+
29
+ def payment_accounts
30
+ (bank_accounts | credit_card_accounts).flatten
31
+ end
32
+
33
+ ##
34
+ #Get payment accounts in a more useful format for
35
+ #displaying in CSR, website, etc.
36
+ def payment_accounts_hash
37
+ cc_results = credit_card_accounts.map do |cca|
38
+ { id: cca.id,
39
+ description: cca.credit_card.description,
40
+ card_type: cca.credit_card.card_type,
41
+ last_four: nil, #not stored yet
42
+ exp_dt: "#{cca.credit_card.expiration_month}-#{cca.credit_card.expiration_year}",
43
+ account_type: 'Credit Card'}
44
+ end
45
+
46
+ ba_results = bank_accounts.map do |ba|
47
+ {id: ba.id,
48
+ description: ba.name_on_account,
49
+ routing_number: ba.routing_number,
50
+ account_type: 'Bank Account'}
51
+ end
52
+
53
+ (ba_results | cc_results).flatten
54
+ end
55
+ end
File without changes
File without changes
data/app/models/fee.rb CHANGED
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  class Payment < ActiveRecord::Base
2
2
  include AASM
3
3
 
4
- belongs_to :financial_txn
4
+ belongs_to :financial_txn, :dependent => :destroy
5
5
  has_many :payment_gateways
6
6
 
7
7
  aasm_column :current_state
@@ -13,6 +13,11 @@ class Payment < ActiveRecord::Base
13
13
  aasm_state :authorized
14
14
  aasm_state :captured
15
15
  aasm_state :authorization_reversed
16
+ aasm_state :canceled
17
+
18
+ aasm_event :cancel do
19
+ transitions :to => :canceled, :from => [:pending]
20
+ end
16
21
 
17
22
  aasm_event :authorize do
18
23
  transitions :to => :authorized, :from => [:pending]
@@ -27,12 +32,10 @@ class Payment < ActiveRecord::Base
27
32
  end
28
33
 
29
34
  aasm_event :capture do
30
- transitions :to => :captured, :from => [:authorized]
35
+ transitions :to => :captured, :from => [:authorized, :pending]
31
36
  end
32
37
 
33
38
  aasm_event :reverse_authorization do
34
39
  transitions :to => :authorization_reversed, :from => [:authorized]
35
40
  end
36
-
37
-
38
- end
41
+ end
File without changes
File without changes
data/app/models/price.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,15 @@
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>
@@ -2,7 +2,7 @@ module Widgets
2
2
  module Orders
3
3
  class Base < ErpApp::Widgets::Base
4
4
  def index
5
- @orders = OrderTxn.find_by_party_role('buyer', current_user.party)
5
+ @orders = OrderTxn.find_by_party_role('payor', current_user.party)
6
6
  @orders = @orders.select{|order| order.status != "Initialized"}
7
7
  render
8
8
  end
@@ -17,11 +17,7 @@ module Widgets
17
17
  def title
18
18
  "Orders"
19
19
  end
20
-
21
- def views_location
22
- File.join(File.dirname(__FILE__),"/views")
23
- end
24
-
20
+
25
21
  def widget_name
26
22
  File.basename(File.dirname(__FILE__))
27
23
  end
File without changes
File without changes
@@ -32,10 +32,6 @@ module Widgets
32
32
  def title
33
33
  "Product Catalog"
34
34
  end
35
-
36
- def views_location
37
- File.join(File.dirname(__FILE__),"/views")
38
- end
39
35
 
40
36
  def widget_name
41
37
  File.basename(File.dirname(__FILE__))
File without changes
File without changes
@@ -80,10 +80,11 @@ module Widgets
80
80
 
81
81
  def checkout_finalize
82
82
  @products_url = params[:products_url]
83
- success, @message, @order = ErpCommerce::OrderHelper.new(self).complete_order(params)
83
+ success, @message, @order, @payment = ErpCommerce::OrderHelper.new(self).complete_order(params)
84
84
  set_total_price(@order)
85
85
 
86
86
  if success
87
+ CheckoutMailer.email_confirmation(self.current_user.party.billing_email_address.email_address, @order, @payment).deliver
87
88
  render :update => {:id => "#{@uuid}_result", :view => :confirmation}
88
89
  else
89
90
  render :update => {:id => "#{@uuid}_result", :view => :payment}
@@ -155,10 +156,6 @@ module Widgets
155
156
  "Shopping Cart"
156
157
  end
157
158
 
158
- def views_location
159
- File.join(File.dirname(__FILE__),"/views")
160
- end
161
-
162
159
  def widget_name
163
160
  File.basename(File.dirname(__FILE__))
164
161
  end
File without changes
@@ -1,6 +1,7 @@
1
1
  <div id="<%=widget_result_id%>">
2
2
  <p>Your order is complete.
3
3
  <br/>Your should receive a confirmation email.
4
+ <br/>Confirmation Number <%=@payment.authorization_code%>
4
5
  <br/>Your order number is <%=@order.order_number%>
5
6
  </p>
6
7
 
File without changes
File without changes