effective_orders 4.4.1 → 4.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -3
- data/app/controllers/admin/customers_controller.rb +1 -1
- data/app/controllers/admin/order_items_controller.rb +1 -1
- data/app/controllers/admin/orders_controller.rb +1 -1
- data/app/controllers/effective/concerns/purchase.rb +30 -7
- data/app/controllers/effective/orders_controller.rb +9 -18
- data/app/controllers/effective/providers/cheque.rb +7 -24
- data/app/controllers/effective/providers/mark_as_paid.rb +2 -2
- data/app/controllers/effective/providers/phone.rb +22 -0
- data/app/datatables/{effective_customers_datatable.rb → admin/effective_customers_datatable.rb} +1 -1
- data/app/datatables/admin/effective_orders_datatable.rb +100 -0
- data/app/datatables/effective_orders_datatable.rb +24 -44
- data/app/helpers/effective_orders_helper.rb +6 -6
- data/app/helpers/effective_subscriptions_helper.rb +0 -2
- data/app/mailers/effective/orders_mailer.rb +1 -0
- data/app/models/effective/order.rb +27 -2
- data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
- data/app/views/effective/orders/_checkout_step2.html.haml +4 -6
- data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
- data/app/views/effective/orders/_fields.html.haml +2 -2
- data/app/views/effective/orders/{_order_note_fields.html.haml → _fields_note.html.haml} +0 -0
- data/app/views/effective/orders/{_order_terms_and_conditions_fields.html.haml → _fields_terms.html.haml} +0 -0
- data/app/views/effective/orders/_order.html.haml +2 -1
- data/app/views/effective/orders/_order_actions.html.haml +1 -1
- data/app/views/effective/orders/_order_deferred.html.haml +9 -0
- data/app/views/effective/orders/_order_header.html.haml +4 -1
- data/app/views/effective/orders/_order_items.html.haml +12 -3
- data/app/views/effective/orders/_order_notes.html.haml +2 -0
- data/app/views/effective/orders/_order_payment.html.haml +24 -0
- data/app/views/effective/orders/cheque/_form.html.haml +3 -4
- data/app/views/effective/orders/declined.html.haml +0 -2
- data/app/views/effective/orders/deferred.html.haml +13 -0
- data/app/views/effective/orders/deferred/_form.html.haml +16 -0
- data/app/views/effective/orders/index.html.haml +1 -10
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +1 -3
- data/app/views/effective/orders/phone/_form.html.haml +4 -0
- data/app/views/effective/orders/pretend/_form.html.haml +3 -0
- data/app/views/effective/orders/stripe/_form.html.haml +2 -2
- data/config/effective_orders.rb +13 -3
- data/config/routes.rb +3 -1
- data/lib/effective_orders.rb +21 -6
- data/lib/effective_orders/version.rb +1 -1
- metadata +13 -8
- data/app/datatables/effective_order_items_datatable.rb +0 -99
- data/app/views/admin/orders/_actions.html.haml +0 -22
- data/app/views/effective/orders/_order_payment_details.html.haml +0 -18
- data/app/views/effective/orders/cheque/pay_by_cheque.html.haml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44adcf0828b7d2908e37632adf7188210fde69b5b31ecada6fd4e489dda14213
|
4
|
+
data.tar.gz: ace9a901e39c54be2b848b6032c741d3ed5595b1d7d7f9007a1ed079d632acee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43344caae87fe3fdbe44213928cc8297b75fa5e7b437f4fe62be4270973fdbb6b984d29350ffb6c63de5d803f136b5bcbb8b1e313ad7fb9d76765139c3ad1ca4
|
7
|
+
data.tar.gz: 88a9e598b60b201eb776c8ca8e0a7537f07c4352af733c5d6673ef92c88abe238a6ef495fca01fe274235d8d2f0967c3a85587916e54025725f6cb9167a0f852
|
data/README.md
CHANGED
@@ -430,7 +430,6 @@ In addition to the above, the following permissions allow access to the `/admin`
|
|
430
430
|
|
431
431
|
```ruby
|
432
432
|
can :admin, :effective_orders # Can access the admin screens
|
433
|
-
can :show, :payment_details # Can see the payment purchase details on orders
|
434
433
|
```
|
435
434
|
|
436
435
|
## Whats Included
|
@@ -471,8 +470,6 @@ If the configuration options `config.billing_address` and/or `config.shipping_ad
|
|
471
470
|
|
472
471
|
If `config.use_address_full_name` is set to `true` then appropriate form field will be shown and the user will be prompted for the appropriate address full name during the checkout process, based on [effective_addresses](https://github.com/code-and-effect/effective_addresses/).
|
473
472
|
|
474
|
-
As well, if the config option `config.collect_user_fields` is present, form fields to collect those user attributes will be present on this page.
|
475
|
-
|
476
473
|
When the user submits the form on this screen, a POST to `effective_orders.order_path` is made, and the `Effective::Order` object is validated and created.
|
477
474
|
|
478
475
|
On this final checkout screen, links to all configured payment providers are displayed, and the user may choose which payment processor should be used to make a payment.
|
@@ -5,7 +5,7 @@ module Admin
|
|
5
5
|
layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:admin_customers] : EffectiveOrders.layout)
|
6
6
|
|
7
7
|
def index
|
8
|
-
@datatable = EffectiveCustomersDatatable.new(self)
|
8
|
+
@datatable = Admin::EffectiveCustomersDatatable.new(self)
|
9
9
|
|
10
10
|
@page_title = 'Customers'
|
11
11
|
|
@@ -5,7 +5,7 @@ module Admin
|
|
5
5
|
layout (EffectiveOrders.layout.kind_of?(Hash) ? EffectiveOrders.layout[:admin_orders] : EffectiveOrders.layout)
|
6
6
|
|
7
7
|
def index
|
8
|
-
@datatable = EffectiveOrderItemsDatatable.new(self)
|
8
|
+
@datatable = Admin::EffectiveOrderItemsDatatable.new(self)
|
9
9
|
|
10
10
|
@page_title = 'Order Items'
|
11
11
|
|
@@ -9,9 +9,9 @@ module Effective
|
|
9
9
|
begin
|
10
10
|
@order.purchase!(payment: payment, provider: provider, card: card, email: email, skip_buyer_validations: skip_buyer_validations)
|
11
11
|
|
12
|
-
Effective::Cart.where(
|
12
|
+
Effective::Cart.where(user: @order.user).destroy_all
|
13
13
|
|
14
|
-
|
14
|
+
if flash[:success].blank?
|
15
15
|
if EffectiveOrders.mailer[:send_order_receipt_to_buyer] && email
|
16
16
|
flash[:success] = "Payment successful! A receipt has been sent to #{@order.user.email}"
|
17
17
|
else
|
@@ -19,19 +19,42 @@ module Effective
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
purchased_url ||= effective_orders.purchased_order_path(':id')
|
23
|
+
redirect_to purchased_url.gsub(':id', @order.to_param.to_s)
|
23
24
|
rescue => e
|
24
25
|
flash[:danger] = "An error occurred while processing your payment: #{e.message}. Please try again."
|
25
|
-
|
26
|
+
|
27
|
+
declined_url ||= effective_orders.declined_order_path(':id')
|
28
|
+
redirect_to declined_url.gsub(':id', @order.to_param.to_s)
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
|
-
def
|
32
|
+
def order_deferred(provider:, email: true, deferred_url: nil)
|
33
|
+
@order.defer!(provider: provider, email: email)
|
34
|
+
|
35
|
+
Effective::Cart.where(user: @order.user).destroy_all
|
36
|
+
|
37
|
+
if flash[:success].blank?
|
38
|
+
if email
|
39
|
+
flash[:success] = "Deferred payment created! A request for payment has been sent to #{@order.user.email}"
|
40
|
+
else
|
41
|
+
flash[:success] = "Deferred payment created!"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
deferred_url ||= effective_orders.deferred_order_path(':id')
|
46
|
+
redirect_to deferred_url.gsub(':id', @order.to_param.to_s)
|
47
|
+
end
|
48
|
+
|
49
|
+
def order_declined(payment:, provider:, card: 'none', declined_url: nil)
|
30
50
|
@order.decline!(payment: payment, provider: provider, card: card)
|
31
51
|
|
32
|
-
flash[:danger]
|
52
|
+
if flash[:danger].blank?
|
53
|
+
flash[:danger] = 'Payment was unsuccessful. Your credit card was declined by the payment processor. Please try again.'
|
54
|
+
end
|
33
55
|
|
34
|
-
|
56
|
+
declined_url ||= effective_orders.declined_order_path(':id')
|
57
|
+
redirect_to declined_url.gsub(':id', @order.to_param.to_s)
|
35
58
|
end
|
36
59
|
|
37
60
|
end
|
@@ -7,6 +7,7 @@ module Effective
|
|
7
7
|
include Providers::MarkAsPaid if EffectiveOrders.mark_as_paid?
|
8
8
|
include Providers::Moneris if EffectiveOrders.moneris?
|
9
9
|
include Providers::Paypal if EffectiveOrders.paypal?
|
10
|
+
include Providers::Phone if EffectiveOrders.phone?
|
10
11
|
include Providers::Pretend if EffectiveOrders.pretend?
|
11
12
|
include Providers::Refund if EffectiveOrders.refund?
|
12
13
|
include Providers::Stripe if EffectiveOrders.stripe?
|
@@ -84,34 +85,24 @@ module Effective
|
|
84
85
|
|
85
86
|
# My Orders History
|
86
87
|
def index
|
87
|
-
@
|
88
|
-
@pending_orders = Effective::Order.deep.pending.where(user: current_user)
|
89
|
-
|
88
|
+
@datatable = EffectiveOrdersDatatable.new(user_id: current_user.id)
|
90
89
|
EffectiveOrders.authorize!(self, :index, Effective::Order.new(user: current_user))
|
91
90
|
end
|
92
91
|
|
93
92
|
# Thank you for Purchasing this Order. This is where a successfully purchased order ends up
|
94
93
|
def purchased # Thank You!
|
95
|
-
@order =
|
96
|
-
Effective::Order.find(params[:id])
|
97
|
-
elsif current_user.present?
|
98
|
-
Effective::Order.sorted.purchased_by(current_user).last
|
99
|
-
end
|
100
|
-
|
101
|
-
if @order.blank?
|
102
|
-
redirect_to(effective_orders.orders_path) and return
|
103
|
-
end
|
104
|
-
|
94
|
+
@order = Effective::Order.purchased.find(params[:id])
|
105
95
|
EffectiveOrders.authorize!(self, :show, @order)
|
96
|
+
end
|
106
97
|
|
107
|
-
|
98
|
+
def deferred
|
99
|
+
@order = Effective::Order.deferred.find(params[:id])
|
100
|
+
EffectiveOrders.authorize!(self, :show, @order)
|
108
101
|
end
|
109
102
|
|
110
103
|
def declined
|
111
|
-
@order = Effective::Order.find(params[:id])
|
104
|
+
@order = Effective::Order.declined.find(params[:id])
|
112
105
|
EffectiveOrders.authorize!(self, :show, @order)
|
113
|
-
|
114
|
-
redirect_to(effective_orders.order_path(@order)) unless @order.declined?
|
115
106
|
end
|
116
107
|
|
117
108
|
def send_buyer_receipt
|
@@ -141,7 +132,6 @@ module Effective
|
|
141
132
|
|
142
133
|
@orders.each do |order|
|
143
134
|
next unless EffectiveOrders.authorized?(self, :show, order)
|
144
|
-
|
145
135
|
order.send_order_receipt_to_buyer!
|
146
136
|
end
|
147
137
|
|
@@ -163,6 +153,7 @@ module Effective
|
|
163
153
|
when 'index' ; 'Order History'
|
164
154
|
when 'purchased' ; 'Thank You'
|
165
155
|
when 'declined' ; 'Payment Declined'
|
156
|
+
when 'deferred' ; 'Thank You'
|
166
157
|
else 'Checkout'
|
167
158
|
end
|
168
159
|
end
|
@@ -3,37 +3,20 @@ module Effective
|
|
3
3
|
module Cheque
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
def
|
6
|
+
def cheque
|
7
7
|
@order ||= Order.find(params[:id])
|
8
|
-
@page_title = 'Payment Required'
|
9
8
|
|
10
9
|
EffectiveOrders.authorize!(self, :update, @order)
|
11
10
|
|
12
|
-
|
13
|
-
@order.payment_provider = 'cheque'
|
11
|
+
flash[:success] = EffectiveOrders.cheque[:success]
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
@order.send_pending_order_invoice_to_buyer!
|
18
|
-
|
19
|
-
Effective::Cart.where(user_id: @order.user_id).destroy_all
|
20
|
-
|
21
|
-
message = "Successfully indicated order will be payed by cheque. A pending order invoice has been sent to #{@order.user.email}"
|
13
|
+
order_deferred(provider: 'cheque', deferred_url: cheque_params[:deferred_url])
|
14
|
+
end
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
flash[:success] = message
|
26
|
-
redirect_to params[:purchased_url].gsub(':id', @order.to_param.to_s)
|
27
|
-
else
|
28
|
-
# Otherwise this is the user flow
|
29
|
-
flash.now[:success] = message
|
30
|
-
render 'effective/orders/cheque/pay_by_cheque'
|
31
|
-
end
|
32
|
-
rescue => e
|
33
|
-
flash[:danger] = "Unable to save your order: #{@order.errors.full_messages.to_sentence}. Please try again."
|
34
|
-
redirect_to params[:declined_url].presence || effective_orders.order_path(@order)
|
35
|
-
end
|
16
|
+
def cheque_params
|
17
|
+
params.require(:cheque).permit(:deferred_url)
|
36
18
|
end
|
19
|
+
|
37
20
|
end
|
38
21
|
end
|
39
22
|
end
|
@@ -17,8 +17,8 @@ module Effective
|
|
17
17
|
card: mark_as_paid_params[:payment_card],
|
18
18
|
email: @order.send_mark_as_paid_email_to_buyer?,
|
19
19
|
skip_buyer_validations: true,
|
20
|
-
purchased_url:
|
21
|
-
declined_url:
|
20
|
+
purchased_url: effective_orders.admin_order_path(@order),
|
21
|
+
declined_url: effective_orders.admin_order_path(@order)
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Effective
|
2
|
+
module Providers
|
3
|
+
module Phone
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def phone
|
7
|
+
@order ||= Order.find(params[:id])
|
8
|
+
|
9
|
+
EffectiveOrders.authorize!(self, :update, @order)
|
10
|
+
|
11
|
+
flash[:success] = EffectiveOrders.phone[:success]
|
12
|
+
|
13
|
+
order_deferred(provider: 'phone', deferred_url: phone_params[:deferred_url])
|
14
|
+
end
|
15
|
+
|
16
|
+
def phone_params
|
17
|
+
params.require(:phone).permit(:deferred_url)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
class Admin::EffectiveOrdersDatatable < Effective::Datatable
|
2
|
+
bulk_actions do
|
3
|
+
bulk_action(
|
4
|
+
'Send payment request email to selected orders',
|
5
|
+
effective_orders.bulk_send_payment_request_admin_orders_path,
|
6
|
+
data: { confirm: 'Send payment request emails?' }
|
7
|
+
)
|
8
|
+
|
9
|
+
bulk_action(
|
10
|
+
'Send receipt email to selected purchased orders',
|
11
|
+
effective_orders.bulk_send_buyer_receipt_orders_path,
|
12
|
+
data: { confirm: 'Send receipt emails?' }
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
filters do
|
17
|
+
scope :purchased, default: true
|
18
|
+
scope :deferred
|
19
|
+
scope :refunds
|
20
|
+
scope :not_purchased
|
21
|
+
scope :all
|
22
|
+
end
|
23
|
+
|
24
|
+
datatable do
|
25
|
+
order :id, :desc
|
26
|
+
|
27
|
+
bulk_actions_col
|
28
|
+
|
29
|
+
col :created_at, visible: false
|
30
|
+
col :updated_at, visible: false
|
31
|
+
|
32
|
+
col :id, label: 'Number' do |order|
|
33
|
+
'#' + order.to_param
|
34
|
+
end
|
35
|
+
|
36
|
+
col :purchased_at do |order|
|
37
|
+
order.purchased_at&.strftime('%F %H:%M') || 'not purchased'
|
38
|
+
end
|
39
|
+
|
40
|
+
if attributes[:user_id].blank?
|
41
|
+
col :user
|
42
|
+
col 'user.email', visible: false
|
43
|
+
col :billing_name, visible: false
|
44
|
+
end
|
45
|
+
|
46
|
+
if EffectiveOrders.billing_address
|
47
|
+
col :billing_address, visible: false
|
48
|
+
end
|
49
|
+
|
50
|
+
if EffectiveOrders.shipping_address
|
51
|
+
col :shipping_address, visible: false
|
52
|
+
end
|
53
|
+
|
54
|
+
col :order_items, search: { as: :string }
|
55
|
+
|
56
|
+
col :subtotal, as: :price, visible: false
|
57
|
+
col :tax, as: :price, visible: false
|
58
|
+
|
59
|
+
col :tax_rate, visible: false do |order|
|
60
|
+
tax_rate_to_percentage(order.tax_rate)
|
61
|
+
end
|
62
|
+
|
63
|
+
col :total, as: :price
|
64
|
+
|
65
|
+
col :payment_provider, label: 'Provider', visible: false, search: { collection: EffectiveOrders.payment_providers }
|
66
|
+
col :payment_card, label: 'Card', visible: false
|
67
|
+
|
68
|
+
if EffectiveOrders.collect_note
|
69
|
+
col :note, visible: false
|
70
|
+
end
|
71
|
+
|
72
|
+
col :note_to_buyer, visible: false
|
73
|
+
col :note_internal, visible: false
|
74
|
+
|
75
|
+
actions_col partial: 'admin/orders/datatable_actions', partial_as: :order
|
76
|
+
|
77
|
+
aggregate :total
|
78
|
+
end
|
79
|
+
|
80
|
+
collection do
|
81
|
+
scope = Effective::Order.all.includes(:addresses, :order_items, :user)
|
82
|
+
|
83
|
+
if EffectiveOrders.orders_collection_scope.respond_to?(:call)
|
84
|
+
scope = EffectiveOrders.orders_collection_scope.call(scope)
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes[:user_id].present?
|
88
|
+
scope = scope.where(user: user)
|
89
|
+
else
|
90
|
+
scope = scope.joins(:user)
|
91
|
+
end
|
92
|
+
|
93
|
+
scope
|
94
|
+
end
|
95
|
+
|
96
|
+
def user
|
97
|
+
@user ||= User.find(attributes[:user_id])
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -1,31 +1,19 @@
|
|
1
|
-
|
2
|
-
bulk_actions do
|
3
|
-
if EffectiveOrders.authorized?(view.controller, :admin, :effective_orders)
|
4
|
-
bulk_action(
|
5
|
-
'Send payment request email to selected pending orders',
|
6
|
-
effective_orders.bulk_send_payment_request_admin_orders_path,
|
7
|
-
data: { confirm: 'Send payment request emails to pending orders?' }
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
bulk_action(
|
12
|
-
'Send receipt email to selected purchased orders',
|
13
|
-
effective_orders.bulk_send_buyer_receipt_orders_path,
|
14
|
-
data: { confirm: 'Send receipt emails to purchased orders?' }
|
15
|
-
)
|
16
|
-
end
|
1
|
+
# This is a user specific EffectiveOrdersDatatable
|
17
2
|
|
3
|
+
class EffectiveOrdersDatatable < Effective::Datatable
|
18
4
|
filters do
|
19
|
-
|
20
|
-
|
21
|
-
|
5
|
+
unless attributes[:not_purchased]
|
6
|
+
scope :purchased, default: true
|
7
|
+
scope :deferred
|
8
|
+
scope :refunds
|
9
|
+
scope :not_purchased
|
10
|
+
scope :all
|
11
|
+
end
|
22
12
|
end
|
23
13
|
|
24
14
|
datatable do
|
25
15
|
order :id, :desc
|
26
16
|
|
27
|
-
bulk_actions_col
|
28
|
-
|
29
17
|
col :created_at, visible: false
|
30
18
|
col :updated_at, visible: false
|
31
19
|
|
@@ -33,18 +21,10 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
33
21
|
'#' + order.to_param
|
34
22
|
end
|
35
23
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
if attributes[:user_id].blank?
|
41
|
-
col :user
|
42
|
-
|
43
|
-
col :email, label: 'Email', visible: false, search: :string, sort: :email do |order|
|
44
|
-
link_to order.user.email, (edit_admin_user_path(order.user) rescue admin_user_path(order.user) rescue '#')
|
24
|
+
unless attributes[:not_purchased]
|
25
|
+
col :purchased_at do |order|
|
26
|
+
order.purchased_at&.strftime('%F %H:%M') || 'not purchased'
|
45
27
|
end
|
46
|
-
|
47
|
-
col :billing_name, visible: false
|
48
28
|
end
|
49
29
|
|
50
30
|
if EffectiveOrders.billing_address
|
@@ -55,10 +35,6 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
55
35
|
col :shipping_address, visible: false
|
56
36
|
end
|
57
37
|
|
58
|
-
# col :state, label: 'State', search: { collection: EffectiveOrders::STATES.invert } do |order|
|
59
|
-
# EffectiveOrders::STATES[order.state]
|
60
|
-
# end
|
61
|
-
|
62
38
|
col :order_items, search: { as: :string }
|
63
39
|
|
64
40
|
col :subtotal, as: :price, visible: false
|
@@ -73,27 +49,31 @@ class EffectiveOrdersDatatable < Effective::Datatable
|
|
73
49
|
col :payment_provider, label: 'Provider', visible: false, search: { collection: EffectiveOrders.payment_providers }
|
74
50
|
col :payment_card, label: 'Card', visible: false
|
75
51
|
|
76
|
-
|
77
|
-
|
78
|
-
|
52
|
+
if EffectiveOrders.collect_note
|
53
|
+
col :note
|
54
|
+
end
|
79
55
|
|
80
|
-
|
56
|
+
col :note_to_buyer
|
81
57
|
|
82
|
-
|
58
|
+
actions_col partial: 'effective/orders/datatable_actions', partial_as: :order
|
83
59
|
end
|
84
60
|
|
85
61
|
collection do
|
86
|
-
scope = Effective::Order.
|
62
|
+
scope = Effective::Order.all.where(user: user).includes(:addresses, :order_items, :user)
|
87
63
|
|
88
64
|
if EffectiveOrders.orders_collection_scope.respond_to?(:call)
|
89
65
|
scope = EffectiveOrders.orders_collection_scope.call(scope)
|
90
66
|
end
|
91
67
|
|
92
|
-
if attributes[:
|
93
|
-
scope = scope.
|
68
|
+
if attributes[:not_purchased]
|
69
|
+
scope = scope.not_purchased
|
94
70
|
end
|
95
71
|
|
96
72
|
scope
|
97
73
|
end
|
98
74
|
|
75
|
+
def user
|
76
|
+
@user ||= User.find(attributes[:user_id])
|
77
|
+
end
|
78
|
+
|
99
79
|
end
|