workarea-flow_io 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintignore +2 -0
  3. data/.eslintrc.json +37 -0
  4. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  5. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  7. data/.github/workflows/ci.yml +90 -0
  8. data/.gitignore +21 -0
  9. data/.rubocop.yml +2 -0
  10. data/.ruby-version +1 -0
  11. data/.stylelintrc.json +12 -0
  12. data/CHANGELOG.md +200 -0
  13. data/Gemfile +19 -0
  14. data/LICENSE +52 -0
  15. data/README.md +200 -0
  16. data/Rakefile +59 -0
  17. data/app/assets/javascripts/workarea/storefront/flow_io/adapters/flow_io_adapter.js +61 -0
  18. data/app/assets/javascripts/workarea/storefront/flow_io/configuration.js.erb +10 -0
  19. data/app/assets/javascripts/workarea/storefront/flow_io/flow.js +91 -0
  20. data/app/assets/stylesheets/flow_io/storefront/country_picker.scss +189 -0
  21. data/app/controllers/workarea/admin/application_controller.decorator +5 -0
  22. data/app/controllers/workarea/admin/catalog_categories_controller.decorator +9 -0
  23. data/app/controllers/workarea/admin/flow_imports_controller.rb +9 -0
  24. data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
  25. data/app/controllers/workarea/admin/pricing_skus_controller.decorator +7 -0
  26. data/app/controllers/workarea/admin/search_settings_controller.decorator +27 -0
  27. data/app/controllers/workarea/storefront/application_controller.decorator +80 -0
  28. data/app/controllers/workarea/storefront/checkouts_controller.decorator +38 -0
  29. data/app/controllers/workarea/storefront/flow_io_webhook_controller.rb +49 -0
  30. data/app/controllers/workarea/storefront/recent_views_controller.decorator +15 -0
  31. data/app/controllers/workarea/storefront/searches_controller.decorator +11 -0
  32. data/app/helpers/workarea/admin/flow_helper.rb +13 -0
  33. data/app/helpers/workarea/storefront/flow_analytics_helper.rb +23 -0
  34. data/app/helpers/workarea/storefront/flow_content_helper.rb +21 -0
  35. data/app/middleware/workarea/flow_io/session_middleware.rb +68 -0
  36. data/app/models/workarea/address.decorator +12 -0
  37. data/app/models/workarea/catalog/category.decorator +8 -0
  38. data/app/models/workarea/checkout.decorator +26 -0
  39. data/app/models/workarea/flow_io/experience_geo.rb +18 -0
  40. data/app/models/workarea/flow_io/experience_summary.rb +15 -0
  41. data/app/models/workarea/flow_io/import.rb +31 -0
  42. data/app/models/workarea/flow_io/imported_item.rb +124 -0
  43. data/app/models/workarea/flow_io/local_item.rb +28 -0
  44. data/app/models/workarea/flow_io/localized_price.rb +30 -0
  45. data/app/models/workarea/flow_io/price.rb +12 -0
  46. data/app/models/workarea/flow_io/price_with_base.rb +7 -0
  47. data/app/models/workarea/flow_io/webhook/shared_secret.rb +12 -0
  48. data/app/models/workarea/flow_price_adjustment_set.rb +80 -0
  49. data/app/models/workarea/fulfillment.decorator +63 -0
  50. data/app/models/workarea/order.decorator +39 -0
  51. data/app/models/workarea/order/item.decorator +43 -0
  52. data/app/models/workarea/payment.decorator +11 -0
  53. data/app/models/workarea/payment/authorize/flow_payment.rb +48 -0
  54. data/app/models/workarea/payment/capture/flow_payment.rb +35 -0
  55. data/app/models/workarea/payment/flow_payment_data.rb +25 -0
  56. data/app/models/workarea/payment/flow_payment_operation.rb +20 -0
  57. data/app/models/workarea/payment/purchase/flow_payment.rb +44 -0
  58. data/app/models/workarea/payment/refund/flow_payment.rb +42 -0
  59. data/app/models/workarea/payment/store_flow_credit_card.rb +34 -0
  60. data/app/models/workarea/payment/tender.decorator +8 -0
  61. data/app/models/workarea/payment/tender/flow_payment.rb +15 -0
  62. data/app/models/workarea/payment/transaction.decorator +12 -0
  63. data/app/models/workarea/pricing/calculators/flow_localization_calculator.rb +30 -0
  64. data/app/models/workarea/pricing/calculators/item_calculator.decorator +39 -0
  65. data/app/models/workarea/pricing/collection.decorator +113 -0
  66. data/app/models/workarea/pricing/order_totals.decorator +53 -0
  67. data/app/models/workarea/pricing/price.decorator +17 -0
  68. data/app/models/workarea/pricing/price_distributor.decorator +51 -0
  69. data/app/models/workarea/pricing/request.decorator +17 -0
  70. data/app/models/workarea/pricing/shipping_totals.decorator +24 -0
  71. data/app/models/workarea/pricing/sku.decorator +46 -0
  72. data/app/models/workarea/search/settings.decorator +8 -0
  73. data/app/models/workarea/search/storefront/product.decorator +25 -0
  74. data/app/models/workarea/shipping.decorator +28 -0
  75. data/app/queries/workarea/order_metrics.decorator +23 -0
  76. data/app/queries/workarea/search/product_search.decorator +14 -0
  77. data/app/queries/workarea/search/storefront_search/response.decorator +40 -0
  78. data/app/services/workarea/flow_io/checkout.rb +242 -0
  79. data/app/services/workarea/flow_io/checkout_token_form.rb +36 -0
  80. data/app/services/workarea/flow_io/countries.rb +14 -0
  81. data/app/services/workarea/flow_io/detailed_shipping_notification_form.rb +84 -0
  82. data/app/services/workarea/flow_io/experiences.rb +24 -0
  83. data/app/services/workarea/flow_io/fulfillment_cancellation_form.rb +40 -0
  84. data/app/services/workarea/flow_io/item.rb +122 -0
  85. data/app/services/workarea/flow_io/item_importer.rb +108 -0
  86. data/app/services/workarea/flow_io/line_item_form.rb +72 -0
  87. data/app/services/workarea/flow_io/order_put_form.rb +62 -0
  88. data/app/services/workarea/flow_io/price_applier.rb +81 -0
  89. data/app/services/workarea/flow_io/price_applier/item_applier.rb +157 -0
  90. data/app/services/workarea/flow_io/routing_contraints.rb +10 -0
  91. data/app/services/workarea/flow_io/session.rb +90 -0
  92. data/app/services/workarea/flow_io/webhook.rb +28 -0
  93. data/app/services/workarea/flow_io/webhook/experience_deleted_v2.rb +9 -0
  94. data/app/services/workarea/flow_io/webhook/experience_upserted_v2.rb +9 -0
  95. data/app/services/workarea/flow_io/webhook/order_upserted_v2.rb +36 -0
  96. data/app/services/workarea/flow_io/webhook_request_signature.rb +19 -0
  97. data/app/view_models/workarea/admin/flow_imports_view_model.rb +36 -0
  98. data/app/view_models/workarea/storefront/cart_view_model.decorator +27 -0
  99. data/app/view_models/workarea/storefront/content_blocks/category_summary_view_model.decorator +11 -0
  100. data/app/view_models/workarea/storefront/content_blocks/product_insights_view_model.decorator +11 -0
  101. data/app/view_models/workarea/storefront/content_blocks/product_list_view_model.decorator +13 -0
  102. data/app/view_models/workarea/storefront/order_item_view_model.decorator +35 -0
  103. data/app/view_models/workarea/storefront/order_view_model.decorator +51 -0
  104. data/app/view_models/workarea/storefront/product_templates/option_set_view_model.decorator +20 -0
  105. data/app/view_models/workarea/storefront/product_templates/package_view_model.decorator +14 -0
  106. data/app/view_models/workarea/storefront/product_view_model.decorator +15 -0
  107. data/app/view_models/workarea/storefront/product_view_model/cache_key.decorator +7 -0
  108. data/app/view_models/workarea/storefront/recommendations_view_model.decorator +20 -0
  109. data/app/view_models/workarea/storefront/user_activity_view_model.decorator +18 -0
  110. data/app/views/workarea/admin/catalog_categories/edit.html.haml +85 -0
  111. data/app/views/workarea/admin/facets/_price_inputs.html.haml +50 -0
  112. data/app/views/workarea/admin/flow_imports/index.html.haml +44 -0
  113. data/app/views/workarea/admin/orders/_flow.html.haml +22 -0
  114. data/app/views/workarea/admin/orders/_flow_aux_navigation.html.haml +2 -0
  115. data/app/views/workarea/admin/orders/flow.html.haml +109 -0
  116. data/app/views/workarea/admin/orders/tenders/_flow_payment.html.haml +3 -0
  117. data/app/views/workarea/admin/pricing_skus/_cards.html.haml +83 -0
  118. data/app/views/workarea/admin/pricing_skus/flow.html.haml +60 -0
  119. data/app/views/workarea/admin/search_settings/show.html.haml +55 -0
  120. data/app/views/workarea/admin/shared/_flow_imports_link.html.haml +1 -0
  121. data/app/views/workarea/storefront/_flow_io_country_picker.html.haml +2 -0
  122. data/app/views/workarea/storefront/_flow_io_country_picker_javascript.html.haml +1 -0
  123. data/app/views/workarea/storefront/order_mailer/tenders/_flow_payment.html.haml +2 -0
  124. data/app/views/workarea/storefront/order_mailer/tenders/_flow_payment.text.erb +1 -0
  125. data/app/views/workarea/storefront/orders/tenders/_flow_payment.html.haml +3 -0
  126. data/app/views/workarea/storefront/products/_pricing.html.haml +41 -0
  127. data/app/workers/workarea/flow_io/delete_items.rb +30 -0
  128. data/app/workers/workarea/flow_io/fetch_import.rb +34 -0
  129. data/app/workers/workarea/flow_io/fulfillment_cancellation.rb +14 -0
  130. data/app/workers/workarea/flow_io/item_exporter.rb +47 -0
  131. data/app/workers/workarea/flow_io/process_import.rb +28 -0
  132. data/app/workers/workarea/flow_io/shipping_notifications.rb +13 -0
  133. data/bin/rails +25 -0
  134. data/config/initializers/appends.rb +39 -0
  135. data/config/initializers/freedom_patches.rb +23 -0
  136. data/config/initializers/middleware.rb +11 -0
  137. data/config/initializers/payment_proxy.rb +5 -0
  138. data/config/initializers/rack_attack.rb +15 -0
  139. data/config/initializers/scheduled_jobs.rb +9 -0
  140. data/config/initializers/workarea.rb +101 -0
  141. data/config/initializers/workarea_i18n.rb +11 -0
  142. data/config/locales/en.yml +72 -0
  143. data/config/routes.rb +21 -0
  144. data/lib/active_merchant/billing/bogus_flow_gateway.rb +16 -0
  145. data/lib/active_merchant/billing/flow_gateway.rb +48 -0
  146. data/lib/tasks/flow_io.rake +117 -0
  147. data/lib/workarea/flow_io.rb +73 -0
  148. data/lib/workarea/flow_io/bogus_client.rb +57 -0
  149. data/lib/workarea/flow_io/bogus_client/checkout_tokens.rb +25 -0
  150. data/lib/workarea/flow_io/bogus_client/experiences.rb +152 -0
  151. data/lib/workarea/flow_io/bogus_client/fulfillments.rb +9 -0
  152. data/lib/workarea/flow_io/bogus_client/items.rb +11 -0
  153. data/lib/workarea/flow_io/bogus_client/orders.rb +499 -0
  154. data/lib/workarea/flow_io/bogus_client/organizations.rb +42 -0
  155. data/lib/workarea/flow_io/bogus_client/proxy_client.rb +29 -0
  156. data/lib/workarea/flow_io/bogus_client/sessions.rb +115 -0
  157. data/lib/workarea/flow_io/bogus_client/shipping_notifications.rb +10 -0
  158. data/lib/workarea/flow_io/bogus_client/webhook_settings.rb +11 -0
  159. data/lib/workarea/flow_io/bogus_client/webhooks.rb +11 -0
  160. data/lib/workarea/flow_io/controller_log_subscriber.rb +21 -0
  161. data/lib/workarea/flow_io/engine.rb +8 -0
  162. data/lib/workarea/flow_io/http_handler.rb +27 -0
  163. data/lib/workarea/flow_io/version.rb +5 -0
  164. data/lib/workarea/freedom_patches/flow_io.rb +53 -0
  165. data/package.json +9 -0
  166. data/script/admin_ci +9 -0
  167. data/script/ci +11 -0
  168. data/script/core_ci +9 -0
  169. data/script/plugins_ci +9 -0
  170. data/script/storefront_ci +9 -0
  171. data/test/dummy/.ruby-version +1 -0
  172. data/test/dummy/Rakefile +6 -0
  173. data/test/dummy/bin/bundle +3 -0
  174. data/test/dummy/bin/rails +4 -0
  175. data/test/dummy/bin/rake +4 -0
  176. data/test/dummy/bin/setup +28 -0
  177. data/test/dummy/bin/update +28 -0
  178. data/test/dummy/bin/yarn +11 -0
  179. data/test/dummy/config.ru +5 -0
  180. data/test/dummy/config/application.rb +32 -0
  181. data/test/dummy/config/boot.rb +5 -0
  182. data/test/dummy/config/cable.yml +10 -0
  183. data/test/dummy/config/environment.rb +5 -0
  184. data/test/dummy/config/environments/development.rb +52 -0
  185. data/test/dummy/config/environments/production.rb +88 -0
  186. data/test/dummy/config/environments/test.rb +45 -0
  187. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  188. data/test/dummy/config/initializers/assets.rb +14 -0
  189. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  190. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  191. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  192. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  193. data/test/dummy/config/initializers/inflections.rb +16 -0
  194. data/test/dummy/config/initializers/mime_types.rb +4 -0
  195. data/test/dummy/config/initializers/workarea.rb +5 -0
  196. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  197. data/test/dummy/config/locales/en.yml +33 -0
  198. data/test/dummy/config/puma.rb +34 -0
  199. data/test/dummy/config/routes.rb +5 -0
  200. data/test/dummy/config/secrets.yml +22 -0
  201. data/test/dummy/config/spring.rb +6 -0
  202. data/test/dummy/db/seeds.rb +2 -0
  203. data/test/dummy/log/.keep +0 -0
  204. data/test/dummy/package.json +5 -0
  205. data/test/factories/workarea/flow_io.rb +136 -0
  206. data/test/factories/workarea/flow_io/euro_order_upserted_payload.rb +581 -0
  207. data/test/fixtures/files/example.csv +14 -0
  208. data/test/integration/workarea/admin/flow_imports_integration_test.rb +20 -0
  209. data/test/integration/workarea/admin/flow_order_integration_test.rb +37 -0
  210. data/test/integration/workarea/admin/search_settings_integration_test.decorator +44 -0
  211. data/test/integration/workarea/flow_locale_integration_test.rb +34 -0
  212. data/test/integration/workarea/storefront/copying_guest_order_integration_test.decorator +113 -0
  213. data/test/integration/workarea/storefront/flow_io_order_redirect_test.rb +55 -0
  214. data/test/integration/workarea/storefront/flow_io_session_integration_test.rb +122 -0
  215. data/test/integration/workarea/storefront/flow_io_webhooks/order_integration_test.rb +750 -0
  216. data/test/integration/workarea/storefront/flow_webhook_rack_attack_integration_test.rb +54 -0
  217. data/test/integration/workarea/storefront/search_integration_test.decorator +51 -0
  218. data/test/javascripts/flow_spec.js +39 -0
  219. data/test/javascripts/spec_helper.js +3 -0
  220. data/test/models/workarea/address_test.decorator +20 -0
  221. data/test/models/workarea/checkout_test.decorator +20 -0
  222. data/test/models/workarea/flow_io/imported_item_test.rb +50 -0
  223. data/test/models/workarea/fulfillment_test.decorator +12 -0
  224. data/test/models/workarea/oms_fulfillment_test.decorator +14 -0
  225. data/test/models/workarea/order/item_test.decorator +46 -0
  226. data/test/models/workarea/order_test.decorator +16 -0
  227. data/test/models/workarea/payment/flow_payment_integration_test.rb +163 -0
  228. data/test/models/workarea/price_adjustment_set_flow_test.rb +8 -0
  229. data/test/models/workarea/pricing/calculators/flow_localization_calculator_test.rb +152 -0
  230. data/test/models/workarea/pricing/calculators/item_calculator_test.decorator +59 -0
  231. data/test/models/workarea/pricing/collection_test.decorator +140 -0
  232. data/test/models/workarea/pricing/order_totals_test.rb +247 -0
  233. data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
  234. data/test/models/workarea/pricing/sku_test.decorator +113 -0
  235. data/test/models/workarea/shipping_test.decorator +70 -0
  236. data/test/queries/workarea/flow_order_metrics_test.rb +104 -0
  237. data/test/services/workarea/commit_shipments_test.decorator +14 -0
  238. data/test/services/workarea/flow_io/checkout_test.rb +43 -0
  239. data/test/services/workarea/flow_io/detailed_shipping_notification_form_test.rb +145 -0
  240. data/test/services/workarea/flow_io/experiences_test.rb +14 -0
  241. data/test/services/workarea/flow_io/fulfillment_cancellation_form_test.rb +46 -0
  242. data/test/services/workarea/flow_io/item_importer_test.rb +357 -0
  243. data/test/services/workarea/flow_io/item_test.rb +72 -0
  244. data/test/services/workarea/flow_io/line_item_form_test.rb +34 -0
  245. data/test/services/workarea/flow_io/order_put_form_test.rb +48 -0
  246. data/test/services/workarea/flow_io/price_applier_test.rb +916 -0
  247. data/test/support/flow_fixtures.rb +1362 -0
  248. data/test/support/webhook_integration_test.rb +43 -0
  249. data/test/support/workarea/flow_bogus_client_support.rb +18 -0
  250. data/test/support/workarea/flow_io_vcr_config.rb +22 -0
  251. data/test/system/workarea/admin/search_fulfillment_system_test.decorator +25 -0
  252. data/test/system/workarea/storefront/analytics_system_test.decorator +28 -0
  253. data/test/system/workarea/storefront/flow_cart_recommendations_system_test.rb +70 -0
  254. data/test/system/workarea/storefront/users_flow_orders_system_test.rb +25 -0
  255. data/test/teaspoon_env.rb +6 -0
  256. data/test/test_helper.rb +27 -0
  257. data/test/vcr_cassettes/payment/flow/auth_capture.yml +188 -0
  258. data/test/vcr_cassettes/payment/flow/auth_capture_refund.yml +249 -0
  259. data/test/vcr_cassettes/payment/flow/auth_void.yml +188 -0
  260. data/test/vcr_cassettes/payment/flow/purchase_refund.yml +249 -0
  261. data/test/vcr_cassettes/payment/flow/store_auth.yml +127 -0
  262. data/test/vcr_cassettes/payment/flow/store_purchase.yml +188 -0
  263. data/test/view_models/workarea/storefront/cart_view_model_test.decorator +19 -0
  264. data/test/view_models/workarea/storefront/order_item_view_model_test.decorator +24 -0
  265. data/test/view_models/workarea/storefront/order_view_model_test.decorator +41 -0
  266. data/test/view_models/workarea/storefront/package_view_model_test.decorator +11 -0
  267. data/test/workers/workarea/flow_io/delete_items_test.rb +37 -0
  268. data/test/workers/workarea/flow_io/fetch_import_test.rb +41 -0
  269. data/test/workers/workarea/flow_io/item_exporter_test.rb +47 -0
  270. data/test/workers/workarea/flow_io/process_import_test.rb +25 -0
  271. data/workarea-flow_io.gemspec +20 -0
  272. metadata +375 -0
