workarea-core 3.4.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1428) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +52 -0
  3. data/README.md +19 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/images/workarea/core/favicon_placeholder.png +0 -0
  6. data/app/assets/images/workarea/core/icon.svg +4 -0
  7. data/app/assets/images/workarea/core/open_graph_placeholder.png +0 -0
  8. data/app/assets/images/workarea/core/placeholder.png +0 -0
  9. data/app/assets/images/workarea/core/product_placeholder.jpg +0 -0
  10. data/app/assets/javascripts/workarea/core/config.js +59 -0
  11. data/app/assets/javascripts/workarea/core/modules/cookie.js +64 -0
  12. data/app/assets/javascripts/workarea/core/modules/date.js +111 -0
  13. data/app/assets/javascripts/workarea/core/modules/deletion_forms.js +45 -0
  14. data/app/assets/javascripts/workarea/core/modules/duplicate_id.js +78 -0
  15. data/app/assets/javascripts/workarea/core/modules/environment.js +23 -0
  16. data/app/assets/javascripts/workarea/core/modules/form_submitting_controls.js +52 -0
  17. data/app/assets/javascripts/workarea/core/modules/forms.js +14 -0
  18. data/app/assets/javascripts/workarea/core/modules/image.js +43 -0
  19. data/app/assets/javascripts/workarea/core/modules/jquery.js +34 -0
  20. data/app/assets/javascripts/workarea/core/modules/local_time.js +16 -0
  21. data/app/assets/javascripts/workarea/core/modules/reveal_password.js +47 -0
  22. data/app/assets/javascripts/workarea/core/modules/string.js +62 -0
  23. data/app/assets/javascripts/workarea/core/modules/style_guide_accordions.js +21 -0
  24. data/app/assets/javascripts/workarea/core/modules/style_guide_autocomplete_fields.js +42 -0
  25. data/app/assets/javascripts/workarea/core/modules/style_guide_empty_links.js +23 -0
  26. data/app/assets/javascripts/workarea/core/modules/transition_events.js +71 -0
  27. data/app/assets/javascripts/workarea/core/modules/url.js +123 -0
  28. data/app/assets/javascripts/workarea/core/routes.js +9 -0
  29. data/app/assets/javascripts/workarea/core/templates/hidden_input.jst.ejs +1 -0
  30. data/app/assets/javascripts/workarea/core/templates/lorem_ipsum_view.jst.ejs +6 -0
  31. data/app/assets/javascripts/workarea/core/templates/reveal_password_button.jst.ejs +4 -0
  32. data/app/assets/javascripts/workarea/core/templates/ui_menu_item.jst.ejs +10 -0
  33. data/app/assets/javascripts/workarea/core/workarea.js +63 -0
  34. data/app/controllers/workarea/admin_guest_browsing.rb +54 -0
  35. data/app/controllers/workarea/application_controller.rb +42 -0
  36. data/app/controllers/workarea/authentication.rb +117 -0
  37. data/app/controllers/workarea/authorization.rb +46 -0
  38. data/app/controllers/workarea/current_referrer.rb +14 -0
  39. data/app/controllers/workarea/current_release.rb +56 -0
  40. data/app/controllers/workarea/impersonation.rb +92 -0
  41. data/app/controllers/workarea/style_guides.rb +17 -0
  42. data/app/helpers/workarea/addresses_helper.rb +48 -0
  43. data/app/helpers/workarea/application_helper.rb +70 -0
  44. data/app/helpers/workarea/content_assets_helper.rb +22 -0
  45. data/app/helpers/workarea/details_helper.rb +12 -0
  46. data/app/helpers/workarea/facets_helper.rb +53 -0
  47. data/app/helpers/workarea/i18n_helper.rb +19 -0
  48. data/app/helpers/workarea/plugins_helper.rb +23 -0
  49. data/app/helpers/workarea/style_guides_helper.rb +88 -0
  50. data/app/mailers/workarea/application_mailer.rb +13 -0
  51. data/app/middleware/workarea/audit_log_client_middleware.rb +8 -0
  52. data/app/middleware/workarea/audit_log_server_middleware.rb +14 -0
  53. data/app/middleware/workarea/enforce_host_middleware.rb +39 -0
  54. data/app/middleware/workarea/i18n_client_middleware.rb +8 -0
  55. data/app/middleware/workarea/i18n_server_middleware.rb +11 -0
  56. data/app/middleware/workarea/rack_cache_config_middleware.rb +19 -0
  57. data/app/middleware/workarea/release_server_middleware.rb +11 -0
  58. data/app/middleware/workarea/skip_rack_cache_middleware.rb +19 -0
  59. data/app/middleware/workarea/strip_http_caching_middleware.rb +23 -0
  60. data/app/models/workarea/address.rb +149 -0
  61. data/app/models/workarea/application_document.rb +75 -0
  62. data/app/models/workarea/bulk_action.rb +82 -0
  63. data/app/models/workarea/bulk_action/deletion.rb +11 -0
  64. data/app/models/workarea/bulk_action/product_edit.rb +83 -0
  65. data/app/models/workarea/bulk_action/sequential_product_edit.rb +21 -0
  66. data/app/models/workarea/calculate_percent_change.rb +8 -0
  67. data/app/models/workarea/catalog/category.rb +31 -0
  68. data/app/models/workarea/catalog/clean_details.rb +18 -0
  69. data/app/models/workarea/catalog/customizations.rb +81 -0
  70. data/app/models/workarea/catalog/details_queries.rb +57 -0
  71. data/app/models/workarea/catalog/product.rb +154 -0
  72. data/app/models/workarea/catalog/product_image.rb +59 -0
  73. data/app/models/workarea/catalog/product_placeholder_image.rb +57 -0
  74. data/app/models/workarea/catalog/product_positions.rb +40 -0
  75. data/app/models/workarea/catalog/variant.rb +26 -0
  76. data/app/models/workarea/checkout.rb +234 -0
  77. data/app/models/workarea/checkout/auto_complete.rb +74 -0
  78. data/app/models/workarea/checkout/collect_payment.rb +40 -0
  79. data/app/models/workarea/checkout/credit_card_params.rb +54 -0
  80. data/app/models/workarea/checkout/shipping_options.rb +99 -0
  81. data/app/models/workarea/checkout/steps/addresses.rb +102 -0
  82. data/app/models/workarea/checkout/steps/base.rb +35 -0
  83. data/app/models/workarea/checkout/steps/payment.rb +71 -0
  84. data/app/models/workarea/checkout/steps/shipping.rb +82 -0
  85. data/app/models/workarea/comment.rb +15 -0
  86. data/app/models/workarea/commentable.rb +35 -0
  87. data/app/models/workarea/content.rb +231 -0
  88. data/app/models/workarea/content/asset.rb +162 -0
  89. data/app/models/workarea/content/asset_lookup.rb +14 -0
  90. data/app/models/workarea/content/block.rb +157 -0
  91. data/app/models/workarea/content/block_draft.rb +36 -0
  92. data/app/models/workarea/content/block_name.rb +45 -0
  93. data/app/models/workarea/content/block_type.rb +195 -0
  94. data/app/models/workarea/content/block_type_definition.rb +16 -0
  95. data/app/models/workarea/content/email.rb +31 -0
  96. data/app/models/workarea/content/field.rb +49 -0
  97. data/app/models/workarea/content/fields/asset.rb +15 -0
  98. data/app/models/workarea/content/fields/boolean.rb +11 -0
  99. data/app/models/workarea/content/fields/breakpoints.rb +11 -0
  100. data/app/models/workarea/content/fields/category.rb +8 -0
  101. data/app/models/workarea/content/fields/color.rb +11 -0
  102. data/app/models/workarea/content/fields/integer.rb +11 -0
  103. data/app/models/workarea/content/fields/options.rb +11 -0
  104. data/app/models/workarea/content/fields/products.rb +11 -0
  105. data/app/models/workarea/content/fields/range.rb +23 -0
  106. data/app/models/workarea/content/fields/string.rb +11 -0
  107. data/app/models/workarea/content/fields/taxonomy.rb +8 -0
  108. data/app/models/workarea/content/fields/text.rb +8 -0
  109. data/app/models/workarea/content/fields/url.rb +8 -0
  110. data/app/models/workarea/content/fieldset.rb +31 -0
  111. data/app/models/workarea/content/page.rb +18 -0
  112. data/app/models/workarea/content/preset.rb +66 -0
  113. data/app/models/workarea/contentable.rb +9 -0
  114. data/app/models/workarea/data_file/csv.rb +161 -0
  115. data/app/models/workarea/data_file/csv_fields.rb +82 -0
  116. data/app/models/workarea/data_file/export.rb +38 -0
  117. data/app/models/workarea/data_file/format.rb +85 -0
  118. data/app/models/workarea/data_file/import.rb +82 -0
  119. data/app/models/workarea/data_file/json.rb +56 -0
  120. data/app/models/workarea/data_file/operation.rb +71 -0
  121. data/app/models/workarea/data_file/tax_import.rb +33 -0
  122. data/app/models/workarea/data_file/tax_rates.rb +58 -0
  123. data/app/models/workarea/data_file/unknown_format_error.rb +5 -0
  124. data/app/models/workarea/details.rb +111 -0
  125. data/app/models/workarea/discount_ids.rb +34 -0
  126. data/app/models/workarea/email.rb +21 -0
  127. data/app/models/workarea/email/signup.rb +18 -0
  128. data/app/models/workarea/featured_products.rb +39 -0
  129. data/app/models/workarea/fulfillment.rb +166 -0
  130. data/app/models/workarea/fulfillment/event.rb +14 -0
  131. data/app/models/workarea/fulfillment/item.rb +27 -0
  132. data/app/models/workarea/fulfillment/package.rb +46 -0
  133. data/app/models/workarea/fulfillment/status.rb +55 -0
  134. data/app/models/workarea/guard_negative_price.rb +6 -0
  135. data/app/models/workarea/help/article.rb +71 -0
  136. data/app/models/workarea/help/asset.rb +26 -0
  137. data/app/models/workarea/inquiry.rb +30 -0
  138. data/app/models/workarea/insights/base.rb +66 -0
  139. data/app/models/workarea/insights/best_customers.rb +30 -0
  140. data/app/models/workarea/insights/best_full_price_customers.rb +31 -0
  141. data/app/models/workarea/insights/cold_products.rb +49 -0
  142. data/app/models/workarea/insights/cold_searches.rb +49 -0
  143. data/app/models/workarea/insights/customer_acquisition.rb +62 -0
  144. data/app/models/workarea/insights/customers_at_risk.rb +26 -0
  145. data/app/models/workarea/insights/hot_products.rb +49 -0
  146. data/app/models/workarea/insights/hot_searches.rb +49 -0
  147. data/app/models/workarea/insights/low_aov_customers.rb +27 -0
  148. data/app/models/workarea/insights/most_discount_given.rb +52 -0
  149. data/app/models/workarea/insights/most_discounted_products.rb +25 -0
  150. data/app/models/workarea/insights/new_products.rb +33 -0
  151. data/app/models/workarea/insights/non_sellers.rb +25 -0
  152. data/app/models/workarea/insights/popular_searches.rb +29 -0
  153. data/app/models/workarea/insights/popular_searches_without_results.rb +30 -0
  154. data/app/models/workarea/insights/products_purchased_together.rb +30 -0
  155. data/app/models/workarea/insights/products_to_improve.rb +44 -0
  156. data/app/models/workarea/insights/promising_products.rb +47 -0
  157. data/app/models/workarea/insights/release_reminder.rb +20 -0
  158. data/app/models/workarea/insights/repeat_purchase_rate.rb +38 -0
  159. data/app/models/workarea/insights/sales_by_navigation.rb +50 -0
  160. data/app/models/workarea/insights/searches_to_improve.rb +44 -0
  161. data/app/models/workarea/insights/star_products.rb +30 -0
  162. data/app/models/workarea/insights/star_searches.rb +30 -0
  163. data/app/models/workarea/insights/top_categories.rb +51 -0
  164. data/app/models/workarea/insights/top_discounts.rb +51 -0
  165. data/app/models/workarea/insights/top_products.rb +51 -0
  166. data/app/models/workarea/insights/trending_products.rb +69 -0
  167. data/app/models/workarea/insights/trending_searches.rb +69 -0
  168. data/app/models/workarea/insights/upcoming_releases.rb +20 -0
  169. data/app/models/workarea/invalid_display.rb +3 -0
  170. data/app/models/workarea/inventory.rb +72 -0
  171. data/app/models/workarea/inventory/capture.rb +100 -0
  172. data/app/models/workarea/inventory/collection.rb +50 -0
  173. data/app/models/workarea/inventory/policies/allow_backorder.rb +38 -0
  174. data/app/models/workarea/inventory/policies/base.rb +44 -0
  175. data/app/models/workarea/inventory/policies/displayable_when_out_of_stock.rb +11 -0
  176. data/app/models/workarea/inventory/policies/ignore.rb +20 -0
  177. data/app/models/workarea/inventory/policies/standard.rb +23 -0
  178. data/app/models/workarea/inventory/sku.rb +158 -0
  179. data/app/models/workarea/inventory/transaction.rb +102 -0
  180. data/app/models/workarea/inventory/transaction_item.rb +19 -0
  181. data/app/models/workarea/inventory/unit_of_work.rb +81 -0
  182. data/app/models/workarea/lock.rb +75 -0
  183. data/app/models/workarea/lockable.rb +58 -0
  184. data/app/models/workarea/metrics/by_day.rb +59 -0
  185. data/app/models/workarea/metrics/by_week.rb +36 -0
  186. data/app/models/workarea/metrics/calculate_percentiles.rb +42 -0
  187. data/app/models/workarea/metrics/category_by_day.rb +21 -0
  188. data/app/models/workarea/metrics/country_by_day.rb +20 -0
  189. data/app/models/workarea/metrics/discount_by_day.rb +17 -0
  190. data/app/models/workarea/metrics/menu_by_day.rb +21 -0
  191. data/app/models/workarea/metrics/product_by_day.rb +22 -0
  192. data/app/models/workarea/metrics/product_by_week.rb +32 -0
  193. data/app/models/workarea/metrics/product_for_last_week.rb +185 -0
  194. data/app/models/workarea/metrics/revenue_change.rb +39 -0
  195. data/app/models/workarea/metrics/sales_by_day.rb +20 -0
  196. data/app/models/workarea/metrics/scoring.rb +30 -0
  197. data/app/models/workarea/metrics/search_by_day.rb +35 -0
  198. data/app/models/workarea/metrics/search_by_week.rb +36 -0
  199. data/app/models/workarea/metrics/search_for_last_week.rb +192 -0
  200. data/app/models/workarea/metrics/sku_by_day.rb +19 -0
  201. data/app/models/workarea/metrics/traffic_referrer_by_day.rb +20 -0
  202. data/app/models/workarea/metrics/user.rb +128 -0
  203. data/app/models/workarea/navigable.rb +46 -0
  204. data/app/models/workarea/navigation/breadcrumbs.rb +58 -0
  205. data/app/models/workarea/navigation/menu.rb +30 -0
  206. data/app/models/workarea/navigation/redirect.rb +61 -0
  207. data/app/models/workarea/navigation/search_results.rb +49 -0
  208. data/app/models/workarea/navigation/taxon.rb +150 -0
  209. data/app/models/workarea/navigation/taxon_cache.rb +43 -0
  210. data/app/models/workarea/normalize_email.rb +13 -0
  211. data/app/models/workarea/order.rb +335 -0
  212. data/app/models/workarea/order/item.rb +139 -0
  213. data/app/models/workarea/order/items_extension.rb +14 -0
  214. data/app/models/workarea/order/queries.rb +200 -0
  215. data/app/models/workarea/order/status.rb +48 -0
  216. data/app/models/workarea/ordering.rb +47 -0
  217. data/app/models/workarea/payment.rb +179 -0
  218. data/app/models/workarea/payment/address.rb +9 -0
  219. data/app/models/workarea/payment/authorize/credit_card.rb +42 -0
  220. data/app/models/workarea/payment/authorize/store_credit.rb +43 -0
  221. data/app/models/workarea/payment/capture.rb +43 -0
  222. data/app/models/workarea/payment/capture/credit_card.rb +25 -0
  223. data/app/models/workarea/payment/capture/store_credit.rb +25 -0
  224. data/app/models/workarea/payment/credit_card.rb +120 -0
  225. data/app/models/workarea/payment/credit_card_operation.rb +20 -0
  226. data/app/models/workarea/payment/insufficient_funds.rb +5 -0
  227. data/app/models/workarea/payment/operation.rb +50 -0
  228. data/app/models/workarea/payment/operation_implementation.rb +24 -0
  229. data/app/models/workarea/payment/processing.rb +102 -0
  230. data/app/models/workarea/payment/profile.rb +59 -0
  231. data/app/models/workarea/payment/purchase/credit_card.rb +42 -0
  232. data/app/models/workarea/payment/purchase/store_credit.rb +7 -0
  233. data/app/models/workarea/payment/refund.rb +44 -0
  234. data/app/models/workarea/payment/refund/credit_card.rb +25 -0
  235. data/app/models/workarea/payment/refund/store_credit.rb +35 -0
  236. data/app/models/workarea/payment/saved_credit_card.rb +43 -0
  237. data/app/models/workarea/payment/status.rb +74 -0
  238. data/app/models/workarea/payment/store_credit_card.rb +34 -0
  239. data/app/models/workarea/payment/tender.rb +80 -0
  240. data/app/models/workarea/payment/tender/credit_card.rb +49 -0
  241. data/app/models/workarea/payment/tender/store_credit.rb +27 -0
  242. data/app/models/workarea/payment/transaction.rb +148 -0
  243. data/app/models/workarea/payment_reference.rb +18 -0
  244. data/app/models/workarea/price_adjustment.rb +46 -0
  245. data/app/models/workarea/price_adjustment_extension.rb +19 -0
  246. data/app/models/workarea/price_adjustment_set.rb +69 -0
  247. data/app/models/workarea/pricing.rb +56 -0
  248. data/app/models/workarea/pricing/cache_key.rb +51 -0
  249. data/app/models/workarea/pricing/calculator.rb +37 -0
  250. data/app/models/workarea/pricing/calculators/customizations_calculator.rb +33 -0
  251. data/app/models/workarea/pricing/calculators/discount_calculator.rb +38 -0
  252. data/app/models/workarea/pricing/calculators/item_calculator.rb +28 -0
  253. data/app/models/workarea/pricing/calculators/overrides_calculator.rb +105 -0
  254. data/app/models/workarea/pricing/calculators/tax_calculator.rb +29 -0
  255. data/app/models/workarea/pricing/collection.rb +84 -0
  256. data/app/models/workarea/pricing/discount.rb +370 -0
  257. data/app/models/workarea/pricing/discount/amount_calculator.rb +57 -0
  258. data/app/models/workarea/pricing/discount/application_group.rb +126 -0
  259. data/app/models/workarea/pricing/discount/buy_some_get_some.rb +120 -0
  260. data/app/models/workarea/pricing/discount/buy_some_get_some/item_application.rb +65 -0
  261. data/app/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product.rb +38 -0
  262. data/app/models/workarea/pricing/discount/buy_some_get_some/product_application.rb +83 -0
  263. data/app/models/workarea/pricing/discount/category.rb +59 -0
  264. data/app/models/workarea/pricing/discount/code_list.rb +100 -0
  265. data/app/models/workarea/pricing/discount/collection.rb +61 -0
  266. data/app/models/workarea/pricing/discount/conditions/item_quantity.rb +42 -0
  267. data/app/models/workarea/pricing/discount/conditions/order_total.rb +53 -0
  268. data/app/models/workarea/pricing/discount/conditions/promo_codes.rb +78 -0
  269. data/app/models/workarea/pricing/discount/conditions/user_tags.rb +36 -0
  270. data/app/models/workarea/pricing/discount/flat_or_percent_off.rb +47 -0
  271. data/app/models/workarea/pricing/discount/free_gift.rb +136 -0
  272. data/app/models/workarea/pricing/discount/generated_promo_code.rb +96 -0
  273. data/app/models/workarea/pricing/discount/order.rb +104 -0
  274. data/app/models/workarea/pricing/discount/order_total.rb +52 -0
  275. data/app/models/workarea/pricing/discount/product.rb +60 -0
  276. data/app/models/workarea/pricing/discount/product_attribute.rb +65 -0
  277. data/app/models/workarea/pricing/discount/product_attribute/item_qualifier.rb +52 -0
  278. data/app/models/workarea/pricing/discount/quantity_fixed_price.rb +102 -0
  279. data/app/models/workarea/pricing/discount/quantity_fixed_price/application_calculator.rb +57 -0
  280. data/app/models/workarea/pricing/discount/quantity_fixed_price/item_shares.rb +64 -0
  281. data/app/models/workarea/pricing/discount/reconcile_total.rb +39 -0
  282. data/app/models/workarea/pricing/discount/redemption.rb +33 -0
  283. data/app/models/workarea/pricing/discount/shipping.rb +80 -0
  284. data/app/models/workarea/pricing/order_totals.rb +56 -0
  285. data/app/models/workarea/pricing/override.rb +36 -0
  286. data/app/models/workarea/pricing/price.rb +52 -0
  287. data/app/models/workarea/pricing/price_distributor.rb +88 -0
  288. data/app/models/workarea/pricing/request.rb +146 -0
  289. data/app/models/workarea/pricing/shipping_totals.rb +27 -0
  290. data/app/models/workarea/pricing/sku.rb +88 -0
  291. data/app/models/workarea/pricing/tax_applier.rb +90 -0
  292. data/app/models/workarea/product_list.rb +11 -0
  293. data/app/models/workarea/product_rule.rb +139 -0
  294. data/app/models/workarea/query_string.rb +58 -0
  295. data/app/models/workarea/recommendation/product_predictor.rb +10 -0
  296. data/app/models/workarea/recommendation/search_predictor.rb +10 -0
  297. data/app/models/workarea/recommendation/settings.rb +24 -0
  298. data/app/models/workarea/recommendation/user_activity.rb +53 -0
  299. data/app/models/workarea/releasable.rb +171 -0
  300. data/app/models/workarea/release.rb +232 -0
  301. data/app/models/workarea/release/changeset.rb +137 -0
  302. data/app/models/workarea/release/status.rb +52 -0
  303. data/app/models/workarea/release_session.rb +45 -0
  304. data/app/models/workarea/reports/export.rb +62 -0
  305. data/app/models/workarea/search/admin.rb +133 -0
  306. data/app/models/workarea/search/admin/catalog_category.rb +67 -0
  307. data/app/models/workarea/search/admin/catalog_product.rb +98 -0
  308. data/app/models/workarea/search/admin/content.rb +37 -0
  309. data/app/models/workarea/search/admin/content_asset.rb +46 -0
  310. data/app/models/workarea/search/admin/content_page.rb +25 -0
  311. data/app/models/workarea/search/admin/inventory_sku.rb +27 -0
  312. data/app/models/workarea/search/admin/navigation.rb +50 -0
  313. data/app/models/workarea/search/admin/navigation_menu.rb +13 -0
  314. data/app/models/workarea/search/admin/order.rb +74 -0
  315. data/app/models/workarea/search/admin/payment_transaction.rb +68 -0
  316. data/app/models/workarea/search/admin/pricing_discount.rb +37 -0
  317. data/app/models/workarea/search/admin/pricing_sku.rb +25 -0
  318. data/app/models/workarea/search/admin/releasable.rb +41 -0
  319. data/app/models/workarea/search/admin/release.rb +38 -0
  320. data/app/models/workarea/search/admin/user.rb +59 -0
  321. data/app/models/workarea/search/customization.rb +81 -0
  322. data/app/models/workarea/search/facet_values.rb +16 -0
  323. data/app/models/workarea/search/hash_text.rb +32 -0
  324. data/app/models/workarea/search/help.rb +17 -0
  325. data/app/models/workarea/search/order_text.rb +75 -0
  326. data/app/models/workarea/search/settings.rb +79 -0
  327. data/app/models/workarea/search/storefront.rb +101 -0
  328. data/app/models/workarea/search/storefront/category.rb +19 -0
  329. data/app/models/workarea/search/storefront/page.rb +19 -0
  330. data/app/models/workarea/search/storefront/product.rb +133 -0
  331. data/app/models/workarea/search/storefront/product/analytics.rb +26 -0
  332. data/app/models/workarea/search/storefront/product/categories.rb +86 -0
  333. data/app/models/workarea/search/storefront/product/facets.rb +62 -0
  334. data/app/models/workarea/search/storefront/product/inventory.rb +34 -0
  335. data/app/models/workarea/search/storefront/product/pricing.rb +56 -0
  336. data/app/models/workarea/search/storefront/product/sorting.rb +25 -0
  337. data/app/models/workarea/search/storefront/product/text.rb +71 -0
  338. data/app/models/workarea/search/storefront/search.rb +27 -0
  339. data/app/models/workarea/search/user_text.rb +45 -0
  340. data/app/models/workarea/shipping.rb +176 -0
  341. data/app/models/workarea/shipping/address.rb +22 -0
  342. data/app/models/workarea/shipping/location_query.rb +49 -0
  343. data/app/models/workarea/shipping/rate.rb +19 -0
  344. data/app/models/workarea/shipping/rate_lookup.rb +55 -0
  345. data/app/models/workarea/shipping/service.rb +89 -0
  346. data/app/models/workarea/shipping/service_selection.rb +15 -0
  347. data/app/models/workarea/shipping/sku.rb +35 -0
  348. data/app/models/workarea/shipping_option.rb +53 -0
  349. data/app/models/workarea/sort.rb +153 -0
  350. data/app/models/workarea/status_calculator.rb +40 -0
  351. data/app/models/workarea/tax.rb +29 -0
  352. data/app/models/workarea/tax/category.rb +48 -0
  353. data/app/models/workarea/tax/rate.rb +30 -0
  354. data/app/models/workarea/tax/rate_lookup.rb +107 -0
  355. data/app/models/workarea/traffic_referrer.rb +9 -0
  356. data/app/models/workarea/user.rb +90 -0
  357. data/app/models/workarea/user/addresses.rb +51 -0
  358. data/app/models/workarea/user/admin_bookmark.rb +40 -0
  359. data/app/models/workarea/user/admin_visit.rb +39 -0
  360. data/app/models/workarea/user/authorization.rb +72 -0
  361. data/app/models/workarea/user/avatar.rb +32 -0
  362. data/app/models/workarea/user/login.rb +76 -0
  363. data/app/models/workarea/user/password_reset.rb +37 -0
  364. data/app/models/workarea/user/passwords.rb +67 -0
  365. data/app/models/workarea/user/recent_password.rb +27 -0
  366. data/app/models/workarea/user/saved_address.rb +13 -0
  367. data/app/models/workarea/user/system_users.rb +30 -0
  368. data/app/queries/workarea/admin_query_operation.rb +58 -0
  369. data/app/queries/workarea/admin_search_query_wrapper.rb +68 -0
  370. data/app/queries/workarea/alerts.rb +82 -0
  371. data/app/queries/workarea/bulk_action_selections.rb +39 -0
  372. data/app/queries/workarea/categorization.rb +63 -0
  373. data/app/queries/workarea/extract_content_block_text.rb +33 -0
  374. data/app/queries/workarea/find_pipeline_asset.rb +30 -0
  375. data/app/queries/workarea/find_taxonomy_slug.rb +24 -0
  376. data/app/queries/workarea/find_unique_slug.rb +35 -0
  377. data/app/queries/workarea/metadata.rb +56 -0
  378. data/app/queries/workarea/metadata/catalog_category.rb +45 -0
  379. data/app/queries/workarea/metadata/content_page.rb +37 -0
  380. data/app/queries/workarea/metadata/home_page.rb +48 -0
  381. data/app/queries/workarea/order_item_details.rb +55 -0
  382. data/app/queries/workarea/order_metrics.rb +203 -0
  383. data/app/queries/workarea/pricing_override_params.rb +31 -0
  384. data/app/queries/workarea/product_primary_image_url.rb +34 -0
  385. data/app/queries/workarea/product_primary_navigation.rb +41 -0
  386. data/app/queries/workarea/recommendation/order_based.rb +48 -0
  387. data/app/queries/workarea/recommendation/product_based.rb +47 -0
  388. data/app/queries/workarea/recommendation/searches.rb +21 -0
  389. data/app/queries/workarea/recommendation/user_activity_based.rb +40 -0
  390. data/app/queries/workarea/reports/average_order_value.rb +44 -0
  391. data/app/queries/workarea/reports/customers.rb +46 -0
  392. data/app/queries/workarea/reports/first_time_vs_returning_sales.rb +59 -0
  393. data/app/queries/workarea/reports/group_by_time.rb +84 -0
  394. data/app/queries/workarea/reports/low_inventory.rb +36 -0
  395. data/app/queries/workarea/reports/report.rb +83 -0
  396. data/app/queries/workarea/reports/sales_by_category.rb +51 -0
  397. data/app/queries/workarea/reports/sales_by_country.rb +56 -0
  398. data/app/queries/workarea/reports/sales_by_discount.rb +47 -0
  399. data/app/queries/workarea/reports/sales_by_menu.rb +51 -0
  400. data/app/queries/workarea/reports/sales_by_product.rb +54 -0
  401. data/app/queries/workarea/reports/sales_by_sku.rb +61 -0
  402. data/app/queries/workarea/reports/sales_by_traffic_referrer.rb +64 -0
  403. data/app/queries/workarea/reports/sales_over_time.rb +73 -0
  404. data/app/queries/workarea/reports/searches.rb +65 -0
  405. data/app/queries/workarea/reports/searches_over_time.rb +37 -0
  406. data/app/queries/workarea/reports/searches_without_results_over_time.rb +38 -0
  407. data/app/queries/workarea/search/admin_assets.rb +23 -0
  408. data/app/queries/workarea/search/admin_categories.rb +20 -0
  409. data/app/queries/workarea/search/admin_discounts.rb +30 -0
  410. data/app/queries/workarea/search/admin_index_search.rb +127 -0
  411. data/app/queries/workarea/search/admin_inventory_skus.rb +20 -0
  412. data/app/queries/workarea/search/admin_orders.rb +49 -0
  413. data/app/queries/workarea/search/admin_pages.rb +16 -0
  414. data/app/queries/workarea/search/admin_payment_transactions.rb +24 -0
  415. data/app/queries/workarea/search/admin_pricing_skus.rb +16 -0
  416. data/app/queries/workarea/search/admin_product_rules_preview.rb +10 -0
  417. data/app/queries/workarea/search/admin_products.rb +39 -0
  418. data/app/queries/workarea/search/admin_releasables.rb +18 -0
  419. data/app/queries/workarea/search/admin_releases.rb +38 -0
  420. data/app/queries/workarea/search/admin_search.rb +16 -0
  421. data/app/queries/workarea/search/admin_sorting.rb +38 -0
  422. data/app/queries/workarea/search/admin_users.rb +39 -0
  423. data/app/queries/workarea/search/categorization.rb +14 -0
  424. data/app/queries/workarea/search/categorization_filtering.rb +38 -0
  425. data/app/queries/workarea/search/category_browse.rb +119 -0
  426. data/app/queries/workarea/search/date_filter.rb +49 -0
  427. data/app/queries/workarea/search/facet.rb +71 -0
  428. data/app/queries/workarea/search/facet_matches.rb +39 -0
  429. data/app/queries/workarea/search/facet_sorting.rb +67 -0
  430. data/app/queries/workarea/search/facet_sorting/size.rb +15 -0
  431. data/app/queries/workarea/search/facets.rb +29 -0
  432. data/app/queries/workarea/search/filter.rb +70 -0
  433. data/app/queries/workarea/search/help_search.rb +58 -0
  434. data/app/queries/workarea/search/load_product_results.rb +36 -0
  435. data/app/queries/workarea/search/pagination.rb +46 -0
  436. data/app/queries/workarea/search/product_display_rules.rb +68 -0
  437. data/app/queries/workarea/search/product_entries.rb +24 -0
  438. data/app/queries/workarea/search/product_rules.rb +122 -0
  439. data/app/queries/workarea/search/product_rules_filtering.rb +14 -0
  440. data/app/queries/workarea/search/product_search.rb +218 -0
  441. data/app/queries/workarea/search/query.rb +131 -0
  442. data/app/queries/workarea/search/query_suggestions.rb +71 -0
  443. data/app/queries/workarea/search/range_facet.rb +60 -0
  444. data/app/queries/workarea/search/range_filter.rb +25 -0
  445. data/app/queries/workarea/search/range_parameter.rb +71 -0
  446. data/app/queries/workarea/search/related_help.rb +58 -0
  447. data/app/queries/workarea/search/related_products.rb +96 -0
  448. data/app/queries/workarea/search/search_suggestions.rb +43 -0
  449. data/app/queries/workarea/search/storefront_search.rb +51 -0
  450. data/app/queries/workarea/search/storefront_search/exact_matches.rb +34 -0
  451. data/app/queries/workarea/search/storefront_search/middleware.rb +26 -0
  452. data/app/queries/workarea/search/storefront_search/product_auto_redirect.rb +19 -0
  453. data/app/queries/workarea/search/storefront_search/product_multipass.rb +50 -0
  454. data/app/queries/workarea/search/storefront_search/redirect.rb +17 -0
  455. data/app/queries/workarea/search/storefront_search/response.rb +72 -0
  456. data/app/queries/workarea/search/storefront_search/spelling_correction.rb +31 -0
  457. data/app/queries/workarea/search/storefront_search/template.rb +17 -0
  458. data/app/queries/workarea/search/term_filter.rb +10 -0
  459. data/app/queries/workarea/search/terms_facet.rb +62 -0
  460. data/app/queries/workarea/taxonomy_sitemap.rb +34 -0
  461. data/app/seeds/workarea/admins_seeds.rb +53 -0
  462. data/app/seeds/workarea/assets_seeds.rb +23 -0
  463. data/app/seeds/workarea/browse_navigation_seeds.rb +30 -0
  464. data/app/seeds/workarea/browsing_pages_seeds.rb +33 -0
  465. data/app/seeds/workarea/categories_seeds.rb +50 -0
  466. data/app/seeds/workarea/customer_service_navigation_seeds.rb +16 -0
  467. data/app/seeds/workarea/customer_service_pages_seeds.rb +33 -0
  468. data/app/seeds/workarea/customers_seeds.rb +24 -0
  469. data/app/seeds/workarea/discounts_seeds.rb +79 -0
  470. data/app/seeds/workarea/dynamic_content_seeds.rb +62 -0
  471. data/app/seeds/workarea/email_content_seeds.rb +11 -0
  472. data/app/seeds/workarea/help_seeds.rb +65 -0
  473. data/app/seeds/workarea/inquiries_seeds.rb +15 -0
  474. data/app/seeds/workarea/insights_seeds.rb +65 -0
  475. data/app/seeds/workarea/orders_seeds.rb +113 -0
  476. data/app/seeds/workarea/products_seeds.rb +104 -0
  477. data/app/seeds/workarea/search_settings_seeds.rb +31 -0
  478. data/app/seeds/workarea/shipping_services_seeds.rb +61 -0
  479. data/app/seeds/workarea/system_content_seeds.rb +90 -0
  480. data/app/seeds/workarea/tax_seeds.rb +33 -0
  481. data/app/services/workarea/add_multiple_cart_items.rb +21 -0
  482. data/app/services/workarea/add_multiple_cart_items/item.rb +79 -0
  483. data/app/services/workarea/cancel_order.rb +68 -0
  484. data/app/services/workarea/cart_cleaner.rb +59 -0
  485. data/app/services/workarea/clean_range_facets.rb +38 -0
  486. data/app/services/workarea/copy_order.rb +73 -0
  487. data/app/services/workarea/copy_product.rb +27 -0
  488. data/app/services/workarea/create_fulfillment.rb +24 -0
  489. data/app/services/workarea/direct_upload.rb +77 -0
  490. data/app/services/workarea/direct_upload/asset.rb +14 -0
  491. data/app/services/workarea/direct_upload/processor.rb +20 -0
  492. data/app/services/workarea/direct_upload/product_image.rb +42 -0
  493. data/app/services/workarea/export_report.rb +88 -0
  494. data/app/services/workarea/hash_update.rb +32 -0
  495. data/app/services/workarea/inventory_adjustment.rb +45 -0
  496. data/app/services/workarea/login.rb +39 -0
  497. data/app/services/workarea/new_discount.rb +17 -0
  498. data/app/services/workarea/order_merge.rb +34 -0
  499. data/app/services/workarea/packaging.rb +103 -0
  500. data/app/services/workarea/save_publishing.rb +34 -0
  501. data/app/services/workarea/save_taxonomy.rb +39 -0
  502. data/app/services/workarea/set_navigable.rb +71 -0
  503. data/app/services/workarea/sort_navigation_menus_by_orders.rb +32 -0
  504. data/app/services/workarea/tag_update.rb +15 -0
  505. data/app/view_models/workarea/application_view_model.rb +72 -0
  506. data/app/view_models/workarea/shipping_carrier_view_model.rb +24 -0
  507. data/app/workers/sidekiq/callbacks.rb +242 -0
  508. data/app/workers/sidekiq/callbacks_worker.rb +73 -0
  509. data/app/workers/workarea/bulk_index_admin.rb +34 -0
  510. data/app/workers/workarea/bulk_index_products.rb +28 -0
  511. data/app/workers/workarea/bulk_index_searches.rb +33 -0
  512. data/app/workers/workarea/bust_discount_cache.rb +16 -0
  513. data/app/workers/workarea/bust_navigation_cache.rb +18 -0
  514. data/app/workers/workarea/bust_sku_cache.rb +16 -0
  515. data/app/workers/workarea/clean_inventory_transactions.rb +9 -0
  516. data/app/workers/workarea/clean_orders.rb +10 -0
  517. data/app/workers/workarea/clean_product_recommendations.rb +13 -0
  518. data/app/workers/workarea/clean_user_activity.rb +11 -0
  519. data/app/workers/workarea/deactivate_stale_discounts.rb +38 -0
  520. data/app/workers/workarea/generate_content_metadata.rb +17 -0
  521. data/app/workers/workarea/generate_insights.rb +37 -0
  522. data/app/workers/workarea/generate_promo_codes.rb +12 -0
  523. data/app/workers/workarea/index_admin_search.rb +40 -0
  524. data/app/workers/workarea/index_categorization.rb +24 -0
  525. data/app/workers/workarea/index_category.rb +20 -0
  526. data/app/workers/workarea/index_category_changes.rb +40 -0
  527. data/app/workers/workarea/index_fulfillment_changes.rb +16 -0
  528. data/app/workers/workarea/index_help.rb +18 -0
  529. data/app/workers/workarea/index_page.rb +20 -0
  530. data/app/workers/workarea/index_payment_transactions.rb +23 -0
  531. data/app/workers/workarea/index_product.rb +26 -0
  532. data/app/workers/workarea/index_product_children.rb +20 -0
  533. data/app/workers/workarea/index_product_rule.rb +22 -0
  534. data/app/workers/workarea/index_search_customizations.rb +18 -0
  535. data/app/workers/workarea/index_skus.rb +20 -0
  536. data/app/workers/workarea/keep_product_index_fresh.rb +32 -0
  537. data/app/workers/workarea/mark_discounts_as_redeemed.rb +30 -0
  538. data/app/workers/workarea/order_reminder.rb +16 -0
  539. data/app/workers/workarea/process_direct_upload.rb +10 -0
  540. data/app/workers/workarea/process_export.rb +21 -0
  541. data/app/workers/workarea/process_import.rb +29 -0
  542. data/app/workers/workarea/process_product_recommendations.rb +31 -0
  543. data/app/workers/workarea/process_reports_export.rb +20 -0
  544. data/app/workers/workarea/process_search_recommendations.rb +35 -0
  545. data/app/workers/workarea/publish_bulk_action.rb +14 -0
  546. data/app/workers/workarea/publish_release.rb +15 -0
  547. data/app/workers/workarea/redirect_navigable_slugs.rb +51 -0
  548. data/app/workers/workarea/save_order_metrics.rb +105 -0
  549. data/app/workers/workarea/save_user_order_details.rb +72 -0
  550. data/app/workers/workarea/send_refund_email.rb +17 -0
  551. data/app/workers/workarea/status_reporter.rb +12 -0
  552. data/app/workers/workarea/undo_release.rb +15 -0
  553. data/app/workers/workarea/update_elasticsearch_settings.rb +28 -0
  554. data/app/workers/workarea/update_payment_profile_email.rb +22 -0
  555. data/app/workers/workarea/verify_scheduled_releases.rb +35 -0
  556. data/bin/rails +18 -0
  557. data/config/i18n-js.yml +2 -0
  558. data/config/initializers/00_mongoid.rb +2 -0
  559. data/config/initializers/01_eager_load.rb +1 -0
  560. data/config/initializers/02_assets.rb +17 -0
  561. data/config/initializers/03_js_routes.rb +3 -0
  562. data/config/initializers/04_sidekiq.rb +1 -0
  563. data/config/initializers/05_scheduled_jobs.rb +92 -0
  564. data/config/initializers/06_predictor.rb +1 -0
  565. data/config/initializers/07_dragonfly.rb +117 -0
  566. data/config/initializers/08_inflections.rb +3 -0
  567. data/config/initializers/09_geocoder.rb +15 -0
  568. data/config/initializers/10_rack_middleware.rb +29 -0
  569. data/config/initializers/11_payment.rb +8 -0
  570. data/config/initializers/12_filter_parameters.rb +13 -0
  571. data/config/initializers/13_rack_attack.rb +178 -0
  572. data/config/initializers/14_content_block_types.rb +240 -0
  573. data/config/initializers/15_endpoint_monitoring.rb +41 -0
  574. data/config/initializers/16_turbolinks.rb +1 -0
  575. data/config/initializers/17_audit_log.rb +1 -0
  576. data/config/initializers/18_time_formats.rb +11 -0
  577. data/config/initializers/19_mailer_previews.rb +20 -0
  578. data/config/initializers/20_i18n_js.rb +3 -0
  579. data/config/initializers/20_mail_interceptor.rb +1 -0
  580. data/config/initializers/21_premailer.rb +3 -0
  581. data/config/initializers/21_serviceworkers.rb +16 -0
  582. data/config/initializers/22_session_store.rb +11 -0
  583. data/config/initializers/23_chartkick.rb +3 -0
  584. data/config/locales/en.yml +168 -0
  585. data/config/routes.rb +13 -0
  586. data/data/content_assets/100x100.png +0 -0
  587. data/data/content_assets/960x470_dark.png +0 -0
  588. data/data/content_assets/960x470_light.png +0 -0
  589. data/data/help/howto/add_help_articles/body.md +50 -0
  590. data/data/help/howto/add_help_articles/summary.md +1 -0
  591. data/lib/generators/workarea/content_block_type/USAGE +16 -0
  592. data/lib/generators/workarea/content_block_type/content_block_type_generator.rb +71 -0
  593. data/lib/generators/workarea/content_block_type/templates/block.svg +1 -0
  594. data/lib/generators/workarea/content_block_type/templates/initializer.rb +3 -0
  595. data/lib/generators/workarea/content_block_type/templates/storefront_view.html.haml.erb +4 -0
  596. data/lib/generators/workarea/content_block_type/templates/stylesheet.scss.erb +7 -0
  597. data/lib/generators/workarea/content_block_type/templates/view_model.rb.erb +16 -0
  598. data/lib/generators/workarea/decorator/USAGE +15 -0
  599. data/lib/generators/workarea/decorator/decorator_generator.rb +79 -0
  600. data/lib/generators/workarea/decorator/templates/decorator.rb.erb +20 -0
  601. data/lib/generators/workarea/decorator/templates/test_decorator.rb.erb +13 -0
  602. data/lib/generators/workarea/discount/USAGE +16 -0
  603. data/lib/generators/workarea/discount/discount_generator.rb +48 -0
  604. data/lib/generators/workarea/discount/templates/model.rb.erb +22 -0
  605. data/lib/generators/workarea/discount/templates/model_test.rb.erb +13 -0
  606. data/lib/generators/workarea/discount/templates/partial.html.haml +10 -0
  607. data/lib/generators/workarea/discount/templates/select_type_partial.rb.erb +6 -0
  608. data/lib/generators/workarea/discount/templates/view_model.rb.erb +11 -0
  609. data/lib/generators/workarea/discount/templates/view_model_test.rb.erb +11 -0
  610. data/lib/generators/workarea/docker/USAGE +16 -0
  611. data/lib/generators/workarea/docker/docker_generator.rb +61 -0
  612. data/lib/generators/workarea/docker/templates/.env.erb +6 -0
  613. data/lib/generators/workarea/docker/templates/Dockerfile.erb +48 -0
  614. data/lib/generators/workarea/docker/templates/docker-compose.yml.erb +72 -0
  615. data/lib/generators/workarea/docker/templates/docker-entrypoint.sh.erb +6 -0
  616. data/lib/generators/workarea/docker/templates/docker-sync.yml.erb +8 -0
  617. data/lib/generators/workarea/docker/templates/docker-wait.sh +11 -0
  618. data/lib/generators/workarea/docker/templates/docker.env +16 -0
  619. data/lib/generators/workarea/docker/templates/docker_init.rb.erb +29 -0
  620. data/lib/generators/workarea/install/USAGE +19 -0
  621. data/lib/generators/workarea/install/install_generator.rb +71 -0
  622. data/lib/generators/workarea/install/templates/initializer.rb.erb +22 -0
  623. data/lib/generators/workarea/js_adapter/USAGE +8 -0
  624. data/lib/generators/workarea/js_adapter/js_adapter_generator.rb +28 -0
  625. data/lib/generators/workarea/js_adapter/templates/js_adapter.js.erb +21 -0
  626. data/lib/generators/workarea/js_module/USAGE +8 -0
  627. data/lib/generators/workarea/js_module/js_module_generator.rb +30 -0
  628. data/lib/generators/workarea/js_module/templates/js_module.js.erb +33 -0
  629. data/lib/generators/workarea/override/USAGE +22 -0
  630. data/lib/generators/workarea/override/override_generator.rb +85 -0
  631. data/lib/generators/workarea/pricing_calculator/USAGE +9 -0
  632. data/lib/generators/workarea/pricing_calculator/pricing_calculator_generator.rb +26 -0
  633. data/lib/generators/workarea/pricing_calculator/templates/calculator.rb.erb +13 -0
  634. data/lib/generators/workarea/pricing_calculator/templates/test.rb.erb +13 -0
  635. data/lib/generators/workarea/product_template/USAGE +11 -0
  636. data/lib/generators/workarea/product_template/product_template_generator.rb +26 -0
  637. data/lib/generators/workarea/product_template/templates/view_model.rb.erb +16 -0
  638. data/lib/generators/workarea/seeds/USAGE +11 -0
  639. data/lib/generators/workarea/seeds/seeds_generator.rb +15 -0
  640. data/lib/generators/workarea/seeds/templates/seeds.rb.erb +15 -0
  641. data/lib/generators/workarea/style_guide/USAGE +24 -0
  642. data/lib/generators/workarea/style_guide/style_guide_generator.rb +35 -0
  643. data/lib/generators/workarea/style_guide/templates/style_guide_partial.html.haml.erb +51 -0
  644. data/lib/minitest/workarea_plugin.rb +11 -0
  645. data/lib/tasks/assets.rake +3 -0
  646. data/lib/tasks/cache.rake +40 -0
  647. data/lib/tasks/cleanup.rake +13 -0
  648. data/lib/tasks/help.rake +59 -0
  649. data/lib/tasks/insights.rake +49 -0
  650. data/lib/tasks/lint.rake +7 -0
  651. data/lib/tasks/search.rake +89 -0
  652. data/lib/tasks/services.rake +73 -0
  653. data/lib/tasks/tests.rake +96 -0
  654. data/lib/workarea.rb +88 -0
  655. data/lib/workarea/asset_endpoints/base.rb +23 -0
  656. data/lib/workarea/asset_endpoints/favicons.rb +22 -0
  657. data/lib/workarea/asset_endpoints/product_images.rb +16 -0
  658. data/lib/workarea/asset_endpoints/product_placeholder_images.rb +9 -0
  659. data/lib/workarea/autoexpire_cache_redis.rb +29 -0
  660. data/lib/workarea/bogus_carrier.rb +18 -0
  661. data/lib/workarea/cache.rb +106 -0
  662. data/lib/workarea/changelog.rake +87 -0
  663. data/lib/workarea/configuration.rb +1273 -0
  664. data/lib/workarea/configuration/action_mailer.rb +24 -0
  665. data/lib/workarea/configuration/asset_host.rb +13 -0
  666. data/lib/workarea/configuration/cache_store.rb +21 -0
  667. data/lib/workarea/configuration/dragonfly.rb +43 -0
  668. data/lib/workarea/configuration/elasticsearch.rb +39 -0
  669. data/lib/workarea/configuration/error_handling.rb +15 -0
  670. data/lib/workarea/configuration/headless_chrome.rb +42 -0
  671. data/lib/workarea/configuration/i18n.rb +12 -0
  672. data/lib/workarea/configuration/localized_active_fields.rb +26 -0
  673. data/lib/workarea/configuration/logstasher.rb +16 -0
  674. data/lib/workarea/configuration/mongoid.rb +27 -0
  675. data/lib/workarea/configuration/mongoid_client.rb +53 -0
  676. data/lib/workarea/configuration/puma.rb +37 -0
  677. data/lib/workarea/configuration/redis.rb +78 -0
  678. data/lib/workarea/configuration/s3.rb +68 -0
  679. data/lib/workarea/configuration/sidekiq.rb +120 -0
  680. data/lib/workarea/constants.rb +29 -0
  681. data/lib/workarea/core.rb +221 -0
  682. data/lib/workarea/core/engine.rb +134 -0
  683. data/lib/workarea/elasticsearch/document.rb +109 -0
  684. data/lib/workarea/elasticsearch/index.rb +143 -0
  685. data/lib/workarea/elasticsearch/query_cache.rb +132 -0
  686. data/lib/workarea/elasticsearch/serializer.rb +43 -0
  687. data/lib/workarea/ext/active_shipping/workarea.rb +7 -0
  688. data/lib/workarea/ext/freedom_patches/action_view_cache_helper.rb +26 -0
  689. data/lib/workarea/ext/freedom_patches/action_view_conditional_url_helper.rb +23 -0
  690. data/lib/workarea/ext/freedom_patches/action_view_number_helper.rb +23 -0
  691. data/lib/workarea/ext/freedom_patches/action_view_path_resolver.rb +16 -0
  692. data/lib/workarea/ext/freedom_patches/bson.rb +11 -0
  693. data/lib/workarea/ext/freedom_patches/country.rb +15 -0
  694. data/lib/workarea/ext/freedom_patches/dragonfly_attachment.rb +14 -0
  695. data/lib/workarea/ext/freedom_patches/dragonfly_callable_url_host.rb +28 -0
  696. data/lib/workarea/ext/freedom_patches/dragonfly_job_fetch_url.rb +22 -0
  697. data/lib/workarea/ext/freedom_patches/float.rb +13 -0
  698. data/lib/workarea/ext/freedom_patches/global_id.rb +24 -0
  699. data/lib/workarea/ext/freedom_patches/money.rb +23 -0
  700. data/lib/workarea/ext/freedom_patches/mongoid_simple_tags.rb +87 -0
  701. data/lib/workarea/ext/freedom_patches/net_http_ssl_connection.rb +19 -0
  702. data/lib/workarea/ext/freedom_patches/routes_reloader.rb +21 -0
  703. data/lib/workarea/ext/freedom_patches/string.rb +16 -0
  704. data/lib/workarea/ext/freedom_patches/uri.rb +7 -0
  705. data/lib/workarea/ext/jbuilder/jbuilder_append_partials.rb +16 -0
  706. data/lib/workarea/ext/mongoid/audit_log_entry.decorator +66 -0
  707. data/lib/workarea/ext/mongoid/each_by.rb +46 -0
  708. data/lib/workarea/ext/mongoid/error.rb +17 -0
  709. data/lib/workarea/ext/mongoid/except.rb +5 -0
  710. data/lib/workarea/ext/mongoid/find_ordered.rb +21 -0
  711. data/lib/workarea/ext/mongoid/list_field.rb +21 -0
  712. data/lib/workarea/ext/mongoid/moped_bson.rb +6 -0
  713. data/lib/workarea/ext/mongoid/timestamps_timeless.rb +51 -0
  714. data/lib/workarea/ext/sprockets/ruby_processor.rb +19 -0
  715. data/lib/workarea/ext/sprockets/task.rb +31 -0
  716. data/lib/workarea/geolocation.rb +71 -0
  717. data/lib/workarea/i18n.rb +71 -0
  718. data/lib/workarea/image_optim_processor.rb +13 -0
  719. data/lib/workarea/lint.rb +89 -0
  720. data/lib/workarea/lint/inconsistent_details.rb +32 -0
  721. data/lib/workarea/lint/products_missing_images.rb +13 -0
  722. data/lib/workarea/lint/products_missing_variants.rb +13 -0
  723. data/lib/workarea/lint/skus_missing_inventory.rb +19 -0
  724. data/lib/workarea/lint/skus_missing_pricing.rb +19 -0
  725. data/lib/workarea/lint/skus_missing_variants.rb +17 -0
  726. data/lib/workarea/mail_interceptor.rb +15 -0
  727. data/lib/workarea/monitoring/elasticsearch_check.rb +24 -0
  728. data/lib/workarea/monitoring/load_balancing_check.rb +9 -0
  729. data/lib/workarea/monitoring/mongoid_check.rb +23 -0
  730. data/lib/workarea/monitoring/sidekiq_queue_size_check.rb +16 -0
  731. data/lib/workarea/mount_point.rb +27 -0
  732. data/lib/workarea/paged_array.rb +37 -0
  733. data/lib/workarea/passenger.rb +5 -0
  734. data/lib/workarea/ping_home_base.rb +69 -0
  735. data/lib/workarea/plugin.rb +117 -0
  736. data/lib/workarea/plugin/asset_appends_helper.rb +36 -0
  737. data/lib/workarea/robots.rb +9 -0
  738. data/lib/workarea/routes_constraints/redirect.rb +11 -0
  739. data/lib/workarea/routes_constraints/super_admin.rb +11 -0
  740. data/lib/workarea/scheduled_jobs.rb +15 -0
  741. data/lib/workarea/scheduler.rb +44 -0
  742. data/lib/workarea/seeds.rb +69 -0
  743. data/lib/workarea/string_id.rb +45 -0
  744. data/lib/workarea/svg_asset_finder.rb +43 -0
  745. data/lib/workarea/swappable_list.rb +64 -0
  746. data/lib/workarea/url_token.rb +24 -0
  747. data/lib/workarea/validators/email_validator.rb +24 -0
  748. data/lib/workarea/validators/ip_address_validator.rb +7 -0
  749. data/lib/workarea/validators/parameter_validator.rb +9 -0
  750. data/lib/workarea/validators/password_validator.rb +32 -0
  751. data/lib/workarea/validators/url_validator.rb +11 -0
  752. data/lib/workarea/version.rb +28 -0
  753. data/test/dummy/README.rdoc +28 -0
  754. data/test/dummy/Rakefile +6 -0
  755. data/test/dummy/app/assets/images/.keep +0 -0
  756. data/test/dummy/app/assets/images/workarea/core/foo.png +0 -0
  757. data/test/dummy/app/assets/javascripts/application.js +13 -0
  758. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  759. data/test/dummy/app/controllers/application_controller.rb +5 -0
  760. data/test/dummy/app/controllers/concerns/.keep +0 -0
  761. data/test/dummy/app/helpers/application_helper.rb +2 -0
  762. data/test/dummy/app/mailers/.keep +0 -0
  763. data/test/dummy/app/models/.keep +0 -0
  764. data/test/dummy/app/models/concerns/.keep +0 -0
  765. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  766. data/test/dummy/bin/bundle +3 -0
  767. data/test/dummy/bin/rails +5 -0
  768. data/test/dummy/bin/rake +4 -0
  769. data/test/dummy/bin/setup +34 -0
  770. data/test/dummy/bin/update +29 -0
  771. data/test/dummy/config.ru +4 -0
  772. data/test/dummy/config/application.rb +21 -0
  773. data/test/dummy/config/boot.rb +5 -0
  774. data/test/dummy/config/cable.yml +9 -0
  775. data/test/dummy/config/environment.rb +5 -0
  776. data/test/dummy/config/environments/development.rb +51 -0
  777. data/test/dummy/config/environments/production.rb +86 -0
  778. data/test/dummy/config/environments/test.rb +43 -0
  779. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  780. data/test/dummy/config/initializers/assets.rb +11 -0
  781. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  782. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  783. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  784. data/test/dummy/config/initializers/inflections.rb +16 -0
  785. data/test/dummy/config/initializers/mime_types.rb +4 -0
  786. data/test/dummy/config/initializers/new_framework_defaults.rb +17 -0
  787. data/test/dummy/config/initializers/session_store.rb +3 -0
  788. data/test/dummy/config/initializers/workarea.rb +8 -0
  789. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  790. data/test/dummy/config/locales/en.yml +23 -0
  791. data/test/dummy/config/puma.rb +47 -0
  792. data/test/dummy/config/routes.rb +8 -0
  793. data/test/dummy/config/secrets.yml +22 -0
  794. data/test/dummy/config/spring.rb +6 -0
  795. data/test/dummy/db/seeds.rb +10 -0
  796. data/test/dummy/lib/assets/.keep +0 -0
  797. data/test/dummy/log/.keep +0 -0
  798. data/test/dummy/public/404.html +67 -0
  799. data/test/dummy/public/422.html +67 -0
  800. data/test/dummy/public/500.html +66 -0
  801. data/test/dummy/public/favicon.ico +1 -0
  802. data/test/fixtures/label.png +0 -0
  803. data/test/fixtures/tax_rates.csv +3 -0
  804. data/test/generators/workarea/content_block_type_generator_test.rb +48 -0
  805. data/test/generators/workarea/decorator_generator_test.rb +36 -0
  806. data/test/generators/workarea/discount_generator_test.rb +64 -0
  807. data/test/generators/workarea/docker_generator_test.rb +156 -0
  808. data/test/generators/workarea/install_generator_test.rb +92 -0
  809. data/test/generators/workarea/js_adapter_generator_test.rb +15 -0
  810. data/test/generators/workarea/override_generator_test.rb +16 -0
  811. data/test/generators/workarea/pricing_calculator_generator_test.rb +26 -0
  812. data/test/generators/workarea/product_template_generator_test.rb +36 -0
  813. data/test/generators/workarea/seeds_generator_test.rb +29 -0
  814. data/test/helpers/workarea/addresses_helper_test.rb +42 -0
  815. data/test/helpers/workarea/application_helper_test.rb +67 -0
  816. data/test/helpers/workarea/conditional_url_helper_test.rb +29 -0
  817. data/test/helpers/workarea/content_assets_helper_test.rb +23 -0
  818. data/test/helpers/workarea/facets_helper_test.rb +31 -0
  819. data/test/helpers/workarea/i18n_helper_test.rb +18 -0
  820. data/test/helpers/workarea/style_guides_helper_test.rb +63 -0
  821. data/test/integration/workarea/authentication_test.rb +166 -0
  822. data/test/integration/workarea/authorization_test.rb +88 -0
  823. data/test/integration/workarea/cache_varies_integration_test.rb +80 -0
  824. data/test/integration/workarea/monitoring_integration_test.rb +30 -0
  825. data/test/integration/workarea/rack_attack_integration_test.rb +168 -0
  826. data/test/javascripts/cookie_spec.js +37 -0
  827. data/test/javascripts/date_spec.js +102 -0
  828. data/test/javascripts/deletion_forms_spec.js +27 -0
  829. data/test/javascripts/duplicate_id_spec.js +15 -0
  830. data/test/javascripts/fixtures/deletion_forms.html.haml +3 -0
  831. data/test/javascripts/fixtures/duplicate_id.html.haml +6 -0
  832. data/test/javascripts/fixtures/form_submitting_controls.html.haml +4 -0
  833. data/test/javascripts/fixtures/reveal_password.html.haml +5 -0
  834. data/test/javascripts/fixtures/workarea_scope.html.haml +5 -0
  835. data/test/javascripts/form_submitting_controls_spec.js +36 -0
  836. data/test/javascripts/reveal_password_spec.js +22 -0
  837. data/test/javascripts/spec_helper.js +26 -0
  838. data/test/javascripts/string_spec.js +41 -0
  839. data/test/javascripts/url_spec.js +74 -0
  840. data/test/javascripts/workarea_spec.js +66 -0
  841. data/test/lib/workarea/asset_endpoints/favicons_test.rb +39 -0
  842. data/test/lib/workarea/autoexpire_cache_redis_test.rb +37 -0
  843. data/test/lib/workarea/constants_test.rb +26 -0
  844. data/test/lib/workarea/elasticsearch/document_test.rb +125 -0
  845. data/test/lib/workarea/elasticsearch/query_cache_test.rb +93 -0
  846. data/test/lib/workarea/ext/freedom_patches/country_test.rb +23 -0
  847. data/test/lib/workarea/ext/freedom_patches/dragonfly_callable_url_host_test.rb +20 -0
  848. data/test/lib/workarea/ext/freedom_patches/global_id_test.rb +16 -0
  849. data/test/lib/workarea/ext/mongoid/audit_log_entry_test.rb +68 -0
  850. data/test/lib/workarea/ext/mongoid/each_by_test.rb +49 -0
  851. data/test/lib/workarea/ext/mongoid/except_test.rb +18 -0
  852. data/test/lib/workarea/ext/mongoid/find_ordered_test.rb +17 -0
  853. data/test/lib/workarea/ext/mongoid/list_field_test.rb +27 -0
  854. data/test/lib/workarea/geolocation_test.rb +86 -0
  855. data/test/lib/workarea/lint/inconsistent_details_test.rb +46 -0
  856. data/test/lib/workarea/lint/products_missing_images_test.rb +18 -0
  857. data/test/lib/workarea/lint/products_missing_variants_test.rb +18 -0
  858. data/test/lib/workarea/lint/skus_missing_inventory_test.rb +30 -0
  859. data/test/lib/workarea/lint/skus_missing_pricing_test.rb +30 -0
  860. data/test/lib/workarea/lint/skus_missing_variants_test.rb +34 -0
  861. data/test/lib/workarea/mail_interceptor_test.rb +69 -0
  862. data/test/lib/workarea/paged_array_test.rb +11 -0
  863. data/test/lib/workarea/ping_home_base/request_test.rb +23 -0
  864. data/test/lib/workarea/plugin_test.rb +100 -0
  865. data/test/lib/workarea/scheduled_jobs_test.rb +26 -0
  866. data/test/lib/workarea/scheduler_test.rb +46 -0
  867. data/test/lib/workarea/string_id_test.rb +43 -0
  868. data/test/lib/workarea/svg_asset_finder_test.rb +29 -0
  869. data/test/lib/workarea/swappable_list_test.rb +45 -0
  870. data/test/lib/workarea/url_token_test.rb +21 -0
  871. data/test/lib/workarea/validators/email_validator_test.rb +25 -0
  872. data/test/lib/workarea/validators/parameter_validator_test.rb +19 -0
  873. data/test/lib/workarea/validators/password_validator_test.rb +60 -0
  874. data/test/mailers/workarea/application_mailer_test.rb +25 -0
  875. data/test/middleware/workarea/audit_log_middleware_test.rb +19 -0
  876. data/test/middleware/workarea/release_server_middleware_test.rb +13 -0
  877. data/test/models/workarea/address_equality_test.rb +62 -0
  878. data/test/models/workarea/address_test.rb +112 -0
  879. data/test/models/workarea/address_validation_test.rb +94 -0
  880. data/test/models/workarea/application_document_test.rb +39 -0
  881. data/test/models/workarea/bulk_action/product_edit_test.rb +138 -0
  882. data/test/models/workarea/bulk_action/sequential_product_edit_test.rb +40 -0
  883. data/test/models/workarea/bulk_action_test.rb +84 -0
  884. data/test/models/workarea/catalog/category_test.rb +41 -0
  885. data/test/models/workarea/catalog/customizations_test.rb +27 -0
  886. data/test/models/workarea/catalog/product_image_test.rb +39 -0
  887. data/test/models/workarea/catalog/product_placeholder_image_test.rb +17 -0
  888. data/test/models/workarea/catalog/product_positions_test.rb +43 -0
  889. data/test/models/workarea/catalog/product_test.rb +83 -0
  890. data/test/models/workarea/catalog/variant_test.rb +14 -0
  891. data/test/models/workarea/checkout/collect_payment_test.rb +51 -0
  892. data/test/models/workarea/checkout/shipping_options_test.rb +71 -0
  893. data/test/models/workarea/checkout/steps/addresses_test.rb +127 -0
  894. data/test/models/workarea/checkout/steps/payment_test.rb +108 -0
  895. data/test/models/workarea/checkout/steps/shipping_test.rb +106 -0
  896. data/test/models/workarea/checkout_test.rb +262 -0
  897. data/test/models/workarea/comment_test.rb +15 -0
  898. data/test/models/workarea/commentable_test.rb +29 -0
  899. data/test/models/workarea/content/asset_test.rb +32 -0
  900. data/test/models/workarea/content/asset_validation_test.rb +68 -0
  901. data/test/models/workarea/content/block_name_test.rb +25 -0
  902. data/test/models/workarea/content/block_test.rb +157 -0
  903. data/test/models/workarea/content/block_type_definition_test.rb +152 -0
  904. data/test/models/workarea/content/block_type_test.rb +95 -0
  905. data/test/models/workarea/content/email_test.rb +20 -0
  906. data/test/models/workarea/content/field_test.rb +15 -0
  907. data/test/models/workarea/content/fields/asset_test.rb +17 -0
  908. data/test/models/workarea/content/fields/products_test.rb +14 -0
  909. data/test/models/workarea/content/page_test.rb +13 -0
  910. data/test/models/workarea/content_test.rb +28 -0
  911. data/test/models/workarea/data_file/csv_test.rb +408 -0
  912. data/test/models/workarea/data_file/export_test.rb +24 -0
  913. data/test/models/workarea/data_file/format_test.rb +24 -0
  914. data/test/models/workarea/data_file/import_test.rb +106 -0
  915. data/test/models/workarea/data_file/json_test.rb +80 -0
  916. data/test/models/workarea/data_file/operation_test.rb +18 -0
  917. data/test/models/workarea/data_file/tax_test.rb +59 -0
  918. data/test/models/workarea/details_test.rb +63 -0
  919. data/test/models/workarea/discount_ids_test.rb +35 -0
  920. data/test/models/workarea/fulfillment/item_test.rb +34 -0
  921. data/test/models/workarea/fulfillment/package_test.rb +43 -0
  922. data/test/models/workarea/fulfillment_test.rb +217 -0
  923. data/test/models/workarea/help/article_test.rb +54 -0
  924. data/test/models/workarea/insights/base_test.rb +41 -0
  925. data/test/models/workarea/insights/best_customers_test.rb +51 -0
  926. data/test/models/workarea/insights/best_full_price_customers_test.rb +52 -0
  927. data/test/models/workarea/insights/cold_products_test.rb +124 -0
  928. data/test/models/workarea/insights/cold_searches_test.rb +124 -0
  929. data/test/models/workarea/insights/customer_acquisition_test.rb +44 -0
  930. data/test/models/workarea/insights/customers_at_risk_test.rb +26 -0
  931. data/test/models/workarea/insights/hot_products_test.rb +124 -0
  932. data/test/models/workarea/insights/hot_searches_test.rb +124 -0
  933. data/test/models/workarea/insights/low_aov_customers_test.rb +30 -0
  934. data/test/models/workarea/insights/most_discount_given.rb +70 -0
  935. data/test/models/workarea/insights/most_discounted_products_test.rb +47 -0
  936. data/test/models/workarea/insights/new_products_test.rb +33 -0
  937. data/test/models/workarea/insights/non_sellers_test.rb +39 -0
  938. data/test/models/workarea/insights/popular_searches_test.rb +45 -0
  939. data/test/models/workarea/insights/popular_searches_without_results_test.rb +28 -0
  940. data/test/models/workarea/insights/products_purchased_together_test.rb +63 -0
  941. data/test/models/workarea/insights/products_to_improve_test.rb +134 -0
  942. data/test/models/workarea/insights/promising_products_test.rb +137 -0
  943. data/test/models/workarea/insights/release_reminder_test.rb +25 -0
  944. data/test/models/workarea/insights/repeat_purchase_rate_test.rb +38 -0
  945. data/test/models/workarea/insights/sales_by_navigation_test.rb +94 -0
  946. data/test/models/workarea/insights/searches_to_improve_test.rb +134 -0
  947. data/test/models/workarea/insights/star_products_test.rb +67 -0
  948. data/test/models/workarea/insights/star_searches_test.rb +67 -0
  949. data/test/models/workarea/insights/top_categories_test.rb +94 -0
  950. data/test/models/workarea/insights/top_discounts_test.rb +91 -0
  951. data/test/models/workarea/insights/top_products_test.rb +94 -0
  952. data/test/models/workarea/insights/trending_products_test.rb +83 -0
  953. data/test/models/workarea/insights/trending_searches_test.rb +83 -0
  954. data/test/models/workarea/insights/upcoming_releases_test.rb +21 -0
  955. data/test/models/workarea/inventory/capture_test.rb +97 -0
  956. data/test/models/workarea/inventory/collection_test.rb +35 -0
  957. data/test/models/workarea/inventory/policies/allow_backorder_test.rb +70 -0
  958. data/test/models/workarea/inventory/policies/ignore_test.rb +21 -0
  959. data/test/models/workarea/inventory/policies/standard_test.rb +19 -0
  960. data/test/models/workarea/inventory/sku_test.rb +97 -0
  961. data/test/models/workarea/inventory/transaction_test.rb +169 -0
  962. data/test/models/workarea/inventory_test.rb +29 -0
  963. data/test/models/workarea/lock_test.rb +47 -0
  964. data/test/models/workarea/lockable_test.rb +73 -0
  965. data/test/models/workarea/metrics/by_day_test.rb +145 -0
  966. data/test/models/workarea/metrics/calculate_percentiles_test.rb +47 -0
  967. data/test/models/workarea/metrics/product_by_week_test.rb +141 -0
  968. data/test/models/workarea/metrics/product_for_last_week_test.rb +128 -0
  969. data/test/models/workarea/metrics/search_by_day_test.rb +40 -0
  970. data/test/models/workarea/metrics/search_by_week_test.rb +141 -0
  971. data/test/models/workarea/metrics/search_for_last_week_test.rb +134 -0
  972. data/test/models/workarea/metrics/user_test.rb +79 -0
  973. data/test/models/workarea/navigation/breadcrumbs_test.rb +52 -0
  974. data/test/models/workarea/navigation/menu_test.rb +23 -0
  975. data/test/models/workarea/navigation/redirect_test.rb +51 -0
  976. data/test/models/workarea/navigation/search_results_test.rb +32 -0
  977. data/test/models/workarea/navigation/taxon_test.rb +118 -0
  978. data/test/models/workarea/normalize_email_test.rb +17 -0
  979. data/test/models/workarea/order/item_test.rb +60 -0
  980. data/test/models/workarea/order/queries_test.rb +187 -0
  981. data/test/models/workarea/order_test.rb +154 -0
  982. data/test/models/workarea/ordering_test.rb +41 -0
  983. data/test/models/workarea/payment/address_test.rb +139 -0
  984. data/test/models/workarea/payment/authorize/credit_card_test.rb +108 -0
  985. data/test/models/workarea/payment/authorize/store_credit_test.rb +73 -0
  986. data/test/models/workarea/payment/capture/credit_card_test.rb +66 -0
  987. data/test/models/workarea/payment/capture/store_credit_test.rb +50 -0
  988. data/test/models/workarea/payment/capture_test.rb +168 -0
  989. data/test/models/workarea/payment/credit_card_integration_test.rb +174 -0
  990. data/test/models/workarea/payment/credit_card_test.rb +111 -0
  991. data/test/models/workarea/payment/operation_test.rb +143 -0
  992. data/test/models/workarea/payment/profile_test.rb +48 -0
  993. data/test/models/workarea/payment/purchase/credit_card_test.rb +95 -0
  994. data/test/models/workarea/payment/purchase/store_credit_test.rb +72 -0
  995. data/test/models/workarea/payment/refund/credit_card_test.rb +66 -0
  996. data/test/models/workarea/payment/refund/store_credit_test.rb +63 -0
  997. data/test/models/workarea/payment/refund_test.rb +188 -0
  998. data/test/models/workarea/payment/saved_credit_card_test.rb +32 -0
  999. data/test/models/workarea/payment/store_credit_card_test.rb +42 -0
  1000. data/test/models/workarea/payment/tender/credit_card_test.rb +52 -0
  1001. data/test/models/workarea/payment/tender/store_credit_test.rb +18 -0
  1002. data/test/models/workarea/payment/tender_test.rb +191 -0
  1003. data/test/models/workarea/payment/transaction_test.rb +126 -0
  1004. data/test/models/workarea/payment_reference_test.rb +17 -0
  1005. data/test/models/workarea/payment_test.rb +172 -0
  1006. data/test/models/workarea/price_adjustment_test.rb +26 -0
  1007. data/test/models/workarea/pricing/cache_key_test.rb +67 -0
  1008. data/test/models/workarea/pricing/calculators/customizations_calculator_test.rb +28 -0
  1009. data/test/models/workarea/pricing/calculators/discount_calculator_test.rb +152 -0
  1010. data/test/models/workarea/pricing/calculators/item_calculator_test.rb +76 -0
  1011. data/test/models/workarea/pricing/calculators/overrides_calculator_test.rb +130 -0
  1012. data/test/models/workarea/pricing/calculators/tax_calculator_test.rb +118 -0
  1013. data/test/models/workarea/pricing/collection_test.rb +101 -0
  1014. data/test/models/workarea/pricing/discount/amount_calculator_test.rb +31 -0
  1015. data/test/models/workarea/pricing/discount/application_group_test.rb +174 -0
  1016. data/test/models/workarea/pricing/discount/buy_some_get_some/order_items_by_product_test.rb +28 -0
  1017. data/test/models/workarea/pricing/discount/buy_some_get_some_test.rb +200 -0
  1018. data/test/models/workarea/pricing/discount/category_test.rb +68 -0
  1019. data/test/models/workarea/pricing/discount/code_list_test.rb +23 -0
  1020. data/test/models/workarea/pricing/discount/collection_test.rb +44 -0
  1021. data/test/models/workarea/pricing/discount/conditions/user_tags_test.rb +43 -0
  1022. data/test/models/workarea/pricing/discount/free_gift_test.rb +65 -0
  1023. data/test/models/workarea/pricing/discount/generated_promo_code_test.rb +14 -0
  1024. data/test/models/workarea/pricing/discount/order_test.rb +60 -0
  1025. data/test/models/workarea/pricing/discount/order_total_test.rb +60 -0
  1026. data/test/models/workarea/pricing/discount/product_attribute_test.rb +81 -0
  1027. data/test/models/workarea/pricing/discount/product_test.rb +63 -0
  1028. data/test/models/workarea/pricing/discount/quantity_fixed_price_test.rb +292 -0
  1029. data/test/models/workarea/pricing/discount/shipping_test.rb +67 -0
  1030. data/test/models/workarea/pricing/discount_test.rb +95 -0
  1031. data/test/models/workarea/pricing/override_test.rb +59 -0
  1032. data/test/models/workarea/pricing/price_distributor_test.rb +40 -0
  1033. data/test/models/workarea/pricing/price_test.rb +58 -0
  1034. data/test/models/workarea/pricing/request_test.rb +86 -0
  1035. data/test/models/workarea/pricing/sku_test.rb +47 -0
  1036. data/test/models/workarea/pricing/tax_applier_test.rb +125 -0
  1037. data/test/models/workarea/pricing_test.rb +1398 -0
  1038. data/test/models/workarea/product_rule_test.rb +55 -0
  1039. data/test/models/workarea/query_string_test.rb +90 -0
  1040. data/test/models/workarea/recommendation/user_activity_test.rb +96 -0
  1041. data/test/models/workarea/releasable_test.rb +479 -0
  1042. data/test/models/workarea/release_test.rb +287 -0
  1043. data/test/models/workarea/reports/export_test.rb +33 -0
  1044. data/test/models/workarea/search/admin/catalog_category_test.rb +44 -0
  1045. data/test/models/workarea/search/admin/catalog_product_test.rb +126 -0
  1046. data/test/models/workarea/search/admin/content_asset_test.rb +54 -0
  1047. data/test/models/workarea/search/admin/content_page_test.rb +18 -0
  1048. data/test/models/workarea/search/admin/content_test.rb +17 -0
  1049. data/test/models/workarea/search/admin/order_test.rb +105 -0
  1050. data/test/models/workarea/search/admin/pricing_discount_test.rb +31 -0
  1051. data/test/models/workarea/search/admin/releasable_test.rb +36 -0
  1052. data/test/models/workarea/search/admin/user_test.rb +53 -0
  1053. data/test/models/workarea/search/admin_test.rb +18 -0
  1054. data/test/models/workarea/search/customization_test.rb +69 -0
  1055. data/test/models/workarea/search/settings_test.rb +18 -0
  1056. data/test/models/workarea/search/storefront/product/categories_test.rb +95 -0
  1057. data/test/models/workarea/search/storefront/product/facets_test.rb +35 -0
  1058. data/test/models/workarea/search/storefront/product/inventory_test.rb +23 -0
  1059. data/test/models/workarea/search/storefront/product/pricing_test.rb +41 -0
  1060. data/test/models/workarea/search/storefront/product/text_test.rb +69 -0
  1061. data/test/models/workarea/search/storefront/product_test.rb +108 -0
  1062. data/test/models/workarea/search/storefront_test.rb +27 -0
  1063. data/test/models/workarea/shipping/address_test.rb +139 -0
  1064. data/test/models/workarea/shipping/location_query_test.rb +60 -0
  1065. data/test/models/workarea/shipping/rate_lookup_test.rb +76 -0
  1066. data/test/models/workarea/shipping/rate_test.rb +19 -0
  1067. data/test/models/workarea/shipping/service_test.rb +40 -0
  1068. data/test/models/workarea/shipping/sku_test.rb +31 -0
  1069. data/test/models/workarea/shipping_option_test.rb +50 -0
  1070. data/test/models/workarea/shipping_test.rb +106 -0
  1071. data/test/models/workarea/tax/category_test.rb +57 -0
  1072. data/test/models/workarea/tax/rate_lookup_test.rb +217 -0
  1073. data/test/models/workarea/tax_test.rb +34 -0
  1074. data/test/models/workarea/user/admin_bookmark_test.rb +39 -0
  1075. data/test/models/workarea/user/admin_visit_test.rb +23 -0
  1076. data/test/models/workarea/user/password_reset_test.rb +30 -0
  1077. data/test/models/workarea/user/recent_password_test.rb +50 -0
  1078. data/test/models/workarea/user/system_users_test.rb +14 -0
  1079. data/test/models/workarea/user_test.rb +312 -0
  1080. data/test/queries/workarea/admin_query_operation_test.rb +67 -0
  1081. data/test/queries/workarea/admin_search_query_wrapper_test.rb +90 -0
  1082. data/test/queries/workarea/alerts_test.rb +131 -0
  1083. data/test/queries/workarea/bulk_action_selections_test.rb +35 -0
  1084. data/test/queries/workarea/categorization_test.rb +88 -0
  1085. data/test/queries/workarea/extract_content_block_text_test.rb +60 -0
  1086. data/test/queries/workarea/find_pipeline_asset_test.rb +21 -0
  1087. data/test/queries/workarea/find_taxonomy_slug_test.rb +20 -0
  1088. data/test/queries/workarea/find_unique_slug_test.rb +14 -0
  1089. data/test/queries/workarea/metadata/catalog_category_test.rb +38 -0
  1090. data/test/queries/workarea/metadata/content_page_test.rb +36 -0
  1091. data/test/queries/workarea/metadata/home_page_test.rb +34 -0
  1092. data/test/queries/workarea/order_item_details_test.rb +43 -0
  1093. data/test/queries/workarea/order_metrics_test.rb +180 -0
  1094. data/test/queries/workarea/pricing_override_params_test.rb +28 -0
  1095. data/test/queries/workarea/product_primary_image_url_test.rb +22 -0
  1096. data/test/queries/workarea/product_primary_navigation_test.rb +49 -0
  1097. data/test/queries/workarea/recommendation/order_based_test.rb +51 -0
  1098. data/test/queries/workarea/recommendation/product_based_test.rb +91 -0
  1099. data/test/queries/workarea/recommendation/searches_test.rb +23 -0
  1100. data/test/queries/workarea/recommendation/user_activity_based_test.rb +37 -0
  1101. data/test/queries/workarea/reports/average_order_value_test.rb +336 -0
  1102. data/test/queries/workarea/reports/customers_test.rb +106 -0
  1103. data/test/queries/workarea/reports/first_time_vs_returning_sales_test.rb +274 -0
  1104. data/test/queries/workarea/reports/low_inventory_test.rb +48 -0
  1105. data/test/queries/workarea/reports/report_test.rb +100 -0
  1106. data/test/queries/workarea/reports/sales_by_category_test.rb +137 -0
  1107. data/test/queries/workarea/reports/sales_by_country_test.rb +130 -0
  1108. data/test/queries/workarea/reports/sales_by_discount_test.rb +122 -0
  1109. data/test/queries/workarea/reports/sales_by_menu_test.rb +130 -0
  1110. data/test/queries/workarea/reports/sales_by_product_test.rb +130 -0
  1111. data/test/queries/workarea/reports/sales_by_sku_test.rb +171 -0
  1112. data/test/queries/workarea/reports/sales_by_traffic_referrer_test.rb +159 -0
  1113. data/test/queries/workarea/reports/sales_over_time_test.rb +539 -0
  1114. data/test/queries/workarea/reports/searches_over_time_test.rb +90 -0
  1115. data/test/queries/workarea/reports/searches_test.rb +179 -0
  1116. data/test/queries/workarea/reports/searches_without_results_over_time_test.rb +100 -0
  1117. data/test/queries/workarea/search/admin_discounts_test.rb +26 -0
  1118. data/test/queries/workarea/search/admin_orders_test.rb +63 -0
  1119. data/test/queries/workarea/search/admin_payment_transactions_test.rb +13 -0
  1120. data/test/queries/workarea/search/admin_releases_test.rb +67 -0
  1121. data/test/queries/workarea/search/admin_search_test.rb +105 -0
  1122. data/test/queries/workarea/search/admin_users_test.rb +20 -0
  1123. data/test/queries/workarea/search/categorization_test.rb +31 -0
  1124. data/test/queries/workarea/search/category_browse_test.rb +334 -0
  1125. data/test/queries/workarea/search/date_filter_test.rb +39 -0
  1126. data/test/queries/workarea/search/facet_matches_test.rb +55 -0
  1127. data/test/queries/workarea/search/facet_sorting/size_test.rb +27 -0
  1128. data/test/queries/workarea/search/facet_sorting_test.rb +127 -0
  1129. data/test/queries/workarea/search/facet_test.rb +108 -0
  1130. data/test/queries/workarea/search/filter_test.rb +68 -0
  1131. data/test/queries/workarea/search/pagination_test.rb +66 -0
  1132. data/test/queries/workarea/search/product_entries_test.rb +14 -0
  1133. data/test/queries/workarea/search/product_facet_sorting_test.rb +90 -0
  1134. data/test/queries/workarea/search/product_rules_test.rb +348 -0
  1135. data/test/queries/workarea/search/product_search_test.rb +413 -0
  1136. data/test/queries/workarea/search/query_test.rb +43 -0
  1137. data/test/queries/workarea/search/range_facet_test.rb +15 -0
  1138. data/test/queries/workarea/search/range_parameter_test.rb +30 -0
  1139. data/test/queries/workarea/search/related_help_test.rb +101 -0
  1140. data/test/queries/workarea/search/related_products_test.rb +81 -0
  1141. data/test/queries/workarea/search/search_suggestions_test.rb +29 -0
  1142. data/test/queries/workarea/search/storefront_search_test.rb +111 -0
  1143. data/test/queries/workarea/search/terms_facet_test.rb +12 -0
  1144. data/test/queries/workarea/taxonomy_sitemap_test.rb +34 -0
  1145. data/test/services/workarea/add_multiple_cart_items/item_test.rb +56 -0
  1146. data/test/services/workarea/add_multiple_cart_items_test.rb +100 -0
  1147. data/test/services/workarea/cancel_order_test.rb +118 -0
  1148. data/test/services/workarea/cart_cleaner_test.rb +66 -0
  1149. data/test/services/workarea/clean_range_facets_test.rb +28 -0
  1150. data/test/services/workarea/copy_order_test.rb +83 -0
  1151. data/test/services/workarea/copy_product_test.rb +25 -0
  1152. data/test/services/workarea/create_fulfillment_test.rb +23 -0
  1153. data/test/services/workarea/direct_upload_test.rb +58 -0
  1154. data/test/services/workarea/export_report_test.rb +66 -0
  1155. data/test/services/workarea/hash_update_test.rb +24 -0
  1156. data/test/services/workarea/inventory_adjustment_test.rb +41 -0
  1157. data/test/services/workarea/login_test.rb +74 -0
  1158. data/test/services/workarea/order_merge_test.rb +30 -0
  1159. data/test/services/workarea/packaging_test.rb +91 -0
  1160. data/test/services/workarea/save_publishing_test.rb +46 -0
  1161. data/test/services/workarea/save_taxonomy_test.rb +72 -0
  1162. data/test/services/workarea/set_navigable_test.rb +54 -0
  1163. data/test/services/workarea/sort_navigation_menus_by_orders_test.rb +25 -0
  1164. data/test/teaspoon_env.rb +6 -0
  1165. data/test/test_helper.rb +10 -0
  1166. data/test/vcr_cassettes/csv_image_upload.yml +49 -0
  1167. data/test/view_models/workarea/shipping_carrier_view_model_test.rb +49 -0
  1168. data/test/workarea_test.rb +9 -0
  1169. data/test/workers/sidekiq/callbacks_test.rb +433 -0
  1170. data/test/workers/workarea/bulk_index_admin_test.rb +30 -0
  1171. data/test/workers/workarea/bulk_index_products_test.rb +18 -0
  1172. data/test/workers/workarea/bulk_index_searches_test.rb +45 -0
  1173. data/test/workers/workarea/clean_inventory_transactions_test.rb +19 -0
  1174. data/test/workers/workarea/clean_orders_test.rb +22 -0
  1175. data/test/workers/workarea/clean_product_recommendations_test.rb +15 -0
  1176. data/test/workers/workarea/deactivate_stale_discounts_test.rb +82 -0
  1177. data/test/workers/workarea/generate_content_metadata_test.rb +32 -0
  1178. data/test/workers/workarea/generate_insights_test.rb +38 -0
  1179. data/test/workers/workarea/index_admin_search_test.rb +10 -0
  1180. data/test/workers/workarea/index_categorization_test.rb +26 -0
  1181. data/test/workers/workarea/index_category_changes_test.rb +63 -0
  1182. data/test/workers/workarea/index_fulfillment_changes_test.rb +14 -0
  1183. data/test/workers/workarea/index_help_test.rb +18 -0
  1184. data/test/workers/workarea/index_payment_transactions_test.rb +42 -0
  1185. data/test/workers/workarea/index_product_rule_test.rb +20 -0
  1186. data/test/workers/workarea/index_product_test.rb +17 -0
  1187. data/test/workers/workarea/index_skus_test.rb +14 -0
  1188. data/test/workers/workarea/keep_product_index_fresh_test.rb +46 -0
  1189. data/test/workers/workarea/mark_discounts_as_redeemed_test.rb +51 -0
  1190. data/test/workers/workarea/order_reminder_test.rb +45 -0
  1191. data/test/workers/workarea/process_import_test.rb +57 -0
  1192. data/test/workers/workarea/process_product_recommendations_test.rb +57 -0
  1193. data/test/workers/workarea/process_search_recommendations_test.rb +27 -0
  1194. data/test/workers/workarea/publish_bulk_action_test.rb +27 -0
  1195. data/test/workers/workarea/publish_release_test.rb +20 -0
  1196. data/test/workers/workarea/redirect_navigable_slugs_test.rb +28 -0
  1197. data/test/workers/workarea/save_order_metrics_test.rb +14 -0
  1198. data/test/workers/workarea/save_user_order_details_test.rb +130 -0
  1199. data/test/workers/workarea/send_refund_email_test.rb +74 -0
  1200. data/test/workers/workarea/status_reporter_test.rb +20 -0
  1201. data/test/workers/workarea/undo_release_test.rb +23 -0
  1202. data/test/workers/workarea/update_payment_profile_email_test.rb +27 -0
  1203. data/test/workers/workarea/verify_scheduled_releases_test.rb +71 -0
  1204. data/vendor/active_shipping/.gitignore +15 -0
  1205. data/vendor/active_shipping/.travis.yml +31 -0
  1206. data/vendor/active_shipping/.yardopts +13 -0
  1207. data/vendor/active_shipping/CHANGELOG.md +218 -0
  1208. data/vendor/active_shipping/CONTRIBUTING.md +23 -0
  1209. data/vendor/active_shipping/Gemfile +3 -0
  1210. data/vendor/active_shipping/MIT-LICENSE +20 -0
  1211. data/vendor/active_shipping/README.md +163 -0
  1212. data/vendor/active_shipping/Rakefile +35 -0
  1213. data/vendor/active_shipping/active_shipping.gemspec +38 -0
  1214. data/vendor/active_shipping/dev.yml +17 -0
  1215. data/vendor/active_shipping/gemfiles/activesupport42.gemfile +5 -0
  1216. data/vendor/active_shipping/gemfiles/activesupport50.gemfile +6 -0
  1217. data/vendor/active_shipping/gemfiles/activesupport51.gemfile +5 -0
  1218. data/vendor/active_shipping/gemfiles/activesupport52.gemfile +5 -0
  1219. data/vendor/active_shipping/gemfiles/activesupport_master.gemfile +5 -0
  1220. data/vendor/active_shipping/lib/active_shipping.rb +26 -0
  1221. data/vendor/active_shipping/lib/active_shipping/address_validation_response.rb +29 -0
  1222. data/vendor/active_shipping/lib/active_shipping/carrier.rb +183 -0
  1223. data/vendor/active_shipping/lib/active_shipping/carriers.rb +34 -0
  1224. data/vendor/active_shipping/lib/active_shipping/carriers/australia_post.rb +248 -0
  1225. data/vendor/active_shipping/lib/active_shipping/carriers/benchmark_carrier.rb +31 -0
  1226. data/vendor/active_shipping/lib/active_shipping/carriers/bogus_carrier.rb +12 -0
  1227. data/vendor/active_shipping/lib/active_shipping/carriers/canada_post.rb +263 -0
  1228. data/vendor/active_shipping/lib/active_shipping/carriers/canada_post_pws.rb +908 -0
  1229. data/vendor/active_shipping/lib/active_shipping/carriers/fedex.rb +796 -0
  1230. data/vendor/active_shipping/lib/active_shipping/carriers/kunaki.rb +155 -0
  1231. data/vendor/active_shipping/lib/active_shipping/carriers/new_zealand_post.rb +260 -0
  1232. data/vendor/active_shipping/lib/active_shipping/carriers/shipwire.rb +178 -0
  1233. data/vendor/active_shipping/lib/active_shipping/carriers/stamps.rb +860 -0
  1234. data/vendor/active_shipping/lib/active_shipping/carriers/ups.rb +1216 -0
  1235. data/vendor/active_shipping/lib/active_shipping/carriers/usps.rb +708 -0
  1236. data/vendor/active_shipping/lib/active_shipping/carriers/usps_returns.rb +85 -0
  1237. data/vendor/active_shipping/lib/active_shipping/delivery_date_estimate.rb +20 -0
  1238. data/vendor/active_shipping/lib/active_shipping/delivery_date_estimates_response.rb +11 -0
  1239. data/vendor/active_shipping/lib/active_shipping/errors.rb +35 -0
  1240. data/vendor/active_shipping/lib/active_shipping/external_return_label_request.rb +417 -0
  1241. data/vendor/active_shipping/lib/active_shipping/external_return_label_response.rb +24 -0
  1242. data/vendor/active_shipping/lib/active_shipping/label.rb +10 -0
  1243. data/vendor/active_shipping/lib/active_shipping/label_response.rb +10 -0
  1244. data/vendor/active_shipping/lib/active_shipping/location.rb +166 -0
  1245. data/vendor/active_shipping/lib/active_shipping/package.rb +165 -0
  1246. data/vendor/active_shipping/lib/active_shipping/package_item.rb +60 -0
  1247. data/vendor/active_shipping/lib/active_shipping/rate_estimate.rb +196 -0
  1248. data/vendor/active_shipping/lib/active_shipping/rate_response.rb +32 -0
  1249. data/vendor/active_shipping/lib/active_shipping/response.rb +43 -0
  1250. data/vendor/active_shipping/lib/active_shipping/shipment_event.rb +22 -0
  1251. data/vendor/active_shipping/lib/active_shipping/shipment_packer.rb +108 -0
  1252. data/vendor/active_shipping/lib/active_shipping/shipping_response.rb +33 -0
  1253. data/vendor/active_shipping/lib/active_shipping/tracking_response.rb +119 -0
  1254. data/vendor/active_shipping/lib/active_shipping/version.rb +3 -0
  1255. data/vendor/active_shipping/lib/certs/eParcel.dtd +111 -0
  1256. data/vendor/active_shipping/shipit.rubygems.yml +1 -0
  1257. data/vendor/active_shipping/test/console.rb +39 -0
  1258. data/vendor/active_shipping/test/credentials.yml +69 -0
  1259. data/vendor/active_shipping/test/fixtures/files/label1.pdf +0 -0
  1260. data/vendor/active_shipping/test/fixtures/json/australia_post/calculate_domestic.json +13 -0
  1261. data/vendor/active_shipping/test/fixtures/json/australia_post/calculate_domestic_2.json +19 -0
  1262. data/vendor/active_shipping/test/fixtures/json/australia_post/calculate_international.json +12 -0
  1263. data/vendor/active_shipping/test/fixtures/json/australia_post/calculate_international_2.json +15 -0
  1264. data/vendor/active_shipping/test/fixtures/json/australia_post/error_message.json +5 -0
  1265. data/vendor/active_shipping/test/fixtures/json/australia_post/service_domestic.json +117 -0
  1266. data/vendor/active_shipping/test/fixtures/json/australia_post/service_domestic_2.json +117 -0
  1267. data/vendor/active_shipping/test/fixtures/json/australia_post/service_international.json +76 -0
  1268. data/vendor/active_shipping/test/fixtures/json/australia_post/service_international_2.json +59 -0
  1269. data/vendor/active_shipping/test/fixtures/json/newzealandpost/domestic_book.json +1 -0
  1270. data/vendor/active_shipping/test/fixtures/json/newzealandpost/domestic_default.json +1 -0
  1271. data/vendor/active_shipping/test/fixtures/json/newzealandpost/domestic_error.json +1 -0
  1272. data/vendor/active_shipping/test/fixtures/json/newzealandpost/domestic_poster.json +1 -0
  1273. data/vendor/active_shipping/test/fixtures/json/newzealandpost/domestic_small_half_pound.json +1 -0
  1274. data/vendor/active_shipping/test/fixtures/json/newzealandpost/international_book.json +1 -0
  1275. data/vendor/active_shipping/test/fixtures/json/newzealandpost/international_new_zealand_wii.json +1 -0
  1276. data/vendor/active_shipping/test/fixtures/json/newzealandpost/international_small_half_pound.json +1 -0
  1277. data/vendor/active_shipping/test/fixtures/json/newzealandpost/international_wii.json +1 -0
  1278. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_request.xml +25 -0
  1279. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response.xml +130 -0
  1280. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_error.xml +16 -0
  1281. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_french.xml +122 -0
  1282. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_with_nil_value.xml +164 -0
  1283. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_with_postal_outlet.xml +155 -0
  1284. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_with_postal_outlet_french.xml +274 -0
  1285. data/vendor/active_shipping/test/fixtures/xml/canadapost/example_response_with_strange_delivery_date.xml +130 -0
  1286. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/dnc_tracking_details_en.xml +112 -0
  1287. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/merchant_details_error.xml +7 -0
  1288. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/merchant_details_response.xml +7 -0
  1289. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/option_response.xml +13 -0
  1290. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/option_response_no_conflicts.xml +7 -0
  1291. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/rates_info.xml +190 -0
  1292. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/rates_info_error.xml +7 -0
  1293. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/receipt_response.xml +42 -0
  1294. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/receipt_response_no_priced_options.xml +36 -0
  1295. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/register_token_error.xml +7 -0
  1296. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/register_token_response.xml +3 -0
  1297. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/service_options_response.xml +42 -0
  1298. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/services_error.xml +6 -0
  1299. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/services_response.xml +32 -0
  1300. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/shipment_domestic.xml +69 -0
  1301. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/shipment_response.xml +20 -0
  1302. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/shipment_us.xml +69 -0
  1303. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/tracking_details_en.xml +152 -0
  1304. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/tracking_details_en_error.xml +7 -0
  1305. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/tracking_details_en_undelivered.xml +116 -0
  1306. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/tracking_details_fr.xml +156 -0
  1307. data/vendor/active_shipping/test/fixtures/xml/canadapost_pws/tracking_details_no_expected_delivery_date.xml +40 -0
  1308. data/vendor/active_shipping/test/fixtures/xml/fedex/create_shipment_response.xml +2 -0
  1309. data/vendor/active_shipping/test/fixtures/xml/fedex/freight_rate_request.xml +82 -0
  1310. data/vendor/active_shipping/test/fixtures/xml/fedex/freight_rate_response.xml +506 -0
  1311. data/vendor/active_shipping/test/fixtures/xml/fedex/invalid_fedex_reply.xml +27 -0
  1312. data/vendor/active_shipping/test/fixtures/xml/fedex/ottawa_to_beverly_hills_commercial_rate_request.xml +79 -0
  1313. data/vendor/active_shipping/test/fixtures/xml/fedex/ottawa_to_beverly_hills_no_saturday_rate_request.xml +79 -0
  1314. data/vendor/active_shipping/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +80 -0
  1315. data/vendor/active_shipping/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +214 -0
  1316. data/vendor/active_shipping/test/fixtures/xml/fedex/raterequest_reply.xml +213 -0
  1317. data/vendor/active_shipping/test/fixtures/xml/fedex/raterequest_response_with_ground_home_delivery.xml +206 -0
  1318. data/vendor/active_shipping/test/fixtures/xml/fedex/reply_without_notifications.xml +185 -0
  1319. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_request.xml +29 -0
  1320. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_bad_tracking_number.xml +20 -0
  1321. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_delivered_at_door.xml +254 -0
  1322. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_delivered_at_facility.xml +403 -0
  1323. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_delivered_with_signature.xml +269 -0
  1324. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_empty_status_detail.xml +84 -0
  1325. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_failure_code_9045.xml +52 -0
  1326. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_failure_code_9080.xml +51 -0
  1327. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_in_transit.xml +127 -0
  1328. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_invalid_tracking_number.xml +52 -0
  1329. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_missing_status_code.xml +89 -0
  1330. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_multiple_results.xml +100 -0
  1331. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_not_found.xml +52 -0
  1332. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_shipment_exception.xml +209 -0
  1333. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_unable_to_process.xml +32 -0
  1334. data/vendor/active_shipping/test/fixtures/xml/fedex/tracking_response_with_blank_state.xml +107 -0
  1335. data/vendor/active_shipping/test/fixtures/xml/fedex/unknown_fedex_document_reply.xml +3 -0
  1336. data/vendor/active_shipping/test/fixtures/xml/kunaki/invalid_state_response.xml +3 -0
  1337. data/vendor/active_shipping/test/fixtures/xml/kunaki/no_valid_items_response.xml +3 -0
  1338. data/vendor/active_shipping/test/fixtures/xml/kunaki/successful_rates_response.xml +3 -0
  1339. data/vendor/active_shipping/test/fixtures/xml/kunaki/unsuccessful_rates_response.xml +9 -0
  1340. data/vendor/active_shipping/test/fixtures/xml/shipwire/international_rates_response.xml +17 -0
  1341. data/vendor/active_shipping/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +18 -0
  1342. data/vendor/active_shipping/test/fixtures/xml/shipwire/no_rates_response.xml +7 -0
  1343. data/vendor/active_shipping/test/fixtures/xml/shipwire/rates_response.xml +36 -0
  1344. data/vendor/active_shipping/test/fixtures/xml/shipwire/rates_response_no_estimate.xml +14 -0
  1345. data/vendor/active_shipping/test/fixtures/xml/stamps/authenticate_user_request.xml +15 -0
  1346. data/vendor/active_shipping/test/fixtures/xml/stamps/authenticate_user_response.xml +10 -0
  1347. data/vendor/active_shipping/test/fixtures/xml/stamps/cleanse_address_request.xml +19 -0
  1348. data/vendor/active_shipping/test/fixtures/xml/stamps/cleanse_address_response.xml +27 -0
  1349. data/vendor/active_shipping/test/fixtures/xml/stamps/create_indicium_request.xml +69 -0
  1350. data/vendor/active_shipping/test/fixtures/xml/stamps/create_indicium_response.xml +40 -0
  1351. data/vendor/active_shipping/test/fixtures/xml/stamps/expired_authenticator_response.xml +15 -0
  1352. data/vendor/active_shipping/test/fixtures/xml/stamps/get_account_info_request.xml +11 -0
  1353. data/vendor/active_shipping/test/fixtures/xml/stamps/get_account_info_response.xml +36 -0
  1354. data/vendor/active_shipping/test/fixtures/xml/stamps/get_purchase_status_request.xml +12 -0
  1355. data/vendor/active_shipping/test/fixtures/xml/stamps/get_purchase_status_response.xml +16 -0
  1356. data/vendor/active_shipping/test/fixtures/xml/stamps/get_rates_request.xml +19 -0
  1357. data/vendor/active_shipping/test/fixtures/xml/stamps/get_rates_response.xml +351 -0
  1358. data/vendor/active_shipping/test/fixtures/xml/stamps/purchase_postage_request.xml +13 -0
  1359. data/vendor/active_shipping/test/fixtures/xml/stamps/purchase_postage_response.xml +17 -0
  1360. data/vendor/active_shipping/test/fixtures/xml/stamps/track_shipment_request.xml +12 -0
  1361. data/vendor/active_shipping/test/fixtures/xml/stamps/track_shipment_response.xml +45 -0
  1362. data/vendor/active_shipping/test/fixtures/xml/usps/api_error_rate_response.xml +53 -0
  1363. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_base_rate_response.xml +2 -0
  1364. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_new_york_book_commercial_plus_rate_response.xml +258 -0
  1365. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_new_york_book_rate_response.xml +108 -0
  1366. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_base_rate_response.xml +84 -0
  1367. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_commercial_plus_rate_response.xml +212 -0
  1368. data/vendor/active_shipping/test/fixtures/xml/usps/beverly_hills_to_ottawa_american_wii_rate_response.xml +230 -0
  1369. data/vendor/active_shipping/test/fixtures/xml/usps/first_class_packages_with_invalid_mail_type_response.xml +12 -0
  1370. data/vendor/active_shipping/test/fixtures/xml/usps/first_class_packages_with_mail_type_response.xml +16 -0
  1371. data/vendor/active_shipping/test/fixtures/xml/usps/first_class_packages_without_mail_type_response.xml +12 -0
  1372. data/vendor/active_shipping/test/fixtures/xml/usps/invalid_xml_response.xml +10 -0
  1373. data/vendor/active_shipping/test/fixtures/xml/usps/invalid_xml_tracking_response_error.xml +2 -0
  1374. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_request.xml +10 -0
  1375. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_request_batch.xml +12 -0
  1376. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response.xml +162 -0
  1377. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response_alt.xml +53 -0
  1378. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response_batch.xml +231 -0
  1379. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response_failure.xml +11 -0
  1380. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response_not_available.xml +12 -0
  1381. data/vendor/active_shipping/test/fixtures/xml/usps/tracking_response_test_error.xml +8 -0
  1382. data/vendor/active_shipping/test/fixtures/xml/usps/us_rate_request.xml +18 -0
  1383. data/vendor/active_shipping/test/fixtures/xml/usps/us_rate_request_large.xml +18 -0
  1384. data/vendor/active_shipping/test/fixtures/xml/usps/world_rate_request_only_country.xml +22 -0
  1385. data/vendor/active_shipping/test/fixtures/xml/usps/world_rate_request_with_value.xml +24 -0
  1386. data/vendor/active_shipping/test/fixtures/xml/usps/world_rate_request_without_value.xml +24 -0
  1387. data/vendor/active_shipping/test/fixtures/xml/usps_returns/external_return_label_response.xml +2 -0
  1388. data/vendor/active_shipping/test/fixtures/xml/usps_returns/external_return_label_response_failure.xml +10 -0
  1389. data/vendor/active_shipping/test/remote/australia_post_test.rb +140 -0
  1390. data/vendor/active_shipping/test/remote/canada_post_pws_platform_test.rb +259 -0
  1391. data/vendor/active_shipping/test/remote/canada_post_pws_test.rb +169 -0
  1392. data/vendor/active_shipping/test/remote/canada_post_test.rb +55 -0
  1393. data/vendor/active_shipping/test/remote/fedex_test.rb +400 -0
  1394. data/vendor/active_shipping/test/remote/kunaki_test.rb +37 -0
  1395. data/vendor/active_shipping/test/remote/new_zealand_post_test.rb +149 -0
  1396. data/vendor/active_shipping/test/remote/shipwire_test.rb +84 -0
  1397. data/vendor/active_shipping/test/remote/stamps_test.rb +396 -0
  1398. data/vendor/active_shipping/test/remote/usps_returns_test.rb +72 -0
  1399. data/vendor/active_shipping/test/remote/usps_test.rb +243 -0
  1400. data/vendor/active_shipping/test/test_helper.rb +295 -0
  1401. data/vendor/active_shipping/test/unit/carrier_test.rb +130 -0
  1402. data/vendor/active_shipping/test/unit/carriers/australia_post_test.rb +181 -0
  1403. data/vendor/active_shipping/test/unit/carriers/benchmark_test.rb +18 -0
  1404. data/vendor/active_shipping/test/unit/carriers/canada_post_pws_rating_test.rb +379 -0
  1405. data/vendor/active_shipping/test/unit/carriers/canada_post_pws_register_test.rb +76 -0
  1406. data/vendor/active_shipping/test/unit/carriers/canada_post_pws_shipping_test.rb +258 -0
  1407. data/vendor/active_shipping/test/unit/carriers/canada_post_pws_test.rb +59 -0
  1408. data/vendor/active_shipping/test/unit/carriers/canada_post_pws_tracking_test.rb +154 -0
  1409. data/vendor/active_shipping/test/unit/carriers/canada_post_test.rb +148 -0
  1410. data/vendor/active_shipping/test/unit/carriers/fedex_test.rb +693 -0
  1411. data/vendor/active_shipping/test/unit/carriers/kunaki_test.rb +56 -0
  1412. data/vendor/active_shipping/test/unit/carriers/new_zealand_post_test.rb +177 -0
  1413. data/vendor/active_shipping/test/unit/carriers/shipwire_test.rb +188 -0
  1414. data/vendor/active_shipping/test/unit/carriers/stamps_test.rb +245 -0
  1415. data/vendor/active_shipping/test/unit/carriers/usps_returns_test.rb +45 -0
  1416. data/vendor/active_shipping/test/unit/carriers/usps_test.rb +633 -0
  1417. data/vendor/active_shipping/test/unit/carriers_test.rb +16 -0
  1418. data/vendor/active_shipping/test/unit/external_return_label_request_test.rb +258 -0
  1419. data/vendor/active_shipping/test/unit/location_test.rb +234 -0
  1420. data/vendor/active_shipping/test/unit/package_item_test.rb +232 -0
  1421. data/vendor/active_shipping/test/unit/package_test.rb +404 -0
  1422. data/vendor/active_shipping/test/unit/rate_estimate_test.rb +93 -0
  1423. data/vendor/active_shipping/test/unit/response_test.rb +38 -0
  1424. data/vendor/active_shipping/test/unit/shipment_event_test.rb +20 -0
  1425. data/vendor/active_shipping/test/unit/shipment_packer_test.rb +212 -0
  1426. data/vendor/active_shipping/test/unit/tracking_response_test.rb +41 -0
  1427. data/workarea-core.gemspec +98 -0
  1428. metadata +2585 -0
