workarea-global_e 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintrc.json +37 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +77 -0
- data/.gitignore +20 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +261 -0
- data/Gemfile +16 -0
- data/README.md +39 -0
- data/Rakefile +59 -0
- data/app/assets/javascripts/workarea/storefront/global_e/modules/checkout_info_validator.js +122 -0
- data/app/assets/javascripts/workarea/storefront/global_e/modules/suppress_price_ranges.js +19 -0
- data/app/controllers/workarea/admin/country_exceptions_controller.rb +67 -0
- data/app/controllers/workarea/admin/fixed_prices_controller.rb +89 -0
- data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
- data/app/controllers/workarea/storefront/application_controller.decorator +30 -0
- data/app/controllers/workarea/storefront/checkouts_controller.decorator +22 -0
- data/app/controllers/workarea/storefront/ge_checkouts_controller.rb +10 -0
- data/app/controllers/workarea/storefront/global_e_controller.rb +42 -0
- data/app/controllers/workarea/storefront/globale/api_controller.rb +108 -0
- data/app/controllers/workarea/storefront/globale/refund_controller.rb +65 -0
- data/app/controllers/workarea/storefront/users/logins_controller.decorator +13 -0
- data/app/helpers/workarea/admin/global_e_helpers.rb +28 -0
- data/app/models/workarea/address.decorator +11 -0
- data/app/models/workarea/catalog/product.decorator +14 -0
- data/app/models/workarea/fulfillment/status/partially_refunded.rb +13 -0
- data/app/models/workarea/fulfillment/status/refunded.rb +15 -0
- data/app/models/workarea/fulfillment.decorator +55 -0
- data/app/models/workarea/global_e/country_exception.rb +37 -0
- data/app/models/workarea/global_e/fixed_price.rb +93 -0
- data/app/models/workarea/global_e/order_api_events.rb +29 -0
- data/app/models/workarea/order/item.decorator +46 -0
- data/app/models/workarea/order/status/pending_global_e_fraud_check.rb +12 -0
- data/app/models/workarea/order.decorator +64 -0
- data/app/models/workarea/payment/status/global_e_appoved.rb +9 -0
- data/app/models/workarea/payment/status/pending_global_e_fraud_check.rb +9 -0
- data/app/models/workarea/payment/tender/global_e_payment.rb +16 -0
- data/app/models/workarea/payment.decorator +10 -0
- data/app/models/workarea/price_adjustment.decorator +13 -0
- data/app/models/workarea/price_adjustment_set.decorator +25 -0
- data/app/models/workarea/pricing/calculators/item_calculator.decorator +48 -0
- data/app/models/workarea/pricing/collection.decorator +90 -0
- data/app/models/workarea/pricing/discount/appliation_group.decorator +16 -0
- data/app/models/workarea/pricing/discount/international_item_proxy.rb +27 -0
- data/app/models/workarea/pricing/discount/international_order.rb +29 -0
- data/app/models/workarea/pricing/discount.decorator +65 -0
- data/app/models/workarea/pricing/price_distributor.decorator +37 -0
- data/app/models/workarea/pricing/request.decorator +17 -0
- data/app/models/workarea/pricing/sku.decorator +17 -0
- data/app/models/workarea/search/admin/order.decorator +11 -0
- data/app/models/workarea/shipping/sku.decorator +23 -0
- data/app/models/workarea/shipping.decorator +11 -0
- data/app/models/workarea/user.decorator +10 -0
- data/app/seeds/workarea/global_e_seeds.rb +66 -0
- data/app/services/workarea/create_fulfillment.decorator +12 -0
- data/app/services/workarea/global_e/address_details.rb +218 -0
- data/app/services/workarea/global_e/api/notify_order_refunded.rb +45 -0
- data/app/services/workarea/global_e/api/perform_order_payment.rb +46 -0
- data/app/services/workarea/global_e/api/remove_restricted_products.rb +28 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb +147 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant/save_user.rb +59 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant.rb +359 -0
- data/app/services/workarea/global_e/api/update_order_shipping_info.rb +38 -0
- data/app/services/workarea/global_e/api/update_order_status/canceled.rb +42 -0
- data/app/services/workarea/global_e/api/update_order_status.rb +28 -0
- data/app/services/workarea/global_e/attribute.rb +44 -0
- data/app/services/workarea/global_e/brand.rb +19 -0
- data/app/services/workarea/global_e/cart_user_details.rb +34 -0
- data/app/services/workarea/global_e/category.rb +19 -0
- data/app/services/workarea/global_e/checkout_cart_info.rb +358 -0
- data/app/services/workarea/global_e/custom_product_attribute.rb +19 -0
- data/app/services/workarea/global_e/discount.rb +215 -0
- data/app/services/workarea/global_e/merchant/brand.rb +21 -0
- data/app/services/workarea/global_e/merchant/category.rb +21 -0
- data/app/services/workarea/global_e/merchant/customer.rb +36 -0
- data/app/services/workarea/global_e/merchant/customer_details.rb +201 -0
- data/app/services/workarea/global_e/merchant/discount.rb +127 -0
- data/app/services/workarea/global_e/merchant/international_details.rb +296 -0
- data/app/services/workarea/global_e/merchant/order.rb +425 -0
- data/app/services/workarea/global_e/merchant/order_refund.rb +103 -0
- data/app/services/workarea/global_e/merchant/original_order.rb +28 -0
- data/app/services/workarea/global_e/merchant/parcel_tracking.rb +31 -0
- data/app/services/workarea/global_e/merchant/payment_details.rb +161 -0
- data/app/services/workarea/global_e/merchant/product.rb +222 -0
- data/app/services/workarea/global_e/merchant/refund_product.rb +69 -0
- data/app/services/workarea/global_e/merchant/response_info.rb +115 -0
- data/app/services/workarea/global_e/merchant_cart_product_attribute.rb +21 -0
- data/app/services/workarea/global_e/order_status.rb +20 -0
- data/app/services/workarea/global_e/order_status_details.rb +79 -0
- data/app/services/workarea/global_e/order_status_reason.rb +20 -0
- data/app/services/workarea/global_e/parcel.rb +53 -0
- data/app/services/workarea/global_e/product.rb +612 -0
- data/app/services/workarea/global_e/product_meta_data.rb +13 -0
- data/app/services/workarea/global_e/tracking_details.rb +23 -0
- data/app/services/workarea/global_e/update_order_dispatch_exception.rb +46 -0
- data/app/services/workarea/global_e/update_order_dispatch_request.rb +108 -0
- data/app/services/workarea/global_e/user_id_number_type.rb +21 -0
- data/app/services/workarea/global_e/users_details.rb +151 -0
- data/app/services/workarea/global_e/vat_category.rb +20 -0
- data/app/services/workarea/global_e/vat_rate_type.rb +27 -0
- data/app/services/workarea/save_order_analytics.decorator +18 -0
- data/app/view_models/workarea/admin/order_view_model.decorator +13 -0
- data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
- data/app/view_models/workarea/storefront/order_item_view_model.decorator +16 -0
- data/app/view_models/workarea/storefront/order_view_model.decorator +45 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +35 -0
- data/app/views/workarea/admin/catalog_products/_country_exceptions_card.html.haml +31 -0
- data/app/views/workarea/admin/catalog_products/_global_e_attributes.html.haml +3 -0
- data/app/views/workarea/admin/catalog_products/_global_e_fields.html.haml +4 -0
- data/app/views/workarea/admin/country_exceptions/edit.html.haml +48 -0
- data/app/views/workarea/admin/country_exceptions/index.html.haml +47 -0
- data/app/views/workarea/admin/country_exceptions/new.html.haml +44 -0
- data/app/views/workarea/admin/fixed_prices/edit.html.haml +73 -0
- data/app/views/workarea/admin/fixed_prices/index.html.haml +55 -0
- data/app/views/workarea/admin/fixed_prices/new.html.haml +70 -0
- data/app/views/workarea/admin/orders/_global_e.html.haml +27 -0
- data/app/views/workarea/admin/orders/attributes.html.haml +131 -0
- data/app/views/workarea/admin/orders/global_e.html.haml +110 -0
- data/app/views/workarea/admin/orders/show.html.haml +27 -0
- data/app/views/workarea/admin/orders/tenders/_global_e_payment.html.haml +3 -0
- data/app/views/workarea/admin/pricing_skus/_cards.html.haml +98 -0
- data/app/views/workarea/storefront/cart_items/create.html.haml +71 -0
- data/app/views/workarea/storefront/carts/_pricing.html.haml +14 -0
- data/app/views/workarea/storefront/carts/show.html.haml +187 -0
- data/app/views/workarea/storefront/ge_checkouts/show.html.haml +1 -0
- data/app/views/workarea/storefront/global_e/_country_picker.html.haml +1 -0
- data/app/views/workarea/storefront/global_e/_head.html.haml +10 -0
- data/app/views/workarea/storefront/orders/_summary.html.haml +275 -0
- data/app/views/workarea/storefront/orders/tenders/_global_e_payment.html.haml +3 -0
- data/app/views/workarea/storefront/products/_pricing.html.haml +49 -0
- data/app/views/workarea/storefront/products/_restricted_item_text.html.haml +1 -0
- data/app/views/workarea/storefront/users/orders/_summary.html.haml +22 -0
- data/app/workers/workarea/global_e/update_order_dispatch.rb +28 -0
- data/app/workers/workarea/save_user_order_details.decorator +9 -0
- data/bin/rails +25 -0
- data/config/initializers/appends.rb +46 -0
- data/config/initializers/seeds.rb +1 -0
- data/config/initializers/workarea.rb +64 -0
- data/config/locales/en.yml +105 -0
- data/config/routes.rb +31 -0
- data/lib/workarea/global_e/engine.rb +10 -0
- data/lib/workarea/global_e/error.rb +8 -0
- data/lib/workarea/global_e/version.rb +5 -0
- data/lib/workarea/global_e.rb +58 -0
- data/script/admin_ci +5 -0
- data/script/ci +8 -0
- data/script/core_ci +5 -0
- data/script/plugins_ci +5 -0
- data/script/storefront_ci +5 -0
- data/test/dummy/.ruby-version +1 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +14 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +28 -0
- data/test/dummy/bin/update +28 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +52 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +45 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +34 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +18 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/workarea/global_e_factories.rb +836 -0
- data/test/integration/workarea/admin/catalog_product_country_exceptions_integration_test.rb +81 -0
- data/test/integration/workarea/admin/global_e_jump_to_integration_test.rb +20 -0
- data/test/integration/workarea/admin/pricing_sku_fixed_prices_integration_test.rb +83 -0
- data/test/integration/workarea/storefront/global_e_api/receive_order_integration_test.rb +278 -0
- data/test/integration/workarea/storefront/global_e_api/receive_order_refund_integration_test.rb +25 -0
- data/test/integration/workarea/storefront/global_e_api/receive_payment_integration_test.rb +34 -0
- data/test/integration/workarea/storefront/global_e_api/receive_shipping_info_integration_test.rb +29 -0
- data/test/integration/workarea/storefront/global_e_api/remove_restricted_products_integration_test.rb +27 -0
- data/test/integration/workarea/storefront/global_e_api/update_order_status_integration_test.rb +29 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info/fixed_pricing_test.rb +438 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info/gift_card_test.rb +63 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info_integration_test.rb +660 -0
- data/test/integration/workarea/storefront/global_e_checkouts_integration_test.rb +71 -0
- data/test/integration/workarea/storefront/users/global_e_logins_integration_test.rb +20 -0
- data/test/models/workarea/catalog/product_global_e_test.rb +13 -0
- data/test/models/workarea/fixed_pricing_test.rb +117 -0
- data/test/models/workarea/global_e/country_exception_test.rb +36 -0
- data/test/models/workarea/payment_test.decorator +31 -0
- data/test/models/workarea/pricing/calculators/item_calculator_fixed_prices_test.rb +83 -0
- data/test/models/workarea/pricing/collection_fixed_prices_test.rb +83 -0
- data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
- data/test/models/workarea/pricing/sku_fixed_price_test.rb +133 -0
- data/test/support/workarea/global_e_support.rb +18 -0
- data/test/system/workarea/admin/global_e_system_test.rb +21 -0
- data/test/system/workarea/storefront/global_e_cart_system_test.rb +48 -0
- data/test/system/workarea/storefront/global_e_order_history_system_test.rb +43 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +9 -0
- data/test/view_models/workarea/admin/global_e_order_view_model_test.rb +22 -0
- data/test/workers/workarea/global_e/update_order_dispatch_test.rb +64 -0
- data/test/workers/workarea/global_e_save_user_order_details_test.rb +41 -0
- data/workarea-global_e.gemspec +16 -0
- metadata +293 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class GlobalESystemTest < Workarea::SystemTest
|
6
|
+
# this tests assertions exist in "workarea/storefront/global_e/modules/checkout_info_validator"
|
7
|
+
def test_cart_show
|
8
|
+
assert_nothing_raised do
|
9
|
+
product_1 = create_complete_product
|
10
|
+
product_2 = create_complete_product(
|
11
|
+
variants: [{ sku: 'SKU2', details: { material: 'cotton' }, regular: 5.00, sale: 4.00, on_sale: true }]
|
12
|
+
)
|
13
|
+
|
14
|
+
product_3 = create_complete_product(
|
15
|
+
variants: [{ sku: 'SKU3', details: { material: 'cotton' }, regular: 5.00 }]
|
16
|
+
)
|
17
|
+
|
18
|
+
product_discount = create_product_discount(
|
19
|
+
product_ids: [product_1.id.to_s, product_2.id.to_s]
|
20
|
+
)
|
21
|
+
|
22
|
+
product_discount_2 = create_product_discount(
|
23
|
+
product_ids: [product_1.id.to_s],
|
24
|
+
compatible_discount_ids: [product_discount.id.to_s]
|
25
|
+
)
|
26
|
+
|
27
|
+
_order_discount = create_order_total_discount(
|
28
|
+
compatible_discount_ids: [product_discount.id.to_s, product_discount_2.id.to_s]
|
29
|
+
)
|
30
|
+
|
31
|
+
visit storefront.product_path(product_1)
|
32
|
+
fill_in :quantity, with: 2
|
33
|
+
click_button t('workarea.storefront.products.add_to_cart')
|
34
|
+
|
35
|
+
visit storefront.product_path(product_2)
|
36
|
+
fill_in :quantity, with: 2
|
37
|
+
click_button t('workarea.storefront.products.add_to_cart')
|
38
|
+
|
39
|
+
visit storefront.product_path(product_3)
|
40
|
+
fill_in :quantity, with: 2
|
41
|
+
click_button t('workarea.storefront.products.add_to_cart')
|
42
|
+
|
43
|
+
visit storefront.cart_path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class GlobalEOrderHistorySystemTest < Workarea::SystemTest
|
6
|
+
def test_viewing_orders_pending_fraud_check
|
7
|
+
user = create_user(email: 'user@workarea.com', password: 'W3bl1nc!')
|
8
|
+
order = create_global_e_completed_checkout(order: create_order(email: user.email, user_id: user.id))
|
9
|
+
|
10
|
+
visit storefront.login_path
|
11
|
+
|
12
|
+
within '#login_form' do
|
13
|
+
fill_in 'email', with: user.email
|
14
|
+
fill_in 'password', with: 'W3bl1nc!'
|
15
|
+
click_button t('workarea.storefront.users.login')
|
16
|
+
end
|
17
|
+
|
18
|
+
assert page.has_content? order.id
|
19
|
+
|
20
|
+
visit storefront.users_order_path order.id
|
21
|
+
|
22
|
+
assert page.has_text? "€5.00"
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_viewing_orders_with_discounts
|
26
|
+
user = create_user(email: 'user@workarea.com', password: 'W3bl1nc!')
|
27
|
+
order = create_global_e_completed_checkout(order: create_order(email: user.email, user_id: user.id))
|
28
|
+
|
29
|
+
visit storefront.login_path
|
30
|
+
|
31
|
+
within '#login_form' do
|
32
|
+
fill_in 'email', with: user.email
|
33
|
+
fill_in 'password', with: 'W3bl1nc!'
|
34
|
+
click_button t('workarea.storefront.users.login')
|
35
|
+
end
|
36
|
+
|
37
|
+
assert page.has_content? order.id
|
38
|
+
|
39
|
+
visit storefront.users_order_path order.id
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start "rails"
|
3
|
+
ENV['RAILS_ENV'] = 'test'
|
4
|
+
|
5
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
6
|
+
require 'rails/test_help'
|
7
|
+
require 'workarea/test_help'
|
8
|
+
|
9
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Admin
|
5
|
+
class GlobalEOrderViewModelTest < Workarea::TestCase
|
6
|
+
def test_discount_total
|
7
|
+
product = create_product
|
8
|
+
order = create_order
|
9
|
+
|
10
|
+
order.add_item(sku: product.skus.first, quantity: 1)
|
11
|
+
order.discount_adjustments.create!(
|
12
|
+
price: 'item',
|
13
|
+
amount: -5.to_m
|
14
|
+
)
|
15
|
+
|
16
|
+
view_model = OrderViewModel.wrap(order)
|
17
|
+
|
18
|
+
assert_equal(5.to_m, view_model.discount_total)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module GlobalE
|
5
|
+
class UpdateOrderDispatchTest < Workarea::TestCase
|
6
|
+
def test_exporting_packages
|
7
|
+
Workarea.with_config do |config|
|
8
|
+
config.global_e.merchant_guid = "abcdabcd-abcd-abcd-abcd-abcdabcdabcd"
|
9
|
+
|
10
|
+
items = 3.times.map do |i|
|
11
|
+
begin
|
12
|
+
product = create_product(
|
13
|
+
variants: [{ sku: "SKU#{i}", regular: 5.00 }]
|
14
|
+
)
|
15
|
+
{
|
16
|
+
product: product,
|
17
|
+
sku: product.skus.first,
|
18
|
+
quantity: 1
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
order = create_global_e_placed_order(items: items)
|
23
|
+
|
24
|
+
fulfillment = Fulfillment.find order.id
|
25
|
+
|
26
|
+
package_items = fulfillment.items.map do |fulfillment_item|
|
27
|
+
{ 'id' => fulfillment_item.order_item_id, "quantity" => fulfillment_item.quantity }
|
28
|
+
end
|
29
|
+
|
30
|
+
url = "https://connect-qa.bglobale.com/Order/UpdateOrderDispatchV2?merchantGUID=#{GlobalE.merchant_guid}"
|
31
|
+
stub_request(:any, url).to_return(body: "{}")
|
32
|
+
|
33
|
+
fulfillment.ship_items("1Z", package_items)
|
34
|
+
|
35
|
+
expected_body = {
|
36
|
+
"OrderId" => order.global_e_id,
|
37
|
+
"MerchantOrderId" => nil,
|
38
|
+
"DeliveryReferenceNumber" => nil,
|
39
|
+
"IsCompleted" => true,
|
40
|
+
"Parcels" => [
|
41
|
+
{
|
42
|
+
"ParcelCode" => "1z",
|
43
|
+
"Products" => order.items.map do |order_item|
|
44
|
+
{
|
45
|
+
CartItemId: order_item.id.to_s,
|
46
|
+
DeliveryQuantity: order_item.quantity,
|
47
|
+
ProductCode: order_item.sku
|
48
|
+
}
|
49
|
+
end,
|
50
|
+
"TrackingDetails" => { "TrackingNumber" => "1z" }
|
51
|
+
}
|
52
|
+
],
|
53
|
+
"Exceptions" => nil,
|
54
|
+
"TrackingDetails" => { "TrackingNumber" => "1Z" }
|
55
|
+
}.to_json
|
56
|
+
|
57
|
+
assert_requested :post, url,
|
58
|
+
body: expected_body,
|
59
|
+
times: 1
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class SaveUserOrderDetailsTest < Workarea::TestCase
|
5
|
+
setup :setup_sidekiq
|
6
|
+
teardown :teardown_sidekiq
|
7
|
+
|
8
|
+
def test_not_enqueued_for_global_e_orders
|
9
|
+
user = create_user(email: 'foo@baz.com')
|
10
|
+
_order = create_placed_order(
|
11
|
+
global_e: true,
|
12
|
+
email: 'foo@bar.com',
|
13
|
+
user_id: user.id
|
14
|
+
)
|
15
|
+
|
16
|
+
assert_equal 0, Workarea::SaveUserOrderDetails.jobs.size
|
17
|
+
|
18
|
+
_order = create_placed_order(
|
19
|
+
id: "12345",
|
20
|
+
email: 'foo@bar.com',
|
21
|
+
user_id: user.id
|
22
|
+
)
|
23
|
+
|
24
|
+
assert_equal 1, Workarea::SaveUserOrderDetails.jobs.size
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def setup_sidekiq
|
30
|
+
Sidekiq::Testing.fake!
|
31
|
+
Sidekiq::Callbacks.async(Workarea::SaveUserOrderDetails)
|
32
|
+
Sidekiq::Callbacks.enable(Workarea::SaveUserOrderDetails)
|
33
|
+
|
34
|
+
Workarea::SaveUserOrderDetails.drain
|
35
|
+
end
|
36
|
+
|
37
|
+
def teardown_sidekiq
|
38
|
+
Sidekiq::Testing.inline!
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
2
|
+
|
3
|
+
require "workarea/global_e/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "workarea-global_e"
|
7
|
+
spec.version = Workarea::GlobalE::VERSION
|
8
|
+
spec.authors = ["Eric Pigeon"]
|
9
|
+
spec.email = ["epigeon@weblinc.com"]
|
10
|
+
spec.summary = "Global E integration for Workarea Platform"
|
11
|
+
spec.description = "Global E integration for Workarea Platform"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.files = `git ls-files`.split("\n")
|
14
|
+
|
15
|
+
spec.add_dependency 'workarea', '~> 3.x', "< 3.4"
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,293 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: workarea-global_e
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eric Pigeon
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: workarea
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.x
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.4'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.x
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.4'
|
33
|
+
description: Global E integration for Workarea Platform
|
34
|
+
email:
|
35
|
+
- epigeon@weblinc.com
|
36
|
+
executables: []
|
37
|
+
extensions: []
|
38
|
+
extra_rdoc_files: []
|
39
|
+
files:
|
40
|
+
- ".eslintrc.json"
|
41
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
42
|
+
- ".github/ISSUE_TEMPLATE/documentation-request.md"
|
43
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
44
|
+
- ".github/workflows/ci.yml"
|
45
|
+
- ".gitignore"
|
46
|
+
- ".rubocop.yml"
|
47
|
+
- ".ruby-version"
|
48
|
+
- CHANGELOG.md
|
49
|
+
- Gemfile
|
50
|
+
- README.md
|
51
|
+
- Rakefile
|
52
|
+
- app/assets/javascripts/workarea/storefront/global_e/modules/checkout_info_validator.js
|
53
|
+
- app/assets/javascripts/workarea/storefront/global_e/modules/suppress_price_ranges.js
|
54
|
+
- app/controllers/workarea/admin/country_exceptions_controller.rb
|
55
|
+
- app/controllers/workarea/admin/fixed_prices_controller.rb
|
56
|
+
- app/controllers/workarea/admin/orders_controller.decorator
|
57
|
+
- app/controllers/workarea/storefront/application_controller.decorator
|
58
|
+
- app/controllers/workarea/storefront/checkouts_controller.decorator
|
59
|
+
- app/controllers/workarea/storefront/ge_checkouts_controller.rb
|
60
|
+
- app/controllers/workarea/storefront/global_e_controller.rb
|
61
|
+
- app/controllers/workarea/storefront/globale/api_controller.rb
|
62
|
+
- app/controllers/workarea/storefront/globale/refund_controller.rb
|
63
|
+
- app/controllers/workarea/storefront/users/logins_controller.decorator
|
64
|
+
- app/helpers/workarea/admin/global_e_helpers.rb
|
65
|
+
- app/models/workarea/address.decorator
|
66
|
+
- app/models/workarea/catalog/product.decorator
|
67
|
+
- app/models/workarea/fulfillment.decorator
|
68
|
+
- app/models/workarea/fulfillment/status/partially_refunded.rb
|
69
|
+
- app/models/workarea/fulfillment/status/refunded.rb
|
70
|
+
- app/models/workarea/global_e/country_exception.rb
|
71
|
+
- app/models/workarea/global_e/fixed_price.rb
|
72
|
+
- app/models/workarea/global_e/order_api_events.rb
|
73
|
+
- app/models/workarea/order.decorator
|
74
|
+
- app/models/workarea/order/item.decorator
|
75
|
+
- app/models/workarea/order/status/pending_global_e_fraud_check.rb
|
76
|
+
- app/models/workarea/payment.decorator
|
77
|
+
- app/models/workarea/payment/status/global_e_appoved.rb
|
78
|
+
- app/models/workarea/payment/status/pending_global_e_fraud_check.rb
|
79
|
+
- app/models/workarea/payment/tender/global_e_payment.rb
|
80
|
+
- app/models/workarea/price_adjustment.decorator
|
81
|
+
- app/models/workarea/price_adjustment_set.decorator
|
82
|
+
- app/models/workarea/pricing/calculators/item_calculator.decorator
|
83
|
+
- app/models/workarea/pricing/collection.decorator
|
84
|
+
- app/models/workarea/pricing/discount.decorator
|
85
|
+
- app/models/workarea/pricing/discount/appliation_group.decorator
|
86
|
+
- app/models/workarea/pricing/discount/international_item_proxy.rb
|
87
|
+
- app/models/workarea/pricing/discount/international_order.rb
|
88
|
+
- app/models/workarea/pricing/price_distributor.decorator
|
89
|
+
- app/models/workarea/pricing/request.decorator
|
90
|
+
- app/models/workarea/pricing/sku.decorator
|
91
|
+
- app/models/workarea/search/admin/order.decorator
|
92
|
+
- app/models/workarea/shipping.decorator
|
93
|
+
- app/models/workarea/shipping/sku.decorator
|
94
|
+
- app/models/workarea/user.decorator
|
95
|
+
- app/seeds/workarea/global_e_seeds.rb
|
96
|
+
- app/services/workarea/create_fulfillment.decorator
|
97
|
+
- app/services/workarea/global_e/address_details.rb
|
98
|
+
- app/services/workarea/global_e/api/notify_order_refunded.rb
|
99
|
+
- app/services/workarea/global_e/api/perform_order_payment.rb
|
100
|
+
- app/services/workarea/global_e/api/remove_restricted_products.rb
|
101
|
+
- app/services/workarea/global_e/api/send_order_to_merchant.rb
|
102
|
+
- app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb
|
103
|
+
- app/services/workarea/global_e/api/send_order_to_merchant/save_user.rb
|
104
|
+
- app/services/workarea/global_e/api/update_order_shipping_info.rb
|
105
|
+
- app/services/workarea/global_e/api/update_order_status.rb
|
106
|
+
- app/services/workarea/global_e/api/update_order_status/canceled.rb
|
107
|
+
- app/services/workarea/global_e/attribute.rb
|
108
|
+
- app/services/workarea/global_e/brand.rb
|
109
|
+
- app/services/workarea/global_e/cart_user_details.rb
|
110
|
+
- app/services/workarea/global_e/category.rb
|
111
|
+
- app/services/workarea/global_e/checkout_cart_info.rb
|
112
|
+
- app/services/workarea/global_e/custom_product_attribute.rb
|
113
|
+
- app/services/workarea/global_e/discount.rb
|
114
|
+
- app/services/workarea/global_e/merchant/brand.rb
|
115
|
+
- app/services/workarea/global_e/merchant/category.rb
|
116
|
+
- app/services/workarea/global_e/merchant/customer.rb
|
117
|
+
- app/services/workarea/global_e/merchant/customer_details.rb
|
118
|
+
- app/services/workarea/global_e/merchant/discount.rb
|
119
|
+
- app/services/workarea/global_e/merchant/international_details.rb
|
120
|
+
- app/services/workarea/global_e/merchant/order.rb
|
121
|
+
- app/services/workarea/global_e/merchant/order_refund.rb
|
122
|
+
- app/services/workarea/global_e/merchant/original_order.rb
|
123
|
+
- app/services/workarea/global_e/merchant/parcel_tracking.rb
|
124
|
+
- app/services/workarea/global_e/merchant/payment_details.rb
|
125
|
+
- app/services/workarea/global_e/merchant/product.rb
|
126
|
+
- app/services/workarea/global_e/merchant/refund_product.rb
|
127
|
+
- app/services/workarea/global_e/merchant/response_info.rb
|
128
|
+
- app/services/workarea/global_e/merchant_cart_product_attribute.rb
|
129
|
+
- app/services/workarea/global_e/order_status.rb
|
130
|
+
- app/services/workarea/global_e/order_status_details.rb
|
131
|
+
- app/services/workarea/global_e/order_status_reason.rb
|
132
|
+
- app/services/workarea/global_e/parcel.rb
|
133
|
+
- app/services/workarea/global_e/product.rb
|
134
|
+
- app/services/workarea/global_e/product_meta_data.rb
|
135
|
+
- app/services/workarea/global_e/tracking_details.rb
|
136
|
+
- app/services/workarea/global_e/update_order_dispatch_exception.rb
|
137
|
+
- app/services/workarea/global_e/update_order_dispatch_request.rb
|
138
|
+
- app/services/workarea/global_e/user_id_number_type.rb
|
139
|
+
- app/services/workarea/global_e/users_details.rb
|
140
|
+
- app/services/workarea/global_e/vat_category.rb
|
141
|
+
- app/services/workarea/global_e/vat_rate_type.rb
|
142
|
+
- app/services/workarea/save_order_analytics.decorator
|
143
|
+
- app/view_models/workarea/admin/order_view_model.decorator
|
144
|
+
- app/view_models/workarea/storefront/cart_view_model.decorator
|
145
|
+
- app/view_models/workarea/storefront/order_item_view_model.decorator
|
146
|
+
- app/view_models/workarea/storefront/order_view_model.decorator
|
147
|
+
- app/view_models/workarea/storefront/product_view_model.decorator
|
148
|
+
- app/views/workarea/admin/catalog_products/_country_exceptions_card.html.haml
|
149
|
+
- app/views/workarea/admin/catalog_products/_global_e_attributes.html.haml
|
150
|
+
- app/views/workarea/admin/catalog_products/_global_e_fields.html.haml
|
151
|
+
- app/views/workarea/admin/country_exceptions/edit.html.haml
|
152
|
+
- app/views/workarea/admin/country_exceptions/index.html.haml
|
153
|
+
- app/views/workarea/admin/country_exceptions/new.html.haml
|
154
|
+
- app/views/workarea/admin/fixed_prices/edit.html.haml
|
155
|
+
- app/views/workarea/admin/fixed_prices/index.html.haml
|
156
|
+
- app/views/workarea/admin/fixed_prices/new.html.haml
|
157
|
+
- app/views/workarea/admin/orders/_global_e.html.haml
|
158
|
+
- app/views/workarea/admin/orders/attributes.html.haml
|
159
|
+
- app/views/workarea/admin/orders/global_e.html.haml
|
160
|
+
- app/views/workarea/admin/orders/show.html.haml
|
161
|
+
- app/views/workarea/admin/orders/tenders/_global_e_payment.html.haml
|
162
|
+
- app/views/workarea/admin/pricing_skus/_cards.html.haml
|
163
|
+
- app/views/workarea/storefront/cart_items/create.html.haml
|
164
|
+
- app/views/workarea/storefront/carts/_pricing.html.haml
|
165
|
+
- app/views/workarea/storefront/carts/show.html.haml
|
166
|
+
- app/views/workarea/storefront/ge_checkouts/show.html.haml
|
167
|
+
- app/views/workarea/storefront/global_e/_country_picker.html.haml
|
168
|
+
- app/views/workarea/storefront/global_e/_head.html.haml
|
169
|
+
- app/views/workarea/storefront/orders/_summary.html.haml
|
170
|
+
- app/views/workarea/storefront/orders/tenders/_global_e_payment.html.haml
|
171
|
+
- app/views/workarea/storefront/products/_pricing.html.haml
|
172
|
+
- app/views/workarea/storefront/products/_restricted_item_text.html.haml
|
173
|
+
- app/views/workarea/storefront/users/orders/_summary.html.haml
|
174
|
+
- app/workers/workarea/global_e/update_order_dispatch.rb
|
175
|
+
- app/workers/workarea/save_user_order_details.decorator
|
176
|
+
- bin/rails
|
177
|
+
- config/initializers/appends.rb
|
178
|
+
- config/initializers/seeds.rb
|
179
|
+
- config/initializers/workarea.rb
|
180
|
+
- config/locales/en.yml
|
181
|
+
- config/routes.rb
|
182
|
+
- lib/workarea/global_e.rb
|
183
|
+
- lib/workarea/global_e/engine.rb
|
184
|
+
- lib/workarea/global_e/error.rb
|
185
|
+
- lib/workarea/global_e/version.rb
|
186
|
+
- script/admin_ci
|
187
|
+
- script/ci
|
188
|
+
- script/core_ci
|
189
|
+
- script/plugins_ci
|
190
|
+
- script/storefront_ci
|
191
|
+
- test/dummy/.ruby-version
|
192
|
+
- test/dummy/Rakefile
|
193
|
+
- test/dummy/app/assets/config/manifest.js
|
194
|
+
- test/dummy/app/assets/images/.keep
|
195
|
+
- test/dummy/app/assets/javascripts/application.js
|
196
|
+
- test/dummy/app/assets/stylesheets/application.css
|
197
|
+
- test/dummy/app/controllers/application_controller.rb
|
198
|
+
- test/dummy/app/controllers/concerns/.keep
|
199
|
+
- test/dummy/app/helpers/application_helper.rb
|
200
|
+
- test/dummy/app/jobs/application_job.rb
|
201
|
+
- test/dummy/app/mailers/application_mailer.rb
|
202
|
+
- test/dummy/app/models/concerns/.keep
|
203
|
+
- test/dummy/app/views/layouts/application.html.erb
|
204
|
+
- test/dummy/app/views/layouts/mailer.html.erb
|
205
|
+
- test/dummy/app/views/layouts/mailer.text.erb
|
206
|
+
- test/dummy/bin/bundle
|
207
|
+
- test/dummy/bin/rails
|
208
|
+
- test/dummy/bin/rake
|
209
|
+
- test/dummy/bin/setup
|
210
|
+
- test/dummy/bin/update
|
211
|
+
- test/dummy/bin/yarn
|
212
|
+
- test/dummy/config.ru
|
213
|
+
- test/dummy/config/application.rb
|
214
|
+
- test/dummy/config/boot.rb
|
215
|
+
- test/dummy/config/environment.rb
|
216
|
+
- test/dummy/config/environments/development.rb
|
217
|
+
- test/dummy/config/environments/production.rb
|
218
|
+
- test/dummy/config/environments/test.rb
|
219
|
+
- test/dummy/config/initializers/application_controller_renderer.rb
|
220
|
+
- test/dummy/config/initializers/assets.rb
|
221
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
222
|
+
- test/dummy/config/initializers/content_security_policy.rb
|
223
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
224
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
225
|
+
- test/dummy/config/initializers/inflections.rb
|
226
|
+
- test/dummy/config/initializers/mime_types.rb
|
227
|
+
- test/dummy/config/initializers/workarea.rb
|
228
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
229
|
+
- test/dummy/config/locales/en.yml
|
230
|
+
- test/dummy/config/puma.rb
|
231
|
+
- test/dummy/config/routes.rb
|
232
|
+
- test/dummy/config/secrets.yml
|
233
|
+
- test/dummy/config/spring.rb
|
234
|
+
- test/dummy/db/seeds.rb
|
235
|
+
- test/dummy/lib/assets/.keep
|
236
|
+
- test/dummy/log/.keep
|
237
|
+
- test/factories/workarea/global_e_factories.rb
|
238
|
+
- test/integration/workarea/admin/catalog_product_country_exceptions_integration_test.rb
|
239
|
+
- test/integration/workarea/admin/global_e_jump_to_integration_test.rb
|
240
|
+
- test/integration/workarea/admin/pricing_sku_fixed_prices_integration_test.rb
|
241
|
+
- test/integration/workarea/storefront/global_e_api/receive_order_integration_test.rb
|
242
|
+
- test/integration/workarea/storefront/global_e_api/receive_order_refund_integration_test.rb
|
243
|
+
- test/integration/workarea/storefront/global_e_api/receive_payment_integration_test.rb
|
244
|
+
- test/integration/workarea/storefront/global_e_api/receive_shipping_info_integration_test.rb
|
245
|
+
- test/integration/workarea/storefront/global_e_api/remove_restricted_products_integration_test.rb
|
246
|
+
- test/integration/workarea/storefront/global_e_api/update_order_status_integration_test.rb
|
247
|
+
- test/integration/workarea/storefront/global_e_checkout_cart_info/fixed_pricing_test.rb
|
248
|
+
- test/integration/workarea/storefront/global_e_checkout_cart_info/gift_card_test.rb
|
249
|
+
- test/integration/workarea/storefront/global_e_checkout_cart_info_integration_test.rb
|
250
|
+
- test/integration/workarea/storefront/global_e_checkouts_integration_test.rb
|
251
|
+
- test/integration/workarea/storefront/users/global_e_logins_integration_test.rb
|
252
|
+
- test/models/workarea/catalog/product_global_e_test.rb
|
253
|
+
- test/models/workarea/fixed_pricing_test.rb
|
254
|
+
- test/models/workarea/global_e/country_exception_test.rb
|
255
|
+
- test/models/workarea/payment_test.decorator
|
256
|
+
- test/models/workarea/pricing/calculators/item_calculator_fixed_prices_test.rb
|
257
|
+
- test/models/workarea/pricing/collection_fixed_prices_test.rb
|
258
|
+
- test/models/workarea/pricing/price_distributor_test.decorator
|
259
|
+
- test/models/workarea/pricing/sku_fixed_price_test.rb
|
260
|
+
- test/support/workarea/global_e_support.rb
|
261
|
+
- test/system/workarea/admin/global_e_system_test.rb
|
262
|
+
- test/system/workarea/storefront/global_e_cart_system_test.rb
|
263
|
+
- test/system/workarea/storefront/global_e_order_history_system_test.rb
|
264
|
+
- test/teaspoon_env.rb
|
265
|
+
- test/test_helper.rb
|
266
|
+
- test/view_models/workarea/admin/global_e_order_view_model_test.rb
|
267
|
+
- test/workers/workarea/global_e/update_order_dispatch_test.rb
|
268
|
+
- test/workers/workarea/global_e_save_user_order_details_test.rb
|
269
|
+
- workarea-global_e.gemspec
|
270
|
+
homepage:
|
271
|
+
licenses:
|
272
|
+
- MIT
|
273
|
+
metadata: {}
|
274
|
+
post_install_message:
|
275
|
+
rdoc_options: []
|
276
|
+
require_paths:
|
277
|
+
- lib
|
278
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
279
|
+
requirements:
|
280
|
+
- - ">="
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
version: '0'
|
283
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
|
+
requirements:
|
285
|
+
- - ">="
|
286
|
+
- !ruby/object:Gem::Version
|
287
|
+
version: '0'
|
288
|
+
requirements: []
|
289
|
+
rubygems_version: 3.0.6
|
290
|
+
signing_key:
|
291
|
+
specification_version: 4
|
292
|
+
summary: Global E integration for Workarea Platform
|
293
|
+
test_files: []
|