shoppe 1.1.1 → 1.1.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 +6 -0
- data/app/assets/stylesheets/shoppe/application.scss +15 -4
- data/app/controllers/shoppe/application_controller.rb +2 -2
- data/app/controllers/shoppe/customers_controller.rb +10 -12
- data/app/models/shoppe/address.rb +14 -14
- data/app/models/shoppe/attachment.rb +9 -9
- data/app/models/shoppe/country.rb +14 -14
- data/app/models/shoppe/customer.rb +11 -8
- data/app/models/shoppe/delivery_service.rb +10 -10
- data/app/models/shoppe/delivery_service_price.rb +15 -15
- data/app/models/shoppe/order.rb +12 -9
- data/app/models/shoppe/order/actions.rb +15 -15
- data/app/models/shoppe/order/billing.rb +10 -10
- data/app/models/shoppe/order/delivery.rb +13 -13
- data/app/models/shoppe/order/states.rb +20 -20
- data/app/models/shoppe/order_item.rb +10 -10
- data/app/models/shoppe/payment.rb +7 -7
- data/app/models/shoppe/product.rb +24 -24
- data/app/models/shoppe/product/product_attributes.rb +5 -5
- data/app/models/shoppe/product/variants.rb +3 -3
- data/app/models/shoppe/product_attribute.rb +20 -20
- data/app/models/shoppe/product_category.rb +6 -6
- data/app/models/shoppe/setting.rb +13 -13
- data/app/models/shoppe/stock_level_adjustment.rb +5 -5
- data/app/models/shoppe/tax_rate.rb +16 -16
- data/app/models/shoppe/user.rb +13 -13
- data/app/uploaders/shoppe/attachment_uploader.rb +0 -1
- data/app/views/shoppe/customers/_addresses.html.haml +5 -5
- data/app/views/shoppe/customers/_form.html.haml +17 -10
- data/app/views/shoppe/customers/_search_form.html.haml +5 -5
- data/app/views/shoppe/customers/edit.html.haml +4 -4
- data/app/views/shoppe/customers/index.html.haml +11 -11
- data/app/views/shoppe/customers/new.html.haml +3 -3
- data/app/views/shoppe/customers/show.html.haml +11 -12
- data/app/views/shoppe/product_categories/index.html.haml +3 -2
- data/app/views/shoppe/variants/form.html.haml +0 -1
- data/config/locales/de.yml +58 -7
- data/config/locales/en.yml +38 -4
- data/config/locales/es-US.yml +656 -0
- data/config/locales/es.yml +372 -281
- data/config/locales/ru.yml +781 -0
- data/db/seeds.rb +113 -98
- data/lib/shoppe.rb +10 -10
- data/lib/shoppe/version.rb +1 -1
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0acd52b00e0edd053fa7d90446d5a9b556810b0
|
4
|
+
data.tar.gz: d98f37c7e28f5826f2e94858d74989a24acbac37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ed7c349f5f0a0a3c2fe8d4aa006412529663c6e33cb1f98865e3eff5de9a51f171d312b476ff01820a714334fe724fc9227c883f8ae58929213039d3122ceaf
|
7
|
+
data.tar.gz: e9b4983307d928a4cdad022d1de88aa00166634a4ef571ca90ba69a2f42720ac12a372c6cbfa919b6bf5e4487f0685a615c5581f7c20f444f99b34dc7b721e4e
|
data/README.md
CHANGED
@@ -3,15 +3,21 @@
|
|
3
3
|
Shoppe is an Rails-based e-commerce platform which allows you to easily introduce a
|
4
4
|
catalogue-based store into your Rails 4 applications.
|
5
5
|
|
6
|
+
[![Build Status](https://travis-ci.org/tryshoppe/shoppe.svg?branch=master)](https://travis-ci.org/tryshoppe/shoppe)
|
6
7
|
![GemVersion](https://badge.fury.io/rb/shoppe.png)
|
7
8
|
[![Code Climate](https://codeclimate.com/github/tryshoppe/core/badges/gpa.svg)](https://codeclimate.com/github/tryshoppe/core)
|
8
9
|
|
9
10
|
* [Check out the website](http://tryshoppe.com)
|
10
11
|
* [View the demo site](http://demo.tryshoppe.com)
|
12
|
+
* [Read the Getting Started guide](http://tryshoppe.com/docs/tutorials/getting-started)
|
11
13
|
* [Check out the demo site source](http://github.com/tryshoppe/example-store)
|
12
14
|
* [Read the release notes](https://github.com/tryshoppe/core/blob/master/CHANGELOG.md)
|
13
15
|
* [Read API documentation](http://api.tryshoppe.com)
|
14
16
|
|
17
|
+
## Is it any good?
|
18
|
+
|
19
|
+
[Yes](http://news.ycombinator.com/item?id=3067434)
|
20
|
+
|
15
21
|
## Features
|
16
22
|
|
17
23
|
* An attractive & easy to use admin interface with integrated authentication
|
@@ -425,11 +425,22 @@ header.main {
|
|
425
425
|
border:1px solid #DCE2EB;
|
426
426
|
padding:15px;
|
427
427
|
dl {
|
428
|
-
|
428
|
+
float:left;
|
429
429
|
dt { margin-bottom:4px; font-size:0.9em;color:#A9AEB5; font-weight:500;}
|
430
|
-
&.text {
|
431
|
-
|
432
|
-
|
430
|
+
&.text {
|
431
|
+
width: 37%;
|
432
|
+
margin-right: 2%;
|
433
|
+
}
|
434
|
+
|
435
|
+
&.amount {
|
436
|
+
min-width: 131px;
|
437
|
+
margin-right: 2%;
|
438
|
+
}
|
439
|
+
|
440
|
+
&.submit {
|
441
|
+
text-align: right;
|
442
|
+
margin-top: 15px;
|
443
|
+
}
|
433
444
|
}
|
434
445
|
}
|
435
446
|
p.notice {
|
@@ -27,7 +27,7 @@ module Shoppe
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def current_user
|
30
|
-
@current_user ||= login_from_session ||
|
30
|
+
@current_user ||= login_from_session || login_with_demo_mode || :false
|
31
31
|
end
|
32
32
|
|
33
33
|
def login_from_session
|
@@ -36,7 +36,7 @@ module Shoppe
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def login_with_demo_mode
|
40
40
|
if Shoppe.settings.demo_mode?
|
41
41
|
@user = User.first
|
42
42
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class CustomersController < Shoppe::ApplicationController
|
3
|
-
|
4
|
-
before_filter { @
|
5
|
-
before_filter { params[:id] && @customer = Shoppe::Customer.find(params[:id])}
|
3
|
+
before_filter { @active_nav = :customers }
|
4
|
+
before_filter { params[:id] && @customer = Shoppe::Customer.find(params[:id]) }
|
6
5
|
|
7
6
|
def index
|
8
7
|
@query = Shoppe::Customer.ordered.page(params[:page]).search(params[:q])
|
@@ -21,35 +20,34 @@ module Shoppe
|
|
21
20
|
def create
|
22
21
|
@customer = Shoppe::Customer.new(safe_params)
|
23
22
|
if @customer.save
|
24
|
-
redirect_to @customer, :
|
23
|
+
redirect_to @customer, flash: { notice: t('shoppe.customers.created_successfully') }
|
25
24
|
else
|
26
|
-
render :
|
25
|
+
render action: 'new'
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
def update
|
31
30
|
if @customer.update(safe_params)
|
32
|
-
redirect_to @customer, :
|
31
|
+
redirect_to @customer, flash: { notice: t('shoppe.customers.updated_successfully') }
|
33
32
|
else
|
34
|
-
render :
|
33
|
+
render action: 'edit'
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
37
|
def destroy
|
39
38
|
@customer.destroy
|
40
|
-
redirect_to customers_path, :
|
39
|
+
redirect_to customers_path, flash: { notice: t('shoppe.customers.deleted_successfully') }
|
41
40
|
end
|
42
41
|
|
43
42
|
def search
|
44
43
|
index
|
45
|
-
render :
|
44
|
+
render action: 'index'
|
46
45
|
end
|
47
46
|
|
48
47
|
private
|
49
|
-
|
48
|
+
|
50
49
|
def safe_params
|
51
50
|
params[:customer].permit(:first_name, :last_name, :company, :email, :phone, :mobile)
|
52
51
|
end
|
53
|
-
|
54
52
|
end
|
55
|
-
end
|
53
|
+
end
|
@@ -6,32 +6,32 @@ module Shoppe
|
|
6
6
|
|
7
7
|
# Set the table name
|
8
8
|
self.table_name = "shoppe_addresses"
|
9
|
-
|
9
|
+
|
10
10
|
# The customer which this address should be linked to
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# @return [Shoppe::Customer]
|
13
|
-
belongs_to :customer, :
|
14
|
-
|
13
|
+
belongs_to :customer, class_name: "Shoppe::Customer"
|
14
|
+
|
15
15
|
# The order which this address should be linked to
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# @return [Shoppe::Order]
|
18
|
-
belongs_to :order, :
|
18
|
+
belongs_to :order, class_name: "Shoppe::Order"
|
19
19
|
|
20
20
|
# The country which this address should be linked to
|
21
21
|
#
|
22
22
|
# @return [Shoppe::Country]
|
23
|
-
belongs_to :country, :
|
23
|
+
belongs_to :country, class_name: "Shoppe::Country"
|
24
24
|
|
25
25
|
# Validations
|
26
|
-
validates :address_type, :
|
27
|
-
validates :address1, :
|
28
|
-
validates :address3, :
|
29
|
-
validates :address4, :
|
30
|
-
validates :postcode, :
|
31
|
-
validates :country, :
|
26
|
+
validates :address_type, presence: true, inclusion: {in: TYPES}
|
27
|
+
validates :address1, presence: true
|
28
|
+
validates :address3, presence: true
|
29
|
+
validates :address4, presence: true
|
30
|
+
validates :postcode, presence: true
|
31
|
+
validates :country, presence: true
|
32
32
|
|
33
33
|
# All addresses ordered by their id asending
|
34
|
-
scope :ordered, -> { order(:
|
34
|
+
scope :ordered, -> { order(id: :desc)}
|
35
35
|
scope :default, -> { where(default: true)}
|
36
36
|
scope :billing, -> { where(address_type: "billing")}
|
37
37
|
scope :delivery, -> { where(address_type: "delivery")}
|
@@ -8,14 +8,14 @@ module Shoppe
|
|
8
8
|
mount_uploader :file, AttachmentUploader
|
9
9
|
|
10
10
|
# Relationships
|
11
|
-
belongs_to :parent, :
|
11
|
+
belongs_to :parent, polymorphic: true
|
12
12
|
|
13
13
|
# Validations
|
14
|
-
validates :file_name, :
|
15
|
-
validates :file_type, :
|
16
|
-
validates :file_size, :
|
17
|
-
validates :file, :
|
18
|
-
validates :token, :
|
14
|
+
validates :file_name, presence: true
|
15
|
+
validates :file_type, presence: true
|
16
|
+
validates :file_size, presence: true
|
17
|
+
validates :file, presence: true
|
18
|
+
validates :token, presence: true, uniqueness: true
|
19
19
|
|
20
20
|
# All attachments should have a token assigned to this
|
21
21
|
before_validation { self.token = SecureRandom.uuid if self.token.blank? }
|
@@ -31,7 +31,7 @@ module Shoppe
|
|
31
31
|
|
32
32
|
# Return the attachment for a given role
|
33
33
|
def self.for(role)
|
34
|
-
self.where(:
|
34
|
+
self.where(role: role).first
|
35
35
|
end
|
36
36
|
|
37
37
|
# Return the path to the attachment
|
@@ -43,6 +43,6 @@ module Shoppe
|
|
43
43
|
def image?
|
44
44
|
file_type.match(/\Aimage\//).present?
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
end
|
48
|
-
end
|
48
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
module Shoppe
|
2
|
-
|
2
|
+
|
3
3
|
# The Shoppe::Country model stores countries which can be used for delivery & billing
|
4
4
|
# addresses for orders.
|
5
5
|
#
|
6
|
-
# You can use the Shoppe::CountryImporter to import a pre-defined list of countries
|
7
|
-
# into your database. This automatically happens when you run the 'shoppe:setup'
|
6
|
+
# You can use the Shoppe::CountryImporter to import a pre-defined list of countries
|
7
|
+
# into your database. This automatically happens when you run the 'shoppe:setup'
|
8
8
|
# rake task.
|
9
|
-
|
9
|
+
|
10
10
|
class Country < ActiveRecord::Base
|
11
|
-
|
11
|
+
|
12
12
|
self.table_name = 'shoppe_countries'
|
13
|
-
|
13
|
+
|
14
14
|
# All orders which have this country set as their billing country
|
15
|
-
has_many :billed_orders, :
|
16
|
-
|
15
|
+
has_many :billed_orders, dependent: :restrict_with_exception, class_name: 'Shoppe::Order', foreign_key: 'billing_country_id'
|
16
|
+
|
17
17
|
# All orders which have this country set as their delivery country
|
18
|
-
has_many :delivered_orders, :
|
19
|
-
|
18
|
+
has_many :delivered_orders, dependent: :restrict_with_exception, class_name: 'Shoppe::Order', foreign_key: 'delivery_country_id'
|
19
|
+
|
20
20
|
# All countries ordered by their name asending
|
21
|
-
scope :ordered, -> { order(:
|
22
|
-
|
21
|
+
scope :ordered, -> { order(name: :asc) }
|
22
|
+
|
23
23
|
# Validations
|
24
|
-
validates :name, :
|
25
|
-
|
24
|
+
validates :name, presence: true
|
25
|
+
|
26
26
|
end
|
27
27
|
end
|
@@ -1,18 +1,21 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class Customer < ActiveRecord::Base
|
3
3
|
|
4
|
+
EMAIL_REGEX = /\A\b[A-Z0-9\.\_\%\-\+]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,6}\b\z/i
|
5
|
+
PHONE_REGEX = /\A[+?\d\ \-x\(\)]{7,}\z/
|
6
|
+
|
4
7
|
self.table_name = "shoppe_customers"
|
5
8
|
|
6
|
-
has_many :addresses, :
|
9
|
+
has_many :addresses, dependent: :restrict_with_exception, class_name: "Shoppe::Address"
|
7
10
|
|
8
|
-
has_many :orders, :
|
11
|
+
has_many :orders, dependent: :restrict_with_exception, class_name: "Shoppe::Order"
|
9
12
|
|
10
13
|
# Validations
|
11
|
-
validates :email, :
|
12
|
-
validates :phone, :
|
14
|
+
validates :email, presence: true, uniqueness: true, format: { with: EMAIL_REGEX}
|
15
|
+
validates :phone, presence: true, format: { with: PHONE_REGEX }
|
13
16
|
|
14
17
|
# All customers ordered by their ID desending
|
15
|
-
scope :ordered, -> { order(:
|
18
|
+
scope :ordered, -> { order(id: :desc)}
|
16
19
|
|
17
20
|
# The name of the customer in the format of "Company (First Last)" or if they don't have
|
18
21
|
# company specified, just "First Last".
|
@@ -29,13 +32,13 @@ module Shoppe
|
|
29
32
|
"#{first_name} #{last_name}"
|
30
33
|
end
|
31
34
|
|
32
|
-
def self.ransackable_attributes(auth_object = nil)
|
35
|
+
def self.ransackable_attributes(auth_object = nil)
|
33
36
|
["id", "first_name", "last_name", "company", "email", "phone", "mobile"] + _ransackers.keys
|
34
37
|
end
|
35
|
-
|
38
|
+
|
36
39
|
def self.ransackable_associations(auth_object = nil)
|
37
40
|
[]
|
38
41
|
end
|
39
42
|
|
40
43
|
end
|
41
|
-
end
|
44
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class DeliveryService < ActiveRecord::Base
|
3
|
-
|
3
|
+
|
4
4
|
self.table_name = 'shoppe_delivery_services'
|
5
5
|
|
6
6
|
# Validations
|
7
|
-
validates :name, :
|
8
|
-
validates :courier, :
|
9
|
-
|
7
|
+
validates :name, presence: true
|
8
|
+
validates :courier, presence: true
|
9
|
+
|
10
10
|
# Orders which are assigned to this delivery service
|
11
|
-
has_many :orders, :
|
12
|
-
|
11
|
+
has_many :orders, dependent: :restrict_with_exception, class_name: 'Shoppe::Order'
|
12
|
+
|
13
13
|
# Prices for the different levels of service within this delivery service
|
14
|
-
has_many :delivery_service_prices, :
|
15
|
-
|
14
|
+
has_many :delivery_service_prices, dependent: :destroy, class_name: 'Shoppe::DeliveryServicePrice'
|
15
|
+
|
16
16
|
# All active delivery services
|
17
|
-
scope :active, -> { where(:
|
18
|
-
|
17
|
+
scope :active, -> { where(active: true)}
|
18
|
+
|
19
19
|
# Returns a tracking URL for the passed order
|
20
20
|
#
|
21
21
|
# @param order [Shoppe::Order]
|
@@ -3,29 +3,29 @@ module Shoppe
|
|
3
3
|
|
4
4
|
# Set the table name
|
5
5
|
self.table_name = 'shoppe_delivery_service_prices'
|
6
|
-
|
6
|
+
|
7
7
|
include Shoppe::AssociatedCountries
|
8
|
-
|
8
|
+
|
9
9
|
# The delivery service which this price belongs to
|
10
|
-
belongs_to :delivery_service, :
|
11
|
-
|
10
|
+
belongs_to :delivery_service, class_name: 'Shoppe::DeliveryService'
|
11
|
+
|
12
12
|
# The tax rate which should be applied
|
13
|
-
belongs_to :tax_rate, :
|
14
|
-
|
13
|
+
belongs_to :tax_rate, class_name: "Shoppe::TaxRate"
|
14
|
+
|
15
15
|
# Validations
|
16
|
-
validates :code, :
|
17
|
-
validates :price, :
|
18
|
-
validates :cost_price, :
|
19
|
-
validates :min_weight, :
|
20
|
-
validates :max_weight, :
|
21
|
-
|
16
|
+
validates :code, presence: true
|
17
|
+
validates :price, numericality: true
|
18
|
+
validates :cost_price, numericality: true, allow_blank: true
|
19
|
+
validates :min_weight, numericality: true
|
20
|
+
validates :max_weight, numericality: true
|
21
|
+
|
22
22
|
# All prices ordered by their price ascending
|
23
|
-
scope :ordered, -> { order(:
|
24
|
-
|
23
|
+
scope :ordered, -> { order(price: :asc) }
|
24
|
+
|
25
25
|
# All prices which are suitable for the weight passed.
|
26
26
|
#
|
27
27
|
# @param weight [BigDecimal] the weight of the order
|
28
28
|
scope :for_weight, -> weight { where("min_weight <= ? AND max_weight >= ?", weight, weight) }
|
29
|
-
|
29
|
+
|
30
30
|
end
|
31
31
|
end
|
data/app/models/shoppe/order.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class Order < ActiveRecord::Base
|
3
3
|
|
4
|
+
EMAIL_REGEX = /\A\b[A-Z0-9\.\_\%\-\+]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,6}\b\z/i
|
5
|
+
PHONE_REGEX = /\A[+?\d\ \-x\(\)]{7,}\z/
|
6
|
+
|
4
7
|
self.table_name = 'shoppe_orders'
|
5
8
|
|
6
9
|
# Orders can have properties
|
@@ -13,21 +16,21 @@ module Shoppe
|
|
13
16
|
require_dependency 'shoppe/order/delivery'
|
14
17
|
|
15
18
|
# All items which make up this order
|
16
|
-
has_many :order_items, :
|
17
|
-
accepts_nested_attributes_for :order_items, :
|
19
|
+
has_many :order_items, dependent: :destroy, class_name: 'Shoppe::OrderItem', inverse_of: :order
|
20
|
+
accepts_nested_attributes_for :order_items, allow_destroy: true, reject_if: Proc.new { |a| a['ordered_item_id'].blank? }
|
18
21
|
|
19
22
|
# All products which are part of this order (accessed through the items)
|
20
|
-
has_many :products, :
|
23
|
+
has_many :products, through: :order_items, class_name: 'Shoppe::Product', source: :ordered_item, source_type: 'Shoppe::Product'
|
21
24
|
|
22
25
|
# The order can belong to a customer
|
23
|
-
belongs_to :customer, :
|
24
|
-
has_many :addresses, :
|
26
|
+
belongs_to :customer, class_name: 'Shoppe::Customer'
|
27
|
+
has_many :addresses, through: :customers, class_name: 'Shoppe::Address'
|
25
28
|
|
26
29
|
# Validations
|
27
|
-
validates :token, :
|
28
|
-
with_options :
|
29
|
-
order.validates :email_address, :
|
30
|
-
order.validates :phone_number, :
|
30
|
+
validates :token, presence: true
|
31
|
+
with_options if: Proc.new { |o| !o.building? } do |order|
|
32
|
+
order.validates :email_address, format: { with: EMAIL_REGEX }
|
33
|
+
order.validates :phone_number, format: { with: PHONE_REGEX }
|
31
34
|
end
|
32
35
|
|
33
36
|
# Set some defaults
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class Order < ActiveRecord::Base
|
3
|
-
|
3
|
+
|
4
4
|
extend ActiveModel::Callbacks
|
5
|
-
|
5
|
+
|
6
6
|
# These additional callbacks allow for applications to hook into other
|
7
7
|
# parts of the order lifecycle.
|
8
8
|
define_model_callbacks :confirmation, :acceptance, :rejection
|
9
|
-
|
10
|
-
# This method should be called by the base application when the user has completed their
|
9
|
+
|
10
|
+
# This method should be called by the base application when the user has completed their
|
11
11
|
# first round of entering details. This will mark the order as "confirming" which means
|
12
12
|
# the customer now just must confirm.
|
13
13
|
#
|
@@ -21,7 +21,7 @@ module Shoppe
|
|
21
21
|
false
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# This method should be executed by the application when the order should be completed
|
26
26
|
# by the customer. It will raise exceptions if anything goes wrong or return true if
|
27
27
|
# the order has been confirmed successfully
|
@@ -30,9 +30,9 @@ module Shoppe
|
|
30
30
|
def confirm!
|
31
31
|
no_stock_of = self.order_items.select(&:validate_stock_levels)
|
32
32
|
unless no_stock_of.empty?
|
33
|
-
raise Shoppe::Errors::InsufficientStockToFulfil, :
|
33
|
+
raise Shoppe::Errors::InsufficientStockToFulfil, order: self, out_of_stock_items: no_stock_of
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
run_callbacks :confirmation do
|
37
37
|
# If we have successfully charged the card (i.e. no exception) we can go ahead and mark this
|
38
38
|
# order as 'received' which means it can be accepted by staff.
|
@@ -45,14 +45,14 @@ module Shoppe
|
|
45
45
|
# Send an email to the customer
|
46
46
|
deliver_received_order_email
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
# We're all good.
|
50
50
|
true
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# Mark order as accepted
|
54
54
|
#
|
55
|
-
# @param user [Shoppe::User] the user who carried out this action
|
55
|
+
# @param user [Shoppe::User] the user who carried out this action
|
56
56
|
def accept!(user = nil)
|
57
57
|
run_callbacks :acceptance do
|
58
58
|
self.accepted_at = Time.now
|
@@ -63,7 +63,7 @@ module Shoppe
|
|
63
63
|
deliver_accepted_order_email
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
# Mark order as rejected
|
68
68
|
#
|
69
69
|
# @param user [Shoppe::User] the user who carried out the action
|
@@ -79,16 +79,16 @@ module Shoppe
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def deliver_accepted_order_email
|
82
|
-
Shoppe::OrderMailer.accepted(self).
|
82
|
+
Shoppe::OrderMailer.accepted(self).deliver
|
83
83
|
end
|
84
84
|
|
85
85
|
def deliver_rejected_order_email
|
86
|
-
Shoppe::OrderMailer.rejected(self).
|
86
|
+
Shoppe::OrderMailer.rejected(self).deliver
|
87
87
|
end
|
88
88
|
|
89
89
|
def deliver_received_order_email
|
90
|
-
Shoppe::OrderMailer.received(self).
|
90
|
+
Shoppe::OrderMailer.received(self).deliver
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
94
94
|
end
|