@@ -0,0 +1,1362 @@
1
+ module Workarea
2
+ module FlowIo
3
+ module FlowFixtures
4
+ def europe_experience
5
+ @europe_experience ||= build_flow_io_experience_summary(
6
+ id: "exp-f9ec9be879a341ddb8a67e9a1f34775b",
7
+ key: "europe",
8
+ name: "Europe",
9
+ country: "GBR",
10
+ currency: "EUR",
11
+ language: "en"
12
+ )
13
+ end
14
+
15
+ def canada_experience
16
+ @canada_experience ||= build_flow_io_experience_summary(
17
+ _id: "exp-31b66afd8ac44a71a0669b2ad81a794d",
18
+ key: "canada",
19
+ name: "Canada",
20
+ country: "CA",
21
+ currency: "CAD",
22
+ language: "en"
23
+ )
24
+ end
25
+
26
+ def canada_experience_geo
27
+ @canada_experience_geo ||= build_flow_io_experience_geo(
28
+ key: "canada",
29
+ name: "Canada",
30
+ region: { id: "can" },
31
+ country: "CAN",
32
+ currency: "CAD",
33
+ language: "en",
34
+ measurement_system: "metric"
35
+ )
36
+ end
37
+
38
+ def europe_experience_geo
39
+ @canada_experience_geo ||= build_flow_io_experience_geo(
40
+ key: "europe",
41
+ name: "Europe",
42
+ region: { id: "europe" },
43
+ country: "GBR",
44
+ currency: "EUR",
45
+ language: "en",
46
+ measurement_system: "metric"
47
+ )
48
+ end
49
+
50
+ def create_placed_canadian_flow_order
51
+ order_id = "123ABC"
52
+ product = create_product(variants: [{ sku: '386555310-9', regular: 5.00 }])
53
+ product_2 = create_product(variants: [{ sku: '332477498-5', regular: 5.00 }])
54
+
55
+ ['386555310-9', '332477498-5'].each do |sku|
56
+ Pricing::Sku.find(sku).tap do |pricing_sku|
57
+ pricing_sku.flow_io_local_items << build_flow_io_local_item(regular: 6.to_m("CAD"))
58
+ end
59
+ end
60
+
61
+ order = create_order(
62
+ id: order_id,
63
+ flow: true,
64
+ experience: canada_experience_geo
65
+ )
66
+
67
+ order.add_item(product_id: product.id, sku: '386555310-9', quantity: 1)
68
+ order.add_item(product_id: product_2.id, sku: '332477498-5', quantity: 1)
69
+
70
+ Pricing.perform(order)
71
+
72
+ flow_order = ::Io::Flow::V0::Models::OrderUpsertedV2.new(canadian_webhook_payload).order
73
+
74
+ checkout = Workarea::FlowIo::Checkout.new(flow_order, order)
75
+ checkout.build
76
+ checkout.place_order
77
+
78
+ order
79
+ end
80
+
81
+ def create_canadian_cart_with_order_discount
82
+ order_id = "E62D6AD5B6"
83
+ product = create_product(variants: [{ sku: '942594751-1', regular: 14.83 }])
84
+ _order_total_discount = create_order_total_discount(order_total: 5.to_m)
85
+
86
+ order = create_order(
87
+ id: order_id,
88
+ flow: true,
89
+ experience: canada_experience
90
+ )
91
+
92
+ order.add_item(product_id: product.id, sku: '942594751-1', quantity: 1)
93
+
94
+ Pricing.perform(order)
95
+
96
+ order
97
+ end
98
+
99
+ def canadian_discount_webhook_payload(order_id = "E62D6AD5B6")
100
+ @canadian_discount_webhook_payload ||= {
101
+ "event_id": "evt-0bdfe4c64c2d4a84a488e22fec641c78",
102
+ "timestamp": "2018-08-28T17:19:57.823Z",
103
+ "organization": "workarea-sandbox",
104
+ "order": {
105
+ "id": "ord-f1f27775b5054c1ab2068823089c723b",
106
+ "number": "ord-f1f27775b5054c1ab2068823089c723b",
107
+ "customer": {
108
+ "name": {
109
+ "first": "Jeff",
110
+ "last": "Yucis"
111
+ },
112
+ "phone": "3027507743",
113
+ "email": "jyucis-pa-test@weblinc.com",
114
+ "address": {
115
+ "name": {
116
+ "first": "Jeff",
117
+ "last": "Yucis"
118
+ },
119
+ "streets": [
120
+ "35 Letitia Ln"
121
+ ],
122
+ "city": "TORONTO",
123
+ "province": "Ontario",
124
+ "postal": "19063",
125
+ "country": "CAN",
126
+ "company": "Weblinc"
127
+ }
128
+ },
129
+ "delivered_duty": "paid",
130
+ "destination": {
131
+ "streets": [
132
+ "35 Letitia Ln"
133
+ ],
134
+ "city": "TORONTO",
135
+ "province": "Ontario",
136
+ "postal": "19063",
137
+ "country": "CAN",
138
+ "contact": {
139
+ "name": {
140
+ "first": "Jeff",
141
+ "last": "Yucis"
142
+ },
143
+ "company": "Weblinc",
144
+ "email": "jyucis-pa-test@weblinc.com",
145
+ "phone": "3027507743"
146
+ }
147
+ },
148
+ "expires_at": "2018-08-28T18:19:56.293Z",
149
+ "items": [
150
+ {
151
+ "number": "942594751-1",
152
+ "name": "Intelligent Bronze Knife",
153
+ "quantity": 1,
154
+ "local": {
155
+ "experience": {
156
+ "id": "exp-95889ba1ff4b449f8a3c0e0a7a4fb23b",
157
+ "key": "canada",
158
+ "name": "Canada"
159
+ },
160
+ "prices": [
161
+ {
162
+ "currency": "CAD",
163
+ "amount": 20,
164
+ "label": "CA$20.00",
165
+ "base": {
166
+ "amount": 14.83,
167
+ "currency": "USD",
168
+ "label": "US$14.83"
169
+ },
170
+ "key": "localized_item_price"
171
+ }
172
+ ],
173
+ "rates": [],
174
+ "spot_rates": [],
175
+ "status": "included",
176
+ "attributes": {
177
+ "msrp": "40.0",
178
+ "Size": "Extra Large",
179
+ "regular_price": "20.0",
180
+ "sale_price": "20.0",
181
+ "product_id": "DD1252B4F3",
182
+ "Color": "Plum",
183
+ "fulfillment_method": "physical"
184
+ },
185
+ "price_attributes": {
186
+ "msrp": {
187
+ "currency": "CAD",
188
+ "amount": 40,
189
+ "label": "CA$40.00",
190
+ "base": {
191
+ "amount": 29.64,
192
+ "currency": "USD",
193
+ "label": "US$29.64"
194
+ }
195
+ },
196
+ "regular_price": {
197
+ "currency": "CAD",
198
+ "amount": 20,
199
+ "label": "CA$20.00",
200
+ "base": {
201
+ "amount": 14.83,
202
+ "currency": "USD",
203
+ "label": "US$14.83"
204
+ }
205
+ },
206
+ "sale_price": {
207
+ "currency": "CAD",
208
+ "amount": 20,
209
+ "label": "CA$20.00",
210
+ "base": {
211
+ "amount": 14.81,
212
+ "currency": "USD",
213
+ "label": "US$14.81"
214
+ }
215
+ }
216
+ }
217
+ }
218
+ }
219
+ ],
220
+ "deliveries": [
221
+ {
222
+ "id": "del-62a1cf214bc048deb1c4e3752d8dbf33",
223
+ "items": [
224
+ {
225
+ "number": "942594751-1",
226
+ "quantity": 1,
227
+ "price": {
228
+ "currency": "CAD",
229
+ "amount": 20,
230
+ "base": {
231
+ "amount": 14.83,
232
+ "currency": "USD"
233
+ }
234
+ },
235
+ "attributes": {
236
+ "base_amount": "14.83",
237
+ "base_currency": "USD"
238
+ }
239
+ }
240
+ ],
241
+ "options": [
242
+ {
243
+ "id": "opt-618a7e56beb54471ab78d58ef04f032b",
244
+ "cost": {
245
+ "currency": "CAD",
246
+ "amount": 9.26,
247
+ "label": "CA$9.26",
248
+ "base": {
249
+ "amount": 6.86,
250
+ "currency": "USD",
251
+ "label": "US$6.86"
252
+ }
253
+ },
254
+ "delivered_duty": "unpaid",
255
+ "price": {
256
+ "currency": "CAD",
257
+ "amount": 9.26,
258
+ "label": "CA$9.26",
259
+ "base": {
260
+ "amount": 6.86,
261
+ "currency": "USD",
262
+ "label": "US$6.86"
263
+ }
264
+ },
265
+ "service": {
266
+ "id": "landmark-global",
267
+ "carrier": {
268
+ "id": "landmark"
269
+ },
270
+ "name": "Global"
271
+ },
272
+ "tier": {
273
+ "id": "tie-fc0ec702c4384dc8805ae645ef6156e8",
274
+ "integration": "information",
275
+ "name": "Standard Shipping",
276
+ "services": [
277
+ "landmark-global",
278
+ "dhl-express-worldwide"
279
+ ],
280
+ "strategy": "lowest_cost",
281
+ "visibility": "public",
282
+ "currency": "CAD",
283
+ "display": {
284
+ "estimate": {
285
+ "type": "calculated",
286
+ "label": "2-5 Business Days"
287
+ }
288
+ }
289
+ },
290
+ "window": {
291
+ "from": "2018-08-30T00:00:00.000Z",
292
+ "to": "2018-09-04T00:00:00.000Z",
293
+ "timezone": "America/Toronto",
294
+ "label": "2-5 Business Days"
295
+ },
296
+ "cost_details": [
297
+ {
298
+ "source": "ratecard",
299
+ "currency": "CAD",
300
+ "amount": 9.26,
301
+ "label": "CA$9.26",
302
+ "components": [
303
+ {
304
+ "key": "ratecard_base_cost",
305
+ "currency": "CAD",
306
+ "amount": 9.26,
307
+ "label": "CA$9.26",
308
+ "base": {
309
+ "amount": 6.86,
310
+ "currency": "USD",
311
+ "label": "US$6.86"
312
+ }
313
+ }
314
+ ],
315
+ "base": {
316
+ "amount": 6.86,
317
+ "currency": "USD",
318
+ "label": "US$6.86"
319
+ }
320
+ }
321
+ ],
322
+ "rule_outcome": {
323
+ "discriminator": "at_cost"
324
+ },
325
+ "weight": {
326
+ "gravitational": {
327
+ "value": "1.25",
328
+ "units": "pound"
329
+ },
330
+ "dimensional": {
331
+ "value": "2.12",
332
+ "units": "inch"
333
+ }
334
+ }
335
+ },
336
+ {
337
+ "id": "opt-c0f9091fe6984227be3f00775f1811ba",
338
+ "cost": {
339
+ "currency": "CAD",
340
+ "amount": 9.26,
341
+ "label": "CA$9.26",
342
+ "base": {
343
+ "amount": 6.86,
344
+ "currency": "USD",
345
+ "label": "US$6.86"
346
+ }
347
+ },
348
+ "delivered_duty": "paid",
349
+ "price": {
350
+ "currency": "CAD",
351
+ "amount": 9.26,
352
+ "label": "CA$9.26",
353
+ "base": {
354
+ "amount": 6.86,
355
+ "currency": "USD",
356
+ "label": "US$6.86"
357
+ }
358
+ },
359
+ "service": {
360
+ "id": "landmark-global",
361
+ "carrier": {
362
+ "id": "landmark"
363
+ },
364
+ "name": "Global"
365
+ },
366
+ "tier": {
367
+ "id": "tie-fc0ec702c4384dc8805ae645ef6156e8",
368
+ "integration": "information",
369
+ "name": "Standard Shipping",
370
+ "services": [
371
+ "landmark-global",
372
+ "dhl-express-worldwide"
373
+ ],
374
+ "strategy": "lowest_cost",
375
+ "visibility": "public",
376
+ "currency": "CAD",
377
+ "display": {
378
+ "estimate": {
379
+ "type": "calculated",
380
+ "label": "2-5 Business Days"
381
+ }
382
+ }
383
+ },
384
+ "window": {
385
+ "from": "2018-08-30T00:00:00.000Z",
386
+ "to": "2018-09-04T00:00:00.000Z",
387
+ "timezone": "America/Toronto",
388
+ "label": "2-5 Business Days"
389
+ },
390
+ "cost_details": [
391
+ {
392
+ "source": "ratecard",
393
+ "currency": "CAD",
394
+ "amount": 9.26,
395
+ "label": "CA$9.26",
396
+ "components": [
397
+ {
398
+ "key": "ratecard_base_cost",
399
+ "currency": "CAD",
400
+ "amount": 9.26,
401
+ "label": "CA$9.26",
402
+ "base": {
403
+ "amount": 6.86,
404
+ "currency": "USD",
405
+ "label": "US$6.86"
406
+ }
407
+ }
408
+ ],
409
+ "base": {
410
+ "amount": 6.86,
411
+ "currency": "USD",
412
+ "label": "US$6.86"
413
+ }
414
+ }
415
+ ],
416
+ "rule_outcome": {
417
+ "discriminator": "at_cost"
418
+ },
419
+ "weight": {
420
+ "gravitational": {
421
+ "value": "1.25",
422
+ "units": "pound"
423
+ },
424
+ "dimensional": {
425
+ "value": "2.12",
426
+ "units": "inch"
427
+ }
428
+ }
429
+ }
430
+ ],
431
+ "center": {
432
+ "id": "cen-394b1db3c61a495c964dd1fe60969160",
433
+ "key": "center-workarea"
434
+ },
435
+ "discriminator": "physical_delivery"
436
+ }
437
+ ],
438
+ "selections": [
439
+ "opt-c0f9091fe6984227be3f00775f1811ba"
440
+ ],
441
+ "prices": [
442
+ {
443
+ "key": "subtotal",
444
+ "currency": "CAD",
445
+ "amount": 20,
446
+ "label": "CA$20.00",
447
+ "base": {
448
+ "amount": 14.83,
449
+ "currency": "USD",
450
+ "label": "US$14.83"
451
+ },
452
+ "components": [
453
+ {
454
+ "key": "item_price",
455
+ "currency": "CAD",
456
+ "amount": 18.02,
457
+ "label": "CA$18.02",
458
+ "base": {
459
+ "amount": 13.36,
460
+ "currency": "USD",
461
+ "label": "US$13.36"
462
+ },
463
+ "name": "Item price"
464
+ },
465
+ {
466
+ "key": "rounding",
467
+ "currency": "CAD",
468
+ "amount": 1.98,
469
+ "label": "CA$1.98",
470
+ "base": {
471
+ "amount": 1.47,
472
+ "currency": "USD",
473
+ "label": "US$1.47"
474
+ },
475
+ "name": "Rounding"
476
+ }
477
+ ],
478
+ "name": "Item subtotal"
479
+ },
480
+ {
481
+ "key": "vat",
482
+ "currency": "CAD",
483
+ "amount": 3.07,
484
+ "label": "CA$3.07",
485
+ "base": {
486
+ "amount": 2.27,
487
+ "currency": "USD",
488
+ "label": "US$2.27"
489
+ },
490
+ "components": [
491
+ {
492
+ "key": "vat_item_price",
493
+ "currency": "CAD",
494
+ "amount": 2.6,
495
+ "label": "CA$2.60",
496
+ "base": {
497
+ "amount": 1.92,
498
+ "currency": "USD",
499
+ "label": "US$1.92"
500
+ },
501
+ "name": "HST on item price"
502
+ },
503
+ {
504
+ "key": "vat_duties_item_price",
505
+ "currency": "CAD",
506
+ "amount": 0.47,
507
+ "label": "CA$0.47",
508
+ "base": {
509
+ "amount": 0.35,
510
+ "currency": "USD",
511
+ "label": "US$0.35"
512
+ },
513
+ "name": "HST on duties on item price"
514
+ }
515
+ ],
516
+ "name": "HST"
517
+ },
518
+ {
519
+ "key": "duty",
520
+ "currency": "CAD",
521
+ "amount": 3.6,
522
+ "label": "CA$3.60",
523
+ "base": {
524
+ "amount": 2.67,
525
+ "currency": "USD",
526
+ "label": "US$2.67"
527
+ },
528
+ "components": [
529
+ {
530
+ "key": "duties_item_price",
531
+ "currency": "CAD",
532
+ "amount": 3.6,
533
+ "label": "CA$3.60",
534
+ "base": {
535
+ "amount": 2.67,
536
+ "currency": "USD",
537
+ "label": "US$2.67"
538
+ },
539
+ "name": "Duties on item price"
540
+ }
541
+ ],
542
+ "name": "Duties"
543
+ },
544
+ {
545
+ "key": "shipping",
546
+ "currency": "CAD",
547
+ "amount": 9.26,
548
+ "label": "CA$9.26",
549
+ "base": {
550
+ "amount": 6.86,
551
+ "currency": "USD",
552
+ "label": "US$6.86"
553
+ },
554
+ "components": [
555
+ {
556
+ "key": "shipping",
557
+ "currency": "CAD",
558
+ "amount": 9.26,
559
+ "label": "CA$9.26",
560
+ "base": {
561
+ "amount": 6.86,
562
+ "currency": "USD",
563
+ "label": "US$6.86"
564
+ },
565
+ "name": "Shipping"
566
+ }
567
+ ],
568
+ "name": "Shipping"
569
+ },
570
+ {
571
+ "key": "discount",
572
+ "currency": "CAD",
573
+ "amount": -1.8,
574
+ "label": "-CA$1.80",
575
+ "base": {
576
+ "amount": -1.27,
577
+ "currency": "USD",
578
+ "label": "-US$1.27"
579
+ },
580
+ "components": [
581
+ {
582
+ "key": "order_discount",
583
+ "currency": "CAD",
584
+ "amount": -1.8,
585
+ "label": "-CA$1.80",
586
+ "base": {
587
+ "amount": -1.27,
588
+ "currency": "USD",
589
+ "label": "-US$1.27"
590
+ },
591
+ "name": "Order discount"
592
+ }
593
+ ],
594
+ "name": "Discount"
595
+ }
596
+ ],
597
+ "total": {
598
+ "currency": "CAD",
599
+ "amount": 34.13,
600
+ "label": "CA$34.13",
601
+ "base": {
602
+ "amount": 25.36,
603
+ "currency": "USD",
604
+ "label": "US$25.36"
605
+ }
606
+ },
607
+ "attributes": {
608
+ "number": "#{order_id}"
609
+ },
610
+ "merchant_of_record": "flow",
611
+ "experience": {
612
+ "key": "canada",
613
+ "discriminator": "experience_reference"
614
+ },
615
+ "submitted_at": "2018-08-28T17:19:57.782Z",
616
+ "lines": [
617
+ {
618
+ "item_number": "942594751-1",
619
+ "quantity": 1,
620
+ "price": {
621
+ "currency": "CAD",
622
+ "amount": 20,
623
+ "label": "CA$20.00",
624
+ "base": {
625
+ "amount": 14.83,
626
+ "currency": "USD",
627
+ "label": "US$14.83"
628
+ }
629
+ },
630
+ "total": {
631
+ "currency": "CAD",
632
+ "amount": 20,
633
+ "label": "CA$20.00",
634
+ "base": {
635
+ "amount": 14.83,
636
+ "currency": "USD",
637
+ "label": "US$14.83"
638
+ }
639
+ }
640
+ }
641
+ ],
642
+ "promotions": {
643
+ "applied": [
644
+ {
645
+ "id": "order_put_form_discount",
646
+ "label": "Discount",
647
+ "price": {
648
+ "currency": "CAD",
649
+ "amount": -1.8,
650
+ "label": "-CA$1.80",
651
+ "base": {
652
+ "amount": -1.27,
653
+ "currency": "USD",
654
+ "label": "-US$1.27"
655
+ }
656
+ },
657
+ "attributes": {
658
+ "discount_type": "order_put_form_discount"
659
+ },
660
+ "discriminator": "discount"
661
+ }
662
+ ],
663
+ "available": []
664
+ },
665
+ "payments": [
666
+ {
667
+ "id": "opm-3dd423128d804a5b90c2986bd8be11ab",
668
+ "type": "card",
669
+ "merchant_of_record": "flow",
670
+ "reference": "aut-k7YUhioHWekBGpAi9VA7cD4fqs2xoH4Z",
671
+ "description": "VISA ending with 1111",
672
+ "total": {
673
+ "currency": "CAD",
674
+ "amount": 34.13,
675
+ "label": "CA$34.13",
676
+ "base": {
677
+ "amount": 25.36,
678
+ "currency": "USD",
679
+ "label": "US$25.36"
680
+ }
681
+ },
682
+ "attributes": {},
683
+ "address": {
684
+ "name": {
685
+ "first": "Jeff",
686
+ "last": "Yucis"
687
+ },
688
+ "streets": [
689
+ "35 Letitia Ln"
690
+ ],
691
+ "city": "TORONTO",
692
+ "province": "Ontario",
693
+ "postal": "19063",
694
+ "country": "CAN"
695
+ },
696
+ "date": "2018-08-28T17:19:57.167Z"
697
+ }
698
+ ],
699
+ "balance": {
700
+ "currency": "CAD",
701
+ "amount": 0,
702
+ "label": "CA$0.00",
703
+ "base": {
704
+ "amount": 0,
705
+ "currency": "USD",
706
+ "label": "US$0.00"
707
+ }
708
+ }
709
+ },
710
+ "discriminator": "order_upserted_v2"
711
+ }
712
+ end
713
+
714
+ def canadian_webhook_payload(order_id = "6F3A2186EB")
715
+ @canadian_webhook_payload ||= {
716
+ "event_id": "evt-37ba2577b4e54d55b8847891a1ec3a1f",
717
+ "timestamp": "2018-08-09T17:16:54.542Z",
718
+ "organization": "workarea-sandbox",
719
+ "order": {
720
+ "id": "ord-7d170417473c43c99d7ea88f938bfebb",
721
+ "number": "ord-7d170417473c43c99d7ea88f938bfebb",
722
+ "customer": {
723
+ "name": {
724
+ "first": "Jeff",
725
+ "last": "Yucis"
726
+ },
727
+ "phone": "3027507743",
728
+ "email": "flow-test@weblinc.com",
729
+ "address": {
730
+ "name": {
731
+ "first": "Jeff",
732
+ "last": "Yucis"
733
+ },
734
+ "streets": [
735
+ "35 Letitia Ln"
736
+ ],
737
+ "city": "Media",
738
+ "province": "Alberta",
739
+ "postal": "19063",
740
+ "country": "CAN",
741
+ "company": "Weblinc"
742
+ }
743
+ },
744
+ "delivered_duty": "paid",
745
+ "destination": {
746
+ "streets": [
747
+ "35 Letitia Ln"
748
+ ],
749
+ "city": "Media",
750
+ "province": "Alberta",
751
+ "postal": "19063",
752
+ "country": "CAN",
753
+ "contact": {
754
+ "name": {
755
+ "first": "Jeff",
756
+ "last": "Yucis"
757
+ },
758
+ "company": "Weblinc",
759
+ "email": "jyucis-relate-new@weblinc.com",
760
+ "phone": "3027507743"
761
+ }
762
+ },
763
+ "expires_at": "2018-08-09T18:16:53.063Z",
764
+ "items": [
765
+ {
766
+ "number": "386555310-9",
767
+ "name": "Incredible Cotton Bag",
768
+ "quantity": 1,
769
+ "local": {
770
+ "experience": {
771
+ "id": "exp-95889ba1ff4b449f8a3c0e0a7a4fb23b",
772
+ "key": "canada",
773
+ "name": "Canada"
774
+ },
775
+ "prices": [
776
+ {
777
+ "currency": "CAD",
778
+ "amount": 80,
779
+ "label": "CA$80.00",
780
+ "base": {
781
+ "amount": 59.07,
782
+ "currency": "USD",
783
+ "label": "US$59.07"
784
+ },
785
+ "key": "localized_item_price"
786
+ }
787
+ ],
788
+ "rates": [],
789
+ "spot_rates": [],
790
+ "status": "included",
791
+ "attributes": {
792
+ "msrp": "59.74",
793
+ "Size": "Extra Large",
794
+ "regular_price": "49.74",
795
+ "sale_price": "70.0",
796
+ "product_id": "890726C80A",
797
+ "Color": "Orange",
798
+ "fulfillment_method": "physical"
799
+ },
800
+ "price_attributes": {
801
+ "sale_price": {
802
+ "currency": "CAD",
803
+ "amount": 70,
804
+ "label": "CA$70.00",
805
+ "base": {
806
+ "amount": 51.69,
807
+ "currency": "USD",
808
+ "label": "US$51.69"
809
+ }
810
+ }
811
+ }
812
+ }
813
+ },
814
+ {
815
+ "number": "332477498-5",
816
+ "name": "Gorgeous Bronze Plate",
817
+ "quantity": 1,
818
+ "local": {
819
+ "experience": {
820
+ "id": "exp-95889ba1ff4b449f8a3c0e0a7a4fb23b",
821
+ "key": "canada",
822
+ "name": "Canada"
823
+ },
824
+ "prices": [
825
+ {
826
+ "currency": "CAD",
827
+ "amount": 100,
828
+ "label": "CA$100.00",
829
+ "base": {
830
+ "amount": 73.84,
831
+ "currency": "USD",
832
+ "label": "US$73.84"
833
+ },
834
+ "key": "localized_item_price"
835
+ }
836
+ ],
837
+ "rates": [],
838
+ "spot_rates": [],
839
+ "status": "included",
840
+ "attributes": {
841
+ "msrp": "76.96",
842
+ "Size": "Extra Small",
843
+ "regular_price": "66.96",
844
+ "sale_price": "90.0",
845
+ "product_id": "82F12BBA56",
846
+ "Color": "Teal",
847
+ "fulfillment_method": "physical"
848
+ },
849
+ "price_attributes": {
850
+ "sale_price": {
851
+ "currency": "CAD",
852
+ "amount": 90,
853
+ "label": "CA$90.00",
854
+ "base": {
855
+ "amount": 66.46,
856
+ "currency": "USD",
857
+ "label": "US$66.46"
858
+ }
859
+ }
860
+ }
861
+ }
862
+ }
863
+ ],
864
+ "deliveries": [
865
+ {
866
+ "id": "del-2270eea7d85b4ee386137cf8018a37a2",
867
+ "items": [
868
+ {
869
+ "number": "633652208-3",
870
+ "quantity": 1,
871
+ "price": {
872
+ "currency": "CAD",
873
+ "amount": 80,
874
+ "base": {
875
+ "amount": 59.07,
876
+ "currency": "USD"
877
+ }
878
+ },
879
+ "attributes": {
880
+ "base_amount": "59.07",
881
+ "base_currency": "USD"
882
+ }
883
+ },
884
+ {
885
+ "number": "573446691-3",
886
+ "quantity": 1,
887
+ "price": {
888
+ "currency": "CAD",
889
+ "amount": 100,
890
+ "base": {
891
+ "amount": 73.84,
892
+ "currency": "USD"
893
+ }
894
+ },
895
+ "attributes": {
896
+ "base_amount": "73.84",
897
+ "base_currency": "USD"
898
+ }
899
+ }
900
+ ],
901
+ "options": [
902
+ {
903
+ "id": "opt-447ba414cf9448ca995464e88241fb8f",
904
+ "cost": {
905
+ "currency": "CAD",
906
+ "amount": 9.29,
907
+ "label": "CA$9.29",
908
+ "base": {
909
+ "amount": 6.86,
910
+ "currency": "USD",
911
+ "label": "US$6.86"
912
+ }
913
+ },
914
+ "delivered_duty": "unpaid",
915
+ "price": {
916
+ "currency": "CAD",
917
+ "amount": 9.29,
918
+ "label": "CA$9.29",
919
+ "base": {
920
+ "amount": 6.86,
921
+ "currency": "USD",
922
+ "label": "US$6.86"
923
+ }
924
+ },
925
+ "service": {
926
+ "id": "landmark-global",
927
+ "carrier": {
928
+ "id": "landmark"
929
+ },
930
+ "name": "Global"
931
+ },
932
+ "tier": {
933
+ "id": "tie-fc0ec702c4384dc8805ae645ef6156e8",
934
+ "experience": {
935
+ "id": "canada",
936
+ "currency": "CAD"
937
+ },
938
+ "integration": "information",
939
+ "name": "Standard Shipping",
940
+ "services": [
941
+ "landmark-global",
942
+ "dhl-express-worldwide"
943
+ ],
944
+ "strategy": "lowest_cost",
945
+ "visibility": "public",
946
+ "currency": "CAD",
947
+ "display": {
948
+ "estimate": {
949
+ "type": "calculated",
950
+ "label": "2-5 Business Days"
951
+ }
952
+ }
953
+ },
954
+ "window": {
955
+ "from": "2018-08-13T00:00:00.000Z",
956
+ "to": "2018-08-16T00:00:00.000Z",
957
+ "timezone": "America/Toronto",
958
+ "label": "2-5 Business Days"
959
+ },
960
+ "cost_details": [
961
+ {
962
+ "source": "ratecard",
963
+ "currency": "CAD",
964
+ "amount": 9.29,
965
+ "label": "CA$9.29",
966
+ "components": [
967
+ {
968
+ "key": "ratecard_base_cost",
969
+ "currency": "CAD",
970
+ "amount": 9.29,
971
+ "label": "CA$9.29",
972
+ "base": {
973
+ "amount": 6.86,
974
+ "currency": "USD",
975
+ "label": "US$6.86"
976
+ }
977
+ }
978
+ ],
979
+ "base": {
980
+ "amount": 6.86,
981
+ "currency": "USD",
982
+ "label": "US$6.86"
983
+ }
984
+ }
985
+ ],
986
+ "rule_outcome": {
987
+ "discriminator": "at_cost"
988
+ },
989
+ "weight": {
990
+ "gravitational": {
991
+ "value": "2.5",
992
+ "units": "pound"
993
+ },
994
+ "dimensional": {
995
+ "value": "2.12",
996
+ "units": "inch"
997
+ }
998
+ }
999
+ },
1000
+ {
1001
+ "id": "opt-806563c2f4b448e8a4d36bb037de0a21",
1002
+ "cost": {
1003
+ "currency": "CAD",
1004
+ "amount": 9.29,
1005
+ "label": "CA$9.29",
1006
+ "base": {
1007
+ "amount": 6.86,
1008
+ "currency": "USD",
1009
+ "label": "US$6.86"
1010
+ }
1011
+ },
1012
+ "delivered_duty": "paid",
1013
+ "price": {
1014
+ "currency": "CAD",
1015
+ "amount": 9.29,
1016
+ "label": "CA$9.29",
1017
+ "base": {
1018
+ "amount": 6.86,
1019
+ "currency": "USD",
1020
+ "label": "US$6.86"
1021
+ }
1022
+ },
1023
+ "service": {
1024
+ "id": "landmark-global",
1025
+ "carrier": {
1026
+ "id": "landmark"
1027
+ },
1028
+ "name": "Global"
1029
+ },
1030
+ "tier": {
1031
+ "id": "tie-fc0ec702c4384dc8805ae645ef6156e8",
1032
+ "experience": {
1033
+ "id": "canada",
1034
+ "currency": "CAD"
1035
+ },
1036
+ "integration": "information",
1037
+ "name": "Standard Shipping",
1038
+ "services": [
1039
+ "landmark-global",
1040
+ "dhl-express-worldwide"
1041
+ ],
1042
+ "strategy": "lowest_cost",
1043
+ "visibility": "public",
1044
+ "currency": "CAD",
1045
+ "display": {
1046
+ "estimate": {
1047
+ "type": "calculated",
1048
+ "label": "2-5 Business Days"
1049
+ }
1050
+ }
1051
+ },
1052
+ "window": {
1053
+ "from": "2018-08-13T00:00:00.000Z",
1054
+ "to": "2018-08-16T00:00:00.000Z",
1055
+ "timezone": "America/Toronto",
1056
+ "label": "2-5 Business Days"
1057
+ },
1058
+ "cost_details": [
1059
+ {
1060
+ "source": "ratecard",
1061
+ "currency": "CAD",
1062
+ "amount": 9.29,
1063
+ "label": "CA$9.29",
1064
+ "components": [
1065
+ {
1066
+ "key": "ratecard_base_cost",
1067
+ "currency": "CAD",
1068
+ "amount": 9.29,
1069
+ "label": "CA$9.29",
1070
+ "base": {
1071
+ "amount": 6.86,
1072
+ "currency": "USD",
1073
+ "label": "US$6.86"
1074
+ }
1075
+ }
1076
+ ],
1077
+ "base": {
1078
+ "amount": 6.86,
1079
+ "currency": "USD",
1080
+ "label": "US$6.86"
1081
+ }
1082
+ }
1083
+ ],
1084
+ "rule_outcome": {
1085
+ "discriminator": "at_cost"
1086
+ },
1087
+ "weight": {
1088
+ "gravitational": {
1089
+ "value": "2.5",
1090
+ "units": "pound"
1091
+ },
1092
+ "dimensional": {
1093
+ "value": "2.12",
1094
+ "units": "inch"
1095
+ }
1096
+ }
1097
+ }
1098
+ ],
1099
+ "center": {
1100
+ "id": "cen-394b1db3c61a495c964dd1fe60969160",
1101
+ "key": "center-workarea"
1102
+ },
1103
+ "discriminator": "physical_delivery"
1104
+ }
1105
+ ],
1106
+ "selections": [
1107
+ "opt-806563c2f4b448e8a4d36bb037de0a21"
1108
+ ],
1109
+ "prices": [
1110
+ {
1111
+ "key": "subtotal",
1112
+ "currency": "CAD",
1113
+ "amount": 180,
1114
+ "label": "CA$180.00",
1115
+ "base": {
1116
+ "amount": 132.91,
1117
+ "currency": "USD",
1118
+ "label": "US$132.91"
1119
+ },
1120
+ "components": [
1121
+ {
1122
+ "key": "item_price",
1123
+ "currency": "CAD",
1124
+ "amount": 165.94,
1125
+ "label": "CA$165.94",
1126
+ "base": {
1127
+ "amount": 122.53,
1128
+ "currency": "USD",
1129
+ "label": "US$122.53"
1130
+ },
1131
+ "name": "Item price"
1132
+ },
1133
+ {
1134
+ "key": "rounding",
1135
+ "currency": "CAD",
1136
+ "amount": 14.06,
1137
+ "label": "CA$14.06",
1138
+ "base": {
1139
+ "amount": 10.38,
1140
+ "currency": "USD",
1141
+ "label": "US$10.38"
1142
+ },
1143
+ "name": "Rounding"
1144
+ }
1145
+ ],
1146
+ "name": "Item subtotal"
1147
+ },
1148
+ {
1149
+ "key": "vat",
1150
+ "currency": "CAD",
1151
+ "amount": 10.62,
1152
+ "label": "CA$10.62",
1153
+ "base": {
1154
+ "amount": 7.85,
1155
+ "currency": "USD",
1156
+ "label": "US$7.85"
1157
+ },
1158
+ "components": [
1159
+ {
1160
+ "key": "vat_item_price",
1161
+ "currency": "CAD",
1162
+ "amount": 9,
1163
+ "label": "CA$9.00",
1164
+ "base": {
1165
+ "amount": 6.65,
1166
+ "currency": "USD",
1167
+ "label": "US$6.65"
1168
+ },
1169
+ "name": "GST on item price"
1170
+ },
1171
+ {
1172
+ "key": "vat_duties_item_price",
1173
+ "currency": "CAD",
1174
+ "amount": 1.62,
1175
+ "label": "CA$1.62",
1176
+ "base": {
1177
+ "amount": 1.2,
1178
+ "currency": "USD",
1179
+ "label": "US$1.20"
1180
+ },
1181
+ "name": "GST on duties on item price"
1182
+ }
1183
+ ],
1184
+ "name": "GST"
1185
+ },
1186
+ {
1187
+ "key": "duty",
1188
+ "currency": "CAD",
1189
+ "amount": 32.4,
1190
+ "label": "CA$32.40",
1191
+ "base": {
1192
+ "amount": 23.93,
1193
+ "currency": "USD",
1194
+ "label": "US$23.93"
1195
+ },
1196
+ "components": [
1197
+ {
1198
+ "key": "duties_item_price",
1199
+ "currency": "CAD",
1200
+ "amount": 32.4,
1201
+ "label": "CA$32.40",
1202
+ "base": {
1203
+ "amount": 23.93,
1204
+ "currency": "USD",
1205
+ "label": "US$23.93"
1206
+ },
1207
+ "name": "Duties on item price"
1208
+ }
1209
+ ],
1210
+ "name": "Duties"
1211
+ },
1212
+ {
1213
+ "key": "shipping",
1214
+ "currency": "CAD",
1215
+ "amount": 9.29,
1216
+ "label": "CA$9.29",
1217
+ "base": {
1218
+ "amount": 6.86,
1219
+ "currency": "USD",
1220
+ "label": "US$6.86"
1221
+ },
1222
+ "components": [
1223
+ {
1224
+ "key": "shipping",
1225
+ "currency": "CAD",
1226
+ "amount": 9.29,
1227
+ "label": "CA$9.29",
1228
+ "base": {
1229
+ "amount": 6.86,
1230
+ "currency": "USD",
1231
+ "label": "US$6.86"
1232
+ },
1233
+ "name": "Shipping"
1234
+ }
1235
+ ],
1236
+ "name": "Shipping"
1237
+ }
1238
+ ],
1239
+ "total": {
1240
+ "currency": "CAD",
1241
+ "amount": 232.31,
1242
+ "label": "CA$232.31",
1243
+ "base": {
1244
+ "amount": 171.55,
1245
+ "currency": "USD",
1246
+ "label": "US$171.55"
1247
+ }
1248
+ },
1249
+ "attributes": {
1250
+ "number": "#{order_id}"
1251
+ },
1252
+ "merchant_of_record": "flow",
1253
+ "experience": {
1254
+ "key": "canada",
1255
+ "discriminator": "experience_reference"
1256
+ },
1257
+ "submitted_at": "2018-08-09T17:16:54.534Z",
1258
+ "lines": [
1259
+ {
1260
+ "item_number": "633652208-3",
1261
+ "quantity": 1,
1262
+ "price": {
1263
+ "currency": "CAD",
1264
+ "amount": 80,
1265
+ "label": "CA$80.00",
1266
+ "base": {
1267
+ "amount": 59.07,
1268
+ "currency": "USD",
1269
+ "label": "US$59.07"
1270
+ }
1271
+ },
1272
+ "total": {
1273
+ "currency": "CAD",
1274
+ "amount": 80,
1275
+ "label": "CA$80.00",
1276
+ "base": {
1277
+ "amount": 59.07,
1278
+ "currency": "USD",
1279
+ "label": "US$59.07"
1280
+ }
1281
+ }
1282
+ },
1283
+ {
1284
+ "item_number": "573446691-3",
1285
+ "quantity": 1,
1286
+ "price": {
1287
+ "currency": "CAD",
1288
+ "amount": 100,
1289
+ "label": "CA$100.00",
1290
+ "base": {
1291
+ "amount": 73.84,
1292
+ "currency": "USD",
1293
+ "label": "US$73.84"
1294
+ }
1295
+ },
1296
+ "total": {
1297
+ "currency": "CAD",
1298
+ "amount": 100,
1299
+ "label": "CA$100.00",
1300
+ "base": {
1301
+ "amount": 73.84,
1302
+ "currency": "USD",
1303
+ "label": "US$73.84"
1304
+ }
1305
+ }
1306
+ }
1307
+ ],
1308
+ "promotions": {
1309
+ "applied": [],
1310
+ "available": []
1311
+ },
1312
+ "payments": [
1313
+ {
1314
+ "id": "opm-009ef64e13b84baa805d07570072895b",
1315
+ "type": "card",
1316
+ "merchant_of_record": "flow",
1317
+ "reference": "aut-kYDowZbpSrUEqggeDWW9D0phXQrpDybj",
1318
+ "description": "VISA ending with 1111",
1319
+ "total": {
1320
+ "currency": "CAD",
1321
+ "amount": 232.31,
1322
+ "label": "CA$232.31",
1323
+ "base": {
1324
+ "amount": 171.55,
1325
+ "currency": "USD",
1326
+ "label": "US$171.55"
1327
+ }
1328
+ },
1329
+ "attributes": {},
1330
+ "address": {
1331
+ "name": {
1332
+ "first": "Jeff",
1333
+ "last": "Yucis"
1334
+ },
1335
+ "streets": [
1336
+ "35 Letitia Ln"
1337
+ ],
1338
+ "city": "Media",
1339
+ "province": "Alberta",
1340
+ "postal": "19063",
1341
+ "country": "CAN"
1342
+ },
1343
+ "date": "2018-08-09T17:16:54.061Z"
1344
+ }
1345
+ ],
1346
+ "balance": {
1347
+ "currency": "CAD",
1348
+ "amount": 0,
1349
+ "label": "CA$0.00",
1350
+ "base": {
1351
+ "amount": 0,
1352
+ "currency": "USD",
1353
+ "label": "US$0.00"
1354
+ }
1355
+ }
1356
+ },
1357
+ "discriminator": "order_upserted_v2"
1358
+ }
1359
+ end
1360
+ end
1361
+ end
1362
+ end