@@ -0,0 +1,796 @@
1
+ module ActiveShipping
2
+ # FedEx carrier implementation.
3
+ #
4
+ # FedEx module by Jimmy Baker (http://github.com/jimmyebaker)
5
+ # Documentation can be found here: http://images.fedex.com/us/developer/product/WebServices/MyWebHelp/PropDevGuide.pdf
6
+ class FedEx < Carrier
7
+ self.retry_safe = true
8
+
9
+ cattr_reader :name
10
+ @@name = "FedEx"
11
+
12
+ TEST_URL = 'https://gatewaybeta.fedex.com:443/xml'
13
+ LIVE_URL = 'https://gateway.fedex.com:443/xml'
14
+
15
+ CARRIER_CODES = {
16
+ "fedex_ground" => "FDXG",
17
+ "fedex_express" => "FDXE"
18
+ }
19
+
20
+ DELIVERY_ADDRESS_NODE_NAMES = %w(DestinationAddress ActualDeliveryAddress)
21
+ SHIPPER_ADDRESS_NODE_NAMES = %w(ShipperAddress)
22
+
23
+ SERVICE_TYPES = {
24
+ "PRIORITY_OVERNIGHT" => "FedEx Priority Overnight",
25
+ "PRIORITY_OVERNIGHT_SATURDAY_DELIVERY" => "FedEx Priority Overnight Saturday Delivery",
26
+ "FEDEX_2_DAY" => "FedEx 2 Day",
27
+ "FEDEX_2_DAY_SATURDAY_DELIVERY" => "FedEx 2 Day Saturday Delivery",
28
+ "STANDARD_OVERNIGHT" => "FedEx Standard Overnight",
29
+ "FIRST_OVERNIGHT" => "FedEx First Overnight",
30
+ "FIRST_OVERNIGHT_SATURDAY_DELIVERY" => "FedEx First Overnight Saturday Delivery",
31
+ "FEDEX_EXPRESS_SAVER" => "FedEx Express Saver",
32
+ "FEDEX_1_DAY_FREIGHT" => "FedEx 1 Day Freight",
33
+ "FEDEX_1_DAY_FREIGHT_SATURDAY_DELIVERY" => "FedEx 1 Day Freight Saturday Delivery",
34
+ "FEDEX_2_DAY_FREIGHT" => "FedEx 2 Day Freight",
35
+ "FEDEX_2_DAY_FREIGHT_SATURDAY_DELIVERY" => "FedEx 2 Day Freight Saturday Delivery",
36
+ "FEDEX_3_DAY_FREIGHT" => "FedEx 3 Day Freight",
37
+ "FEDEX_3_DAY_FREIGHT_SATURDAY_DELIVERY" => "FedEx 3 Day Freight Saturday Delivery",
38
+ "INTERNATIONAL_PRIORITY" => "FedEx International Priority",
39
+ "INTERNATIONAL_PRIORITY_SATURDAY_DELIVERY" => "FedEx International Priority Saturday Delivery",
40
+ "INTERNATIONAL_ECONOMY" => "FedEx International Economy",
41
+ "INTERNATIONAL_FIRST" => "FedEx International First",
42
+ "INTERNATIONAL_PRIORITY_FREIGHT" => "FedEx International Priority Freight",
43
+ "INTERNATIONAL_ECONOMY_FREIGHT" => "FedEx International Economy Freight",
44
+ "GROUND_HOME_DELIVERY" => "FedEx Ground Home Delivery",
45
+ "FEDEX_GROUND" => "FedEx Ground",
46
+ "INTERNATIONAL_GROUND" => "FedEx International Ground",
47
+ "SMART_POST" => "FedEx SmartPost",
48
+ "FEDEX_FREIGHT_PRIORITY" => "FedEx Freight Priority",
49
+ "FEDEX_FREIGHT_ECONOMY" => "FedEx Freight Economy"
50
+ }
51
+
52
+ PACKAGE_TYPES = {
53
+ "fedex_envelope" => "FEDEX_ENVELOPE",
54
+ "fedex_pak" => "FEDEX_PAK",
55
+ "fedex_box" => "FEDEX_BOX",
56
+ "fedex_tube" => "FEDEX_TUBE",
57
+ "fedex_10_kg_box" => "FEDEX_10KG_BOX",
58
+ "fedex_25_kg_box" => "FEDEX_25KG_BOX",
59
+ "your_packaging" => "YOUR_PACKAGING"
60
+ }
61
+
62
+ DROPOFF_TYPES = {
63
+ 'regular_pickup' => 'REGULAR_PICKUP',
64
+ 'request_courier' => 'REQUEST_COURIER',
65
+ 'dropbox' => 'DROP_BOX',
66
+ 'business_service_center' => 'BUSINESS_SERVICE_CENTER',
67
+ 'station' => 'STATION'
68
+ }
69
+
70
+ SIGNATURE_OPTION_CODES = {
71
+ adult: 'ADULT', # 21 years plus
72
+ direct: 'DIRECT', # A person at the delivery address
73
+ indirect: 'INDIRECT', # A person at the delivery address, or a neighbor, or a signed note for fedex on the door
74
+ none_required: 'NO_SIGNATURE_REQUIRED',
75
+ default_for_service: 'SERVICE_DEFAULT'
76
+ }
77
+
78
+ PAYMENT_TYPES = {
79
+ 'sender' => 'SENDER',
80
+ 'recipient' => 'RECIPIENT',
81
+ 'third_party' => 'THIRDPARTY',
82
+ 'collect' => 'COLLECT'
83
+ }
84
+
85
+ PACKAGE_IDENTIFIER_TYPES = {
86
+ 'tracking_number' => 'TRACKING_NUMBER_OR_DOORTAG',
87
+ 'door_tag' => 'TRACKING_NUMBER_OR_DOORTAG',
88
+ 'rma' => 'RMA',
89
+ 'ground_shipment_id' => 'GROUND_SHIPMENT_ID',
90
+ 'ground_invoice_number' => 'GROUND_INVOICE_NUMBER',
91
+ 'ground_customer_reference' => 'GROUND_CUSTOMER_REFERENCE',
92
+ 'ground_po' => 'GROUND_PO',
93
+ 'express_reference' => 'EXPRESS_REFERENCE',
94
+ 'express_mps_master' => 'EXPRESS_MPS_MASTER',
95
+ 'shipper_reference' => 'SHIPPER_REFERENCE',
96
+ }
97
+
98
+ TRANSIT_TIMES = %w(UNKNOWN ONE_DAY TWO_DAYS THREE_DAYS FOUR_DAYS FIVE_DAYS SIX_DAYS SEVEN_DAYS EIGHT_DAYS NINE_DAYS TEN_DAYS ELEVEN_DAYS TWELVE_DAYS THIRTEEN_DAYS FOURTEEN_DAYS FIFTEEN_DAYS SIXTEEN_DAYS SEVENTEEN_DAYS EIGHTEEN_DAYS)
99
+
100
+ # FedEx tracking codes as described in the FedEx Tracking Service WSDL Guide
101
+ # All delays also have been marked as exceptions
102
+ TRACKING_STATUS_CODES = HashWithIndifferentAccess.new(
103
+ 'AA' => :at_airport,
104
+ 'AD' => :at_delivery,
105
+ 'AF' => :at_fedex_facility,
106
+ 'AR' => :at_fedex_facility,
107
+ 'AP' => :at_pickup,
108
+ 'CA' => :canceled,
109
+ 'CH' => :location_changed,
110
+ 'DE' => :exception,
111
+ 'DL' => :delivered,
112
+ 'DP' => :departed_fedex_location,
113
+ 'DR' => :vehicle_furnished_not_used,
114
+ 'DS' => :vehicle_dispatched,
115
+ 'DY' => :exception,
116
+ 'EA' => :exception,
117
+ 'ED' => :enroute_to_delivery,
118
+ 'EO' => :enroute_to_origin_airport,
119
+ 'EP' => :enroute_to_pickup,
120
+ 'FD' => :at_fedex_destination,
121
+ 'HL' => :held_at_location,
122
+ 'IT' => :in_transit,
123
+ 'LO' => :left_origin,
124
+ 'OC' => :order_created,
125
+ 'OD' => :out_for_delivery,
126
+ 'PF' => :plane_in_flight,
127
+ 'PL' => :plane_landed,
128
+ 'PU' => :picked_up,
129
+ 'RS' => :return_to_shipper,
130
+ 'SE' => :exception,
131
+ 'SF' => :at_sort_facility,
132
+ 'SP' => :split_status,
133
+ 'TR' => :transfer
134
+ )
135
+
136
+ DEFAULT_LABEL_STOCK_TYPE = 'PAPER_7X4.75'
137
+
138
+ # Available return formats for image data when creating labels
139
+ LABEL_FORMATS = %w(DPL EPL2 PDF ZPLII PNG).freeze
140
+
141
+ TRANSIENT_TRACK_RESPONSE_CODES = %w(9035 9040 9041 9045 9050 9055 9060 9065 9070 9075 9085 9086 9090).freeze
142
+
143
+ UNRECOVERABLE_TRACK_RESPONSE_CODES = %w(9080 9081 9082 9095 9100).freeze
144
+
145
+ def self.service_name_for_code(service_code)
146
+ SERVICE_TYPES[service_code] || "FedEx #{service_code.titleize.sub(/Fedex /, '')}"
147
+ end
148
+
149
+ def requirements
150
+ [:key, :password, :account, :login]
151
+ end
152
+
153
+ def find_rates(origin, destination, packages, options = {})
154
+ options = @options.merge(options)
155
+ packages = Array(packages)
156
+
157
+ rate_request = build_rate_request(origin, destination, packages, options)
158
+
159
+ xml = commit(save_request(rate_request), (options[:test] || false))
160
+
161
+ parse_rate_response(origin, destination, packages, xml, options)
162
+ end
163
+
164
+ def find_tracking_info(tracking_number, options = {})
165
+ options = @options.merge(options)
166
+
167
+ tracking_request = build_tracking_request(tracking_number, options)
168
+ xml = commit(save_request(tracking_request), (options[:test] || false))
169
+ parse_tracking_response(xml, options)
170
+ end
171
+
172
+
173
+ # Get Shipping labels
174
+ def create_shipment(origin, destination, packages, options = {})
175
+ options = @options.merge(options)
176
+ packages = Array(packages)
177
+ raise Error, "Multiple packages are not supported yet." if packages.length > 1
178
+
179
+ request = build_shipment_request(origin, destination, packages, options)
180
+ logger.debug(request) if logger
181
+
182
+ response = commit(save_request(request), (options[:test] || false))
183
+ parse_ship_response(response)
184
+ end
185
+
186
+ def maximum_address_field_length
187
+ # See Fedex Developper Guide
188
+ 35
189
+ end
190
+
191
+ protected
192
+
193
+ def build_shipment_request(origin, destination, packages, options = {})
194
+ imperial = location_uses_imperial(origin)
195
+
196
+ xml_builder = Nokogiri::XML::Builder.new do |xml|
197
+ xml.ProcessShipmentRequest(xmlns: 'http://fedex.com/ws/ship/v13') do
198
+ build_request_header(xml)
199
+ build_version_node(xml, 'ship', 13, 0 , 0)
200
+
201
+ xml.RequestedShipment do
202
+ xml.ShipTimestamp(ship_timestamp(options[:turn_around_time]).iso8601(0))
203
+ xml.DropoffType('REGULAR_PICKUP')
204
+ xml.ServiceType(options[:service_type] || 'FEDEX_GROUND')
205
+ xml.PackagingType('YOUR_PACKAGING')
206
+
207
+ xml.Shipper do
208
+ build_contact_address_nodes(xml, options[:shipper] || origin)
209
+ end
210
+
211
+ xml.Recipient do
212
+ build_contact_address_nodes(xml, destination)
213
+ end
214
+
215
+ xml.Origin do
216
+ build_contact_address_nodes(xml, origin)
217
+ end
218
+
219
+ xml.ShippingChargesPayment do
220
+ xml.PaymentType('SENDER')
221
+ xml.Payor do
222
+ build_shipment_responsible_party_node(xml, options[:shipper] || origin)
223
+ end
224
+ end
225
+
226
+ xml.LabelSpecification do
227
+ xml.LabelFormatType('COMMON2D')
228
+ xml.ImageType(options[:label_format] || 'PNG')
229
+ xml.LabelStockType(options[:label_stock_type] || DEFAULT_LABEL_STOCK_TYPE)
230
+ end
231
+
232
+ xml.RateRequestTypes('ACCOUNT')
233
+
234
+ xml.PackageCount(packages.size)
235
+ packages.each do |package|
236
+ xml.RequestedPackageLineItems do
237
+ xml.GroupPackageCount(1)
238
+ build_package_weight_node(xml, package, imperial)
239
+ build_package_dimensions_node(xml, package, imperial)
240
+
241
+ # Reference Numbers
242
+ reference_numbers = Array(package.options[:reference_numbers])
243
+ if reference_numbers.size > 0
244
+ reference_numbers.each do |reference_number_info|
245
+ xml.CustomerReferences do
246
+ xml.CustomerReferenceType(reference_number_info[:type] || "CUSTOMER_REFERENCE")
247
+ xml.Value(reference_number_info[:value])
248
+ end
249
+ end
250
+ end
251
+
252
+ xml.SpecialServicesRequested do
253
+ xml.SpecialServiceTypes("SIGNATURE_OPTION")
254
+ xml.SignatureOptionDetail do
255
+ xml.OptionType(SIGNATURE_OPTION_CODES[package.options[:signature_option] || :default_for_service])
256
+ end
257
+ end
258
+ end
259
+ end
260
+ end
261
+ end
262
+ end
263
+ xml_builder.to_xml
264
+ end
265
+
266
+ def build_contact_address_nodes(xml, location)
267
+ xml.Contact do
268
+ xml.PersonName(location.name)
269
+ xml.CompanyName(location.company)
270
+ xml.PhoneNumber(location.phone)
271
+ end
272
+ xml.Address do
273
+ xml.StreetLines(location.address1) if location.address1
274
+ xml.StreetLines(location.address2) if location.address2
275
+ xml.City(location.city) if location.city
276
+ xml.StateOrProvinceCode(location.state)
277
+ xml.PostalCode(location.postal_code)
278
+ xml.CountryCode(location.country_code(:alpha2))
279
+ xml.Residential('true') if location.residential?
280
+ end
281
+ end
282
+
283
+ def build_shipment_responsible_party_node(xml, origin)
284
+ xml.ResponsibleParty do
285
+ xml.AccountNumber(@options[:account])
286
+ xml.Contact do
287
+ xml.PersonName(origin.name)
288
+ xml.CompanyName(origin.company)
289
+ xml.PhoneNumber(origin.phone)
290
+ end
291
+ end
292
+ end
293
+
294
+ def build_rate_request(origin, destination, packages, options = {})
295
+ imperial = location_uses_imperial(origin)
296
+
297
+ xml_builder = Nokogiri::XML::Builder.new do |xml|
298
+ xml.RateRequest(xmlns: 'http://fedex.com/ws/rate/v13') do
299
+ build_request_header(xml)
300
+ build_version_node(xml, 'crs', 13, 0 , 0)
301
+
302
+ # Returns delivery dates
303
+ xml.ReturnTransitAndCommit(true)
304
+
305
+ # Returns saturday delivery shipping options when available
306
+ xml.VariableOptions('SATURDAY_DELIVERY') if options[:saturday_delivery]
307
+
308
+ xml.RequestedShipment do
309
+ if options[:pickup_date]
310
+ xml.ShipTimestamp(options[:pickup_date].to_time.iso8601(0))
311
+ else
312
+ xml.ShipTimestamp(ship_timestamp(options[:turn_around_time]).iso8601(0))
313
+ end
314
+
315
+ freight = has_freight?(options)
316
+
317
+ unless freight
318
+ # fedex api wants this up here otherwise request returns an error
319
+ xml.DropoffType(options[:dropoff_type] || 'REGULAR_PICKUP')
320
+ xml.PackagingType(options[:packaging_type] || 'YOUR_PACKAGING')
321
+ end
322
+
323
+ build_location_node(xml, 'Shipper', options[:shipper] || origin)
324
+ build_location_node(xml, 'Recipient', destination)
325
+ if options[:shipper] && options[:shipper] != origin
326
+ build_location_node(xml, 'Origin', origin)
327
+ end
328
+
329
+ if freight
330
+ freight_options = options[:freight]
331
+ build_shipping_charges_payment_node(xml, freight_options)
332
+ build_freight_shipment_detail_node(xml, freight_options, packages, imperial)
333
+ build_rate_request_types_node(xml)
334
+ else
335
+ xml.SmartPostDetail do
336
+ xml.Indicia(options[:smart_post_indicia] || 'PARCEL_SELECT')
337
+ xml.HubId(options[:smart_post_hub_id] || 5902) # default to LA
338
+ end
339
+
340
+ build_rate_request_types_node(xml)
341
+ xml.PackageCount(packages.size)
342
+ build_packages_nodes(xml, packages, imperial)
343
+ end
344
+ end
345
+ end
346
+ end
347
+ xml_builder.to_xml
348
+ end
349
+
350
+ def build_packages_nodes(xml, packages, imperial)
351
+ packages.map do |pkg|
352
+ xml.RequestedPackageLineItems do
353
+ xml.GroupPackageCount(1)
354
+ build_package_weight_node(xml, pkg, imperial)
355
+ build_package_dimensions_node(xml, pkg, imperial)
356
+ end
357
+ end
358
+ end
359
+
360
+ def build_shipping_charges_payment_node(xml, freight_options)
361
+ xml.ShippingChargesPayment do
362
+ xml.PaymentType(freight_options[:payment_type])
363
+ xml.Payor do
364
+ xml.ResponsibleParty do
365
+ # TODO: case of different freight account numbers?
366
+ xml.AccountNumber(freight_options[:account])
367
+ end
368
+ end
369
+ end
370
+ end
371
+
372
+ def build_freight_shipment_detail_node(xml, freight_options, packages, imperial)
373
+ xml.FreightShipmentDetail do
374
+ # TODO: case of different freight account numbers?
375
+ xml.FedExFreightAccountNumber(freight_options[:account])
376
+ build_location_node(xml, 'FedExFreightBillingContactAndAddress', freight_options[:billing_location])
377
+ xml.Role(freight_options[:role])
378
+
379
+ packages.each do |pkg|
380
+ xml.LineItems do
381
+ xml.FreightClass(freight_options[:freight_class])
382
+ xml.Packaging(freight_options[:packaging])
383
+ build_package_weight_node(xml, pkg, imperial)
384
+ build_package_dimensions_node(xml, pkg, imperial)
385
+ end
386
+ end
387
+ end
388
+ end
389
+
390
+ def has_freight?(options)
391
+ options[:freight] && options[:freight].present?
392
+ end
393
+
394
+ def build_package_weight_node(xml, pkg, imperial)
395
+ xml.Weight do
396
+ xml.Units(imperial ? 'LB' : 'KG')
397
+ xml.Value([((imperial ? pkg.lbs : pkg.kgs).to_f * 1000).round / 1000.0, 0.1].max)
398
+ end
399
+ end
400
+
401
+ def build_package_dimensions_node(xml, pkg, imperial)
402
+ xml.Dimensions do
403
+ [:length, :width, :height].each do |axis|
404
+ value = ((imperial ? pkg.inches(axis) : pkg.cm(axis)).to_f * 1000).round / 1000.0 # 3 decimals
405
+ xml.public_send(axis.to_s.capitalize, value.ceil)
406
+ end
407
+ xml.Units(imperial ? 'IN' : 'CM')
408
+ end
409
+ end
410
+
411
+ def build_rate_request_types_node(xml, type = 'ACCOUNT')
412
+ xml.RateRequestTypes(type)
413
+ end
414
+
415
+ def build_tracking_request(tracking_number, options = {})
416
+ xml_builder = Nokogiri::XML::Builder.new do |xml|
417
+ xml.TrackRequest(xmlns: 'http://fedex.com/ws/track/v7') do
418
+ build_request_header(xml)
419
+ build_version_node(xml, 'trck', 7, 0, 0)
420
+
421
+ xml.SelectionDetails do
422
+ xml.PackageIdentifier do
423
+ xml.Type(PACKAGE_IDENTIFIER_TYPES[options[:package_identifier_type] || 'tracking_number'])
424
+ xml.Value(tracking_number)
425
+ end
426
+
427
+ xml.ShipDateRangeBegin(options[:ship_date_range_begin]) if options[:ship_date_range_begin]
428
+ xml.ShipDateRangeEnd(options[:ship_date_range_end]) if options[:ship_date_range_end]
429
+ xml.TrackingNumberUniqueIdentifier(options[:unique_identifier]) if options[:unique_identifier]
430
+ end
431
+
432
+ xml.ProcessingOptions('INCLUDE_DETAILED_SCANS')
433
+ end
434
+ end
435
+ xml_builder.to_xml
436
+ end
437
+
438
+ def build_request_header(xml)
439
+ xml.WebAuthenticationDetail do
440
+ xml.UserCredential do
441
+ xml.Key(@options[:key])
442
+ xml.Password(@options[:password])
443
+ end
444
+ end
445
+
446
+ xml.ClientDetail do
447
+ xml.AccountNumber(@options[:account])
448
+ xml.MeterNumber(@options[:login])
449
+ end
450
+
451
+ xml.TransactionDetail do
452
+ xml.CustomerTransactionId(@options[:transaction_id] || 'ActiveShipping') # TODO: Need to do something better with this...
453
+ end
454
+ end
455
+
456
+ def build_version_node(xml, service_id, major, intermediate, minor)
457
+ xml.Version do
458
+ xml.ServiceId(service_id)
459
+ xml.Major(major)
460
+ xml.Intermediate(intermediate)
461
+ xml.Minor(minor)
462
+ end
463
+ end
464
+
465
+ def build_location_node(xml, name, location)
466
+ xml.public_send(name) do
467
+ xml.Address do
468
+ xml.StreetLines(location.address1) if location.address1
469
+ xml.StreetLines(location.address2) if location.address2
470
+ xml.City(location.city) if location.city
471
+ xml.PostalCode(location.postal_code)
472
+ xml.CountryCode(location.country_code(:alpha2))
473
+ xml.Residential(true) unless location.commercial?
474
+ end
475
+ end
476
+ end
477
+
478
+ def parse_rate_response(origin, destination, packages, response, options)
479
+ xml = build_document(response, 'RateReply')
480
+
481
+ success = response_success?(xml)
482
+ message = response_message(xml)
483
+
484
+ if success
485
+ missing_xml_field = false
486
+ rate_estimates = xml.root.css('> RateReplyDetails').map do |rated_shipment|
487
+ begin
488
+ service_code = rated_shipment.at('ServiceType').text
489
+ is_saturday_delivery = rated_shipment.at('AppliedOptions').try(:text) == 'SATURDAY_DELIVERY'
490
+ service_type = is_saturday_delivery ? "#{service_code}_SATURDAY_DELIVERY" : service_code
491
+
492
+ transit_time = rated_shipment.at('TransitTime').text if ["FEDEX_GROUND", "GROUND_HOME_DELIVERY"].include?(service_code)
493
+ max_transit_time = rated_shipment.at('MaximumTransitTime').try(:text) if service_code == "FEDEX_GROUND"
494
+
495
+ delivery_timestamp = rated_shipment.at('DeliveryTimestamp').try(:text)
496
+ delivery_range = delivery_range_from(transit_time, max_transit_time, delivery_timestamp, (service_code == "GROUND_HOME_DELIVERY"), options)
497
+
498
+ currency = rated_shipment.at('RatedShipmentDetails/ShipmentRateDetail/TotalNetCharge/Currency').text
499
+
500
+ RateEstimate.new(origin, destination, @@name,
501
+ self.class.service_name_for_code(service_type),
502
+ service_code: service_code,
503
+ total_price: rated_shipment.at('RatedShipmentDetails/ShipmentRateDetail/TotalNetCharge/Amount').text.to_f,
504
+ currency: currency,
505
+ packages: packages,
506
+ delivery_range: delivery_range)
507
+ rescue NoMethodError
508
+ missing_xml_field = true
509
+ nil
510
+ end
511
+ end
512
+
513
+ rate_estimates = rate_estimates.compact
514
+ logger.warn("[FedexParseRateError] Some fields where missing in the response: #{response}") if logger && missing_xml_field
515
+
516
+ if rate_estimates.empty?
517
+ success = false
518
+ if missing_xml_field
519
+ message = "The response from the carrier contained errors and could not be treated"
520
+ else
521
+ message = "No shipping rates could be found for the destination address" if message.blank?
522
+ end
523
+ end
524
+
525
+ else
526
+ rate_estimates = []
527
+ end
528
+
529
+ RateResponse.new(success, message, Hash.from_xml(response), rates: rate_estimates, xml: response, request: last_request, log_xml: options[:log_xml])
530
+ end
531
+
532
+ def delivery_range_from(transit_time, max_transit_time, delivery_timestamp, is_home_delivery, options)
533
+ delivery_range = [delivery_timestamp, delivery_timestamp]
534
+
535
+ # if there's no delivery timestamp but we do have a transit time, use it
536
+ if delivery_timestamp.blank? && transit_time.present?
537
+ transit_range = parse_transit_times([transit_time, max_transit_time.presence || transit_time])
538
+ pickup_date = options[:pickup_date] || ship_date(options[:turn_around_time])
539
+
540
+ delivery_range = transit_range.map { |days| business_days_from(pickup_date, days, is_home_delivery) }
541
+ end
542
+
543
+ delivery_range
544
+ end
545
+
546
+ def parse_ship_response(response)
547
+ xml = build_document(response, 'ProcessShipmentReply')
548
+ success = response_success?(xml)
549
+ message = response_message(xml)
550
+
551
+ response_info = Hash.from_xml(response)
552
+ tracking_number = xml.css("CompletedPackageDetails TrackingIds TrackingNumber").text
553
+ base_64_image = xml.css("Label Image").text
554
+
555
+ labels = [Label.new(tracking_number, Base64.decode64(base_64_image))]
556
+ LabelResponse.new(success, message, response_info, { labels: labels })
557
+ end
558
+
559
+ def business_days_from(date, days, is_home_delivery = false)
560
+ future_date = date
561
+ count = 0
562
+
563
+ while count < days
564
+ future_date += 1.day
565
+ if is_home_delivery
566
+ count += 1 if home_delivery_business_day?(future_date)
567
+ else
568
+ count += 1 if business_day?(future_date)
569
+ end
570
+ end
571
+
572
+ future_date
573
+ end
574
+
575
+ #Transit times for FedEx® Ground do not include Saturdays, Sundays, or holidays.
576
+ def business_day?(date)
577
+ (1..5).include?(date.wday)
578
+ end
579
+
580
+ #Transit times for FedEx® Home Delivery, do not include Sundays, Mondays, or holidays.
581
+ def home_delivery_business_day?(date)
582
+ (2..6).include?(date.wday)
583
+ end
584
+
585
+ def parse_tracking_response(response, options)
586
+ xml = build_document(response, 'TrackReply')
587
+
588
+ success = response_success?(xml)
589
+ message = response_message(xml)
590
+
591
+ if success
592
+ tracking_details_root = xml.at('CompletedTrackDetails')
593
+ success = response_success?(tracking_details_root)
594
+ message = response_message(tracking_details_root)
595
+ end
596
+
597
+ if success
598
+ delivery_signature = nil
599
+ shipment_events = []
600
+
601
+ all_tracking_details = xml.root.xpath('CompletedTrackDetails/TrackDetails')
602
+ tracking_details = case all_tracking_details.length
603
+ when 1
604
+ all_tracking_details.first
605
+ when 0
606
+ message = "The response did not contain tracking details"
607
+ return TrackingResponse.new(
608
+ false,
609
+ message,
610
+ Hash.from_xml(response),
611
+ carrier: @@name,
612
+ xml: response,
613
+ request: last_request
614
+ )
615
+ else
616
+ all_unique_identifiers = xml.root.xpath('CompletedTrackDetails/TrackDetails/TrackingNumberUniqueIdentifier').map(&:text)
617
+ message = "Multiple matches were found. Specify a unqiue identifier: #{all_unique_identifiers.join(', ')}"
618
+ return TrackingResponse.new(
619
+ false,
620
+ message,
621
+ Hash.from_xml(response),
622
+ carrier: @@name,
623
+ xml: response,
624
+ request: last_request
625
+ )
626
+ end
627
+
628
+ first_notification = tracking_details.at('Notification')
629
+ severity = first_notification.at('Severity').text
630
+ if severity == 'ERROR' || severity == 'FAILURE'
631
+ message = first_notification.try(:text)
632
+ code = first_notification.at('Code').try(:text)
633
+ case code
634
+ when *TRANSIENT_TRACK_RESPONSE_CODES
635
+ raise ActiveShipping::ShipmentNotFound, first_notification.at('Message').text
636
+ else
637
+ raise ActiveShipping::ResponseContentError, StandardError.new(first_notification.at('Message').text)
638
+ end
639
+ end
640
+
641
+ tracking_number = tracking_details.at('TrackingNumber').text
642
+ status_detail = tracking_details.at('StatusDetail')
643
+ if status_detail.blank?
644
+ status_code, status, status_description, delivery_signature = nil
645
+ else
646
+ status_code = status_detail.at('Code').try(:text)
647
+ status_description = status_detail.at('AncillaryDetails/ReasonDescription').try(:text) || status_detail.at('Description').try(:text)
648
+
649
+ status = TRACKING_STATUS_CODES[status_code]
650
+
651
+ if status_code == 'DL' && tracking_details.at('AvailableImages').try(:text) == 'SIGNATURE_PROOF_OF_DELIVERY'
652
+ delivery_signature = tracking_details.at('DeliverySignatureName').try(:text)
653
+ end
654
+ end
655
+
656
+ origin = if origin_node = tracking_details.at('OriginLocationAddress')
657
+ Location.new(
658
+ country: origin_node.at('CountryCode').text,
659
+ province: origin_node.at('StateOrProvinceCode').text,
660
+ city: origin_node.at('City').text
661
+ )
662
+ end
663
+
664
+ destination = extract_address(tracking_details, DELIVERY_ADDRESS_NODE_NAMES)
665
+ shipper_address = extract_address(tracking_details, SHIPPER_ADDRESS_NODE_NAMES)
666
+
667
+ ship_time = extract_timestamp(tracking_details, 'ShipTimestamp')
668
+ actual_delivery_time = extract_timestamp(tracking_details, 'ActualDeliveryTimestamp')
669
+ scheduled_delivery_time = extract_timestamp(tracking_details, 'EstimatedDeliveryTimestamp')
670
+
671
+ tracking_details.xpath('Events').each do |event|
672
+ address = event.at('Address')
673
+ next if address.nil? || address.at('CountryCode').nil?
674
+
675
+ city = address.at('City').try(:text)
676
+ state = address.at('StateOrProvinceCode').try(:text)
677
+ zip_code = address.at('PostalCode').try(:text)
678
+ country = address.at('CountryCode').try(:text)
679
+
680
+ location = Location.new(city: city, state: state, postal_code: zip_code, country: country)
681
+ description = event.at('EventDescription').text
682
+ type_code = event.at('EventType').text
683
+
684
+ time = Time.parse(event.at('Timestamp').text)
685
+ zoneless_time = time.utc
686
+
687
+ shipment_events << ShipmentEvent.new(description, zoneless_time, location, description, type_code)
688
+ end
689
+
690
+ shipment_events = shipment_events.sort_by(&:time)
691
+ end
692
+
693
+ TrackingResponse.new(
694
+ success,
695
+ message,
696
+ Hash.from_xml(response),
697
+ carrier: @@name,
698
+ xml: response,
699
+ request: last_request,
700
+ status: status,
701
+ status_code: status_code,
702
+ status_description: status_description,
703
+ ship_time: ship_time,
704
+ scheduled_delivery_date: scheduled_delivery_time,
705
+ actual_delivery_date: actual_delivery_time,
706
+ delivery_signature: delivery_signature,
707
+ shipment_events: shipment_events,
708
+ shipper_address: (shipper_address.nil? || shipper_address.unknown?) ? nil : shipper_address,
709
+ origin: origin,
710
+ destination: destination,
711
+ tracking_number: tracking_number
712
+ )
713
+ end
714
+
715
+ def ship_timestamp(delay_in_hours)
716
+ delay_in_hours ||= 0
717
+ Time.now + delay_in_hours.hours
718
+ end
719
+
720
+ def ship_date(delay_in_hours)
721
+ delay_in_hours ||= 0
722
+ (Time.now + delay_in_hours.hours).to_date
723
+ end
724
+
725
+ def response_success?(document)
726
+ highest_severity = document.at('HighestSeverity')
727
+ return false if highest_severity.nil?
728
+ %w(SUCCESS WARNING NOTE).include?(highest_severity.text)
729
+ end
730
+
731
+ def response_message(document)
732
+ notifications = document.at('Notifications')
733
+ return "" if notifications.nil?
734
+
735
+ "#{notifications.at('Severity').text} - #{notifications.at('Code').text}: #{notifications.at('Message').text}"
736
+ end
737
+
738
+ def commit(request, test = false)
739
+ ssl_post(test ? TEST_URL : LIVE_URL, request.gsub("\n", ''))
740
+ end
741
+
742
+ def parse_transit_times(times)
743
+ results = []
744
+ times.each do |day_count|
745
+ days = TRANSIT_TIMES.index(day_count.to_s.chomp)
746
+ results << days.to_i
747
+ end
748
+ results
749
+ end
750
+
751
+ def extract_address(document, possible_node_names)
752
+ node = nil
753
+ args = {}
754
+ possible_node_names.each do |name|
755
+ node = document.at(name)
756
+ break if node
757
+ end
758
+
759
+ if node
760
+ args[:country] =
761
+ node.at('CountryCode').try(:text) ||
762
+ ActiveUtils::Country.new(alpha2: 'ZZ', name: 'Unknown or Invalid Territory', alpha3: 'ZZZ', numeric: '999')
763
+
764
+ args[:province] = node.at('StateOrProvinceCode').try(:text) || 'unknown'
765
+ args[:city] = node.at('City').try(:text) || 'unknown'
766
+ end
767
+
768
+ Location.new(args)
769
+ end
770
+
771
+ def extract_timestamp(document, node_name)
772
+ if timestamp_node = document.at(node_name)
773
+ if timestamp_node.text =~ /\A(\d{4}-\d{2}-\d{2})T00:00:00\Z/
774
+ Date.parse($1)
775
+ else
776
+ Time.parse(timestamp_node.text)
777
+ end
778
+ end
779
+ end
780
+
781
+ def build_document(xml, expected_root_tag)
782
+ document = Nokogiri.XML(xml) { |config| config.strict }
783
+ document.remove_namespaces!
784
+ if document.root.nil? || document.root.name != expected_root_tag
785
+ raise ActiveShipping::ResponseContentError.new(StandardError.new('Invalid document'), xml)
786
+ end
787
+ document
788
+ rescue Nokogiri::XML::SyntaxError => e
789
+ raise ActiveShipping::ResponseContentError.new(e, xml)
790
+ end
791
+
792
+ def location_uses_imperial(location)
793
+ %w(US LR MM).include?(location.country_code(:alpha2))
794
+ end
795
+ end
796
+ end