workarea-legacy_orders 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.eslintrc.json +35 -0
  4. data/.github/workflows/ci.yml +61 -0
  5. data/.gitignore +24 -0
  6. data/.rubocop.yml +2 -0
  7. data/.stylelintrc.json +8 -0
  8. data/.yardopts +1 -0
  9. data/CHANGELOG.md +39 -0
  10. data/Gemfile +7 -0
  11. data/LICENSE +52 -0
  12. data/README.md +188 -0
  13. data/Rakefile +56 -0
  14. data/app/controllers/workarea/admin/legacy_orders_controller.rb +17 -0
  15. data/app/controllers/workarea/api/admin/legacy_orders_controller.rb +44 -0
  16. data/app/controllers/workarea/storefront/orders_controller.decorator +37 -0
  17. data/app/controllers/workarea/storefront/users/orders_controller.decorator +42 -0
  18. data/app/models/workarea/legacy_order/address.rb +28 -0
  19. data/app/models/workarea/legacy_order/item.rb +22 -0
  20. data/app/models/workarea/legacy_order/tender.rb +25 -0
  21. data/app/models/workarea/legacy_order.rb +58 -0
  22. data/app/models/workarea/search/admin/legacy_order.rb +80 -0
  23. data/app/queries/workarea/search/admin_legacy_orders.rb +33 -0
  24. data/app/seeds/workarea/legacy_orders_seeds.rb +112 -0
  25. data/app/view_models/workarea/admin/legacy_order_view_model.rb +12 -0
  26. data/app/view_models/workarea/storefront/legacy_order_item_view_model.rb +38 -0
  27. data/app/view_models/workarea/storefront/legacy_order_view_model.rb +37 -0
  28. data/app/view_models/workarea/storefront/user_view_model.decorator +23 -0
  29. data/app/views/workarea/admin/legacy_orders/_menu.html.haml +1 -0
  30. data/app/views/workarea/admin/legacy_orders/_summary.html.haml +7 -0
  31. data/app/views/workarea/admin/legacy_orders/index.html.haml +119 -0
  32. data/app/views/workarea/admin/legacy_orders/show.html.haml +108 -0
  33. data/app/views/workarea/admin/legacy_orders/tenders/_legacy_tender.html.haml +7 -0
  34. data/app/views/workarea/storefront/legacy_orders/_summary.html.haml +223 -0
  35. data/app/views/workarea/storefront/legacy_orders/show.html.haml +16 -0
  36. data/app/views/workarea/storefront/legacy_orders/tenders/_legacy_tender.html.haml +14 -0
  37. data/app/views/workarea/storefront/users/legacy_orders/show.html.haml +24 -0
  38. data/bin/rails +19 -0
  39. data/config/initializers/appends.rb +4 -0
  40. data/config/initializers/config.rb +4 -0
  41. data/config/locales/en.yml +16 -0
  42. data/config/routes.rb +19 -0
  43. data/doc/index.json +37 -0
  44. data/doc/legacy_orders/creating_a_legacy_order.json +44 -0
  45. data/doc/legacy_orders/listing_legacy_orders.json +56 -0
  46. data/doc/legacy_orders/showing_a_legacy_order.json +42 -0
  47. data/doc/legacy_orders/updating_a_legacy_order.json +40 -0
  48. data/lib/workarea/legacy_orders/engine.rb +17 -0
  49. data/lib/workarea/legacy_orders/version.rb +5 -0
  50. data/lib/workarea/legacy_orders.rb +11 -0
  51. data/package.json +9 -0
  52. data/script/admin_ci +9 -0
  53. data/script/ci +11 -0
  54. data/script/core_ci +9 -0
  55. data/script/plugins_ci +9 -0
  56. data/script/storefront_ci +9 -0
  57. data/test/documentation/workarea/api/legacy_orders_documentation_test.rb +81 -0
  58. data/test/dummy/Rakefile +6 -0
  59. data/test/dummy/app/assets/config/manifest.js +4 -0
  60. data/test/dummy/app/assets/images/.keep +0 -0
  61. data/test/dummy/app/assets/javascripts/application.js +13 -0
  62. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  63. data/test/dummy/app/controllers/application_controller.rb +3 -0
  64. data/test/dummy/app/controllers/concerns/.keep +0 -0
  65. data/test/dummy/app/helpers/application_helper.rb +2 -0
  66. data/test/dummy/app/jobs/application_job.rb +2 -0
  67. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  68. data/test/dummy/app/models/concerns/.keep +0 -0
  69. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  70. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  71. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  72. data/test/dummy/bin/bundle +3 -0
  73. data/test/dummy/bin/rails +4 -0
  74. data/test/dummy/bin/rake +4 -0
  75. data/test/dummy/bin/setup +34 -0
  76. data/test/dummy/bin/update +29 -0
  77. data/test/dummy/config/application.rb +25 -0
  78. data/test/dummy/config/boot.rb +5 -0
  79. data/test/dummy/config/cable.yml +9 -0
  80. data/test/dummy/config/environment.rb +5 -0
  81. data/test/dummy/config/environments/development.rb +54 -0
  82. data/test/dummy/config/environments/production.rb +86 -0
  83. data/test/dummy/config/environments/test.rb +44 -0
  84. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  85. data/test/dummy/config/initializers/assets.rb +11 -0
  86. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  88. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  89. data/test/dummy/config/initializers/inflections.rb +16 -0
  90. data/test/dummy/config/initializers/mime_types.rb +4 -0
  91. data/test/dummy/config/initializers/new_framework_defaults.rb +23 -0
  92. data/test/dummy/config/initializers/session_store.rb +5 -0
  93. data/test/dummy/config/initializers/workarea.rb +5 -0
  94. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  95. data/test/dummy/config/locales/en.yml +23 -0
  96. data/test/dummy/config/puma.rb +47 -0
  97. data/test/dummy/config/routes.rb +6 -0
  98. data/test/dummy/config/secrets.yml +22 -0
  99. data/test/dummy/config/spring.rb +6 -0
  100. data/test/dummy/config.ru +5 -0
  101. data/test/dummy/db/seeds.rb +2 -0
  102. data/test/dummy/lib/assets/.keep +0 -0
  103. data/test/dummy/log/.keep +0 -0
  104. data/test/factories/legacy_orders.rb +88 -0
  105. data/test/integration/workarea/api/admin/legacy_orders_integration_test.rb +59 -0
  106. data/test/integration/workarea/storefront/legacy_order_lookup_integration_test.rb +113 -0
  107. data/test/system/workarea/storefront/legacy_order_lookup_system_test.rb +21 -0
  108. data/test/system/workarea/storefront/order_history_system_test.rb +64 -0
  109. data/test/teaspoon_env.rb +6 -0
  110. data/test/test_helper.rb +10 -0
  111. data/workarea-legacy_orders.gemspec +18 -0
  112. metadata +173 -0
