effective_orders 6.0.1 → 6.1.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.
- checksums.yaml +4 -4
- data/README.md +22 -3
- data/app/controllers/admin/order_reports_controller.rb +36 -0
- data/app/datatables/admin/effective_customers_datatable.rb +19 -17
- data/app/datatables/admin/effective_orders_datatable.rb +85 -83
- data/app/datatables/admin/report_grouped_transactions_datatable.rb +78 -0
- data/app/datatables/admin/report_payment_providers_datatable.rb +60 -0
- data/app/datatables/admin/report_transactions_datatable.rb +63 -0
- data/app/helpers/effective_stripe_helper.rb +5 -3
- data/app/models/effective/order_item.rb +4 -0
- data/app/views/admin/order_reports/index.html.haml +3 -0
- data/config/routes.rb +9 -0
- data/lib/effective_orders/version.rb +1 -1
- data/lib/effective_orders.rb +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9249f1d10040622da38e49058f9a644551208f8be9744e5444ce4288432f68ce
|
4
|
+
data.tar.gz: bf7f2ca0477fbfedacf7034b2692d82dfc6fb915c6af66162b95aeab3ba1df3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08ba32390474ae77d738d6305845fd1b3797edc880d9a82ac1ac348abf1daf1a77ed6b196c04424ef9feff151fd3a5c8a3305953a91da34f77cfc97ead00d870'
|
7
|
+
data.tar.gz: c817be2902218f0c7a7462859579c606e2905b17891e75f231c141f7902424761d06b715bcaf3c33fa76a4791bbae3c04e3f046be93ba66e39880e1b16af0a76
|
data/README.md
CHANGED
@@ -10,13 +10,13 @@ Sends order receipt emails automatically.
|
|
10
10
|
|
11
11
|
Has Order History, My Purchases, My Sales and Admin screens.
|
12
12
|
|
13
|
-
## effective_orders
|
13
|
+
## effective_orders 6.0
|
14
14
|
|
15
|
-
This is the
|
15
|
+
This is the 6.0 series of effective_orders.
|
16
16
|
|
17
17
|
This requires Twitter Bootstrap 4 and Rails 5.1+
|
18
18
|
|
19
|
-
Please check out [Effective Orders 3.x](https://github.com/code-and-effect/effective_orders/tree/bootstrap3) for more information using this gem with Bootstrap 3.
|
19
|
+
Please check out [Effective Orders 3.x](https://github.com/code-and-effect/effective_orders/tree/bootstrap3) for more information using this gem with Bootstrap 3. Deprecated and not maintained.
|
20
20
|
|
21
21
|
## Getting Started
|
22
22
|
|
@@ -362,6 +362,14 @@ In addition to the above, the following permissions allow access to the `/admin`
|
|
362
362
|
|
363
363
|
```ruby
|
364
364
|
can :admin, :effective_orders # Can access the admin screens
|
365
|
+
|
366
|
+
can :index, :report_transactions
|
367
|
+
can :index, :report_grouped_transactions
|
368
|
+
can :index, :report_payment_providers
|
369
|
+
|
370
|
+
can :index, Admin::ReportTransactionsDatatable
|
371
|
+
can :index, Admin::ReportGroupedTransactionsDatatable
|
372
|
+
can :index, Admin::ReportPaymentProvidersDatatable
|
365
373
|
```
|
366
374
|
|
367
375
|
## Whats Included
|
@@ -606,6 +614,8 @@ We are also going to use ngrok to give us a public facing URL
|
|
606
614
|
|
607
615
|
Visit https://esqa.moneris.com/mpg/ and login with: demouser / store1 / password
|
608
616
|
|
617
|
+
Or for the prod environment https://www3.moneris.com/mpg
|
618
|
+
|
609
619
|
- Select Admin -> Moneris Checkout Config from the menu
|
610
620
|
- Click Create Profile
|
611
621
|
|
@@ -657,6 +667,15 @@ config.moneris_checkout = {
|
|
657
667
|
|
658
668
|
[Testing a Solution](https://developer.moneris.com/en/More/Testing/Testing%20a%20Solution)
|
659
669
|
|
670
|
+
### Create a Production Store
|
671
|
+
|
672
|
+
Visit https://www3.moneris.com/mpg and follow the above instructions
|
673
|
+
|
674
|
+
The Checkout Id, something like `chktJF76Btore1` is on the configuration page.
|
675
|
+
|
676
|
+
The Store Id, something like `gwca12345` should match the login information
|
677
|
+
|
678
|
+
To find the Api Token, click Admin -> Store Settings -> and copy the API key there
|
660
679
|
|
661
680
|
|
662
681
|
## Paying via Moneris (hosted pay page - old)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Admin
|
2
|
+
class OrderReportsController < ApplicationController
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :effective_orders) }
|
5
|
+
|
6
|
+
include Effective::CrudController
|
7
|
+
|
8
|
+
def transactions
|
9
|
+
@page_title = 'Revenue: Individual Transactions'
|
10
|
+
@datatable = Admin::ReportTransactionsDatatable.new
|
11
|
+
|
12
|
+
authorize! :index, :report_transactions
|
13
|
+
|
14
|
+
render 'index'
|
15
|
+
end
|
16
|
+
|
17
|
+
def grouped_transactions
|
18
|
+
@page_title = 'Revenue: Grouped Transactions'
|
19
|
+
@datatable = Admin::ReportGroupedTransactionsDatatable.new
|
20
|
+
|
21
|
+
authorize! :index, :report_grouped_transactions
|
22
|
+
|
23
|
+
render 'index'
|
24
|
+
end
|
25
|
+
|
26
|
+
def payment_providers
|
27
|
+
@page_title = 'Revenue: Payment Providers'
|
28
|
+
@datatable = Admin::ReportPaymentProvidersDatatable.new
|
29
|
+
|
30
|
+
authorize! :index, :report_payment_providers
|
31
|
+
|
32
|
+
render 'index'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -1,26 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Admin
|
2
|
+
class EffectiveCustomersDatatable < Effective::Datatable
|
3
|
+
datatable do
|
3
4
|
|
4
|
-
|
5
|
+
col :id, visible: false
|
5
6
|
|
6
|
-
|
7
|
+
col :user, search: :string
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
col :email do |customer|
|
10
|
+
customer.user.email
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
if EffectiveOrders.stripe?
|
14
|
+
col :stripe_customer_id
|
15
|
+
col :active_card
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
actions_col do |customer|
|
19
|
+
link_to('Manage', "https://dashboard.stripe.com/#{'test/' if Rails.env.development?}customers/#{customer.stripe_customer_id}")
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
collection do
|
25
|
+
Effective::Customer.includes(:user).all
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
@@ -1,119 +1,121 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
module Admin
|
2
|
+
class EffectiveOrdersDatatable < Effective::Datatable
|
3
|
+
bulk_actions do
|
4
|
+
bulk_action(
|
5
|
+
'Send payment request email to selected orders',
|
6
|
+
effective_orders.bulk_send_payment_request_admin_orders_path,
|
7
|
+
data: { confirm: 'Send payment request emails?' }
|
8
|
+
)
|
9
|
+
|
10
|
+
bulk_action(
|
11
|
+
'Send receipt email to selected purchased orders',
|
12
|
+
effective_orders.bulk_send_buyer_receipt_orders_path,
|
13
|
+
data: { confirm: 'Send receipt emails?' }
|
14
|
+
)
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
filters do
|
18
|
+
unless attributes[:skip_filters]
|
19
|
+
scope :all
|
20
|
+
scope :purchased
|
20
21
|
|
21
|
-
|
22
|
+
scope :deferred if EffectiveOrders.deferred_providers.present?
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
scope :pending_refunds if EffectiveOrders.refund && !EffectiveOrders.buyer_purchases_refund?
|
25
|
+
scope :refunds if EffectiveOrders.refund
|
25
26
|
|
26
|
-
|
27
|
+
scope :not_purchased
|
28
|
+
end
|
27
29
|
end
|
28
|
-
end
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
datatable do
|
32
|
+
order :updated_at
|
32
33
|
|
33
|
-
|
34
|
+
bulk_actions_col
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
col :created_at, visible: false
|
37
|
+
col :updated_at, visible: false
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
col :id, label: 'Number' do |order|
|
40
|
+
'#' + order.to_param
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
43
|
+
col :purchased_at do |order|
|
44
|
+
order.purchased_at&.strftime('%F %H:%M') || ('pending refund' if order.pending_refund?) || ("pending #{order.payment_provider}" if order.deferred?) || 'not purchased'
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
if attributes[:user_id].blank?
|
48
|
+
col :user, search: :string
|
49
|
+
col :billing_name, visible: false
|
50
|
+
col :email, visible: false
|
51
|
+
end
|
51
52
|
|
52
|
-
|
53
|
+
col :parent, visible: false, search: :string
|
53
54
|
|
54
|
-
|
55
|
+
col :cc, visible: false
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
if EffectiveOrders.billing_address
|
58
|
+
col :billing_address, visible: false
|
59
|
+
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
if EffectiveOrders.shipping_address
|
62
|
+
col :shipping_address, visible: false
|
63
|
+
end
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
col(:order_items, search: :string).search do |collection, term|
|
66
|
+
collection.where(id: Effective::OrderItem.where('name ILIKE ?', "%#{term}%").select('order_id'))
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
col :payment_method
|
70
|
+
col :payment_provider, label: 'Provider', visible: false, search: { collection: EffectiveOrders.admin_payment_providers }
|
71
|
+
col :payment_card, label: 'Card', visible: false
|
71
72
|
|
72
|
-
|
73
|
+
col :subtotal, as: :price, visible: false
|
73
74
|
|
74
|
-
|
75
|
-
|
75
|
+
col :tax, as: :price, visible: false
|
76
|
+
col(:tax_rate, visible: false) { |order| rate_to_percentage(order.tax_rate) }
|
76
77
|
|
77
|
-
|
78
|
-
|
78
|
+
col :surcharge, as: :price, visible: false
|
79
|
+
col(:surcharge_percent, visible: false) { |order| rate_to_percentage(order.surcharge_percent) }
|
79
80
|
|
80
|
-
|
81
|
+
col :total, as: :price
|
81
82
|
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
if EffectiveOrders.collect_note
|
84
|
+
col :note, visible: false
|
85
|
+
end
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
col :note_to_buyer, visible: false
|
88
|
+
col :note_internal, visible: false
|
88
89
|
|
89
|
-
|
90
|
+
actions_col partial: 'admin/orders/datatable_actions', partial_as: :order
|
91
|
+
|
92
|
+
unless attributes[:total] == false
|
93
|
+
aggregate :total
|
94
|
+
end
|
90
95
|
|
91
|
-
unless attributes[:total] == false
|
92
|
-
aggregate :total
|
93
96
|
end
|
94
97
|
|
95
|
-
|
98
|
+
collection do
|
99
|
+
scope = Effective::Order.all.deep
|
96
100
|
|
97
|
-
|
98
|
-
|
101
|
+
if EffectiveOrders.orders_collection_scope.respond_to?(:call)
|
102
|
+
scope = EffectiveOrders.orders_collection_scope.call(scope)
|
103
|
+
end
|
99
104
|
|
100
|
-
|
101
|
-
|
102
|
-
|
105
|
+
if attributes[:user_id].present?
|
106
|
+
user_klass = (attributes[:user_type].constantize if attributes[:user_type].present?)
|
107
|
+
user_klass ||= current_user.class
|
103
108
|
|
104
|
-
|
105
|
-
|
106
|
-
|
109
|
+
user = user_klass.find(attributes[:user_id])
|
110
|
+
scope = scope.where(user: user)
|
111
|
+
end
|
107
112
|
|
108
|
-
|
109
|
-
|
110
|
-
|
113
|
+
if attributes[:parent_id].present? && attributes[:parent_type].present?
|
114
|
+
scope = scope.where(parent_id: attributes[:parent_id], parent_type: attributes[:parent_type])
|
115
|
+
end
|
111
116
|
|
112
|
-
|
113
|
-
scope = scope.where(parent_id: attributes[:parent_id], parent_type: attributes[:parent_type])
|
117
|
+
scope
|
114
118
|
end
|
115
119
|
|
116
|
-
scope
|
117
120
|
end
|
118
|
-
|
119
121
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Revenue: Grouped Transactions
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class ReportGroupedTransactionsDatatable < Effective::Datatable
|
5
|
+
filters do
|
6
|
+
filter :start_date, nil, as: :date
|
7
|
+
filter :end_date, nil, as: :date
|
8
|
+
end
|
9
|
+
|
10
|
+
datatable do
|
11
|
+
length 250
|
12
|
+
|
13
|
+
col :item
|
14
|
+
col :subtotal, as: :price
|
15
|
+
col :tax, as: :price
|
16
|
+
col :total, as: :price
|
17
|
+
|
18
|
+
payment_providers.each do |provider|
|
19
|
+
col(provider, as: :price)
|
20
|
+
end
|
21
|
+
|
22
|
+
col :orders_count
|
23
|
+
|
24
|
+
col :orders
|
25
|
+
col :users
|
26
|
+
|
27
|
+
col :start_date, as: :date, search: false, sort: false, visible: false do
|
28
|
+
date_range.begin&.strftime('%F')
|
29
|
+
end
|
30
|
+
|
31
|
+
col :end_date, as: :date, search: false, sort: false, visible: false do
|
32
|
+
date_range.end&.strftime('%F')
|
33
|
+
end
|
34
|
+
|
35
|
+
aggregate :total
|
36
|
+
end
|
37
|
+
|
38
|
+
collection do
|
39
|
+
start_date = date_range.begin&.strftime('%F')
|
40
|
+
end_date = date_range.end&.strftime('%F')
|
41
|
+
|
42
|
+
orders = Effective::Order.purchased.where(purchased_at: date_range).where('total != 0')
|
43
|
+
order_items = Effective::OrderItem.where(order_id: orders).includes(:purchasable, order: :user)
|
44
|
+
|
45
|
+
items = order_items.group_by(&:to_s).map do |name, items|
|
46
|
+
row = [
|
47
|
+
name,
|
48
|
+
items.sum { |item| item.subtotal }.to_i,
|
49
|
+
items.sum { |item| item.tax }.to_i,
|
50
|
+
items.sum { |item| item.total }.to_i,
|
51
|
+
]
|
52
|
+
|
53
|
+
row += payment_providers.map do |payment_provider|
|
54
|
+
items.sum { |item| (item.order.payment_provider == payment_provider) ? item.total : 0 }.to_i
|
55
|
+
end
|
56
|
+
|
57
|
+
row += [
|
58
|
+
items.map(&:order_id).uniq.length,
|
59
|
+
items.map { |item| item.order },
|
60
|
+
items.map { |item| item.order.user },
|
61
|
+
start_date,
|
62
|
+
end_date
|
63
|
+
]
|
64
|
+
|
65
|
+
row
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def payment_providers
|
70
|
+
@payment_providers ||= EffectiveOrders.payment_providers - ['free', 'pretend']
|
71
|
+
end
|
72
|
+
|
73
|
+
def date_range
|
74
|
+
@date_range ||= (filters[:start_date].presence)..(filters[:end_date].presence)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Revenue: Payment Providers
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class ReportPaymentProvidersDatatable < Effective::Datatable
|
5
|
+
filters do
|
6
|
+
filter :start_date, nil, as: :date
|
7
|
+
filter :end_date, nil, as: :date
|
8
|
+
end
|
9
|
+
|
10
|
+
datatable do
|
11
|
+
length 250
|
12
|
+
|
13
|
+
col :payment_provider
|
14
|
+
|
15
|
+
col :sales, as: :price
|
16
|
+
col :returns, as: :price
|
17
|
+
col :total, as: :price
|
18
|
+
|
19
|
+
col :start_date, as: :date, search: false, sort: false, visible: false do
|
20
|
+
date_range.begin&.strftime('%F')
|
21
|
+
end
|
22
|
+
|
23
|
+
col :end_date, as: :date, search: false, sort: false, visible: false do
|
24
|
+
date_range.end&.strftime('%F')
|
25
|
+
end
|
26
|
+
|
27
|
+
aggregate :total
|
28
|
+
end
|
29
|
+
|
30
|
+
collection do
|
31
|
+
start_date = date_range.begin&.strftime('%F')
|
32
|
+
end_date = date_range.end&.strftime('%F')
|
33
|
+
|
34
|
+
orders = Effective::Order.purchased.where(purchased_at: date_range).where('total != 0')
|
35
|
+
order_items = Effective::OrderItem.where(order_id: orders).includes(:purchasable, order: :user)
|
36
|
+
|
37
|
+
payment_providers.map do |provider|
|
38
|
+
items = order_items.select { |item| item.order.payment_provider == provider }
|
39
|
+
|
40
|
+
[
|
41
|
+
provider,
|
42
|
+
items.sum { |item| (item.total > 0 ? item.total : 0) }.to_i,
|
43
|
+
items.sum { |item| (item.total < 0 ? item.total : 0) }.to_i,
|
44
|
+
items.sum { |item| item.total }.to_i,
|
45
|
+
start_date,
|
46
|
+
end_date
|
47
|
+
]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def payment_providers
|
52
|
+
@payment_providers ||= EffectiveOrders.payment_providers - ['free', 'pretend']
|
53
|
+
end
|
54
|
+
|
55
|
+
def date_range
|
56
|
+
@date_range ||= (filters[:start_date].presence)..(filters[:end_date].presence)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Revenue: Individual Transactions
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class ReportTransactionsDatatable < Effective::Datatable
|
5
|
+
|
6
|
+
filters do
|
7
|
+
filter :start_date, nil, as: :date
|
8
|
+
filter :end_date, nil, as: :date
|
9
|
+
end
|
10
|
+
|
11
|
+
datatable do
|
12
|
+
order :id, :desc
|
13
|
+
length 250
|
14
|
+
|
15
|
+
col :created_at, visible: false
|
16
|
+
|
17
|
+
col :id, label: 'Order' do |order|
|
18
|
+
link_to(order.to_param, effective_orders.admin_order_path(order))
|
19
|
+
end
|
20
|
+
|
21
|
+
col :purchased_at
|
22
|
+
col :user
|
23
|
+
col :order_items
|
24
|
+
|
25
|
+
col :subtotal, as: :price
|
26
|
+
col :tax, as: :price
|
27
|
+
col(:tax_rate) { |order| rate_to_percentage(order.tax_rate) }.aggregate { nil }
|
28
|
+
|
29
|
+
col :amount_owing, as: :price
|
30
|
+
|
31
|
+
if EffectiveOrders.surcharge?
|
32
|
+
col :surcharge, as: :price
|
33
|
+
col(:surcharge_percent) { |order| rate_to_percentage(order.surcharge_percent) }.aggregate { nil }
|
34
|
+
end
|
35
|
+
|
36
|
+
col :total, as: :price
|
37
|
+
|
38
|
+
col :start_date, as: :date, search: false, sort: false, visible: false do
|
39
|
+
date_range.begin&.strftime('%F')
|
40
|
+
end
|
41
|
+
|
42
|
+
col :end_date, as: :date, search: false, sort: false, visible: false do
|
43
|
+
date_range.end&.strftime('%F')
|
44
|
+
end
|
45
|
+
|
46
|
+
aggregate :total
|
47
|
+
|
48
|
+
actions_col
|
49
|
+
end
|
50
|
+
|
51
|
+
collection do
|
52
|
+
Effective::Order.purchased
|
53
|
+
.where(purchased_at: date_range)
|
54
|
+
.where('total != 0')
|
55
|
+
.includes(:user, [order_items: :purchasable])
|
56
|
+
end
|
57
|
+
|
58
|
+
def date_range
|
59
|
+
@date_range ||= (filters[:start_date].presence)..(filters[:end_date].presence)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -59,11 +59,13 @@ module EffectiveStripeHelper
|
|
59
59
|
def stripe_payment_intent_payload(order, customer)
|
60
60
|
customer.create_stripe_customer! # Only creates if customer not already present
|
61
61
|
|
62
|
+
remember_card = EffectiveOrders.stripe[:remember_card]
|
63
|
+
|
62
64
|
payment = {
|
63
65
|
amount: order.total_with_surcharge,
|
64
66
|
currency: EffectiveOrders.stripe[:currency],
|
65
67
|
customer: customer.stripe_customer_id,
|
66
|
-
payment_method: customer.payment_method_id.presence,
|
68
|
+
payment_method: (customer.payment_method_id.presence if remember_card),
|
67
69
|
description: stripe_order_description(order),
|
68
70
|
metadata: { order_id: order.id }
|
69
71
|
}
|
@@ -71,7 +73,7 @@ module EffectiveStripeHelper
|
|
71
73
|
token_required = customer.token_required?
|
72
74
|
|
73
75
|
# Always prompt them for a card unless remember card
|
74
|
-
token_required = true unless
|
76
|
+
token_required = true unless remember_card
|
75
77
|
|
76
78
|
intent = begin
|
77
79
|
Rails.logger.info "[STRIPE] create payment intent : #{payment}"
|
@@ -87,7 +89,7 @@ module EffectiveStripeHelper
|
|
87
89
|
client_secret: intent.client_secret,
|
88
90
|
payment_method: intent.payment_method,
|
89
91
|
|
90
|
-
active_card: customer.active_card,
|
92
|
+
active_card: (customer.active_card if remember_card),
|
91
93
|
email: customer.email,
|
92
94
|
token_required: token_required
|
93
95
|
}
|
@@ -59,6 +59,10 @@ module Effective
|
|
59
59
|
(subtotal * order.tax_rate / 100.0).round(0).to_i
|
60
60
|
end
|
61
61
|
|
62
|
+
def amount_owing
|
63
|
+
total
|
64
|
+
end
|
65
|
+
|
62
66
|
def total
|
63
67
|
return subtotal if tax_exempt?
|
64
68
|
raise 'parent Effective::Order must have a tax_rate to compute order item total' unless order.try(:tax_rate).present?
|
data/config/routes.rb
CHANGED
@@ -63,6 +63,15 @@ EffectiveOrders::Engine.routes.draw do
|
|
63
63
|
post 'orders/:id', to: 'orders#update'
|
64
64
|
|
65
65
|
resources :order_items, only: [:index]
|
66
|
+
|
67
|
+
resources :order_reports, only: [] do
|
68
|
+
collection do
|
69
|
+
get :transactions
|
70
|
+
get :grouped_transactions
|
71
|
+
get :payment_providers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
66
75
|
end
|
67
76
|
end
|
68
77
|
|
data/lib/effective_orders.rb
CHANGED
@@ -188,6 +188,10 @@ module EffectiveOrders
|
|
188
188
|
use_effective_qb_online && defined?(EffectiveQbOnline)
|
189
189
|
end
|
190
190
|
|
191
|
+
def self.surcharge?
|
192
|
+
credit_card_surcharge_percent.to_f > 0.0
|
193
|
+
end
|
194
|
+
|
191
195
|
def self.mailer_class
|
192
196
|
mailer&.constantize || Effective::OrdersMailer
|
193
197
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- app/assets/stylesheets/effective_orders/_order.scss
|
188
188
|
- app/controllers/admin/customers_controller.rb
|
189
189
|
- app/controllers/admin/order_items_controller.rb
|
190
|
+
- app/controllers/admin/order_reports_controller.rb
|
190
191
|
- app/controllers/admin/orders_controller.rb
|
191
192
|
- app/controllers/effective/carts_controller.rb
|
192
193
|
- app/controllers/effective/concerns/purchase.rb
|
@@ -207,6 +208,9 @@ files:
|
|
207
208
|
- app/controllers/effective/webhooks_controller.rb
|
208
209
|
- app/datatables/admin/effective_customers_datatable.rb
|
209
210
|
- app/datatables/admin/effective_orders_datatable.rb
|
211
|
+
- app/datatables/admin/report_grouped_transactions_datatable.rb
|
212
|
+
- app/datatables/admin/report_payment_providers_datatable.rb
|
213
|
+
- app/datatables/admin/report_transactions_datatable.rb
|
210
214
|
- app/datatables/effective_orders_datatable.rb
|
211
215
|
- app/helpers/effective_carts_helper.rb
|
212
216
|
- app/helpers/effective_moneris_checkout_helper.rb
|
@@ -233,6 +237,7 @@ files:
|
|
233
237
|
- app/views/admin/customers/index.html.haml
|
234
238
|
- app/views/admin/customers/show.html.haml
|
235
239
|
- app/views/admin/order_items/index.html.haml
|
240
|
+
- app/views/admin/order_reports/index.html.haml
|
236
241
|
- app/views/admin/orders/_datatable_actions.html.haml
|
237
242
|
- app/views/admin/orders/_form.html.haml
|
238
243
|
- app/views/admin/orders/_form_note_internal.html.haml
|