workarea-legacy_orders 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.eslintrc.json +35 -0
- data/.github/workflows/ci.yml +61 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +2 -0
- data/.stylelintrc.json +8 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +7 -0
- data/LICENSE +52 -0
- data/README.md +188 -0
- data/Rakefile +56 -0
- data/app/controllers/workarea/admin/legacy_orders_controller.rb +17 -0
- data/app/controllers/workarea/api/admin/legacy_orders_controller.rb +44 -0
- data/app/controllers/workarea/storefront/orders_controller.decorator +37 -0
- data/app/controllers/workarea/storefront/users/orders_controller.decorator +42 -0
- data/app/models/workarea/legacy_order/address.rb +28 -0
- data/app/models/workarea/legacy_order/item.rb +22 -0
- data/app/models/workarea/legacy_order/tender.rb +25 -0
- data/app/models/workarea/legacy_order.rb +58 -0
- data/app/models/workarea/search/admin/legacy_order.rb +80 -0
- data/app/queries/workarea/search/admin_legacy_orders.rb +33 -0
- data/app/seeds/workarea/legacy_orders_seeds.rb +112 -0
- data/app/view_models/workarea/admin/legacy_order_view_model.rb +12 -0
- data/app/view_models/workarea/storefront/legacy_order_item_view_model.rb +38 -0
- data/app/view_models/workarea/storefront/legacy_order_view_model.rb +37 -0
- data/app/view_models/workarea/storefront/user_view_model.decorator +23 -0
- data/app/views/workarea/admin/legacy_orders/_menu.html.haml +1 -0
- data/app/views/workarea/admin/legacy_orders/_summary.html.haml +7 -0
- data/app/views/workarea/admin/legacy_orders/index.html.haml +119 -0
- data/app/views/workarea/admin/legacy_orders/show.html.haml +108 -0
- data/app/views/workarea/admin/legacy_orders/tenders/_legacy_tender.html.haml +7 -0
- data/app/views/workarea/storefront/legacy_orders/_summary.html.haml +223 -0
- data/app/views/workarea/storefront/legacy_orders/show.html.haml +16 -0
- data/app/views/workarea/storefront/legacy_orders/tenders/_legacy_tender.html.haml +14 -0
- data/app/views/workarea/storefront/users/legacy_orders/show.html.haml +24 -0
- data/bin/rails +19 -0
- data/config/initializers/appends.rb +4 -0
- data/config/initializers/config.rb +4 -0
- data/config/locales/en.yml +16 -0
- data/config/routes.rb +19 -0
- data/doc/index.json +37 -0
- data/doc/legacy_orders/creating_a_legacy_order.json +44 -0
- data/doc/legacy_orders/listing_legacy_orders.json +56 -0
- data/doc/legacy_orders/showing_a_legacy_order.json +42 -0
- data/doc/legacy_orders/updating_a_legacy_order.json +40 -0
- data/lib/workarea/legacy_orders/engine.rb +17 -0
- data/lib/workarea/legacy_orders/version.rb +5 -0
- data/lib/workarea/legacy_orders.rb +11 -0
- data/package.json +9 -0
- data/script/admin_ci +9 -0
- data/script/ci +11 -0
- data/script/core_ci +9 -0
- data/script/plugins_ci +9 -0
- data/script/storefront_ci +9 -0
- data/test/documentation/workarea/api/legacy_orders_documentation_test.rb +81 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config/application.rb +25 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +23 -0
- data/test/dummy/config/initializers/session_store.rb +5 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/legacy_orders.rb +88 -0
- data/test/integration/workarea/api/admin/legacy_orders_integration_test.rb +59 -0
- data/test/integration/workarea/storefront/legacy_order_lookup_integration_test.rb +113 -0
- data/test/system/workarea/storefront/legacy_order_lookup_system_test.rb +21 -0
- data/test/system/workarea/storefront/order_history_system_test.rb +64 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +10 -0
- data/workarea-legacy_orders.gemspec +18 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 841ffe9b077193a86f4755a8e998cc14c4a4ba2de5ad978edb0bb72deb543132
|
4
|
+
data.tar.gz: ee329f6ad586fec610232775deda33d2f98281aa8a66fb9c0d063371fa411d5a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8b5c4c281f9423d079337de131fdba12bed00da7461075ada03fbe10ae1669cfa51af87159b715fd59058ad12a9f5f4a16b88e0352241d1de3db1b14acef342
|
7
|
+
data.tar.gz: 485da6e8964e4df4bff09b750cca381d0c2f289d8c0ba6aabd9100efec8c14ebd8b4d7969b1f987342f2aca35cbe25ffc36e18969e8c82acc76a5768111e8020
|
data/.editorconfig
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
charset = utf-8
|
6
|
+
indent_style = space
|
7
|
+
end_of_line = lf
|
8
|
+
trim_trailing_whitespace = true
|
9
|
+
insert_final_newline = true
|
10
|
+
|
11
|
+
[{*.rb,*.haml,*.decorator,*.yml,*.yaml,*.jbuilder}]
|
12
|
+
indent_size = 2
|
13
|
+
indent_style = space
|
14
|
+
|
15
|
+
[{*.js,*.jst,*.ejs,*.scss}]
|
16
|
+
indent_size = 4
|
17
|
+
|
18
|
+
[*.md]
|
19
|
+
indent_size = 4
|
20
|
+
trim_trailing_whitespace = false
|
data/.eslintrc.json
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"extends": "eslint:recommended",
|
3
|
+
"rules": {
|
4
|
+
"semi": ["error", "always"],
|
5
|
+
"eqeqeq": ["error", "always"]
|
6
|
+
},
|
7
|
+
"globals": {
|
8
|
+
"window": true,
|
9
|
+
"document": true,
|
10
|
+
"WORKAREA": true,
|
11
|
+
"$": true,
|
12
|
+
"jQuery": true,
|
13
|
+
"_": true,
|
14
|
+
"feature": true,
|
15
|
+
"JST": true,
|
16
|
+
"Turbolinks": true,
|
17
|
+
"I18n": true,
|
18
|
+
"Chart": true,
|
19
|
+
"Dropzone": true,
|
20
|
+
"strftime": true,
|
21
|
+
"Waypoint": true,
|
22
|
+
"wysihtml": true,
|
23
|
+
"LocalTime": true,
|
24
|
+
"describe": true,
|
25
|
+
"after": true,
|
26
|
+
"afterEach": true,
|
27
|
+
"before": true,
|
28
|
+
"beforeEach": true,
|
29
|
+
"it": true,
|
30
|
+
"expect": true,
|
31
|
+
"sinon": true,
|
32
|
+
"fixture": true,
|
33
|
+
"chai": true
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
paths-ignore:
|
5
|
+
- '.github/**'
|
6
|
+
- '**.md'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
static_analysis:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
- uses: workarea-commerce/ci/bundler-audit@v1
|
14
|
+
- uses: workarea-commerce/ci/rubocop@v1
|
15
|
+
- uses: workarea-commerce/ci/eslint@v1
|
16
|
+
with:
|
17
|
+
args: '**/*.js'
|
18
|
+
|
19
|
+
admin_tests:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v1
|
23
|
+
- uses: actions/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: 2.6.x
|
26
|
+
- uses: workarea-commerce/ci/test@v1
|
27
|
+
with:
|
28
|
+
command: bin/rails app:workarea:test:admin
|
29
|
+
|
30
|
+
core_tests:
|
31
|
+
runs-on: ubuntu-latest
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v1
|
34
|
+
- uses: actions/setup-ruby@v1
|
35
|
+
with:
|
36
|
+
ruby-version: 2.6.x
|
37
|
+
- uses: workarea-commerce/ci/test@v1
|
38
|
+
with:
|
39
|
+
command: bin/rails app:workarea:test:core
|
40
|
+
|
41
|
+
storefront_tests:
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
steps:
|
44
|
+
- uses: actions/checkout@v1
|
45
|
+
- uses: actions/setup-ruby@v1
|
46
|
+
with:
|
47
|
+
ruby-version: 2.6.x
|
48
|
+
- uses: workarea-commerce/ci/test@v1
|
49
|
+
with:
|
50
|
+
command: bin/rails app:workarea:test:storefront
|
51
|
+
|
52
|
+
plugins_tests:
|
53
|
+
runs-on: ubuntu-latest
|
54
|
+
steps:
|
55
|
+
- uses: actions/checkout@v1
|
56
|
+
- uses: actions/setup-ruby@v1
|
57
|
+
with:
|
58
|
+
ruby-version: 2.6.x
|
59
|
+
- uses: workarea-commerce/ci/test@v1
|
60
|
+
with:
|
61
|
+
command: bin/rails app:workarea:test:plugins
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
.bundle/
|
2
|
+
log/*.log
|
3
|
+
pkg/
|
4
|
+
test/dummy/log/*.log
|
5
|
+
test/dummy/node_modules/
|
6
|
+
test/dummy/yarn-error.log
|
7
|
+
test/dummy/tmp/
|
8
|
+
.DS_Store
|
9
|
+
.byebug_history
|
10
|
+
.bundle/
|
11
|
+
.sass-cache/
|
12
|
+
Gemfile.lock
|
13
|
+
pkg/
|
14
|
+
test/dummy/tmp/
|
15
|
+
test/dummy/public/
|
16
|
+
log/*.log
|
17
|
+
test/dummy/log/*.log
|
18
|
+
test/dummy/db/*.sqlite3
|
19
|
+
test/dummy/db/*.sqlite3-journal
|
20
|
+
node_modules
|
21
|
+
yarn.lock
|
22
|
+
yarn-error.log
|
23
|
+
package-lock.json
|
24
|
+
.rubocop-http*
|
data/.rubocop.yml
ADDED
data/.stylelintrc.json
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--files CHANGELOG.md
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
Workarea Legacy Orders 2.0.0 (2020-02-21)
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
* Update system test to not use Money object for string comparison
|
5
|
+
|
6
|
+
LEGACYORDERS-4
|
7
|
+
Matt Duffy
|
8
|
+
|
9
|
+
* Add data structure to README
|
10
|
+
|
11
|
+
LEGACYORDERS-3
|
12
|
+
Matt Duffy
|
13
|
+
|
14
|
+
* Add data fields to models for allowing storing additional information
|
15
|
+
|
16
|
+
Matt Duffy
|
17
|
+
|
18
|
+
* Update storefront view with legacy ordre specific appoint points
|
19
|
+
|
20
|
+
LEGACYORDERS-2
|
21
|
+
Matt Duffy
|
22
|
+
|
23
|
+
* Add import/export behavior to legacy orders admin UI
|
24
|
+
|
25
|
+
Matt Duffy
|
26
|
+
|
27
|
+
* Improve legacy order integration
|
28
|
+
|
29
|
+
* Add admin UI and searchability
|
30
|
+
* Add legacy orders in user account summary
|
31
|
+
* Update views and view models to align with regular orders
|
32
|
+
* Include legacy orders in order lookup
|
33
|
+
* Improve seeds
|
34
|
+
|
35
|
+
LEGACYORDERS-1
|
36
|
+
Matt Duffy
|
37
|
+
|
38
|
+
|
39
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
WebLinc
|
2
|
+
Business Source License
|
3
|
+
|
4
|
+
Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
|
5
|
+
|
6
|
+
Licensed Work: Workarea Commerce Platform
|
7
|
+
The Licensed Work is (c) 2019 WebLinc Corporation
|
8
|
+
|
9
|
+
Additional Use Grant:
|
10
|
+
You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
|
11
|
+
|
12
|
+
A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
|
13
|
+
|
14
|
+
For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
|
15
|
+
|
16
|
+
Change Date: 2019-08-20
|
17
|
+
|
18
|
+
Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
|
19
|
+
|
20
|
+
Terms
|
21
|
+
|
22
|
+
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
23
|
+
|
24
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
25
|
+
|
26
|
+
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
27
|
+
|
28
|
+
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
29
|
+
|
30
|
+
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
31
|
+
|
32
|
+
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
33
|
+
|
34
|
+
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
|
35
|
+
|
36
|
+
Covenants of Licensor
|
37
|
+
In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
38
|
+
|
39
|
+
To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
40
|
+
|
41
|
+
To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
|
42
|
+
|
43
|
+
To specify a Change Date.
|
44
|
+
|
45
|
+
Not to modify this License in any other way.
|
46
|
+
|
47
|
+
Notice
|
48
|
+
The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
49
|
+
|
50
|
+
For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
|
51
|
+
|
52
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
|
data/README.md
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
WebLinc Legacy Orders
|
2
|
+
================================================================================
|
3
|
+
|
4
|
+
Workarea Commerce platform plugin that enables the importing of orders from outside sources. Useful during the migration process from another system where you wish to preserve order data for customers.
|
5
|
+
|
6
|
+
Features
|
7
|
+
--------------------------------------------------------------------------------
|
8
|
+
|
9
|
+
* Display order history inline with Workarea order history for customers
|
10
|
+
* Supports order lookup behavior for guest orders
|
11
|
+
* Admin UI support for searching and browsing legacy orders
|
12
|
+
* Admin UI support for importing and exporting legacy orders
|
13
|
+
* Admin API Support for viewing legacy orders
|
14
|
+
|
15
|
+
Getting Started
|
16
|
+
--------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
Add the gem to your application's Gemfile:
|
19
|
+
|
20
|
+
# ...
|
21
|
+
gem 'workarea-legacy_orders'
|
22
|
+
# ...
|
23
|
+
|
24
|
+
Update your application's bundle.
|
25
|
+
|
26
|
+
cd path/to/application
|
27
|
+
bundle
|
28
|
+
|
29
|
+
Data Structure
|
30
|
+
--------------------------------------------------------------------------------
|
31
|
+
|
32
|
+
Legacy orders are structured to be a simplistic representation of order data as compared to real Workarea order data. This more basic data structure alleviates the need to recreate or work around missing data when importing from outside sources. A legacy order has its own model, with embedded documents for items, tenders, and addresses.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Workarea::LegacyOrder.create(
|
36
|
+
id: '012789',
|
37
|
+
email: 'customer@gmail.com',
|
38
|
+
customer_number: '0001031',
|
39
|
+
alternate_number: 'PO-85201',
|
40
|
+
placed_at: Time.parse('20/02/2020 20:20:20'),
|
41
|
+
status: 'shipped',
|
42
|
+
shipping_method: 'USPS Priority Mail',
|
43
|
+
shipping_total: 14.82.to_m,
|
44
|
+
tax_total: 8.94.to_m,
|
45
|
+
discount_total: -5.to_m,
|
46
|
+
total_price: 172.73.to_m,
|
47
|
+
data: {
|
48
|
+
tracking_number: '1Z0E85051951',
|
49
|
+
promo_codes: ['5OFF'],
|
50
|
+
token: 'b1946ac92492d2347c6235b4d2611184'
|
51
|
+
},
|
52
|
+
billing_address: {
|
53
|
+
first_name: 'Robert',
|
54
|
+
last_name: 'Clams',
|
55
|
+
street: '22 South 3rd St.',
|
56
|
+
street_2: 'Second Floor',
|
57
|
+
city: 'Philadelphia',
|
58
|
+
region: 'PA',
|
59
|
+
postal_code: '19106',
|
60
|
+
country: 'US'
|
61
|
+
},
|
62
|
+
shipping_address: {
|
63
|
+
first_name: 'Robert',
|
64
|
+
last_name: 'Clams',
|
65
|
+
street: '22 South 3rd St.',
|
66
|
+
street_2: 'Second Floor',
|
67
|
+
city: 'Philadelphia',
|
68
|
+
region: 'PA',
|
69
|
+
postal_code: '19106',
|
70
|
+
country: 'US'
|
71
|
+
},
|
72
|
+
items: [
|
73
|
+
{
|
74
|
+
name: 'Awesome T-Shirt',
|
75
|
+
sku: 'ATS001',
|
76
|
+
quantity: 1,
|
77
|
+
price: 24.99.to_m,
|
78
|
+
detail: {
|
79
|
+
'Color' => 'Black',
|
80
|
+
'Size' => 'Medium'
|
81
|
+
},
|
82
|
+
customizations: {
|
83
|
+
'custom text' => 'Clever Saying Goes Here'
|
84
|
+
},
|
85
|
+
status: 'pending'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: 'Fancy Pants',
|
89
|
+
sku: 'FP1337',
|
90
|
+
product_id: '00815291',
|
91
|
+
quantity: 2,
|
92
|
+
price: 128.98.to_m,
|
93
|
+
details: { 'Size' => '30x30' },
|
94
|
+
status: 'shipped'
|
95
|
+
}
|
96
|
+
],
|
97
|
+
tenders: [
|
98
|
+
{
|
99
|
+
type: 'gift card',
|
100
|
+
number: 'XXXXXXXX6681',
|
101
|
+
amount: 50.to_m
|
102
|
+
},
|
103
|
+
{
|
104
|
+
type: 'credit card',
|
105
|
+
number: 'XXXXXXXXXXXX1212',
|
106
|
+
amount: 122.73.to_m,
|
107
|
+
issuer: 'visa',
|
108
|
+
expiration_month: '11',
|
109
|
+
expiration_year: '2022',
|
110
|
+
data: { authorization_id: '1595263196681261473' }
|
111
|
+
}
|
112
|
+
]
|
113
|
+
)
|
114
|
+
```
|
115
|
+
|
116
|
+
### `Workarea::LegacyOrder`
|
117
|
+
|
118
|
+
| Field | |
|
119
|
+
|--|--|
|
120
|
+
|`_id` | To match a Workarea order, the ID of a `LegacyOrder` represents the order number displayed across the site. |
|
121
|
+
|`email` | *Required*. The email address associated to the order. |
|
122
|
+
|`customer_number` | Used to store a reference to the customer that placed the order. When looking for legacy orders for a user, Workarea will look to match the user's ID with this number. |
|
123
|
+
|`alternate_number` | Allows for the storage of other reference numbers other than ID. |
|
124
|
+
|`placed_at` | *Required*. When the order was placed. |
|
125
|
+
|`status` | The overall status of the order. |
|
126
|
+
|`shipping_method` | The name of the shipping method that was used for the order. |
|
127
|
+
|`shipping_total` | The total cost of shipping for the order. |
|
128
|
+
|`tax_total` | *Required*. The total cost of tax for the order. |
|
129
|
+
|`discount_total` | The total value of discounts for the order. |
|
130
|
+
|`total_price` | *Required*. The total cost of the entire order, including tax, shipping, and discounts. |
|
131
|
+
|`data` | A hash field that can be used to store other relevant data that you wish to preserve from orders imported to Workarea. |
|
132
|
+
| `billing_address`| An embedded document of the order's billing address. See `Workarea::LegacyOrder::Address` below.|
|
133
|
+
| `shipping_address`| An embedded document of the order's shipping address. See `Workarea::LegacyOrder::Address` below.|
|
134
|
+
| `items`| An embedded collection of items for the order. See `Workarea::LegacyOrder::Item` below.|
|
135
|
+
| `tenders`| An embedded collection of payment methods used for the order. See `Workarea::LegacyOrder::Tender` below.|
|
136
|
+
|
137
|
+
### `Workarea::LegacyOrder::Item`
|
138
|
+
|
139
|
+
| Field | |
|
140
|
+
|--|--|
|
141
|
+
| `name` | *Required*. The display name for the item. Often this will be the name of the product. |
|
142
|
+
| `sku` | *Required*. The unique identifier for the specific item. |
|
143
|
+
| `product_id` | The ID of the product. |
|
144
|
+
| `quantity` | *Required*. The quantity of this item that was purchased. |
|
145
|
+
| `price` | *Required*. The total price of the item. |
|
146
|
+
| `details` | A hash of options for the item. Often things like color and size. |
|
147
|
+
| `customizations` | A hash of values specified by the customer when being ordered, e.g. engravings. |
|
148
|
+
| `status` | The fulfillment status of the item. Can be any value, but suggested to be one of `pending`, `shipped`, or `canceled`. |
|
149
|
+
| `data` | A hash field that can be used to store other relevant data that you wish to preserve from the item imported to Workarea. |
|
150
|
+
|
151
|
+
### `Workarea::LegacyOrder::Tender`
|
152
|
+
|
153
|
+
| Field | |
|
154
|
+
|--|--|
|
155
|
+
| `type` | *Required*. The type of tender used, e.g. credit card, gift card, paypal, etc. |
|
156
|
+
| `number` | A number associated to the payment method. For credit card this would be an obfuscated number with the last four digits. |
|
157
|
+
| `amount` | *Required*. The amount charged to this tender. |
|
158
|
+
| `issuer` | For credit cards, the issuer of the card. |
|
159
|
+
| `expiration_month` | For credit cards, the month of expiration. |
|
160
|
+
| `expiration_year` | For credit cards, the year of expiration. |
|
161
|
+
| `data` | A hash field that can be used to store other relevant data that you wish to preserve from the tender imported to Workarea. |
|
162
|
+
|
163
|
+
### `Workarea::LegacyOrder::Address`
|
164
|
+
|
165
|
+
Legacy order address fields match fields for all other addresses in Workarea. The only exception is that legacy order addresses are not validated and allow for any number of fields to be blank if information is not available.
|
166
|
+
|
167
|
+
* `first_name`
|
168
|
+
* `last_name`
|
169
|
+
* `street`
|
170
|
+
* `street_2`
|
171
|
+
* `city`
|
172
|
+
* `company`
|
173
|
+
* `region`
|
174
|
+
* `postal_code`
|
175
|
+
* `country`
|
176
|
+
* `phone_number`
|
177
|
+
* `phone_extension`
|
178
|
+
|
179
|
+
|
180
|
+
Workarea Platform Documentation
|
181
|
+
--------------------------------------------------------------------------------
|
182
|
+
|
183
|
+
See [https://developer.workarea.com](https://developer.workarea.com) for Workarea platform documentation.
|
184
|
+
|
185
|
+
License
|
186
|
+
--------------------------------------------------------------------------------
|
187
|
+
|
188
|
+
Workarea Shopify Migration is released under the [Business Software License](LICENSE)
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
rdoc.title = 'Shopify Migration'
|
11
|
+
rdoc.options << '--line-numbers'
|
12
|
+
rdoc.rdoc_files.include('README.md')
|
13
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
17
|
+
load 'rails/tasks/engine.rake'
|
18
|
+
load 'rails/tasks/statistics.rake'
|
19
|
+
load 'workarea/changelog.rake'
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |t|
|
23
|
+
t.libs << 'lib'
|
24
|
+
t.libs << 'test'
|
25
|
+
t.pattern = 'test/**/*_test.rb'
|
26
|
+
t.verbose = false
|
27
|
+
end
|
28
|
+
task default: :test
|
29
|
+
|
30
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
31
|
+
require 'workarea/legacy_orders/version'
|
32
|
+
|
33
|
+
desc "Release version #{Workarea::LegacyOrders::VERSION} of the gem"
|
34
|
+
task :release do
|
35
|
+
Rake::Task['workarea:changelog'].execute
|
36
|
+
system 'git add CHANGELOG.md'
|
37
|
+
system 'git commit -m "Update CHANGELOG"'
|
38
|
+
|
39
|
+
system "git tag -a v#{Workarea::LegacyOrders::VERSION} -m 'Tagging #{Workarea::LegacyOrders::VERSION}'"
|
40
|
+
system 'git push origin HEAD --follow-tags'
|
41
|
+
|
42
|
+
system "gem build workarea-legacy_orders.gemspec"
|
43
|
+
system "gem push workarea-legacy_orders-#{Workarea::LegacyOrders::VERSION}.gem"
|
44
|
+
system "rm workarea-legacy_orders-#{Workarea::LegacyOrders::VERSION}.gem"
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Run the JavaScript tests'
|
48
|
+
ENV['TEASPOON_RAILS_ENV'] = File.expand_path('../test/dummy/config/environment', __FILE__)
|
49
|
+
task teaspoon: 'app:teaspoon'
|
50
|
+
|
51
|
+
desc 'Start a server at http://localhost:3000/teaspoon for JavaScript tests'
|
52
|
+
task :teaspoon_server do
|
53
|
+
Dir.chdir("test/dummy")
|
54
|
+
teaspoon_env = File.expand_path('../test/teaspoon_env.rb', __FILE__)
|
55
|
+
system "RAILS_ENV=test TEASPOON_ENV=#{teaspoon_env} rails s"
|
56
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Workarea
|
2
|
+
module Admin
|
3
|
+
class LegacyOrdersController < Admin::ApplicationController
|
4
|
+
def index
|
5
|
+
search = Search::AdminLegacyOrders.new(params)
|
6
|
+
@search = Admin::OrderSearchViewModel.new(search, view_model_options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@order = Admin::LegacyOrderViewModel.wrap(
|
11
|
+
LegacyOrder.find(params[:id]),
|
12
|
+
view_model_options
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Workarea
|
2
|
+
if Plugin.installed?("Workarea::Api")
|
3
|
+
module Api
|
4
|
+
module Admin
|
5
|
+
class LegacyOrdersController < Workarea::Api::Admin::ApplicationController
|
6
|
+
def index
|
7
|
+
@orders = LegacyOrder
|
8
|
+
.all
|
9
|
+
.order_by(sort_field => sort_direction)
|
10
|
+
.page(params[:page])
|
11
|
+
|
12
|
+
respond_with orders: @orders
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@order = LegacyOrder.create!(params[:order])
|
17
|
+
respond_with(
|
18
|
+
{ order: @order },
|
19
|
+
status: :created,
|
20
|
+
location: legacy_order_path(@order.id)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def show
|
25
|
+
@order = LegacyOrder.find(params[:id])
|
26
|
+
respond_with order: @order
|
27
|
+
end
|
28
|
+
|
29
|
+
def update
|
30
|
+
@order = LegacyOrder.find(params[:id])
|
31
|
+
@order.update_attributes!(params[:order])
|
32
|
+
respond_with order: @order
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def sort_field
|
38
|
+
params[:sort_by].presence || :placed_at
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::OrdersController, with: :legacy_orders do
|
3
|
+
def lookup
|
4
|
+
order = LegacyOrder.lookup(params[:order_id], params[:postal_code])
|
5
|
+
|
6
|
+
if order.present?
|
7
|
+
session[:legacy_lookup_order_id] = order.id
|
8
|
+
redirect_to order_path(order)
|
9
|
+
else
|
10
|
+
session[:legacy_lookup_order_id] = nil
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def show
|
16
|
+
if legacy_lookup_order.present? &&
|
17
|
+
legacy_lookup_order.id.to_s.downcase == params[:id].to_s.downcase
|
18
|
+
|
19
|
+
@order = Storefront::LegacyOrderViewModel.wrap(
|
20
|
+
@legacy_lookup_order,
|
21
|
+
view_model_options
|
22
|
+
)
|
23
|
+
|
24
|
+
render 'workarea/storefront/legacy_orders/show'
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def legacy_lookup_order
|
33
|
+
return nil unless session[:legacy_lookup_order_id].present?
|
34
|
+
@legacy_lookup_order ||= LegacyOrder.find(session[:legacy_lookup_order_id])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::Users::OrdersController, with: 'legacy_orders' do
|
3
|
+
def index
|
4
|
+
super
|
5
|
+
@orders += legacy_orders
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
model = LegacyOrder.find(params[:id]) rescue nil
|
10
|
+
|
11
|
+
if model.blank?
|
12
|
+
super
|
13
|
+
return
|
14
|
+
end
|
15
|
+
|
16
|
+
if model.email.downcase != current_user.email.downcase
|
17
|
+
render nothing: true, status: :forbidden and return
|
18
|
+
else
|
19
|
+
@order = Storefront::LegacyOrderViewModel.wrap(model)
|
20
|
+
render "workarea/storefront/users/legacy_orders/show"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def legacy_order_limit
|
27
|
+
Workarea.config.storefront_user_order_display_count - @orders.size
|
28
|
+
end
|
29
|
+
|
30
|
+
def legacy_order_models
|
31
|
+
return [] unless legacy_order_limit > 0
|
32
|
+
|
33
|
+
LegacyOrder
|
34
|
+
.for_email(current_user.email)
|
35
|
+
.limit(legacy_order_limit)
|
36
|
+
end
|
37
|
+
|
38
|
+
def legacy_orders
|
39
|
+
Storefront::LegacyOrderViewModel.wrap(legacy_order_models)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|