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,34 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module FlowIo
5
+ class LineItemFormTest < TestCase
6
+ include FlowFixtures
7
+
8
+ def test_currency_conversion
9
+ product = create_product
10
+ order = create_order
11
+
12
+ create_product_discount(product_ids: [product.id])
13
+ order.add_item(
14
+ sku: product.skus.first,
15
+ product_id: product.id,
16
+ quantity: 1
17
+ )
18
+ order.update!(experience: build_flow_io_experience_geo)
19
+
20
+ Pricing.perform(order)
21
+
22
+ item = LineItemForm.new(
23
+ order_item: order.items.first,
24
+ discounts: []
25
+ )
26
+ discounts = item.to_h[:discounts]
27
+
28
+ assert_equal(11000, item.price.amount)
29
+ assert_equal(order.experience.currency, item.price.currency)
30
+ refute_empty(discounts.discounts)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module FlowIo
5
+ class OrderPutFormTest < Workarea::TestCase
6
+ include FlowFixtures
7
+
8
+ setup :setup_pricing_skus
9
+
10
+ def setup_pricing_skus
11
+ %w(sku1 sku2 sku3).each do |sku|
12
+ create_pricing_sku(id: sku)
13
+ end
14
+ end
15
+
16
+ def test_to_flow_model
17
+ Pricing.perform(order)
18
+
19
+ order_put_form = OrderPutForm.from(order: order)
20
+ line_item_form = order_put_form.items.first
21
+
22
+ assert_equal(order_put_form.customer.name.first, user.first_name)
23
+ assert_equal(order_put_form.customer.name.last, user.last_name)
24
+ assert_equal(11000, line_item_form.price.amount)
25
+ assert_equal('CAD', line_item_form.price.currency)
26
+ end
27
+
28
+ private
29
+
30
+ def user
31
+ @user ||= create_user
32
+ end
33
+
34
+ def order
35
+ @order ||= create_order(
36
+ id: "1234",
37
+ user_id: user.id,
38
+ experience: build_flow_io_experience_geo,
39
+ items: [
40
+ { quantity: 1, sku: "sku1", product_id: "PRODUCT1" },
41
+ { quantity: 2, sku: "sku2", product_id: "PRODUCT1" },
42
+ { quantity: 2, sku: "sku3", product_id: "PRODUCT2" }
43
+ ]
44
+ )
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,916 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module FlowIo
5
+ class PriceApplierTest < Workarea::TestCase
6
+ include Workarea::FlowIo::FlowFixtures
7
+
8
+ def test_perform_with_canada_order
9
+ order = Order.new(
10
+ id: "ORD123",
11
+ experience: canada_experience_geo,
12
+ items: [
13
+ {
14
+ sku: "004056270-0",
15
+ product_id: "cool-shirt",
16
+ price_adjustments: [
17
+ {
18
+ price: "item",
19
+ quantity: 1,
20
+ description: "Item Subtotal",
21
+ calculator: "Workarea::Pricing::Calculators::ItemCalculator",
22
+ data: {
23
+ "on_sale" => false,
24
+ "original_price" => 5.0,
25
+ "tax_code" => nil
26
+ },
27
+ amount: { cents: 500.0, currency_iso: "USD" }
28
+ },
29
+ {
30
+ price: "item",
31
+ quantity: 1,
32
+ description: "Test Discount",
33
+ calculator: "Workarea::Pricing::Discount::Product",
34
+ data: {
35
+ "discount_id" => "5b60ba1f87c68b6b757cde58",
36
+ "discount_value" => 0.25
37
+ },
38
+ amount: { cents: -25.0, currency_iso: "USD" }
39
+ },
40
+ {
41
+ price: "order",
42
+ quantity: 1,
43
+ description: "Discount",
44
+ calculator: "Workarea::Pricing::Discount::OrderTotal",
45
+ data: {
46
+ "discount_id" => "5b60ba1f87c68b6b757cde59",
47
+ "discount_value" => 0.2
48
+ },
49
+ amount: { cents: -20.0, currency_iso: "USD" }
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ )
55
+
56
+ shippings = [Workarea::Shipping.new]
57
+ order_put_form = FlowIo::OrderPutForm.from(order: order, shippings: shippings)
58
+
59
+ flow_order = FlowIo::BogusClient.new.orders.put_by_number(
60
+ "organziation_id",
61
+ order.id,
62
+ order_put_form,
63
+ experience: "canada"
64
+ )
65
+
66
+ FlowIo::PriceApplier.perform(order: order, flow_order: flow_order)
67
+
68
+ item = order.items.first
69
+
70
+ assert_equal(3, item.price_adjustments.size)
71
+ base_price_adjustment = item.price_adjustments.first
72
+ assert_equal(Money.from_amount(88.66, "USD"), base_price_adjustment.amount)
73
+
74
+ discount_price_adjustment = item.price_adjustments.second
75
+ assert_equal(Money.from_amount(-0.25, "USD"), discount_price_adjustment.amount)
76
+
77
+ assert_equal(3, item.flow_price_adjustments.size)
78
+ base_price_adjustment = item.flow_price_adjustments.first
79
+ assert_equal(Money.from_amount(110, "CAD"), base_price_adjustment.amount)
80
+
81
+ discount_price_adjustment = item.flow_price_adjustments.second
82
+ assert_equal(Money.from_amount(-0.36, "CAD"), discount_price_adjustment.amount)
83
+ end
84
+
85
+ def test_perform_with_europe_order
86
+ order = Order.new(
87
+ id: "ORD123",
88
+ experience: europe_experience_geo,
89
+ items: [
90
+ {
91
+ sku: "004056270-0",
92
+ product_id: "cool-shirt",
93
+ price_adjustments: [
94
+ {
95
+ price: "item",
96
+ quantity: 1,
97
+ description: "Item Subtotal",
98
+ calculator: "Workarea::Pricing::Calculators::ItemCalculator",
99
+ data: {
100
+ "on_sale" => false,
101
+ "original_price" => 5.0,
102
+ "tax_code" => nil
103
+ },
104
+ amount: { cents: 500.0, currency_iso: "USD" }
105
+ },
106
+ {
107
+ price: "item",
108
+ quantity: 1,
109
+ description: "Test Discount",
110
+ calculator: "Workarea::Pricing::Discount::Product",
111
+ data: {
112
+ "discount_id" => "5b60ba1f87c68b6b757cde58",
113
+ "discount_value" => 0.25
114
+ },
115
+ amount: { cents: -25.0, currency_iso: "USD" }
116
+ },
117
+ {
118
+ price: "order",
119
+ quantity: 1,
120
+ description: "Discount",
121
+ calculator: "Workarea::Pricing::Discount::OrderTotal",
122
+ data: {
123
+ "discount_id" => "5b60ba1f87c68b6b757cde59",
124
+ "discount_value" => 0.2
125
+ },
126
+ amount: { cents: -20.0, currency_iso: "USD" }
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ )
132
+
133
+ # shippings = [Workarea::Shipping.new]
134
+ order_put_form = FlowIo::OrderPutForm.from(order: order)
135
+
136
+ flow_order = FlowIo::BogusClient.new.orders.put_by_number(
137
+ "organziation_id",
138
+ order.id,
139
+ order_put_form,
140
+ experience: "europe"
141
+ )
142
+
143
+ FlowIo::PriceApplier.perform(order: order, flow_order: flow_order)
144
+
145
+ item = order.items.first
146
+
147
+ assert_equal(3, item.price_adjustments.size)
148
+ base_price_adjustment = item.price_adjustments.first
149
+ assert_equal(Money.from_amount(88.66, "USD"), base_price_adjustment.amount)
150
+
151
+ discount_price_adjustment = item.price_adjustments.second
152
+ assert_equal(Money.from_amount(-0.25, "USD"), discount_price_adjustment.amount)
153
+
154
+ assert_equal(3, item.flow_price_adjustments.size)
155
+ base_price_adjustment = item.flow_price_adjustments.first
156
+ assert_equal(Money.from_amount(110.00, "EUR"), base_price_adjustment.amount)
157
+
158
+ discount_price_adjustment = item.flow_price_adjustments.second
159
+ assert_equal(Money.from_amount(-0.36, "EUR"), discount_price_adjustment.amount)
160
+ end
161
+
162
+ def test_rounding_line_item
163
+ order = Order.new(
164
+ id: "ORD123",
165
+ experience: europe_experience_geo,
166
+ items: [
167
+ {
168
+ sku: "004056270-0",
169
+ product_id: "cool-shirt",
170
+ quantity: 3,
171
+ price_adjustments: [
172
+ {
173
+ price: "item",
174
+ quantity: 3,
175
+ description: "Item Subtotal",
176
+ calculator: "Workarea::Pricing::Calculators::ItemCalculator",
177
+ data: {
178
+ "on_sale" => false,
179
+ "original_price" => 5.0,
180
+ "tax_code" => nil
181
+ },
182
+ amount: { cents: 500.0, currency_iso: "USD" }
183
+ },
184
+ {
185
+ price: "item",
186
+ quantity: 1,
187
+ description: "Test Discount",
188
+ calculator: "Workarea::Pricing::Discount::Product",
189
+ data: {
190
+ "discount_id" => "5b60ba1f87c68b6b757cde58",
191
+ "discount_value" => 0.25
192
+ },
193
+ amount: { cents: -25.0, currency_iso: "USD" }
194
+ }
195
+ ]
196
+ }
197
+ ]
198
+ )
199
+
200
+ flow_order = europe_rounding_order
201
+
202
+ FlowIo::PriceApplier.perform(order: order, flow_order: flow_order)
203
+ end
204
+
205
+ private
206
+
207
+ def europe_rounding_order
208
+ ::Io::Flow::V0::Models::Order.new({
209
+ id: "ord-de8014d720bc43ed8bf95ef66a246fbb",
210
+ number: "41709C67CE",
211
+ merchant_of_record: "flow",
212
+ experience: {
213
+ key: "europe",
214
+ discriminator: "experience_reference"
215
+ },
216
+ customer: {
217
+ name: {
218
+ first: "Ben",
219
+ last: "Crouse"
220
+ },
221
+ number: nil,
222
+ phone: nil,
223
+ email: "user@workarea.com"
224
+ },
225
+ delivered_duty: "paid",
226
+ destination: {
227
+ text: nil,
228
+ streets: nil,
229
+ city: nil,
230
+ province: nil,
231
+ postal: nil,
232
+ country: "GBR",
233
+ latitude: nil,
234
+ longitude: nil,
235
+ contact: {
236
+ name: {
237
+ first: "Ben",
238
+ last: "Crouse"
239
+ },
240
+ company: nil,
241
+ email: "user@workarea.com",
242
+ phone: nil
243
+ }
244
+ },
245
+ expires_at: "Thu, 09 Aug 2018 16:58:57 +0000",
246
+ items: [
247
+ {
248
+ number: "004056270-0",
249
+ name: "Intelligent Steel Knife",
250
+ quantity: 3,
251
+ center: nil,
252
+ price: nil,
253
+ discount: {
254
+ amount: 0.41,
255
+ currency: "EUR",
256
+ label: "0,41 €",
257
+ base: {
258
+ amount: 0.44,
259
+ currency: "USD",
260
+ label: "US$0.44"
261
+ },
262
+ requested: {
263
+ amount: 0.44,
264
+ currency: "USD"
265
+ }
266
+ },
267
+ attributes: nil,
268
+ local: {
269
+ experience: {
270
+ id: "exp-72464b1f651d49fe8108dcabf4678942",
271
+ key: "europe",
272
+ name: "Europe",
273
+ country: nil,
274
+ currency: nil,
275
+ language: nil
276
+ },
277
+ prices: [
278
+ {
279
+ currency: "EUR",
280
+ amount: 0.95,
281
+ label: "0,95 €",
282
+ base: {
283
+ amount: 1.06,
284
+ currency: "USD",
285
+ label: "US$1.06"
286
+ },
287
+ includes: {
288
+ key: "vat",
289
+ label: "Includes VAT"
290
+ },
291
+ key: "localized_item_price"
292
+ }
293
+ ],
294
+ rates: [
295
+ {
296
+ id: "usd-gbp",
297
+ base: "USD",
298
+ target: "GBP",
299
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
300
+ value: 0.843986052e0
301
+ },
302
+ {
303
+ id: "usd-eur",
304
+ base: "USD",
305
+ target: "EUR",
306
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
307
+ value: 0.9403212e0
308
+ },
309
+ {
310
+ id: "gbp-eur",
311
+ base: "GBP",
312
+ target: "EUR",
313
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
314
+ value: 0.11141430569518465e1
315
+ }
316
+ ],
317
+ spot_rates: [],
318
+ status: "included",
319
+ attributes: {
320
+ "msrp" => "10.44",
321
+ "Size" => "Large",
322
+ "regular_price" => "0.44",
323
+ "sale_price" => "3.95",
324
+ "product_id" => "A06AB102F5",
325
+ "Color" => "Fuchsia",
326
+ "fulfillment_method" => "physical"
327
+ },
328
+ price_attributes: {
329
+ "sale_price" => {
330
+ currency: "EUR",
331
+ amount: 3.95,
332
+ label: "3,95 €",
333
+ base: {
334
+ amount: 4.41,
335
+ currency: "USD",
336
+ label: "US$4.41"
337
+ }
338
+ }
339
+ }
340
+ },
341
+ shipment_estimate: nil
342
+ },
343
+ {
344
+ number: "493137410-7",
345
+ name: "Synergistic Silk Plate",
346
+ quantity: 3,
347
+ center: nil,
348
+ price: nil,
349
+ discount: {
350
+ amount: 0.41,
351
+ currency: "EUR",
352
+ label: "0,41 €",
353
+ base: {
354
+ amount: 0.44,
355
+ currency: "USD",
356
+ label: "US$0.44"
357
+ },
358
+ requested: {
359
+ amount: 0.44,
360
+ currency: "USD"
361
+ }
362
+ },
363
+ attributes: nil,
364
+ local: {
365
+ experience: {
366
+ id: "exp-72464b1f651d49fe8108dcabf4678942",
367
+ key: "europe",
368
+ name: "Europe",
369
+ country: nil,
370
+ currency: nil,
371
+ language: nil
372
+ },
373
+ prices: [
374
+ {
375
+ currency: "EUR",
376
+ amount: 0.95,
377
+ label: "0,95 €",
378
+ base: {
379
+ amount: 1.06,
380
+ currency: "USD",
381
+ label: "US$1.06"
382
+ },
383
+ includes: {
384
+ key: "vat",
385
+ label: "Includes VAT"
386
+ },
387
+ key: "localized_item_price"
388
+ }
389
+ ],
390
+ rates: [
391
+ {
392
+ id: "usd-gbp",
393
+ base: "USD",
394
+ target: "GBP",
395
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
396
+ value: 0.843986052e0
397
+ },
398
+ {
399
+ id: "usd-eur",
400
+ base: "USD",
401
+ target: "EUR",
402
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
403
+ value: 0.9403212e0
404
+ },
405
+ {
406
+ id: "gbp-eur",
407
+ base: "GBP",
408
+ target: "EUR",
409
+ effective_at: "Thu, 09 Aug 2018 15:58:57 +0000",
410
+ value: 0.11141430569518465e1
411
+ }
412
+ ],
413
+ spot_rates: [],
414
+ status: "included",
415
+ attributes: {
416
+ "msrp" => "100.5",
417
+ "Size" => "Extra Large",
418
+ "regular_price" => "0.44",
419
+ "sale_price" => "0.95",
420
+ "product_id" => "8C1FAF561F",
421
+ "Color" => "Green",
422
+ "fulfillment_method" => "physical"
423
+ },
424
+ price_attributes: {
425
+ "sale_price" => {
426
+ currency: "EUR",
427
+ amount: 0.95,
428
+ label: "0,95 €",
429
+ base: {
430
+ amount: 1.06,
431
+ currency: "USD",
432
+ label: "US$1.06"
433
+ }
434
+ }
435
+ }
436
+ },
437
+ shipment_estimate: nil
438
+ }
439
+ ],
440
+ deliveries: [
441
+ {
442
+ id: "del-924e558bc5134047a4d3b80eeca46952",
443
+ center: {
444
+ id: "cen-394b1db3c61a495c964dd1fe60969160",
445
+ key: "center-workarea"
446
+ },
447
+ items: [
448
+ {
449
+ number: "004056270-0",
450
+ quantity: 3,
451
+ shipment_estimate: nil,
452
+ price: {
453
+ amount: 0.95,
454
+ currency: "EUR"
455
+ },
456
+ attributes: {
457
+ "base_amount" => "1.06",
458
+ "base_currency" => "USD"
459
+ },
460
+ center: nil,
461
+ discount: {
462
+ amount: 0.44,
463
+ currency: "USD"
464
+ }
465
+ }
466
+ ],
467
+ options: [
468
+ {
469
+ id: "opt-e1910958ea1d437ea9a9b57a231eeb12",
470
+ cost: {
471
+ currency: "EUR",
472
+ amount: 5.26,
473
+ label: "5,26 €",
474
+ base: {
475
+ amount: 5.87,
476
+ currency: "USD",
477
+ label: "US$5.87"
478
+ }
479
+ },
480
+ cost_details: [
481
+ {
482
+ source: "ratecard",
483
+ currency: "EUR",
484
+ amount: 0.526e1,
485
+ label: "5,26 €",
486
+ base: {
487
+ amount: 5.87,
488
+ currency: "USD",
489
+ label: "US$5.87"
490
+ },
491
+ components: [
492
+ {
493
+ key: "ratecard_base_cost",
494
+ currency: "EUR",
495
+ amount: 0.526e1,
496
+ label: "5,26 €",
497
+ base: {
498
+ amount: 5.87,
499
+ currency: "USD",
500
+ label: "US$5.87"
501
+ }
502
+ }
503
+ ]
504
+ }
505
+ ],
506
+ delivered_duty: "unpaid",
507
+ price: {
508
+ currency: "EUR",
509
+ amount: 10,
510
+ label: "10,00 €",
511
+ base: {
512
+ amount: 10.63,
513
+ currency: "USD",
514
+ label: "US$10.63"
515
+ }
516
+ },
517
+ service: {
518
+ id: "landmark-global",
519
+ carrier: {
520
+ id: "landmark"
521
+ },
522
+ name: "Global",
523
+ center_code: nil
524
+ },
525
+ tier: {
526
+ id: "tie-6b992ea6b5c448b1bd033332fdd9dd45",
527
+ experience: {
528
+ id: "europe",
529
+ currency: "EUR"
530
+ },
531
+ integration: "information",
532
+ name: "Standard Shipping",
533
+ services: ["landmark-global"],
534
+ strategy: "lowest_cost",
535
+ visibility: "public",
536
+ currency: "EUR",
537
+ display: {
538
+ estimate: {
539
+ type: "calculated",
540
+ label: "2-4 Business Days"
541
+ }
542
+ }
543
+ },
544
+ window: {
545
+ from: "Mon, 13 Aug 2018 00:00:00 +0000",
546
+ to: "Wed, 15 Aug 2018 00:00:00 +0000",
547
+ timezone: "Etc/GMT",
548
+ label: "2-4 Business Days"
549
+ },
550
+ rule_outcome: {
551
+ price: {
552
+ amount: 10,
553
+ currency: "EUR",
554
+ label: "10,00 €"
555
+ },
556
+ discriminator: "flat_rate"
557
+ },
558
+ weight: {
559
+ gravitational: {
560
+ value: "6.75",
561
+ units: "pound"
562
+ },
563
+ dimensional: {
564
+ value: "3.81",
565
+ units: "inch"
566
+ }
567
+ },
568
+ send_to: nil
569
+ },
570
+ {
571
+ id: "opt-0ab2474735714fcda94f18e420a0a1b7",
572
+ cost: {
573
+ currency: "EUR",
574
+ amount: 5.26,
575
+ label: "5,26 €",
576
+ base: {
577
+ amount: 5.87,
578
+ currency: "USD",
579
+ label: "US$5.87"
580
+ }
581
+ },
582
+ cost_details: [
583
+ {
584
+ source: "ratecard",
585
+ currency: "EUR",
586
+ amount: 0.526e1,
587
+ label: "5,26 €",
588
+ base: {
589
+ amount: 5.87,
590
+ currency: "USD",
591
+ label: "US$5.87"
592
+ },
593
+ components: [
594
+ {
595
+ key: "ratecard_base_cost",
596
+ currency: "EUR",
597
+ amount: 0.526e1,
598
+ label: "5,26 €",
599
+ base: {
600
+ amount: 5.87,
601
+ currency: "USD",
602
+ label: "US$5.87"
603
+ }
604
+ }
605
+ ]
606
+ }
607
+ ],
608
+ delivered_duty: "paid",
609
+ price: {
610
+ currency: "EUR",
611
+ amount: 10,
612
+ label: "10,00 €",
613
+ base: {
614
+ amount: 10.63,
615
+ currency: "USD",
616
+ label: "US$10.63"
617
+ }
618
+ },
619
+ service: {
620
+ id: "landmark-global",
621
+ carrier: {
622
+ id: "landmark"
623
+ },
624
+ name: "Global",
625
+ center_code: nil
626
+ },
627
+ tier: {
628
+ id: "tie-6b992ea6b5c448b1bd033332fdd9dd45",
629
+ experience: {
630
+ id: "europe",
631
+ currency: "EUR"
632
+ },
633
+ integration: "information",
634
+ name: "Standard Shipping",
635
+ services: ["landmark-global"],
636
+ strategy: "lowest_cost",
637
+ visibility: "public",
638
+ currency: "EUR",
639
+ display: {
640
+ estimate: {
641
+ type: "calculated",
642
+ label: "2-4 Business Days"
643
+ }
644
+ }
645
+ },
646
+ window: {
647
+ from: "Mon, 13 Aug 2018 00:00:00 +0000",
648
+ to: "Wed, 15 Aug 2018 00:00:00 +0000",
649
+ timezone: "Etc/GMT",
650
+ label: "2-4 Business Days"
651
+ },
652
+ rule_outcome: {
653
+ price: {
654
+ amount: 10,
655
+ currency: "EUR",
656
+ label: "10,00 €"
657
+ },
658
+ discriminator: "flat_rate"
659
+ },
660
+ weight: {
661
+ gravitational: {
662
+ value: "6.75",
663
+ units: "pound"
664
+ },
665
+ dimensional: {
666
+ value: "3.81",
667
+ units: "inch"
668
+ }
669
+ },
670
+ send_to: nil
671
+ }
672
+ ],
673
+ discriminator: "physical_delivery"
674
+ }
675
+ ],
676
+ selections: ["opt-0ab2474735714fcda94f18e420a0a1b7"],
677
+ prices: [
678
+ {
679
+ key: "subtotal",
680
+ currency: "EUR",
681
+ amount: 0.1378e2,
682
+ label: "13,78 €",
683
+ base: {
684
+ amount: 17.78,
685
+ currency: "USD",
686
+ label: "US$17.78"
687
+ },
688
+ components: [
689
+ {
690
+ key: "adjustment",
691
+ currency: "EUR",
692
+ amount: 0.1764e2,
693
+ label: "17,64 €",
694
+ base: {
695
+ amount: 19.72,
696
+ currency: "USD",
697
+ label: "US$19.72"
698
+ },
699
+ name: "Adjustment"
700
+ },
701
+ {
702
+ key: "vat_deminimis",
703
+ currency: "EUR",
704
+ amount: -0.1043e2,
705
+ label: "-10,43 €",
706
+ base: {
707
+ amount: -11.65,
708
+ currency: "USD",
709
+ label: "-US$11.65"
710
+ },
711
+ name: "VAT de minimis adjustment"
712
+ },
713
+ {
714
+ key: "vat_item_price",
715
+ currency: "EUR",
716
+ amount: 0.931e1,
717
+ label: "9,31 €",
718
+ base: {
719
+ amount: 10.4,
720
+ currency: "USD",
721
+ label: "US$10.40"
722
+ },
723
+ name: "VAT on item price"
724
+ },
725
+ {
726
+ key: "vat_duties_item_price",
727
+ currency: "EUR",
728
+ amount: 0.112e1,
729
+ label: "1,12 €",
730
+ base: {
731
+ amount: 1.25,
732
+ currency: "USD",
733
+ label: "US$1.25"
734
+ },
735
+ name: "VAT on duties on item price"
736
+ },
737
+ {
738
+ key: "item_price",
739
+ currency: "EUR",
740
+ amount: 0.4649e2,
741
+ label: "46,49 €",
742
+ base: {
743
+ amount: 51.92,
744
+ currency: "USD",
745
+ label: "US$51.92"
746
+ },
747
+ name: "Item price"
748
+ },
749
+ {
750
+ key: "item_discount",
751
+ currency: "EUR",
752
+ amount: -0.4485e2,
753
+ label: "-44,85 €",
754
+ base: {
755
+ amount: -47.7,
756
+ currency: "USD",
757
+ label: "-US$47.70"
758
+ },
759
+ name: "Item discount"
760
+ },
761
+ {
762
+ key: "rounding",
763
+ currency: "EUR",
764
+ amount: 0.333e1,
765
+ label: "3,33 €",
766
+ base: {
767
+ amount: 3.7,
768
+ currency: "USD",
769
+ label: "US$3.70"
770
+ },
771
+ name: "Rounding"
772
+ },
773
+ {
774
+ key: "vat_subsidy",
775
+ currency: "EUR",
776
+ amount: -0.883e1,
777
+ label: "-8,83 €",
778
+ base: {
779
+ amount: -9.86,
780
+ currency: "USD",
781
+ label: "-US$9.86"
782
+ },
783
+ name: "VAT subsidy"
784
+ }
785
+ ],
786
+ name: "Item subtotal",
787
+ rate: nil
788
+ },
789
+ {
790
+ key: "shipping",
791
+ currency: "EUR",
792
+ amount: 0.1e2,
793
+ label: "10,00 €",
794
+ base: {
795
+ amount: 10.63,
796
+ currency: "USD",
797
+ label: "US$10.63"
798
+ },
799
+ components: [
800
+ {
801
+ key: "vat_deminimis",
802
+ currency: "EUR",
803
+ amount: -0.118e1,
804
+ label: "-1,18 €",
805
+ base: {
806
+ amount: -1.31,
807
+ currency: "USD",
808
+ label: "-US$1.31"
809
+ },
810
+ name: "VAT de minimis adjustment"
811
+ },
812
+ {
813
+ key: "vat_freight",
814
+ currency: "EUR",
815
+ amount: 0.105e1,
816
+ label: "1,05 €",
817
+ base: {
818
+ amount: 1.17,
819
+ currency: "USD",
820
+ label: "US$1.17"
821
+ },
822
+ name: "VAT on freight"
823
+ },
824
+ {
825
+ key: "vat_duties_freight",
826
+ currency: "EUR",
827
+ amount: 0.13e0,
828
+ label: "0,13 €",
829
+ base: {
830
+ amount: 0.14,
831
+ currency: "USD",
832
+ label: "US$0.14"
833
+ },
834
+ name: "VAT on duties on freight"
835
+ },
836
+ {
837
+ key: "shipping",
838
+ currency: "EUR",
839
+ amount: 0.1e2,
840
+ label: "10,00 €",
841
+ base: {
842
+ amount: 10.63,
843
+ currency: "USD",
844
+ label: "US$10.63"
845
+ },
846
+ name: "Shipping"
847
+ }
848
+ ],
849
+ name: "Shipping",
850
+ rate: nil
851
+ }
852
+ ],
853
+ total: {
854
+ currency: "EUR",
855
+ amount: 23.78,
856
+ label: "23,78 €",
857
+ base: {
858
+ amount: 28.41,
859
+ currency: "USD",
860
+ label: "US$28.41"
861
+ },
862
+ key: "localized_total"
863
+ },
864
+ attributes: {
865
+ "number" => "41709C67CE"
866
+ },
867
+ submitted_at: nil,
868
+ lines: [
869
+ {
870
+ item_number: "004056270-0",
871
+ quantity: 3,
872
+ price: {
873
+ currency: "EUR",
874
+ amount: 0.81,
875
+ label: "0,81 €",
876
+ base: {
877
+ amount: 0.9133333333333333,
878
+ currency: "USD",
879
+ label: "US$0.91"
880
+ }
881
+ },
882
+ total: {
883
+ currency: "EUR",
884
+ amount: 2.43,
885
+ label: "2,43 €",
886
+ base: {
887
+ amount: 2.7399999999999998,
888
+ currency: "USD",
889
+ label: "US$2.74"
890
+ }
891
+ },
892
+ attributes: nil
893
+ }
894
+ ],
895
+ identifiers: nil,
896
+ promotions: nil,
897
+ payments: [],
898
+ balance: {
899
+ currency: "EUR",
900
+ amount: 23.78,
901
+ label: "23,78 €",
902
+ base: {
903
+ amount: 28.41,
904
+ currency: "USD",
905
+ label: "US$28.41"
906
+ },
907
+ key: "localized_total"
908
+ },
909
+ rules: nil,
910
+ tax_registration: nil,
911
+ discriminator: "order"
912
+ })
913
+ end
914
+ end
915
+ end
916
+ end