@@ -0,0 +1,108 @@
1
+ - @page_title = @order.name
2
+
3
+ .view
4
+ .view__header
5
+ .grid.grid--center
6
+ .grid__cell.grid__cell--50
7
+ .view__heading
8
+ = link_to_index_for(@order)
9
+ %h1= @order.name
10
+
11
+
12
+ .view__container.view__container--narrow
13
+ .section
14
+ .grid
15
+ .grid__cell.grid__cell--25
16
+ %h2= t('workarea.admin.orders.attributes.checkout.title')
17
+
18
+ .section
19
+ %ul.list-reset
20
+ %li
21
+ %strong= t('workarea.admin.legacy_orders.show.email')
22
+ = @order.email
23
+ - if @order.customer_number.present?
24
+ %li
25
+ %strong= t('workarea.admin.legacy_orders.show.customer_number')
26
+ = @order.customer_number
27
+ %li
28
+ %strong= t('workarea.admin.orders.attributes.checkout.status')
29
+ = @order.status.to_s.titleize
30
+ %li
31
+ %strong= t('workarea.admin.orders.attributes.checkout.placed')
32
+ - if @order.placed?
33
+ = local_time_ago(@order.placed_at)
34
+ %li
35
+ %strong= t('workarea.admin.fields.updated_at')
36
+ #{local_time_ago(@order.updated_at)}
37
+ %li
38
+ %strong= t('workarea.admin.fields.created_at')
39
+ #{local_time_ago(@order.created_at)}
40
+ = append_partials('admin.legacy_order_attributes', order: @order)
41
+
42
+ .section
43
+ %h3= t('workarea.admin.legacy_orders.show.shipping_address')
44
+ %p= formatted_address(@order.shipping_address)
45
+
46
+ .section
47
+ %h3= t('workarea.admin.legacy_orders.show.billing_address')
48
+ %p= formatted_address(@order.billing_address)
49
+
50
+ .section
51
+ %h3= t('workarea.admin.legacy_orders.show.tenders')
52
+ %ul.list-reset
53
+ - @order.tenders.each do |tender|
54
+ = render "workarea/admin/legacy_orders/tenders/#{tender.slug}", tender: tender
55
+
56
+ .grid__cell.grid__cell--75
57
+ %h2= t('workarea.admin.orders.attributes.items.title')
58
+ %table
59
+ %thead
60
+ %tr
61
+ %th= t('workarea.admin.orders.attributes.items.product')
62
+ %th.align-center= t('workarea.admin.orders.attributes.items.quantity')
63
+ %th.align-right= t('workarea.admin.orders.attributes.items.pricing')
64
+ %tbody
65
+ - @order.items.each do |item|
66
+ %tr
67
+ %td
68
+ .grid.grid--auto
69
+ .grid__cell
70
+ - if item.product.present?
71
+ = link_to image_tag(product_image_url(item.image, :small), alt: item.product.name), catalog_product_url(item.product, sku: item.sku)
72
+ - else
73
+ = image_tag(product_image_url(item.image, :small), alt: item.product_name)
74
+ .grid__cell
75
+ %p
76
+ - if item.product.present?
77
+ = link_to item.product_name, catalog_product_path(item.product, sku: item.sku)
78
+ - else
79
+ = item.product_name
80
+ %p= item.sku
81
+ - if item.customizations.any?
82
+ - item.customizations.each do |name, value|
83
+ %p #{name.titleize}: #{value}
84
+ = append_partials('admin.legacy_order_attributes_item_details', item: item)
85
+ %td.align-center= item.quantity
86
+ %td.align-right= number_to_currency item.price
87
+
88
+ .grid.grid--right
89
+ .grid__cell.grid__cell--50
90
+ %table.data-pairs
91
+ %tbody
92
+ %tr
93
+ %th
94
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.subtotal')
95
+ %td= number_to_currency @order.subtotal_price
96
+ %tr
97
+ %th
98
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.shipping')
99
+ %td= number_to_currency @order.shipping_total
100
+ %tr
101
+ %th
102
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.tax')
103
+ %td= number_to_currency @order.tax_total
104
+ %tr
105
+ %th
106
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_price')
107
+ %td
108
+ %strong= number_to_currency @order.total_price
@@ -0,0 +1,7 @@
1
+ %li
2
+ - if tender.issuer.present?
3
+ = credit_card_issuer_icon(card_icon_name(tender.issuer))
4
+ - else
5
+ = tender.type.titleize
6
+ = t('workarea.admin.legacy_orders.show.ending_with', number: tender.number.slice(-4..-1))
7
+ %strong= number_to_currency tender.amount
@@ -0,0 +1,223 @@
1
+ .order-summary
2
+ .box
3
+ .box__header
4
+ .grid.grid--middle.grid--auto.grid--large
5
+ .grid__cell
6
+ %h2.box__heading #{t('workarea.storefront.orders.order')} ##{order.id}
7
+ .grid__cell
8
+ %strong
9
+ #{t('workarea.storefront.orders.placed_at')}:
10
+ = local_time(order.placed_at, '%B %e, %Y')
11
+ .grid__cell
12
+ %strong
13
+ #{t('workarea.storefront.orders.status')}:
14
+ = order.fulfillment_status || order.status
15
+ = append_partials('storefront.legacy_order_summary_header', order: order, show_fullfillment: local_assigns[:show_fullfillment])
16
+ .box__body
17
+ .grid
18
+ .grid__cell.grid__cell--25-at-medium
19
+ %h3= t('workarea.storefront.orders.billing_address')
20
+ = formatted_address(order.billing_address)
21
+
22
+ .grid__cell.grid__cell--25-at-medium
23
+ %h3= t('workarea.storefront.orders.payment_method')
24
+ - order.tenders.each do |tender|
25
+ = render "workarea/storefront/legacy_orders/tenders/#{tender.slug}", tender: tender
26
+
27
+ .grid__cell.grid__cell--25-at-medium
28
+ %h3= t('workarea.storefront.orders.items')
29
+ %ol
30
+ - order.items.each do |item|
31
+ %li
32
+ %p
33
+ - if item.product.present?
34
+ = link_to item.product_name, product_path(item.product, sku: item.sku)
35
+ - else
36
+ = item.product_name
37
+
38
+ - if item.quantity > 1
39
+ %br
40
+ %strong #{t('workarea.storefront.orders.quantity')}: #{item.quantity}
41
+ %br
42
+ %strong= number_to_currency(item.total_price)
43
+ %br
44
+ = item.sku
45
+ %br
46
+ - if item.has_options?
47
+ - item.details.each do |name, value|
48
+ #{name.titleize}: #{value}
49
+ %br
50
+ - item.customizations.each do |name, value|
51
+ #{name.titleize}: #{value}
52
+ %br
53
+ - if item.token&.enabled?
54
+ = link_to t('workarea.storefront.orders.download'), download_path(item.token)
55
+ = append_partials('storefront.legacy_order_summary_item_details', item: item)
56
+
57
+ .grid__cell.grid__cell--25-at-medium
58
+ %h3= t('workarea.storefront.orders.totals')
59
+ %table.table.table--totals
60
+ %tbody
61
+ %tr
62
+ %th
63
+ %span #{t('workarea.storefront.orders.subtotal')}:
64
+ %td= number_to_currency(order.subtotal_price)
65
+
66
+ - if order.requires_shipping?
67
+ %tr
68
+ %th
69
+ %span #{t('workarea.storefront.orders.shipping')}:
70
+ %td= number_to_currency(order.shipping_total)
71
+
72
+ - if order.discount_total.to_m.positive?
73
+ %tr
74
+ %th
75
+ %span #{t('workarea.storefront.orders.discounts')}:
76
+ %td= number_to_currency(order.discount_total)
77
+
78
+ %tr
79
+ %th
80
+ %span #{t('workarea.storefront.orders.tax')}:
81
+ %td= number_to_currency(order.tax_total)
82
+
83
+ = append_partials('storefront.legacy_order_summary_payment', order: order)
84
+
85
+ %tr.table__total
86
+ %th
87
+ %span
88
+ %strong #{t('workarea.storefront.orders.total')}:
89
+ %td
90
+ %strong= number_to_currency(order.total_price)
91
+
92
+ = append_partials('storefront.legacy_orders_summary_top', order: order)
93
+
94
+ - if order.requires_shipping?
95
+ .box
96
+ .box__header
97
+ %h2.box__heading= t('workarea.storefront.orders.shipping')
98
+ .box__body
99
+ .grid
100
+ .grid__cell.grid__cell--33-at-medium
101
+ = formatted_address(order.shipping_address)
102
+
103
+ - if order.shipping_method.present?
104
+ %strong= order.shipping_method
105
+
106
+ .grid__cell.grid__cell--66-at-medium
107
+ - if order.shipped_items.present?
108
+ %ul.product-list
109
+ - order.shipped_items.each do |item|
110
+ %li.product-list__item
111
+ .product-list__item-cell
112
+ .product-list__summary
113
+ %p.product-list__media
114
+ - if item.product.present?
115
+ = link_to image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
116
+ - else
117
+ = image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image')
118
+ .product-list__info
119
+ - if item.product.present?
120
+ %p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
121
+ %p.product-list__id= item.sku_name
122
+ - else
123
+ %p.product-list__name= item.product_name
124
+ - if item.has_options?
125
+ .product-list__option-group
126
+ - item.details.each do |name, value|
127
+ %p.product-list__option #{name.titleize}: #{value}
128
+ - item.customizations.each do |name, value|
129
+ %p.product-list__customization #{name.titleize}: #{value}
130
+ = append_partials('storefront.legacy_order_summary_item_details', item: item)
131
+ .product-list__item-cell
132
+ %table.table
133
+ %thead
134
+ %tr
135
+ %th.table__quantity= t('workarea.storefront.orders.quantity')
136
+ %tbody
137
+ %tr
138
+ %td.table__quantity
139
+ %p= item.quantity
140
+
141
+ - if order.pending_items.any? && (!local_assigns.key?(:show_fullfillment) || show_fullfillment)
142
+ .box
143
+ .box__header
144
+ %h3.box__heading= t('workarea.storefront.orders.pending')
145
+ .box__body
146
+ %ul.product-list
147
+ - order.pending_items.each do |item|
148
+ %li.product-list__item
149
+ .product-list__item-cell
150
+ .product-list__summary
151
+ %p.product-list__media
152
+ - if item.product.present?
153
+ = link_to image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
154
+ - else
155
+ = image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image')
156
+ .product-list__info
157
+ - if item.product.present?
158
+ %p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
159
+ %p.product-list__id= item.sku
160
+ - else
161
+ %p.product-list__name= item.product_name
162
+
163
+ %p.product-list__quantity #{t('workarea.storefront.orders.quantity')}: #{item.quantity}
164
+
165
+ - if order.refunds.any? && (!local_assigns.key?(:show_fullfillment) || show_fullfillment)
166
+ .box
167
+ .box__header
168
+ %h2.box__heading= t('workarea.storefront.orders.refunds')
169
+ .box__body
170
+ - order.refunds.each do |refund|
171
+ %ul
172
+ - refund.tenders.each do |tender, amount|
173
+ %li
174
+ = t('workarea.storefront.orders.issued')
175
+ = local_time(refund.created_at, :short_date_at_time)
176
+ = t('workarea.storefront.orders.refund_description_html', type: tender.name.downcase, amount: number_to_currency(amount))
177
+
178
+ - if order.canceled_items.any? && (!local_assigns.key?(:show_fullfillment) || show_fullfillment)
179
+ .box
180
+ .box__header
181
+ %h2.box__heading= t('workarea.storefront.orders.cancelations')
182
+ .box__body
183
+ %ul.product-list
184
+ - order.canceled_items.each do |item|
185
+ %li.product-list__item
186
+ .product-list__item-cell
187
+ .product-list__summary
188
+ %p.product-list__media
189
+ - if item.product.present?
190
+ = link_to image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image'), product_url(item.product, sku: item.sku), class: 'product-list__media-link'
191
+ - else
192
+ = image_tag(product_image_url(item.image, :small_thumb), alt: item.product_name, class: 'product-list__media-image')
193
+ .product-list__info
194
+ - if item.product.present?
195
+ %p.product-list__name= link_to item.product_name, product_path(item.product, sku: item.sku)
196
+ %p.product-list__id= item.sku
197
+ - else
198
+ %p.product-list__name= item.product_name
199
+
200
+ %p.product-list__quantity #{t('workarea.storefront.orders.quantity')}: #{item.quantity}
201
+
202
+ = append_partials('storefront.legacy_orders_summary_bottom', order: order)
203
+
204
+ - if local_assigns[:recommendations].present?
205
+ .hidden.hidden--for-small-only
206
+ .recommendations
207
+ %h2.recommendations__heading= t('workarea.storefront.recommendations.you_may_also_like')
208
+ .recommendations__products
209
+ .grid
210
+ - recommendations.each do |product|
211
+ .grid__cell.grid__cell--50.grid__cell--33-at-medium.grid__cell--16-at-wide
212
+ .product-summary.product-summary--small
213
+ = render 'workarea/storefront/products/summary', product: product
214
+
215
+ %ul.order-help-menu
216
+ %li.order-help-menu__item
217
+ = link_to t('workarea.storefront.layouts.contact_us'), contact_path, data: { dialog_button: '' }
218
+ %li.order-help-menu__item
219
+ = link_to page_path('shipping-information'), target: '_blank', rel: 'noopener', data: { dialog_button: '' } do
220
+ = t('workarea.storefront.layouts.shipping_policy')
221
+ %li.order-help-menu__item
222
+ = link_to page_path('return-information'), target: '_blank', rel: 'noopener', data: { dialog_button: '' } do
223
+ = t('workarea.storefront.layouts.returns')
@@ -0,0 +1,16 @@
1
+ - @title = @order.id
2
+
3
+ - content_for :breadcrumbs do
4
+ %p.breadcrumbs__node-group
5
+ %span.breadcrumbs__node
6
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home', class: 'breadcrumbs__link'
7
+ %span.breadcrumbs__node
8
+ = link_to t('workarea.storefront.orders.order_status'), check_orders_path, class: 'breadcrumbs__link'
9
+ %span.breadcrumbs__node
10
+ %span.breadcrumbs__text #{t('workarea.storefront.orders.order')} #{@order.id}
11
+
12
+ .view
13
+
14
+ %h1.visually-hidden= @order.id
15
+
16
+ = render 'workarea/storefront/legacy_orders/summary', order: @order
@@ -0,0 +1,14 @@
1
+ .data-card
2
+ .data-card__cell
3
+ - if tender.issuer.present?
4
+ %p.data-card__line.data-card__credit-card
5
+ = credit_card_issuer_icon(card_icon_name(tender.issuer))
6
+ %span.data-card__credit-card-number
7
+ = t('workarea.storefront.credit_cards.summary', issuer: tender.issuer.titleize, number: tender.number.slice(-4..-1))
8
+ - elsif tender.number.present?
9
+ %p.data-card__line= t('workarea.storefront.credit_cards.summary', issuer: tender.type.titleize, number: tender.number.slice(-4..-1))
10
+ - else
11
+ %p.data-card__line= tender.type.titleize
12
+ %p.data-card__line
13
+ %strong
14
+ #{t('workarea.storefront.orders.amount')}: #{number_to_currency(tender.amount)}
@@ -0,0 +1,24 @@
1
+ - @title = @order.id
2
+
3
+ - content_for :breadcrumbs do
4
+ %p.breadcrumbs__node-group
5
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
6
+ = link_to t('workarea.storefront.layouts.home'), root_path, rel: 'home'
7
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }
8
+ = link_to t('workarea.storefront.orders.order_status'), check_orders_path
9
+ %span.breadcrumbs__node{ itemprop: 'breadcrumb' }= @order.id
10
+
11
+ .view
12
+
13
+ %h1= @order.id
14
+
15
+ %table.table
16
+ %tbody
17
+ %tr
18
+ %th= t('workarea.storefront.orders.placed_at')
19
+ %td= local_time(@order.placed_at, :short_date_at_time)
20
+ %tr
21
+ %th= t('workarea.storefront.orders.status')
22
+ %td= @order.fulfillment_status
23
+
24
+ = render 'workarea/storefront/legacy_orders/summary', order: @order
data/bin/rails ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path("../..", __FILE__)
6
+ ENGINE_PATH = File.expand_path("../../lib/workarea/legacy_orders/engine", __FILE__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
10
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
11
+
12
+ require "action_controller/railtie"
13
+ require "action_view/railtie"
14
+ require "action_mailer/railtie"
15
+ require "rails/test_unit/railtie"
16
+ require "sprockets/railtie"
17
+ require "teaspoon-mocha"
18
+
19
+ require "rails/engine/commands"
@@ -0,0 +1,4 @@
1
+ Workarea.append_partials(
2
+ 'admin.orders_menu',
3
+ 'workarea/admin/legacy_orders/menu'
4
+ )
@@ -0,0 +1,4 @@
1
+ Workarea.configure do |config|
2
+ config.seeds.insert_after("Workarea::OrdersSeeds", "Workarea::LegacyOrdersSeeds")
3
+ config.jump_to_navigation['Legacy Orders'] = :legacy_orders_path
4
+ end
@@ -0,0 +1,16 @@
1
+ en:
2
+ workarea:
3
+ admin:
4
+ legacy_orders:
5
+ index:
6
+ title: Legacy Orders
7
+ show:
8
+ billing_address: Billing Address
9
+ customer_number: 'Customer Number:'
10
+ email: 'Email:'
11
+ shipping_address: Shipping Address
12
+ tenders: Tenders
13
+ ending_with: ending with %{number}
14
+ shared:
15
+ primary_nav:
16
+ legacy_orders: Legacy Orders
data/config/routes.rb ADDED
@@ -0,0 +1,19 @@
1
+ Workarea::Storefront::Engine.routes.draw do
2
+ scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
3
+ namespace :users do
4
+ resources :legacy_orders, only: [:show]
5
+ end
6
+ end
7
+ end
8
+
9
+ Workarea::Admin::Engine.routes.draw do
10
+ scope '(:locale)', constraints: Workarea::I18n.routes_constraint do
11
+ resources :legacy_orders, only: [:index, :show]
12
+ end
13
+ end
14
+
15
+ if Workarea::Plugin.installed?("Workarea::Api")
16
+ Workarea::Api::Admin::Engine.routes.draw do
17
+ resources :legacy_orders, except: %i[new edit destroy]
18
+ end
19
+ end
data/doc/index.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "resources": [
3
+ {
4
+ "name": "Legacy Orders",
5
+ "examples": [
6
+ {
7
+ "description": "Listing legacy orders",
8
+ "link": "legacy_orders/listing_legacy_orders.json",
9
+ "groups": "all",
10
+ "route": "/api/legacy_orders",
11
+ "method": "get"
12
+ },
13
+ {
14
+ "description": "Creating a legacy order",
15
+ "link": "legacy_orders/creating_a_legacy_order.json",
16
+ "groups": "all",
17
+ "route": "/api/legacy_orders",
18
+ "method": "post"
19
+ },
20
+ {
21
+ "description": "Showing a legacy order",
22
+ "link": "legacy_orders/showing_a_legacy_order.json",
23
+ "groups": "all",
24
+ "route": "api/legacy_orders/:id",
25
+ "method": "get"
26
+ },
27
+ {
28
+ "description": "Updating a legacy order",
29
+ "link": "legacy_orders/updating_a_legacy_order.json",
30
+ "groups": "all",
31
+ "route": "api/legacy_orders/:id",
32
+ "method": "patch"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "resource": "Legacy Orders",
3
+ "http_method": "POST",
4
+ "route": "/api/legacy_orders",
5
+ "description": "Creating a legacy order",
6
+ "explanation": null,
7
+ "parameters": [
8
+
9
+ ],
10
+ "response_fields": [
11
+
12
+ ],
13
+ "requests": [
14
+ {
15
+ "request_method": "POST",
16
+ "request_path": "/api/legacy_orders",
17
+ "request_body": "{\"order\":{\"alternate_number\":\"O5678\",\"billing_address\":{\"city\":\"Philadelphia\",\"company\":null,\"country\":\"US\",\"name\":\"Eric Pigeon\",\"phone_extension\":null,\"phone_number\":null,\"postal_code\":\"19106\",\"region\":\"PA\",\"street\":\"12 N. 3rd St\",\"street_2\":null},\"customer_number\":\"1234\",\"email\":\"epigeon@workarea.com\",\"items\":[{\"customizations\":null,\"details\":{\"size\":\"Medium\",\"color\":\"Charcoal\"},\"name\":\"City Pigeon - Medium\",\"price\":{\"cents\":3200.0,\"currency_iso\":\"USD\"},\"quantity\":2,\"sku\":\"1410411-025\"},{\"customizations\":{\"line_1\":\"Eric\",\"line_2\":\"Rodriguez\",\"font_style\":\"Block\"},\"details\":{\"material\":\"Brass\"},\"name\":\"Brass Name Plate\",\"price\":{\"cents\":1299.0,\"currency_iso\":\"USD\"},\"quantity\":1,\"sku\":\"22370\"}],\"number\":\"W1234\",\"placed_at\":\"2016-04-13T16:47:05.433-04:00\",\"shipping_address\":{\"city\":\"Philadelphia\",\"company\":null,\"country\":\"US\",\"name\":\"Eric Pigeon\",\"phone_extension\":null,\"phone_number\":\"215.925.1800\",\"postal_code\":\"19106\",\"region\":\"PA\",\"street\":\"12 N. 3rd St\",\"street_2\":null},\"shipping_method\":\"USPS\",\"shipping_total\":{\"cents\":599.0,\"currency_iso\":\"USD\"},\"status\":\"Shipped\",\"tax_total\":{\"cents\":271.0,\"currency_iso\":\"USD\"},\"tenders\":[{\"amount\":{\"cents\":2500.0,\"currency_iso\":\"USD\"},\"expiration_month\":null,\"expiration_year\":null,\"number\":\"XXXX1234\",\"type\":\"Gift Card\"},{\"amount\":{\"cents\":2869.0,\"currency_iso\":\"USD\"},\"expiration_month\":\"12\",\"expiration_year\":\"2017\",\"number\":\"XXXXXXXXXXXX1111\",\"type\":\"VISA\"}],\"total_price\":{\"cents\":5369.0,\"currency_iso\":\"USD\"}}}",
18
+ "request_headers": {
19
+ "Content-Type": "application/json"
20
+ },
21
+ "request_query_parameters": {
22
+ },
23
+ "request_content_type": "application/json",
24
+ "response_status": 201,
25
+ "response_status_text": "Created",
26
+ "response_body": "{\n \"order\": {\n \"_id\": \"570eb049657269e1ee00001d\",\n \"alternate_number\": \"O5678\",\n \"billing_address\": {\n \"_id\": \"570eb049657269e1ee000020\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": null,\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"customer_number\": \"1234\",\n \"email\": \"epigeon@workarea.com\",\n \"items\": [\n {\n \"_id\": \"570eb049657269e1ee00001e\",\n \"customizations\": null,\n \"details\": {\n \"size\": \"Medium\",\n \"color\": \"Charcoal\"\n },\n \"name\": \"City Pigeon - Medium\",\n \"price\": {\n \"cents\": 3200.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 2,\n \"sku\": \"1410411-025\"\n },\n {\n \"_id\": \"570eb049657269e1ee00001f\",\n \"customizations\": {\n \"line_1\": \"Eric\",\n \"line_2\": \"Rodriguez\",\n \"font_style\": \"Block\"\n },\n \"details\": {\n \"material\": \"Brass\"\n },\n \"name\": \"Brass Name Plate\",\n \"price\": {\n \"cents\": 1299.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 1,\n \"sku\": \"22370\"\n }\n ],\n \"number\": \"W1234\",\n \"placed_at\": \"2016-04-13T16:47:05.433-04:00\",\n \"shipping_address\": {\n \"_id\": \"570eb049657269e1ee000021\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": \"215.925.1800\",\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"shipping_method\": \"USPS\",\n \"shipping_total\": {\n \"cents\": 599.0,\n \"currency_iso\": \"USD\"\n },\n \"status\": \"Shipped\",\n \"tax_total\": {\n \"cents\": 271.0,\n \"currency_iso\": \"USD\"\n },\n \"tenders\": [\n {\n \"_id\": \"570eb049657269e1ee000022\",\n \"amount\": {\n \"cents\": 2500.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": null,\n \"expiration_year\": null,\n \"number\": \"XXXX1234\",\n \"type\": \"Gift Card\"\n },\n {\n \"_id\": \"570eb049657269e1ee000023\",\n \"amount\": {\n \"cents\": 2869.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2017\",\n \"number\": \"XXXXXXXXXXXX1111\",\n \"type\": \"VISA\"\n }\n ],\n \"total_price\": {\n \"cents\": 5369.0,\n \"currency_iso\": \"USD\"\n }\n }\n}",
27
+ "response_headers": {
28
+ "X-Frame-Options": "SAMEORIGIN",
29
+ "X-XSS-Protection": "1; mode=block",
30
+ "X-Content-Type-Options": "nosniff",
31
+ "Location": "/api/legacy_orders/570eb049657269e1ee00001d",
32
+ "X-Flash-Messages": "{}",
33
+ "Content-Type": "application/json; charset=utf-8",
34
+ "ETag": "W/\"183bd388367b95c248f53cee6f7129ab\"",
35
+ "Cache-Control": "max-age=0, private, must-revalidate",
36
+ "X-Request-Id": "8d347332-9f0f-4305-b77f-bce2dac815ea",
37
+ "X-Runtime": "0.042056",
38
+ "Content-Length": "1705"
39
+ },
40
+ "response_content_type": "application/json; charset=utf-8",
41
+ "curl": "curl \"https://user%40example.com:p@ssw0rd@www.example.com/api/legacy_orders\" -d '{\"order\":{\"alternate_number\":\"O5678\",\"billing_address\":{\"city\":\"Philadelphia\",\"company\":null,\"country\":\"US\",\"name\":\"Eric Pigeon\",\"phone_extension\":null,\"phone_number\":null,\"postal_code\":\"19106\",\"region\":\"PA\",\"street\":\"12 N. 3rd St\",\"street_2\":null},\"customer_number\":\"1234\",\"email\":\"epigeon@workarea.com\",\"items\":[{\"customizations\":null,\"details\":{\"size\":\"Medium\",\"color\":\"Charcoal\"},\"name\":\"City Pigeon - Medium\",\"price\":{\"cents\":3200.0,\"currency_iso\":\"USD\"},\"quantity\":2,\"sku\":\"1410411-025\"},{\"customizations\":{\"line_1\":\"Eric\",\"line_2\":\"Rodriguez\",\"font_style\":\"Block\"},\"details\":{\"material\":\"Brass\"},\"name\":\"Brass Name Plate\",\"price\":{\"cents\":1299.0,\"currency_iso\":\"USD\"},\"quantity\":1,\"sku\":\"22370\"}],\"number\":\"W1234\",\"placed_at\":\"2016-04-13T16:47:05.433-04:00\",\"shipping_address\":{\"city\":\"Philadelphia\",\"company\":null,\"country\":\"US\",\"name\":\"Eric Pigeon\",\"phone_extension\":null,\"phone_number\":\"215.925.1800\",\"postal_code\":\"19106\",\"region\":\"PA\",\"street\":\"12 N. 3rd St\",\"street_2\":null},\"shipping_method\":\"USPS\",\"shipping_total\":{\"cents\":599.0,\"currency_iso\":\"USD\"},\"status\":\"Shipped\",\"tax_total\":{\"cents\":271.0,\"currency_iso\":\"USD\"},\"tenders\":[{\"amount\":{\"cents\":2500.0,\"currency_iso\":\"USD\"},\"expiration_month\":null,\"expiration_year\":null,\"number\":\"XXXX1234\",\"type\":\"Gift Card\"},{\"amount\":{\"cents\":2869.0,\"currency_iso\":\"USD\"},\"expiration_month\":\"12\",\"expiration_year\":\"2017\",\"number\":\"XXXXXXXXXXXX1111\",\"type\":\"VISA\"}],\"total_price\":{\"cents\":5369.0,\"currency_iso\":\"USD\"}}}' -X POST \\\n\t-H \"Content-Type: application/json\""
42
+ }
43
+ ]
44
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "resource": "Legacy Orders",
3
+ "http_method": "GET",
4
+ "route": "/api/legacy_orders",
5
+ "description": "Listing legacy orders",
6
+ "explanation": null,
7
+ "parameters": [
8
+ {
9
+ "name": "page",
10
+ "description": "Current page"
11
+ },
12
+ {
13
+ "name": "sort_by",
14
+ "description": "Field on which to sort (see responses for possible values)"
15
+ },
16
+ {
17
+ "name": "sort_direction",
18
+ "description": "Direction to sort (asc or desc)"
19
+ }
20
+ ],
21
+ "response_fields": [
22
+
23
+ ],
24
+ "requests": [
25
+ {
26
+ "request_method": "GET",
27
+ "request_path": "/api/legacy_orders?page=1&sort_by=created_at&sort_direction=desc",
28
+ "request_body": null,
29
+ "request_headers": {
30
+ },
31
+ "request_query_parameters": {
32
+ "page": "1",
33
+ "sort_by": "created_at",
34
+ "sort_direction": "desc"
35
+ },
36
+ "request_content_type": null,
37
+ "response_status": 200,
38
+ "response_status_text": "OK",
39
+ "response_body": "{\n \"orders\": [\n {\n \"_id\": \"570eb048657269e1ee000004\",\n \"alternate_number\": \"O5678\",\n \"billing_address\": {\n \"_id\": \"570eb048657269e1ee000007\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": null,\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"customer_number\": \"1234\",\n \"email\": \"epigeon@workarea.com\",\n \"items\": [\n {\n \"_id\": \"570eb048657269e1ee000005\",\n \"customizations\": null,\n \"details\": {\n \"size\": \"Medium\",\n \"color\": \"Charcoal\"\n },\n \"name\": \"City Pigeon - Medium\",\n \"price\": {\n \"cents\": 3200.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 2,\n \"sku\": \"1410411-025\"\n },\n {\n \"_id\": \"570eb048657269e1ee000006\",\n \"customizations\": {\n \"line_1\": \"Eric\",\n \"line_2\": \"Rodriguez\",\n \"font_style\": \"Block\"\n },\n \"details\": {\n \"material\": \"Brass\"\n },\n \"name\": \"Brass Name Plate\",\n \"price\": {\n \"cents\": 1299.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 1,\n \"sku\": \"22370\"\n }\n ],\n \"number\": \"W1234\",\n \"placed_at\": \"2016-04-13T16:47:04.917-04:00\",\n \"shipping_address\": {\n \"_id\": \"570eb048657269e1ee000008\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": \"215.925.1800\",\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"shipping_method\": \"USPS\",\n \"shipping_total\": {\n \"cents\": 599.0,\n \"currency_iso\": \"USD\"\n },\n \"status\": \"Shipped\",\n \"tax_total\": {\n \"cents\": 271.0,\n \"currency_iso\": \"USD\"\n },\n \"tenders\": [\n {\n \"_id\": \"570eb048657269e1ee000009\",\n \"amount\": {\n \"cents\": 2500.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": null,\n \"expiration_year\": null,\n \"number\": \"XXXX1234\",\n \"type\": \"Gift Card\"\n },\n {\n \"_id\": \"570eb048657269e1ee00000a\",\n \"amount\": {\n \"cents\": 2869.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2017\",\n \"number\": \"XXXXXXXXXXXX1111\",\n \"type\": \"VISA\"\n }\n ],\n \"total_price\": {\n \"cents\": 5369.0,\n \"currency_iso\": \"USD\"\n }\n },\n {\n \"_id\": \"570eb048657269e1ee00000b\",\n \"alternate_number\": \"O5678\",\n \"billing_address\": {\n \"_id\": \"570eb048657269e1ee00000e\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": null,\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"customer_number\": \"1234\",\n \"email\": \"epigeon@workarea.com\",\n \"items\": [\n {\n \"_id\": \"570eb048657269e1ee00000c\",\n \"customizations\": null,\n \"details\": {\n \"size\": \"Medium\",\n \"color\": \"Charcoal\"\n },\n \"name\": \"City Pigeon - Medium\",\n \"price\": {\n \"cents\": 3200.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 2,\n \"sku\": \"1410411-025\"\n },\n {\n \"_id\": \"570eb048657269e1ee00000d\",\n \"customizations\": {\n \"line_1\": \"Eric\",\n \"line_2\": \"Rodriguez\",\n \"font_style\": \"Block\"\n },\n \"details\": {\n \"material\": \"Brass\"\n },\n \"name\": \"Brass Name Plate\",\n \"price\": {\n \"cents\": 1299.0,\n \"currency_iso\": \"USD\"\n },\n \"quantity\": 1,\n \"sku\": \"22370\"\n }\n ],\n \"number\": \"W1234\",\n \"placed_at\": \"2016-04-13T16:47:04.925-04:00\",\n \"shipping_address\": {\n \"_id\": \"570eb048657269e1ee00000f\",\n \"city\": \"Philadelphia\",\n \"company\": null,\n \"country\": \"US\",\n \"name\": \"Eric Pigeon\",\n \"phone_extension\": null,\n \"phone_number\": \"215.925.1800\",\n \"postal_code\": \"19106\",\n \"region\": \"PA\",\n \"street\": \"12 N. 3rd St\",\n \"street_2\": null\n },\n \"shipping_method\": \"USPS\",\n \"shipping_total\": {\n \"cents\": 599.0,\n \"currency_iso\": \"USD\"\n },\n \"status\": \"Shipped\",\n \"tax_total\": {\n \"cents\": 271.0,\n \"currency_iso\": \"USD\"\n },\n \"tenders\": [\n {\n \"_id\": \"570eb048657269e1ee000010\",\n \"amount\": {\n \"cents\": 2500.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": null,\n \"expiration_year\": null,\n \"number\": \"XXXX1234\",\n \"type\": \"Gift Card\"\n },\n {\n \"_id\": \"570eb048657269e1ee000011\",\n \"amount\": {\n \"cents\": 2869.0,\n \"currency_iso\": \"USD\"\n },\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2017\",\n \"number\": \"XXXXXXXXXXXX1111\",\n \"type\": \"VISA\"\n }\n ],\n \"total_price\": {\n \"cents\": 5369.0,\n \"currency_iso\": \"USD\"\n }\n }\n ]\n}",
40
+ "response_headers": {
41
+ "X-Frame-Options": "SAMEORIGIN",
42
+ "X-XSS-Protection": "1; mode=block",
43
+ "X-Content-Type-Options": "nosniff",
44
+ "X-Flash-Messages": "{}",
45
+ "Content-Type": "application/json; charset=utf-8",
46
+ "ETag": "W/\"3a176376ddb377c8e5a094081b759a4f\"",
47
+ "Cache-Control": "max-age=0, private, must-revalidate",
48
+ "X-Request-Id": "486c1127-5071-4ecb-b7d8-d32d0aa95ed0",
49
+ "X-Runtime": "0.087782",
50
+ "Content-Length": "3404"
51
+ },
52
+ "response_content_type": "application/json; charset=utf-8",
53
+ "curl": "curl \"https://user%40example.com:p@ssw0rd@www.example.com/api/legacy_orders?page=1&sort_by=created_at&sort_direction=desc\" -X GET "
54
+ }
55
+ ]
56
+ }